mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 03:44:06 +08:00
wfreerdp-server: build CLI interface separate from server library
This commit is contained in:
parent
05d6725c65
commit
efe82e6ede
@ -24,6 +24,8 @@ option(WITH_SERVER "Build server binaries" OFF)
|
||||
option(WITH_CHANNELS "Build virtual channel plugins" ON)
|
||||
option(WITH_THIRD_PARTY "Build third-party components" OFF)
|
||||
|
||||
option(WITH_SERVER_INTERFACE "Build server as a library with an interface" OFF)
|
||||
|
||||
option(WITH_DEBUG_ALL "Print all debug messages." OFF)
|
||||
|
||||
if(WITH_DEBUG_ALL)
|
||||
|
@ -17,7 +17,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_executable(wfreerdp-server
|
||||
include_directories(.)
|
||||
|
||||
set(WFREERDP_SERVER_SRCS
|
||||
wf_update.c
|
||||
wf_update.h
|
||||
wf_dxgi.c
|
||||
@ -33,17 +35,21 @@ add_executable(wfreerdp-server
|
||||
wf_settings.c
|
||||
wf_settings.h
|
||||
wf_info.c
|
||||
wf_info.h
|
||||
wfreerdp.c
|
||||
wfreerdp.h)
|
||||
wf_info.h)
|
||||
|
||||
if(WITH_SERVER_INTERFACE)
|
||||
add_library(wfreerdp-server ${WFREERDP_SERVER_SRCS})
|
||||
set_target_properties(wfreerdp-server PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
|
||||
else()
|
||||
set(WFREERDP_SERVER_SRCS ${WFREERDP_SERVER_SRCS} cli/wfreerdp.c cli/wfreerdp.h)
|
||||
add_executable(wfreerdp-server ${WFREERDP_SERVER_SRCS})
|
||||
endif()
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(wfreerdp-server freerdp)
|
||||
|
||||
set(WFREERDP_SERVER_LIBS freerdp)
|
||||
else()
|
||||
|
||||
target_link_libraries(wfreerdp-server
|
||||
|
||||
set(WFREERDP_SERVER_LIBS
|
||||
freerdp-core
|
||||
|
||||
freerdp-utils
|
||||
@ -53,3 +59,16 @@ else()
|
||||
freerdp-channels)
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(wfreerdp-server ${WFREERDP_SERVER_LIBS})
|
||||
|
||||
|
||||
if(WITH_SERVER_INTERFACE)
|
||||
install(TARGETS wfreerdp-server DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
else()
|
||||
install(TARGETS wfreerdp-server DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
if(WITH_SERVER_INTERFACE)
|
||||
add_subdirectory(cli)
|
||||
endif()
|
||||
|
34
server/Windows/cli/CMakeLists.txt
Normal file
34
server/Windows/cli/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP Windows Server (CLI) cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_directories(..)
|
||||
|
||||
set(WFREERDP_SERVER_CLI_SRCS
|
||||
wfreerdp.c
|
||||
wfreerdp.h)
|
||||
|
||||
add_executable(wfreerdp-server-cli ${WFREERDP_SERVER_CLI_SRCS})
|
||||
|
||||
set_target_properties(wfreerdp-server-cli PROPERTIES OUTPUT_NAME "wfreerdp-server")
|
||||
|
||||
set(WFREERDP_SERVER_CLI_LIBS wfreerdp-server)
|
||||
|
||||
target_link_libraries(wfreerdp-server-cli ${WFREERDP_SERVER_CLI_LIBS})
|
||||
|
||||
|
||||
install(TARGETS wfreerdp-server-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Windows Server
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/tchar.h>
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
|
||||
#include "wfreerdp.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
wfServer* server;
|
||||
|
||||
server = wfreerdp_server_new();
|
||||
|
||||
if (argc == 2)
|
||||
server->port = (DWORD) atoi(argv[1]);
|
||||
|
||||
wfreerdp_server_start(server);
|
||||
|
||||
WaitForSingleObject(server->thread, INFINITE);
|
||||
|
||||
wfreerdp_server_stop(server);
|
||||
wfreerdp_server_free(server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Windows Server
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/tchar.h>
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
|
||||
#include "wfreerdp.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
wfServer* server;
|
||||
|
||||
server = wfreerdp_server_new();
|
||||
|
||||
if (argc == 2)
|
||||
server->port = (DWORD) atoi(argv[1]);
|
||||
|
||||
wfreerdp_server_start(server);
|
||||
|
||||
WaitForSingleObject(server->thread, INFINITE);
|
||||
|
||||
wfreerdp_server_stop(server);
|
||||
wfreerdp_server_free(server);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,41 +1,25 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Windows Server
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef WFREERDP_H
|
||||
#define WFREERDP_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
#include "wf_info.h"
|
||||
|
||||
struct wf_peer_context
|
||||
{
|
||||
rdpContext _p;
|
||||
|
||||
wfInfo* info;
|
||||
boolean activated;
|
||||
HANDLE updateEvent;
|
||||
BOOL socketClose;
|
||||
HANDLE socketEvent;
|
||||
HANDLE socketThread;
|
||||
HANDLE socketSemaphore;
|
||||
};
|
||||
typedef struct wf_peer_context wfPeerContext;
|
||||
|
||||
#endif /* WFREERDP_H */
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Windows Server
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef WFREERDP_H
|
||||
#define WFREERDP_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
#endif /* WFREERDP_H */
|
@ -20,7 +20,7 @@
|
||||
#ifndef WF_DXGI_H
|
||||
#define WF_DXGI_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
|
||||
|
||||
|
@ -20,39 +20,7 @@
|
||||
#ifndef WF_INFO_H
|
||||
#define WF_INFO_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/codec/rfx.h>
|
||||
|
||||
struct wf_peer_context;
|
||||
typedef struct wf_peer_context wfPeerContext;
|
||||
|
||||
struct wf_info
|
||||
{
|
||||
STREAM* s;
|
||||
int width;
|
||||
int height;
|
||||
int bitsPerPixel;
|
||||
HDC driverDC;
|
||||
int peerCount;
|
||||
BOOL activated;
|
||||
void* changeBuffer;
|
||||
int framesPerSecond;
|
||||
LPTSTR deviceKey;
|
||||
TCHAR deviceName[32];
|
||||
wfPeerContext** peers;
|
||||
|
||||
RECT invalid;
|
||||
HANDLE mutex;
|
||||
BOOL updatePending;
|
||||
HANDLE updateEvent;
|
||||
HANDLE updateThread;
|
||||
HANDLE updateSemaphore;
|
||||
RFX_CONTEXT* rfx_context;
|
||||
unsigned long lastUpdate;
|
||||
unsigned long nextUpdate;
|
||||
SURFACE_BITS_COMMAND cmd;
|
||||
};
|
||||
typedef struct wf_info wfInfo;
|
||||
#include "wf_interface.h"
|
||||
|
||||
int wf_info_lock(wfInfo* wfi);
|
||||
int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef WF_INPUT_H
|
||||
#define WF_INPUT_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
void wf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
|
||||
void wf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
|
||||
|
@ -20,12 +20,58 @@
|
||||
#ifndef WF_INTERFACE_H
|
||||
#define WF_INTERFACE_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/listener.h>
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/codec/rfx.h>
|
||||
|
||||
typedef struct wf_info wfInfo;
|
||||
typedef struct wf_peer_context wfPeerContext;
|
||||
|
||||
struct wf_info
|
||||
{
|
||||
STREAM* s;
|
||||
int width;
|
||||
int height;
|
||||
int bitsPerPixel;
|
||||
HDC driverDC;
|
||||
int peerCount;
|
||||
BOOL activated;
|
||||
void* changeBuffer;
|
||||
int framesPerSecond;
|
||||
LPTSTR deviceKey;
|
||||
TCHAR deviceName[32];
|
||||
wfPeerContext** peers;
|
||||
|
||||
RECT invalid;
|
||||
HANDLE mutex;
|
||||
BOOL updatePending;
|
||||
HANDLE updateEvent;
|
||||
HANDLE updateThread;
|
||||
HANDLE updateSemaphore;
|
||||
RFX_CONTEXT* rfx_context;
|
||||
unsigned long lastUpdate;
|
||||
unsigned long nextUpdate;
|
||||
SURFACE_BITS_COMMAND cmd;
|
||||
};
|
||||
|
||||
struct wf_peer_context
|
||||
{
|
||||
rdpContext _p;
|
||||
|
||||
wfInfo* info;
|
||||
boolean activated;
|
||||
HANDLE updateEvent;
|
||||
BOOL socketClose;
|
||||
HANDLE socketEvent;
|
||||
HANDLE socketThread;
|
||||
HANDLE socketSemaphore;
|
||||
};
|
||||
|
||||
struct wf_server
|
||||
{
|
||||
DWORD port;
|
||||
@ -34,10 +80,10 @@ struct wf_server
|
||||
};
|
||||
typedef struct wf_server wfServer;
|
||||
|
||||
BOOL wfreerdp_server_start(wfServer* server);
|
||||
BOOL wfreerdp_server_stop(wfServer* server);
|
||||
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
|
||||
FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);
|
||||
|
||||
wfServer* wfreerdp_server_new();
|
||||
void wfreerdp_server_free(wfServer* server);
|
||||
FREERDP_API wfServer* wfreerdp_server_new();
|
||||
FREERDP_API void wfreerdp_server_free(wfServer* server);
|
||||
|
||||
#endif /* WF_INTERFACE_H */
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef WF_MIRAGE_H
|
||||
#define WF_MIRAGE_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <freerdp/codec/rfx.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
#include "wf_info.h"
|
||||
#include "wf_input.h"
|
||||
#include "wf_mirage.h"
|
||||
#include "wf_update.h"
|
||||
|
@ -20,12 +20,10 @@
|
||||
#ifndef WF_PEER_H
|
||||
#define WF_PEER_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
#include <freerdp/listener.h>
|
||||
|
||||
#include "wf_info.h"
|
||||
|
||||
void wf_peer_context_new(freerdp_peer* client, wfPeerContext* context);
|
||||
void wf_peer_context_free(freerdp_peer* client, wfPeerContext* context);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef WF_SETTINGS_H
|
||||
#define WF_SETTINGS_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
BOOL wf_settings_read_dword(HKEY key, LPTSTR subkey, LPTSTR name, DWORD* value);
|
||||
BOOL wf_settings_read_string_ascii(HKEY key, LPTSTR subkey, LPTSTR name, char** value);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <freerdp/listener.h>
|
||||
|
||||
#include "wf_peer.h"
|
||||
#include "wf_info.h"
|
||||
#include "wf_mirage.h"
|
||||
|
||||
#include "wf_update.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef WF_UPDATE_H
|
||||
#define WF_UPDATE_H
|
||||
|
||||
#include "wfreerdp.h"
|
||||
#include "wf_interface.h"
|
||||
|
||||
void wf_update_encode(wfInfo* wfi);
|
||||
void wf_update_send(wfInfo* wfi);
|
||||
|
Loading…
Reference in New Issue
Block a user