FreeRDP
client/rdpdr_main.c File Reference
#include <freerdp/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/sysinfo.h>
#include <winpr/assert.h>
#include <winpr/stream.h>
#include <winpr/print.h>
#include <winpr/sspicli.h>
#include <freerdp/types.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/channels/log.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/rdpdr_utils.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "rdpdr_capabilities.h"
#include "devman.h"
#include "irp.h"
#include "rdpdr_main.h"

Macros

#define TAG   CHANNELS_TAG("rdpdr.client")
 
#define MAX_USB_DEVICES   100
 
#define VirtualChannelEntryEx   rdpdr_VirtualChannelEntryEx
 

Functions

static const char * rdpdr_state_str (enum RDPDR_CHANNEL_STATE state)
 
static const char * rdpdr_device_type_string (UINT32 type)
 
static const char * support_str (BOOL val)
 
static const char * rdpdr_caps_pdu_str (UINT32 flag)
 
static BOOL rdpdr_check_extended_pdu_flag (rdpdrPlugin *rdpdr, UINT32 flag)
 
BOOL rdpdr_state_advance (rdpdrPlugin *rdpdr, enum RDPDR_CHANNEL_STATE next)
 
static BOOL device_foreach (rdpdrPlugin *rdpdr, BOOL abortOnFail, BOOL(*fkt)(ULONG_PTR key, void *element, void *data), void *data)
 
static UINT rdpdr_try_send_device_list_announce_request (rdpdrPlugin *rdpdr)
 
static BOOL rdpdr_load_drive (rdpdrPlugin *rdpdr, const char *name, const char *path, BOOL automount)
 
static UINT rdpdr_send_device_list_remove_request (rdpdrPlugin *rdpdr, UINT32 count, UINT32 ids[])
 
static BOOL isAutomountLocation (const char *path)
 
static void handle_mountpoint (hotplug_dev *dev_array, size_t *size, const char *mountpoint)
 
static UINT handle_platform_mounts (wLog *log, hotplug_dev *dev_array, size_t *size)
 
static BOOL device_not_plugged (ULONG_PTR key, void *element, void *data)
 
static BOOL device_already_plugged (rdpdrPlugin *rdpdr, const hotplug_dev *device)
 
static BOOL hotplug_delete_foreach (ULONG_PTR key, void *element, void *data)
 
static UINT handle_hotplug (rdpdrPlugin *rdpdr)
 
static void first_hotplug (rdpdrPlugin *rdpdr)
 
static DWORD WINAPI drive_hotplug_thread_func (LPVOID arg)
 
static UINT drive_hotplug_thread_terminate (rdpdrPlugin *rdpdr)
 
static UINT rdpdr_process_connect (rdpdrPlugin *rdpdr)
 
static UINT rdpdr_process_server_announce_request (rdpdrPlugin *rdpdr, wStream *s)
 
static UINT rdpdr_send_client_announce_reply (rdpdrPlugin *rdpdr)
 
static UINT rdpdr_send_client_name_request (rdpdrPlugin *rdpdr)
 
static UINT rdpdr_process_server_clientid_confirm (rdpdrPlugin *rdpdr, wStream *s)
 
static BOOL device_announce (ULONG_PTR key, void *element, void *data)
 
static UINT rdpdr_send_device_list_announce_request (rdpdrPlugin *rdpdr, BOOL userLoggedOn)
 
static UINT dummy_irp_response (rdpdrPlugin *rdpdr, wStream *s)
 
static UINT rdpdr_process_irp (rdpdrPlugin *rdpdr, wStream *s)
 
static UINT rdpdr_process_component (rdpdrPlugin *rdpdr, UINT16 component, UINT16 packetId, wStream *s)
 
static BOOL device_init (ULONG_PTR key, void *element, void *data)
 
static UINT rdpdr_process_init (rdpdrPlugin *rdpdr)
 
static BOOL state_match (enum RDPDR_CHANNEL_STATE state, size_t count, va_list ap)
 
static const char * state_str (size_t count, va_list ap, char *buffer, size_t size)
 
static BOOL rdpdr_state_check (rdpdrPlugin *rdpdr, UINT16 packetid, enum RDPDR_CHANNEL_STATE next, size_t count,...)
 
static BOOL rdpdr_check_channel_state (rdpdrPlugin *rdpdr, UINT16 packetid)
 
static UINT rdpdr_process_receive (rdpdrPlugin *rdpdr, wStream *s)
 
UINT rdpdr_send (rdpdrPlugin *rdpdr, wStream *s)
 
static UINT rdpdr_virtual_channel_event_data_received (rdpdrPlugin *rdpdr, void *pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 
static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex (LPVOID lpUserParam, DWORD openHandle, UINT event, LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 
static DWORD WINAPI rdpdr_virtual_channel_client_thread (LPVOID arg)
 
static void queue_free (void *obj)
 
static UINT rdpdr_virtual_channel_event_connected (rdpdrPlugin *rdpdr, LPVOID pData, UINT32 dataLength)
 
static UINT rdpdr_virtual_channel_event_disconnected (rdpdrPlugin *rdpdr)
 
static void rdpdr_virtual_channel_event_terminated (rdpdrPlugin *rdpdr)
 
static VOID VCAPITYPE rdpdr_virtual_channel_init_event_ex (LPVOID lpUserParam, LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)
 
 FREERDP_ENTRY_POINT (BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID pInitHandle))
 

Variables

static const char * automountLocations []
 

Macro Definition Documentation

◆ MAX_USB_DEVICES

#define MAX_USB_DEVICES   100

◆ TAG

#define TAG   CHANNELS_TAG("rdpdr.client")

FreeRDP: A Remote Desktop Protocol Implementation Device Redirection Virtual Channel

Copyright 2010-2011 Vic Lee Copyright 2010-2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015-2016 Thincast Technologies GmbH Copyright 2015 DI (FH) Martin Haimberger marti.nosp@m.n.ha.nosp@m.imber.nosp@m.ger@.nosp@m.thinc.nosp@m.ast..nosp@m.com Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016 David PHAM-VAN d.pha.nosp@m.mvan.nosp@m.@inuv.nosp@m.ika..nosp@m.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.

◆ VirtualChannelEntryEx

#define VirtualChannelEntryEx   rdpdr_VirtualChannelEntryEx

Function Documentation

◆ device_already_plugged()

static BOOL device_already_plugged ( rdpdrPlugin rdpdr,
const hotplug_dev *  device 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_announce()

static BOOL device_announce ( ULONG_PTR  key,
void *  element,
void *  data 
)
static
  1. versionMinor 0x0005 doesn't send PAKID_CORE_USER_LOGGEDON so all devices should be sent regardless of user_loggedon
  2. smartcard devices should be always sent
  3. other devices are sent only after user_loggedon
Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_foreach()

static BOOL device_foreach ( rdpdrPlugin rdpdr,
BOOL  abortOnFail,
BOOL(*)(ULONG_PTR key, void *element, void *data fkt,
void *  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_init()

static BOOL device_init ( ULONG_PTR  key,
void *  element,
void *  data 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_not_plugged()

static BOOL device_not_plugged ( ULONG_PTR  key,
void *  element,
void *  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drive_hotplug_thread_func()

static DWORD WINAPI drive_hotplug_thread_func ( LPVOID  arg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drive_hotplug_thread_terminate()

static UINT drive_hotplug_thread_terminate ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dummy_irp_response()

static UINT dummy_irp_response ( rdpdrPlugin rdpdr,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ first_hotplug()

static void first_hotplug ( rdpdrPlugin rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FREERDP_ENTRY_POINT()

FREERDP_ENTRY_POINT ( BOOL VCAPITYPE   VirtualChannelEntryExPCHANNEL_ENTRY_POINTS pEntryPoints, PVOID pInitHandle)
Here is the call graph for this function:

◆ handle_hotplug()

static UINT handle_hotplug ( rdpdrPlugin rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_mountpoint()

static void handle_mountpoint ( hotplug_dev *  dev_array,
size_t *  size,
const char *  mountpoint 
)
static
Here is the call graph for this function:

◆ handle_platform_mounts()

static UINT handle_platform_mounts ( wLog *  log,
hotplug_dev *  dev_array,
size_t *  size 
)
static
Here is the caller graph for this function:

◆ hotplug_delete_foreach()

static BOOL hotplug_delete_foreach ( ULONG_PTR  key,
void *  element,
void *  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAutomountLocation()

static BOOL isAutomountLocation ( const char *  path)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ queue_free()

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

◆ rdpdr_caps_pdu_str()

static const char* rdpdr_caps_pdu_str ( UINT32  flag)
static
Here is the caller graph for this function:

◆ rdpdr_check_channel_state()

static BOOL rdpdr_check_channel_state ( rdpdrPlugin rdpdr,
UINT16  packetid 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_check_extended_pdu_flag()

static BOOL rdpdr_check_extended_pdu_flag ( rdpdrPlugin rdpdr,
UINT32  flag 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_device_type_string()

static const char* rdpdr_device_type_string ( UINT32  type)
static
Here is the caller graph for this function:

◆ rdpdr_load_drive()

static BOOL rdpdr_load_drive ( rdpdrPlugin rdpdr,
const char *  name,
const char *  path,
BOOL  automount 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_component()

static UINT rdpdr_process_component ( rdpdrPlugin rdpdr,
UINT16  component,
UINT16  packetId,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_connect()

static UINT rdpdr_process_connect ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_init()

static UINT rdpdr_process_init ( rdpdrPlugin rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_irp()

static UINT rdpdr_process_irp ( rdpdrPlugin rdpdr,
wStream s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_receive()

static UINT rdpdr_process_receive ( rdpdrPlugin rdpdr,
wStream s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_process_server_announce_request()

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

◆ rdpdr_process_server_clientid_confirm()

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

◆ rdpdr_send()

UINT rdpdr_send ( rdpdrPlugin rdpdr,
wStream s 
)

Function description

Returns
0 on success, otherwise a Win32 error code
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 ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
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 ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_device_list_announce_request()

static UINT rdpdr_send_device_list_announce_request ( rdpdrPlugin rdpdr,
BOOL  userLoggedOn 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_send_device_list_remove_request()

static UINT rdpdr_send_device_list_remove_request ( rdpdrPlugin rdpdr,
UINT32  count,
UINT32  ids[] 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_state_advance()

BOOL rdpdr_state_advance ( rdpdrPlugin rdpdr,
enum RDPDR_CHANNEL_STATE  next 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_state_check()

static BOOL rdpdr_state_check ( rdpdrPlugin rdpdr,
UINT16  packetid,
enum RDPDR_CHANNEL_STATE  next,
size_t  count,
  ... 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_state_str()

static const char* rdpdr_state_str ( enum RDPDR_CHANNEL_STATE  state)
static
Here is the caller graph for this function:

◆ rdpdr_try_send_device_list_announce_request()

UINT rdpdr_try_send_device_list_announce_request ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_client_thread()

static DWORD WINAPI rdpdr_virtual_channel_client_thread ( LPVOID  arg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_event_connected()

static UINT rdpdr_virtual_channel_event_connected ( rdpdrPlugin rdpdr,
LPVOID  pData,
UINT32  dataLength 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_event_data_received()

static UINT rdpdr_virtual_channel_event_data_received ( rdpdrPlugin rdpdr,
void *  pData,
UINT32  dataLength,
UINT32  totalLength,
UINT32  dataFlags 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_event_disconnected()

static UINT rdpdr_virtual_channel_event_disconnected ( rdpdrPlugin rdpdr)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_event_terminated()

static void rdpdr_virtual_channel_event_terminated ( rdpdrPlugin rdpdr)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_init_event_ex()

static VOID VCAPITYPE rdpdr_virtual_channel_init_event_ex ( LPVOID  lpUserParam,
LPVOID  pInitHandle,
UINT  event,
LPVOID  pData,
UINT  dataLength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpdr_virtual_channel_open_event_ex()

static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex ( LPVOID  lpUserParam,
DWORD  openHandle,
UINT  event,
LPVOID  pData,
UINT32  dataLength,
UINT32  totalLength,
UINT32  dataFlags 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ state_match()

static BOOL state_match ( enum RDPDR_CHANNEL_STATE  state,
size_t  count,
va_list  ap 
)
static
Here is the caller graph for this function:

◆ state_str()

static const char* state_str ( size_t  count,
va_list  ap,
char *  buffer,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ support_str()

static const char* support_str ( BOOL  val)
static
Here is the caller graph for this function:

Variable Documentation

◆ automountLocations

const char* automountLocations[]
static
Initial value:
= { "/run/user/%lu/gvfs", "/run/media/%s", "/media/%s",
"/media", "/mnt" }