FreeRDP
|
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/ssl.h>
#include <winpr/path.h>
#include <winpr/synch.h>
#include <winpr/string.h>
#include <winpr/winsock.h>
#include <winpr/thread.h>
#include <errno.h>
#include <freerdp/freerdp.h>
#include <freerdp/streamdump.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/channels.h>
#include <freerdp/channels/drdynvc.h>
#include <freerdp/build-config.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/server/proxy/proxy_server.h>
#include <freerdp/server/proxy/proxy_log.h>
#include "pf_server.h"
#include "pf_channel.h"
#include <freerdp/server/proxy/proxy_config.h>
#include "pf_client.h"
#include <freerdp/server/proxy/proxy_context.h>
#include "pf_update.h"
#include "proxy_modules.h"
#include "pf_utils.h"
#include "channels/pf_channel_drdynvc.h"
#include "channels/pf_channel_rdpdr.h"
Macros | |
#define | TAG PROXY_TAG("server") |
#define | TARGET_MAX (100) |
#define | ROUTING_TOKEN_PREFIX "Cookie: msts=" |
Functions | |
static BOOL | pf_server_parse_target_from_routing_token (rdpContext *context, rdpSettings *settings, FreeRDP_Settings_Keys_String targetID, FreeRDP_Settings_Keys_UInt32 portID) |
static BOOL | pf_server_get_target_info (rdpContext *context, rdpSettings *settings, const proxyConfig *config) |
static BOOL | pf_server_setup_channels (freerdp_peer *peer) |
static BOOL | pf_server_post_connect (freerdp_peer *peer) |
static BOOL | pf_server_activate (freerdp_peer *peer) |
static BOOL | pf_server_logon (freerdp_peer *peer, const SEC_WINNT_AUTH_IDENTITY *identity, BOOL automatic) |
static BOOL | pf_server_adjust_monitor_layout (freerdp_peer *peer) |
static BOOL | pf_server_receive_channel_data_hook (freerdp_peer *peer, UINT16 channelId, const BYTE *data, size_t size, UINT32 flags, size_t totalSize) |
static BOOL | pf_server_initialize_peer_connection (freerdp_peer *peer) |
static DWORD WINAPI | pf_server_handle_peer (LPVOID arg) |
static BOOL | pf_server_start_peer (freerdp_peer *client) |
static BOOL | pf_server_peer_accepted (freerdp_listener *listener, freerdp_peer *client) |
BOOL | pf_server_start (proxyServer *server) |
pf_server_start Starts the proxy, binding the configured port. More... | |
BOOL | pf_server_start_from_socket (proxyServer *server, int socket) |
pf_server_start_from_socket Starts the proxy using an existing bound socket More... | |
BOOL | pf_server_start_with_peer_socket (proxyServer *server, int peer_fd) |
pf_server_start_with_peer_socket Use existing peer socket More... | |
static BOOL | are_all_required_modules_loaded (proxyModule *module, const proxyConfig *config) |
static void | peer_free (void *obj) |
proxyServer * | pf_server_new (const proxyConfig *config) |
pf_server_new Creates a new proxy server instance More... | |
BOOL | pf_server_run (proxyServer *server) |
pf_server_run This (blocking) function runs the main loop of the proxy. More... | |
void | pf_server_stop (proxyServer *server) |
pf_server_stop Stops a server instance asynchronously. Can be called from any thread to stop a running server instance. More... | |
void | pf_server_free (proxyServer *server) |
pf_server_free Cleans up a (stopped) proxy server instance. More... | |
BOOL | pf_server_add_module (proxyServer *server, proxyModuleEntryPoint ep, void *userdata) |
pf_server_add_module Allows registering proxy modules that are build-in instead of shipped as separate module loaded at runtime. More... | |
#define ROUTING_TOKEN_PREFIX "Cookie: msts=" |
#define TAG PROXY_TAG("server") |
FreeRDP: A Remote Desktop Protocol Implementation FreeRDP Proxy Server
Copyright 2019 Mati Shabtay matis Copyright 2019 Kobi Mizrachi habt ay@gm ail. comkmizr Copyright 2019 Idan Freiberg achi 18@gm ail. comspeid Copyright 2021 Armin Novak y@gm ail.c omanova Copyright 2021 Thincast Technologies GmbH k@th incas t.co m
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.
#define TARGET_MAX (100) |
|
static |
|
static |
|
static |
BOOL pf_server_add_module | ( | proxyServer * | server, |
proxyModuleEntryPoint | ep, | ||
void * | userdata | ||
) |
pf_server_add_module Allows registering proxy modules that are build-in instead of shipped as separate module loaded at runtime.
server | A proxy instance to add the module to. Must NOT be NULL |
ep | The proxy entry function to add. Must NOT be NULL |
userdata | Custom data for the module. May be NULL |
|
static |
void pf_server_free | ( | proxyServer * | server | ) |
pf_server_free Cleans up a (stopped) proxy server instance.
server | The proxy server to clean up. Might be NULL. |
|
static |
|
static |
Handles an incoming client connection, to be run in it's own thread.
arg is a pointer to a freerdp_peer representing the client.
|
static |
|
static |
proxyServer* pf_server_new | ( | const proxyConfig * | config | ) |
pf_server_new Creates a new proxy server instance
config | The proxy server configuration to use. Must NOT be NULL. |
|
static |
|
static |
|
static |
This callback is called when the entire connection sequence is done (as described in MS-RDPBCGR section 1.3)
The server may start sending graphics output and receiving keyboard/mouse input after this callback returns.
|
static |
BOOL pf_server_run | ( | proxyServer * | server | ) |
pf_server_run This (blocking) function runs the main loop of the proxy.
server | The server instance. Must NOT be NULL. |
|
static |
BOOL pf_server_start | ( | proxyServer * | server | ) |
pf_server_start Starts the proxy, binding the configured port.
server | The server instance. Must NOT be NULL. |
BOOL pf_server_start_from_socket | ( | proxyServer * | server, |
int | socket | ||
) |
pf_server_start_from_socket Starts the proxy using an existing bound socket
server | The server instance. Must NOT be NULL. |
socket | The bound socket to wait for events on. |
|
static |
BOOL pf_server_start_with_peer_socket | ( | proxyServer * | server, |
int | socket | ||
) |
pf_server_start_with_peer_socket Use existing peer socket
server | The server instance. Must NOT be NULL. |
socket | Ready to use peer socket |
void pf_server_stop | ( | proxyServer * | server | ) |
pf_server_stop Stops a server instance asynchronously. Can be called from any thread to stop a running server instance.
server | A pointer to the server instance to stop. May be NULL. |