FreeRDP
peer.c File Reference
#include <freerdp/config.h>
#include "settings.h"
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/winsock.h>
#include "info.h"
#include "display.h"
#include <freerdp/log.h>
#include <freerdp/streamdump.h>
#include <freerdp/redirection.h>
#include <freerdp/crypto/certificate.h>
#include "rdp.h"
#include "peer.h"
#include "multitransport.h"

Macros

#define TAG   FREERDP_TAG("core.peer")
 

Functions

static state_run_t peer_recv_pdu (freerdp_peer *client, wStream *s)
 
static HANDLE freerdp_peer_virtual_channel_open (freerdp_peer *client, const char *name, UINT32 flags)
 
static BOOL freerdp_peer_virtual_channel_close (freerdp_peer *client, HANDLE hChannel)
 
static int freerdp_peer_virtual_channel_write (freerdp_peer *client, HANDLE hChannel, const BYTE *buffer, UINT32 length)
 
static void * freerdp_peer_virtual_channel_get_data (freerdp_peer *client, HANDLE hChannel)
 
static int freerdp_peer_virtual_channel_set_data (freerdp_peer *client, HANDLE hChannel, void *data)
 
static BOOL freerdp_peer_set_state (freerdp_peer *client, CONNECTION_STATE state)
 
static BOOL freerdp_peer_initialize (freerdp_peer *client)
 
static HANDLE freerdp_peer_get_event_handle (freerdp_peer *client)
 
static DWORD freerdp_peer_get_event_handles (freerdp_peer *client, HANDLE *events, DWORD count)
 
static BOOL freerdp_peer_check_fds (freerdp_peer *peer)
 
static state_run_t peer_recv_data_pdu (freerdp_peer *client, wStream *s, UINT16 totalLength)
 
static state_run_t peer_recv_tpkt_pdu (freerdp_peer *client, wStream *s)
 
static state_run_t peer_recv_handle_auto_detect (freerdp_peer *client, wStream *s)
 
static state_run_t peer_recv_handle_licensing (freerdp_peer *client, wStream *s)
 
static state_run_t peer_recv_fastpath_pdu (freerdp_peer *client, wStream *s)
 
static state_run_t peer_unexpected_client_message (rdpRdp *rdp, UINT32 flag)
 
state_run_t rdp_peer_handle_state_demand_active (freerdp_peer *client)
 
static state_run_t rdp_peer_handle_state_active (freerdp_peer *client)
 Handle server peer state ACTIVE: On initial run (not connected, not activated) do not read data. More...
 
static state_run_t peer_recv_callback_internal (rdpTransport *transport, wStream *s, void *extra)
 
static state_run_t peer_recv_callback (rdpTransport *transport, wStream *s, void *extra)
 
static BOOL freerdp_peer_close (freerdp_peer *client)
 
static void freerdp_peer_disconnect (freerdp_peer *client)
 
static BOOL freerdp_peer_send_channel_data (freerdp_peer *client, UINT16 channelId, const BYTE *data, size_t size)
 
static BOOL freerdp_peer_send_server_redirection_pdu (freerdp_peer *peer, const rdpRedirection *redirection)
 
static BOOL freerdp_peer_send_channel_packet (freerdp_peer *client, UINT16 channelId, size_t totalSize, UINT32 flags, const BYTE *data, size_t chunkSize)
 
static BOOL freerdp_peer_is_write_blocked (freerdp_peer *peer)
 
static int freerdp_peer_drain_output_buffer (freerdp_peer *peer)
 
static BOOL freerdp_peer_has_more_to_read (freerdp_peer *peer)
 
static LicenseCallbackResult freerdp_peer_nolicense (freerdp_peer *peer, wStream *s)
 
BOOL freerdp_peer_context_new (freerdp_peer *client)
 
void freerdp_peer_context_free (freerdp_peer *client)
 
static const char * os_major_type_to_string (UINT16 osMajorType)
 
const char * freerdp_peer_os_major_type_string (freerdp_peer *client)
 
static const char * os_minor_type_to_string (UINT16 osMinorType)
 
const char * freerdp_peer_os_minor_type_string (freerdp_peer *client)
 
freerdp_peer * freerdp_peer_new (int sockfd)
 
void freerdp_peer_free (freerdp_peer *client)
 
static BOOL freerdp_peer_transport_setup (freerdp_peer *client)
 
BOOL freerdp_peer_context_new_ex (freerdp_peer *client, const rdpSettings *settings)
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("core.peer")

FreeRDP: A Remote Desktop Protocol Implementation RDP Server Peer

Copyright 2011 Vic Lee Copyright 2014 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 2023 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2023 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.

Function Documentation

◆ freerdp_peer_check_fds()

static BOOL freerdp_peer_check_fds ( freerdp_peer *  peer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_close()

static BOOL freerdp_peer_close ( freerdp_peer *  client)
static

if negotiation has failed, we're not MCS connected. So don't send anything else, or some mstsc will consider that as an error

[MS-RDPBCGR] 1.3.1.4.2 User-Initiated Disconnection Sequence on Server The server first sends the client a Deactivate All PDU followed by an optional MCS Disconnect Provider Ultimatum PDU.

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

◆ freerdp_peer_context_free()

void freerdp_peer_context_free ( freerdp_peer *  client)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_context_new()

BOOL freerdp_peer_context_new ( freerdp_peer *  client)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_context_new_ex()

BOOL freerdp_peer_context_new_ex ( freerdp_peer *  client,
const rdpSettings *  settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_disconnect()

static void freerdp_peer_disconnect ( freerdp_peer *  client)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_drain_output_buffer()

static int freerdp_peer_drain_output_buffer ( freerdp_peer *  peer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_free()

void freerdp_peer_free ( freerdp_peer *  client)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_get_event_handle()

static HANDLE freerdp_peer_get_event_handle ( freerdp_peer *  client)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_get_event_handles()

static DWORD freerdp_peer_get_event_handles ( freerdp_peer *  client,
HANDLE *  events,
DWORD  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_has_more_to_read()

static BOOL freerdp_peer_has_more_to_read ( freerdp_peer *  peer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_initialize()

static BOOL freerdp_peer_initialize ( freerdp_peer *  client)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_is_write_blocked()

static BOOL freerdp_peer_is_write_blocked ( freerdp_peer *  peer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_new()

freerdp_peer* freerdp_peer_new ( int  sockfd)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_nolicense()

static LicenseCallbackResult freerdp_peer_nolicense ( freerdp_peer *  peer,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_os_major_type_string()

const char* freerdp_peer_os_major_type_string ( freerdp_peer *  client)
Here is the call graph for this function:

◆ freerdp_peer_os_minor_type_string()

const char* freerdp_peer_os_minor_type_string ( freerdp_peer *  client)
Here is the call graph for this function:

◆ freerdp_peer_send_channel_data()

static BOOL freerdp_peer_send_channel_data ( freerdp_peer *  client,
UINT16  channelId,
const BYTE data,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_send_channel_packet()

static BOOL freerdp_peer_send_channel_packet ( freerdp_peer *  client,
UINT16  channelId,
size_t  totalSize,
UINT32  flags,
const BYTE data,
size_t  chunkSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_send_server_redirection_pdu()

static BOOL freerdp_peer_send_server_redirection_pdu ( freerdp_peer *  peer,
const rdpRedirection *  redirection 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_set_state()

static BOOL freerdp_peer_set_state ( freerdp_peer *  client,
CONNECTION_STATE  state 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_transport_setup()

static BOOL freerdp_peer_transport_setup ( freerdp_peer *  client)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_virtual_channel_close()

static BOOL freerdp_peer_virtual_channel_close ( freerdp_peer *  client,
HANDLE  hChannel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_virtual_channel_get_data()

static void* freerdp_peer_virtual_channel_get_data ( freerdp_peer *  client,
HANDLE  hChannel 
)
static
Here is the caller graph for this function:

◆ freerdp_peer_virtual_channel_open()

static HANDLE freerdp_peer_virtual_channel_open ( freerdp_peer *  client,
const char *  name,
UINT32  flags 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_peer_virtual_channel_set_data()

static int freerdp_peer_virtual_channel_set_data ( freerdp_peer *  client,
HANDLE  hChannel,
void *  data 
)
static
Here is the caller graph for this function:

◆ freerdp_peer_virtual_channel_write()

static int freerdp_peer_virtual_channel_write ( freerdp_peer *  client,
HANDLE  hChannel,
const BYTE buffer,
UINT32  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ os_major_type_to_string()

static const char* os_major_type_to_string ( UINT16  osMajorType)
static
Here is the caller graph for this function:

◆ os_minor_type_to_string()

static const char* os_minor_type_to_string ( UINT16  osMinorType)
static
Here is the caller graph for this function:

◆ peer_recv_callback()

static state_run_t peer_recv_callback ( rdpTransport *  transport,
wStream s,
void *  extra 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_callback_internal()

static state_run_t peer_recv_callback_internal ( rdpTransport *  transport,
wStream s,
void *  extra 
)
static

During reactivation sequence the client might sent some input or channel data before receiving the Deactivate All PDU. We need to process them as usual.

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

◆ peer_recv_data_pdu()

static state_run_t peer_recv_data_pdu ( freerdp_peer *  client,
wStream s,
UINT16  totalLength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_fastpath_pdu()

static state_run_t peer_recv_fastpath_pdu ( freerdp_peer *  client,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_handle_auto_detect()

static state_run_t peer_recv_handle_auto_detect ( freerdp_peer *  client,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_handle_licensing()

static state_run_t peer_recv_handle_licensing ( freerdp_peer *  client,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_pdu()

state_run_t peer_recv_pdu ( freerdp_peer *  client,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_recv_tpkt_pdu()

static state_run_t peer_recv_tpkt_pdu ( freerdp_peer *  client,
wStream s 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_unexpected_client_message()

static state_run_t peer_unexpected_client_message ( rdpRdp *  rdp,
UINT32  flag 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdp_peer_handle_state_active()

static state_run_t rdp_peer_handle_state_active ( freerdp_peer *  client)
static

Handle server peer state ACTIVE: On initial run (not connected, not activated) do not read data.

Returns
-1 in case of an error, 0 if no data needs to be processed, 1 to let the state machine run again and 2 if peer_recv_pdu must be called.

PostConnect should only be called once and should not be called after a reactivation sequence.

Here is the caller graph for this function:

◆ rdp_peer_handle_state_demand_active()

state_run_t rdp_peer_handle_state_demand_active ( freerdp_peer *  client)

FreeRDP: A Remote Desktop Protocol Implementation RDP Server Peer

Copyright 2011 Vic Lee

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: