FreeRDP
pf_channel_rdpdr.c File Reference
#include <freerdp/config.h>
#include <winpr/assert.h>
#include <winpr/string.h>
#include <winpr/print.h>
#include "pf_channel_rdpdr.h"
#include "pf_channel_smartcard.h"
#include <freerdp/server/proxy/proxy_log.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/channels/channels.h>
#include <freerdp/utils/rdpdr_utils.h>

Macros

#define TAG   PROXY_TAG("channel.rdpdr")
 
#define SCARD_DEVICE_ID   UINT32_MAX
 
#define rdpdr_ignore_capset(s, length)   rdpdr_ignore_capset_((s), length, __FUNCTION__)
 

Enumerations

enum  pf_channel_client_state { STATE_CLIENT_EXPECT_SERVER_ANNOUNCE_REQUEST = 0x01, STATE_CLIENT_EXPECT_SERVER_CORE_CAPABILITY_REQUEST = 0x02, STATE_CLIENT_EXPECT_SERVER_CLIENT_ID_CONFIRM = 0x04, STATE_CLIENT_CHANNEL_RUNNING = 0x10 }
 
enum  pf_channel_server_state {
  STATE_SERVER_INITIAL, STATE_SERVER_EXPECT_CLIENT_ANNOUNCE_REPLY, STATE_SERVER_EXPECT_CLIENT_NAME_REQUEST, STATE_SERVER_EXPECT_EXPECT_CLIENT_CAPABILITY_RESPONE,
  STATE_SERVER_CHANNEL_RUNNING
}
 

Functions

static const char * rdpdr_server_state_to_string (pf_channel_server_state state)
 
static const char * rdpdr_client_state_to_string (pf_channel_client_state state)
 
static wStreamrdpdr_get_send_buffer (pf_channel_common_context *rdpdr, UINT16 component, UINT16 PacketID, size_t capacity)
 
static wStreamrdpdr_client_get_send_buffer (pf_channel_client_context *rdpdr, UINT16 component, UINT16 PacketID, size_t capacity)
 
static wStreamrdpdr_server_get_send_buffer (pf_channel_server_context *rdpdr, UINT16 component, UINT16 PacketID, size_t capacity)
 
static UINT rdpdr_client_send (pClientContext *pc, wStream *s)
 
static UINT rdpdr_seal_send_free_request (pf_channel_server_context *context, wStream *s)
 
static BOOL rdpdr_process_server_header (wStream *s, UINT16 component, UINT16 PacketId, size_t expect)
 
static BOOL rdpdr_check_version (UINT16 versionMajor, UINT16 versionMinor, UINT16 component, UINT16 PacketId)
 
static UINT rdpdr_process_server_announce_request (pf_channel_client_context *rdpdr, wStream *s)
 
static UINT rdpdr_server_send_announce_request (pf_channel_server_context *context)
 
static UINT rdpdr_process_client_announce_reply (pf_channel_server_context *rdpdr, wStream *s)
 
static UINT rdpdr_send_client_announce_reply (pClientContext *pc, pf_channel_client_context *rdpdr)
 
static UINT rdpdr_process_client_name_request (pf_channel_server_context *rdpdr, wStream *s, pClientContext *pc)
 
static UINT rdpdr_send_client_name_request (pClientContext *pc, pf_channel_client_context *rdpdr)
 
static UINT rdpdr_ignore_capset_ (wStream *s, size_t capabilityLength, const char *fkt)
 
static UINT rdpdr_client_process_general_capset (pf_channel_client_context *rdpdr, wStream *s, size_t length)
 
static UINT rdpdr_process_printer_capset (pf_channel_client_context *rdpdr, wStream *s, size_t length)
 
static UINT rdpdr_process_port_capset (pf_channel_client_context *rdpdr, wStream *s, size_t length)
 
static UINT rdpdr_process_drive_capset (pf_channel_client_context *rdpdr, wStream *s, size_t length)
 
static UINT rdpdr_process_smartcard_capset (pf_channel_client_context *rdpdr, wStream *s, size_t length)
 
static UINT rdpdr_process_server_core_capability_request (pf_channel_client_context *rdpdr, wStream *s)
 
static BOOL rdpdr_write_capset_header (wStream *s, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version)
 
static BOOL rdpdr_write_general_capset (pf_channel_common_context *rdpdr, wStream *s)
 
static BOOL rdpdr_write_printer_capset (pf_channel_common_context *rdpdr, wStream *s)
 
static BOOL rdpdr_write_port_capset (pf_channel_common_context *rdpdr, wStream *s)
 
static BOOL rdpdr_write_drive_capset (pf_channel_common_context *rdpdr, wStream *s)
 
static BOOL rdpdr_write_smartcard_capset (pf_channel_common_context *rdpdr, wStream *s)
 
static UINT rdpdr_send_server_capability_request (pf_channel_server_context *rdpdr)
 
static UINT rdpdr_process_client_capability_response (pf_channel_server_context *rdpdr, wStream *s)
 
static UINT rdpdr_send_client_capability_response (pClientContext *pc, pf_channel_client_context *rdpdr)
 
static UINT rdpdr_send_server_clientid_confirm (pf_channel_server_context *rdpdr)
 
static UINT rdpdr_process_server_clientid_confirm (pf_channel_client_context *rdpdr, wStream *s)
 
static BOOL rdpdr_process_server_capability_request_or_clientid_confirm (pf_channel_client_context *rdpdr, wStream *s)
 
static BOOL pf_channel_rdpdr_client_send_to_server (pServerContext *ps, wStream *s)
 
static BOOL pf_channel_send_client_queue (pClientContext *pc, pf_channel_client_context *rdpdr)
 
static BOOL rdpdr_handle_server_announce_request (pClientContext *pc, pf_channel_client_context *rdpdr, wStream *s)
 
BOOL pf_channel_rdpdr_client_handle (pClientContext *pc, UINT16 channelId, const char *channel_name, const BYTE *xdata, size_t xsize, UINT32 flags, size_t totalSize)
 
static void pf_channel_rdpdr_common_context_free (pf_channel_common_context *common)
 
static void pf_channel_rdpdr_client_context_free (InterceptContextMapEntry *base)
 
static BOOL pf_channel_rdpdr_common_context_new (pf_channel_common_context *common, void(*fkt)(InterceptContextMapEntry *))
 
static BOOL pf_channel_rdpdr_client_pass_message (pClientContext *pc, UINT16 channelId, const char *channel_name, wStream *s)
 
static void * stream_copy (const void *obj)
 
static void stream_free (void *obj)
 
BOOL pf_channel_rdpdr_client_new (pClientContext *pc)
 
void pf_channel_rdpdr_client_free (pClientContext *pc)
 
static void pf_channel_rdpdr_server_context_free (InterceptContextMapEntry *base)
 
BOOL pf_channel_rdpdr_server_new (pServerContext *ps)
 
void pf_channel_rdpdr_server_free (pServerContext *ps)
 
static pf_channel_server_context * get_channel (pServerContext *ps)
 
BOOL pf_channel_rdpdr_server_handle (pServerContext *ps, UINT16 channelId, const char *channel_name, const BYTE *xdata, size_t xsize, UINT32 flags, size_t totalSize)
 
BOOL pf_channel_rdpdr_server_announce (pServerContext *ps)
 
BOOL pf_channel_rdpdr_client_reset (pClientContext *pc)
 
static PfChannelResult pf_rdpdr_back_data (proxyData *pdata, const pServerStaticChannelContext *channel, const BYTE *xdata, size_t xsize, UINT32 flags, size_t totalSize)
 
static PfChannelResult pf_rdpdr_front_data (proxyData *pdata, const pServerStaticChannelContext *channel, const BYTE *xdata, size_t xsize, UINT32 flags, size_t totalSize)
 
BOOL pf_channel_setup_rdpdr (pServerContext *ps, pServerStaticChannelContext *channel)
 

Macro Definition Documentation

◆ rdpdr_ignore_capset

#define rdpdr_ignore_capset (   s,
  length 
)    rdpdr_ignore_capset_((s), length, __FUNCTION__)

◆ SCARD_DEVICE_ID

#define SCARD_DEVICE_ID   UINT32_MAX

◆ TAG

#define TAG   PROXY_TAG("channel.rdpdr")

FreeRDP: A Remote Desktop Protocol Implementation FreeRDP Proxy Server

Copyright 2021 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2021 Thincast Technologies GmbH

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.

Enumeration Type Documentation

◆ pf_channel_client_state

Enumerator
STATE_CLIENT_EXPECT_SERVER_ANNOUNCE_REQUEST 
STATE_CLIENT_EXPECT_SERVER_CORE_CAPABILITY_REQUEST 
STATE_CLIENT_EXPECT_SERVER_CLIENT_ID_CONFIRM 
STATE_CLIENT_CHANNEL_RUNNING 

◆ pf_channel_server_state

Enumerator
STATE_SERVER_INITIAL 
STATE_SERVER_EXPECT_CLIENT_ANNOUNCE_REPLY 
STATE_SERVER_EXPECT_CLIENT_NAME_REQUEST 
STATE_SERVER_EXPECT_EXPECT_CLIENT_CAPABILITY_RESPONE 
STATE_SERVER_CHANNEL_RUNNING 

Function Documentation

◆ get_channel()

static pf_channel_server_context* get_channel ( pServerContext *  ps)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_context_free()

static void pf_channel_rdpdr_client_context_free ( InterceptContextMapEntry *  base)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_free()

void pf_channel_rdpdr_client_free ( pClientContext *  pc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_handle()

BOOL pf_channel_rdpdr_client_handle ( pClientContext *  pc,
UINT16  channelId,
const char *  channel_name,
const BYTE xdata,
size_t  xsize,
UINT32  flags,
size_t  totalSize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_new()

BOOL pf_channel_rdpdr_client_new ( pClientContext *  pc)

FreeRDP: A Remote Desktop Protocol Implementation FreeRDP Proxy Server

Copyright 2021 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2021 Thincast Technologies GmbH

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_pass_message()

static BOOL pf_channel_rdpdr_client_pass_message ( pClientContext *  pc,
UINT16  channelId,
const char *  channel_name,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_reset()

BOOL pf_channel_rdpdr_client_reset ( pClientContext *  pc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_client_send_to_server()

static BOOL pf_channel_rdpdr_client_send_to_server ( pServerContext *  ps,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_common_context_free()

static void pf_channel_rdpdr_common_context_free ( pf_channel_common_context *  common)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_common_context_new()

static BOOL pf_channel_rdpdr_common_context_new ( pf_channel_common_context *  common,
void(*)(InterceptContextMapEntry *)  fkt 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_server_announce()

BOOL pf_channel_rdpdr_server_announce ( pServerContext *  ps)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_server_context_free()

static void pf_channel_rdpdr_server_context_free ( InterceptContextMapEntry *  base)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_server_free()

void pf_channel_rdpdr_server_free ( pServerContext *  ps)
Here is the call graph for this function:

◆ pf_channel_rdpdr_server_handle()

BOOL pf_channel_rdpdr_server_handle ( pServerContext *  ps,
UINT16  channelId,
const char *  channel_name,
const BYTE xdata,
size_t  xsize,
UINT32  flags,
size_t  totalSize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_rdpdr_server_new()

BOOL pf_channel_rdpdr_server_new ( pServerContext *  ps)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_send_client_queue()

BOOL pf_channel_send_client_queue ( pClientContext *  pc,
pf_channel_client_context *  rdpdr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_channel_setup_rdpdr()

BOOL pf_channel_setup_rdpdr ( pServerContext *  ps,
pServerStaticChannelContext *  channel 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_rdpdr_back_data()

static PfChannelResult pf_rdpdr_back_data ( proxyData *  pdata,
const pServerStaticChannelContext *  channel,
const BYTE xdata,
size_t  xsize,
UINT32  flags,
size_t  totalSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pf_rdpdr_front_data()

static PfChannelResult pf_rdpdr_front_data ( proxyData *  pdata,
const pServerStaticChannelContext *  channel,
const BYTE xdata,
size_t  xsize,
UINT32  flags,
size_t  totalSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_check_version()

static BOOL rdpdr_check_version ( UINT16  versionMajor,
UINT16  versionMinor,
UINT16  component,
UINT16  PacketId 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_client_get_send_buffer()

static wStream* rdpdr_client_get_send_buffer ( pf_channel_client_context *  rdpdr,
UINT16  component,
UINT16  PacketID,
size_t  capacity 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_client_process_general_capset()

static UINT rdpdr_client_process_general_capset ( pf_channel_client_context *  rdpdr,
wStream s,
size_t  length 
)
static
Here is the caller graph for this function:

◆ rdpdr_client_send()

static UINT rdpdr_client_send ( pClientContext *  pc,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_client_state_to_string()

static const char* rdpdr_client_state_to_string ( pf_channel_client_state  state)
static
Here is the caller graph for this function:

◆ rdpdr_get_send_buffer()

static wStream* rdpdr_get_send_buffer ( pf_channel_common_context *  rdpdr,
UINT16  component,
UINT16  PacketID,
size_t  capacity 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_handle_server_announce_request()

static BOOL rdpdr_handle_server_announce_request ( pClientContext *  pc,
pf_channel_client_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_ignore_capset_()

static UINT rdpdr_ignore_capset_ ( wStream s,
size_t  capabilityLength,
const char *  fkt 
)
static
Here is the call graph for this function:

◆ rdpdr_process_client_announce_reply()

static UINT rdpdr_process_client_announce_reply ( pf_channel_server_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_client_capability_response()

static UINT rdpdr_process_client_capability_response ( pf_channel_server_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_client_name_request()

static UINT rdpdr_process_client_name_request ( pf_channel_server_context *  rdpdr,
wStream s,
pClientContext *  pc 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_drive_capset()

static UINT rdpdr_process_drive_capset ( pf_channel_client_context *  rdpdr,
wStream s,
size_t  length 
)
static
Here is the caller graph for this function:

◆ rdpdr_process_port_capset()

static UINT rdpdr_process_port_capset ( pf_channel_client_context *  rdpdr,
wStream s,
size_t  length 
)
static
Here is the caller graph for this function:

◆ rdpdr_process_printer_capset()

static UINT rdpdr_process_printer_capset ( pf_channel_client_context *  rdpdr,
wStream s,
size_t  length 
)
static
Here is the caller graph for this function:

◆ rdpdr_process_server_announce_request()

static UINT rdpdr_process_server_announce_request ( pf_channel_client_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_server_capability_request_or_clientid_confirm()

static BOOL rdpdr_process_server_capability_request_or_clientid_confirm ( pf_channel_client_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_server_clientid_confirm()

static UINT rdpdr_process_server_clientid_confirm ( pf_channel_client_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_server_core_capability_request()

static UINT rdpdr_process_server_core_capability_request ( pf_channel_client_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_server_header()

static BOOL rdpdr_process_server_header ( wStream s,
UINT16  component,
UINT16  PacketId,
size_t  expect 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_smartcard_capset()

static UINT rdpdr_process_smartcard_capset ( pf_channel_client_context *  rdpdr,
wStream s,
size_t  length 
)
static
Here is the caller graph for this function:

◆ rdpdr_seal_send_free_request()

static UINT rdpdr_seal_send_free_request ( pf_channel_server_context *  context,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_client_announce_reply()

static UINT rdpdr_send_client_announce_reply ( pClientContext *  pc,
pf_channel_client_context *  rdpdr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_client_capability_response()

static UINT rdpdr_send_client_capability_response ( pClientContext *  pc,
pf_channel_client_context *  rdpdr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_client_name_request()

static UINT rdpdr_send_client_name_request ( pClientContext *  pc,
pf_channel_client_context *  rdpdr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_server_capability_request()

static UINT rdpdr_send_server_capability_request ( pf_channel_server_context *  rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_server_clientid_confirm()

static UINT rdpdr_send_server_clientid_confirm ( pf_channel_server_context *  rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_server_get_send_buffer()

static wStream* rdpdr_server_get_send_buffer ( pf_channel_server_context *  rdpdr,
UINT16  component,
UINT16  PacketID,
size_t  capacity 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_server_send_announce_request()

static UINT rdpdr_server_send_announce_request ( pf_channel_server_context *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_server_state_to_string()

static const char* rdpdr_server_state_to_string ( pf_channel_server_state  state)
static
Here is the caller graph for this function:

◆ rdpdr_write_capset_header()

static BOOL rdpdr_write_capset_header ( wStream s,
UINT16  capabilityType,
UINT16  capabilityLength,
UINT32  version 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_write_drive_capset()

static BOOL rdpdr_write_drive_capset ( pf_channel_common_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_write_general_capset()

static BOOL rdpdr_write_general_capset ( pf_channel_common_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_write_port_capset()

static BOOL rdpdr_write_port_capset ( pf_channel_common_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_write_printer_capset()

static BOOL rdpdr_write_printer_capset ( pf_channel_common_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_write_smartcard_capset()

static BOOL rdpdr_write_smartcard_capset ( pf_channel_common_context *  rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_copy()

static void* stream_copy ( const void *  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_free()

static void stream_free ( void *  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function: