FreeRDP
gcc.c File Reference
#include <freerdp/config.h>
#include "settings.h"
#include <winpr/crt.h>
#include <winpr/crypto.h>
#include <winpr/assert.h>
#include <freerdp/log.h>
#include <freerdp/utils/string.h>
#include <freerdp/crypto/certificate.h>
#include "utils.h"
#include "gcc.h"
#include "nego.h"
#include "../crypto/certificate.h"

Macros

#define TAG   FREERDP_TAG("core.gcc")
 

Enumerations

enum  HIGH_COLOR_DEPTH {
  HIGH_COLOR_4BPP = 0x04 , HIGH_COLOR_8BPP = 0x08 , HIGH_COLOR_15BPP = 0x0F , HIGH_COLOR_16BPP = 0x10 ,
  HIGH_COLOR_24BPP = 0x18
}
 

Functions

static const char * HighColorToString (HIGH_COLOR_DEPTH color)
 
static HIGH_COLOR_DEPTH ColorDepthToHighColor (UINT32 bpp)
 
static char * gcc_block_type_string (UINT16 type, char *buffer, size_t size)
 
static BOOL gcc_read_client_cluster_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_read_client_core_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_read_client_data_blocks (wStream *s, rdpMcs *mcs, UINT16 length)
 
static BOOL gcc_read_server_data_blocks (wStream *s, rdpMcs *mcs, UINT16 length)
 
static BOOL gcc_read_user_data_header (wStream *s, UINT16 *type, UINT16 *length)
 
static BOOL gcc_write_user_data_header (wStream *s, UINT16 type, UINT16 length)
 
static BOOL gcc_write_client_core_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_server_core_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_server_core_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_read_client_security_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_security_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_server_security_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_server_security_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_read_client_network_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_network_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_server_network_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_server_network_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_write_client_cluster_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_client_monitor_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_monitor_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_client_monitor_extended_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_monitor_extended_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_client_message_channel_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_message_channel_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_server_message_channel_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_server_message_channel_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_client_multitransport_channel_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_client_multitransport_channel_data (wStream *s, const rdpMcs *mcs)
 
static BOOL gcc_read_server_multitransport_channel_data (wStream *s, rdpMcs *mcs)
 
static BOOL gcc_write_server_multitransport_channel_data (wStream *s, const rdpMcs *mcs)
 
static rdpSettings * mcs_get_settings (rdpMcs *mcs)
 
static const rdpSettings * mcs_get_const_settings (const rdpMcs *mcs)
 
static char * rdp_early_server_caps_string (UINT32 flags, char *buffer, size_t size)
 
static const char * rdp_early_client_caps_string (UINT32 flags, char *buffer, size_t size)
 
static DWORD rdp_version_common (DWORD serverVersion, DWORD clientVersion)
 
BOOL gcc_read_conference_create_request (wStream *s, rdpMcs *mcs)
 
BOOL gcc_write_conference_create_request (wStream *s, wStream *userData)
 
BOOL gcc_read_conference_create_response (wStream *s, rdpMcs *mcs)
 
BOOL gcc_write_conference_create_response (wStream *s, wStream *userData)
 
static BOOL gcc_read_client_unused1_data (wStream *s)
 
BOOL gcc_write_client_data_blocks (wStream *s, const rdpMcs *mcs)
 
BOOL gcc_write_server_data_blocks (wStream *s, rdpMcs *mcs)
 
static UINT32 filterAndLogEarlyServerCapabilityFlags (UINT32 flags)
 
static UINT32 earlyServerCapsFromSettings (const rdpSettings *settings)
 
static UINT16 filterAndLogEarlyClientCapabilityFlags (UINT32 flags)
 
static UINT16 earlyClientCapsFromSettings (const rdpSettings *settings)
 
static BOOL updateEarlyClientCaps (rdpSettings *settings, UINT32 earlyCapabilityFlags, UINT32 connectionType)
 
static BOOL updateEarlyServerCaps (rdpSettings *settings, UINT32 earlyCapabilityFlags, UINT32 connectionType)
 
static BOOL gcc_update_server_random (rdpSettings *settings)
 

Variables

static const BYTE t124_02_98_oid [6] = { 0, 0, 20, 124, 0, 1 }
 
static const BYTE h221_cs_key [4] = "Duca"
 
static const BYTE h221_sc_key [4] = "McDn"
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("core.gcc")

FreeRDP: A Remote Desktop Protocol Implementation T.124 Generic Conference Control (GCC)

Copyright 2011 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2014 Norbert Federa norbe.nosp@m.rt.f.nosp@m.edera.nosp@m.@thi.nosp@m.ncast.nosp@m..com 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.

Enumeration Type Documentation

◆ HIGH_COLOR_DEPTH

Enumerator
HIGH_COLOR_4BPP 
HIGH_COLOR_8BPP 
HIGH_COLOR_15BPP 
HIGH_COLOR_16BPP 
HIGH_COLOR_24BPP 

Function Documentation

◆ ColorDepthToHighColor()

static HIGH_COLOR_DEPTH ColorDepthToHighColor ( UINT32  bpp)
static
Here is the caller graph for this function:

◆ earlyClientCapsFromSettings()

static UINT16 earlyClientCapsFromSettings ( const rdpSettings *  settings)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ earlyServerCapsFromSettings()

static UINT32 earlyServerCapsFromSettings ( const rdpSettings *  settings)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterAndLogEarlyClientCapabilityFlags()

static UINT16 filterAndLogEarlyClientCapabilityFlags ( UINT32  flags)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterAndLogEarlyServerCapabilityFlags()

static UINT32 filterAndLogEarlyServerCapabilityFlags ( UINT32  flags)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_block_type_string()

char * gcc_block_type_string ( UINT16  type,
char *  buffer,
size_t  size 
)
static
Here is the caller graph for this function:

◆ gcc_read_client_cluster_data()

BOOL gcc_read_client_cluster_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client cluster data block (TS_UD_CS_CLUSTER). msdn{cc240514}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_core_data()

BOOL gcc_read_client_core_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client core data block (TS_UD_CS_CORE). msdn{cc240510}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise

The following fields are all optional. If one field is present, all of the preceding fields MUST also be present. If one field is not present, all of the subsequent fields MUST NOT be present. We must check the bytes left before reading each field.

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

◆ gcc_read_client_data_blocks()

BOOL gcc_read_client_data_blocks ( wStream s,
rdpMcs *  mcs,
UINT16  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_message_channel_data()

BOOL gcc_read_client_message_channel_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client message channel data block (TS_UD_CS_MCS_MSGCHANNEL). msdn{jj217627}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_monitor_data()

BOOL gcc_read_client_monitor_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client monitor data block (TS_UD_CS_MONITOR). msdn{dd305336}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_monitor_extended_data()

BOOL gcc_read_client_monitor_extended_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_multitransport_channel_data()

BOOL gcc_read_client_multitransport_channel_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client multitransport channel data block (TS_UD_CS_MULTITRANSPORT). msdn{jj217498}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_network_data()

BOOL gcc_read_client_network_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client network data block (TS_UD_CS_NET). msdn{cc240512}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise

CHANNEL_DEF

  • name: an 8-byte array containing a null-terminated collection of seven ANSI characters that uniquely identify the channel.
  • options: a 32-bit, unsigned integer. Channel option flags
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_security_data()

BOOL gcc_read_client_security_data ( wStream s,
rdpMcs *  mcs 
)
static

Read a client security data block (TS_UD_CS_SEC). msdn{cc240511}

Parameters
sstream
mcsMCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_client_unused1_data()

static BOOL gcc_read_client_unused1_data ( wStream s)
static
Here is the caller graph for this function:

◆ gcc_read_conference_create_request()

BOOL gcc_read_conference_create_request ( wStream s,
rdpMcs *  mcs 
)

Read a GCC Conference Create Request. msdn{cc240836}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_conference_create_response()

BOOL gcc_read_conference_create_response ( wStream s,
rdpMcs *  mcs 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_server_core_data()

BOOL gcc_read_server_core_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_server_data_blocks()

BOOL gcc_read_server_data_blocks ( wStream s,
rdpMcs *  mcs,
UINT16  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_server_message_channel_data()

BOOL gcc_read_server_message_channel_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the caller graph for this function:

◆ gcc_read_server_multitransport_channel_data()

BOOL gcc_read_server_multitransport_channel_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_server_network_data()

BOOL gcc_read_server_network_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the caller graph for this function:

◆ gcc_read_server_security_data()

BOOL gcc_read_server_security_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_read_user_data_header()

BOOL gcc_read_user_data_header ( wStream s,
UINT16 type,
UINT16 length 
)
static
Here is the caller graph for this function:

◆ gcc_update_server_random()

static BOOL gcc_update_server_random ( rdpSettings *  settings)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_cluster_data()

BOOL gcc_write_client_cluster_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client cluster data block (TS_UD_CS_CLUSTER). msdn{cc240514}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_core_data()

BOOL gcc_write_client_core_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client core data block (TS_UD_CS_CORE). msdn{cc240510}

Parameters
sThe stream to write to
mcsThe MSC instance to get the data from
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_data_blocks()

BOOL gcc_write_client_data_blocks ( wStream s,
const rdpMcs *  mcs 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_message_channel_data()

BOOL gcc_write_client_message_channel_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client message channel data block (TS_UD_CS_MCS_MSGCHANNEL). msdn{jj217627}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_monitor_data()

BOOL gcc_write_client_monitor_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client monitor data block (TS_UD_CS_MONITOR). msdn{dd305336}

Parameters
sstream
mcsThe MCS to use
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_monitor_extended_data()

BOOL gcc_write_client_monitor_extended_data ( wStream s,
const rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_multitransport_channel_data()

BOOL gcc_write_client_multitransport_channel_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client multitransport channel data block (TS_UD_CS_MULTITRANSPORT). msdn{jj217498}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_network_data()

BOOL gcc_write_client_network_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client network data block (TS_UD_CS_NET). msdn{cc240512}

Parameters
sstream
mcsThe MCS to use
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_client_security_data()

BOOL gcc_write_client_security_data ( wStream s,
const rdpMcs *  mcs 
)
static

Write a client security data block (TS_UD_CS_SEC). msdn{cc240511}

Parameters
sstream
mcsThe MCS instance
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_conference_create_request()

BOOL gcc_write_conference_create_request ( wStream s,
wStream userData 
)

Write a GCC Conference Create Request. msdn{cc240836}

Parameters
sstream
userDataclient data blocks
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_conference_create_response()

BOOL gcc_write_conference_create_response ( wStream s,
wStream userData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_core_data()

BOOL gcc_write_server_core_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_data_blocks()

BOOL gcc_write_server_data_blocks ( wStream s,
rdpMcs *  mcs 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_message_channel_data()

BOOL gcc_write_server_message_channel_data ( wStream s,
const rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_multitransport_channel_data()

BOOL gcc_write_server_multitransport_channel_data ( wStream s,
const rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_network_data()

BOOL gcc_write_server_network_data ( wStream s,
const rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_server_security_data()

BOOL gcc_write_server_security_data ( wStream s,
rdpMcs *  mcs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gcc_write_user_data_header()

BOOL gcc_write_user_data_header ( wStream s,
UINT16  type,
UINT16  length 
)
static

Write a user data header (TS_UD_HEADER). msdn{cc240509}

Parameters
sstream
typedata block type
lengthdata block length
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HighColorToString()

static const char* HighColorToString ( HIGH_COLOR_DEPTH  color)
static
Here is the caller graph for this function:

◆ mcs_get_const_settings()

static const rdpSettings* mcs_get_const_settings ( const rdpMcs *  mcs)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mcs_get_settings()

static rdpSettings* mcs_get_settings ( rdpMcs *  mcs)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdp_early_client_caps_string()

static const char* rdp_early_client_caps_string ( UINT32  flags,
char *  buffer,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdp_early_server_caps_string()

static char* rdp_early_server_caps_string ( UINT32  flags,
char *  buffer,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdp_version_common()

static DWORD rdp_version_common ( DWORD  serverVersion,
DWORD  clientVersion 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateEarlyClientCaps()

static BOOL updateEarlyClientCaps ( rdpSettings *  settings,
UINT32  earlyCapabilityFlags,
UINT32  connectionType 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateEarlyServerCaps()

static BOOL updateEarlyServerCaps ( rdpSettings *  settings,
UINT32  earlyCapabilityFlags,
UINT32  connectionType 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ h221_cs_key

const BYTE h221_cs_key[4] = "Duca"
static

◆ h221_sc_key

const BYTE h221_sc_key[4] = "McDn"
static

◆ t124_02_98_oid

const BYTE t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 }
static

T.124 GCC is defined in:

http://www.itu.int/rec/T-REC-T.124-199802-S/en ITU-T T.124 (02/98): Generic Conference Control ConnectData ::= SEQUENCE { t124Identifier Key, connectPDU OCTET_STRING }

Key ::= CHOICE { object OBJECT_IDENTIFIER, h221NonStandard H221NonStandardIdentifier }

ConnectGCCPDU ::= CHOICE { conferenceCreateRequest ConferenceCreateRequest, conferenceCreateResponse ConferenceCreateResponse, conferenceQueryRequest ConferenceQueryRequest, conferenceQueryResponse ConferenceQueryResponse, conferenceJoinRequest ConferenceJoinRequest, conferenceJoinResponse ConferenceJoinResponse, conferenceInviteRequest ConferenceInviteRequest, conferenceInviteResponse ConferenceInviteResponse, ... }

ConferenceCreateRequest ::= SEQUENCE { conferenceName ConferenceName, convenerPassword Password OPTIONAL, password Password OPTIONAL, lockedConference BOOLEAN, listedConference BOOLEAN, conductibleConference BOOLEAN, terminationMethod TerminationMethod, conductorPrivileges SET OF Privilege OPTIONAL, conductedPrivileges SET OF Privilege OPTIONAL, nonConductedPrivileges SET OF Privilege OPTIONAL, conferenceDescription TextString OPTIONAL, callerIdentifier TextString OPTIONAL, userData UserData OPTIONAL, ..., conferencePriority ConferencePriority OPTIONAL, conferenceMode ConferenceMode OPTIONAL }

ConferenceCreateResponse ::= SEQUENCE { nodeID UserID, tag INTEGER, result ENUMERATED { success (0), userRejected (1), resourcesNotAvailable (2), rejectedForSymmetryBreaking (3), lockedConferenceNotSupported (4) }, userData UserData OPTIONAL, ... }

ConferenceName ::= SEQUENCE { numeric SimpleNumericString text SimpleTextString OPTIONAL, ... }

SimpleNumericString ::= NumericString (SIZE (1..255)) (FROM ("0123456789"))

UserData ::= SET OF SEQUENCE { key Key, value OCTET_STRING OPTIONAL }

H221NonStandardIdentifier ::= OCTET STRING (SIZE (4..255))

UserID ::= DynamicChannelID

ChannelID ::= INTEGER (1..65535) StaticChannelID ::= INTEGER (1..1000) DynamicChannelID ::= INTEGER (1001..65535)