FreeRDP
freerdp.c File Reference
#include <freerdp/config.h>
#include "settings.h"
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include "rdp.h"
#include "input.h"
#include "update.h"
#include "surface.h"
#include "transport.h"
#include "connection.h"
#include "message.h"
#include <freerdp/buildflags.h>
#include "gateway/rpc_fault.h"
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/string.h>
#include <winpr/stream.h>
#include <winpr/wtsapi.h>
#include <winpr/ssl.h>
#include <winpr/debug.h>
#include <freerdp/freerdp.h>
#include <freerdp/streamdump.h>
#include <freerdp/error.h>
#include <freerdp/event.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/channels/channels.h>
#include <freerdp/version.h>
#include <freerdp/log.h>
#include <freerdp/utils/signal.h>
#include "../cache/pointer.h"
#include "utils.h"

Macros

#define TAG   FREERDP_TAG("core")
 

Functions

static void sig_abort_connect (int signum, const char *signame, void *ctx)
 
static int freerdp_connect_begin (freerdp *instance)
 
BOOL freerdp_connect (freerdp *instance)
 
BOOL freerdp_abort_connect (freerdp *instance)
 
BOOL freerdp_abort_connect_context (rdpContext *context)
 
BOOL freerdp_check_fds (freerdp *instance)
 
DWORD freerdp_get_event_handles (rdpContext *context, HANDLE *events, DWORD count)
 
static BOOL freerdp_prevent_session_lock (rdpContext *context)
 
BOOL freerdp_check_event_handles (rdpContext *context)
 
wMessageQueue * freerdp_get_message_queue (freerdp *instance, DWORD id)
 
HANDLE freerdp_get_message_queue_event_handle (freerdp *instance, DWORD id)
 
int freerdp_message_queue_process_message (freerdp *instance, DWORD id, wMessage *message)
 
int freerdp_message_queue_process_pending_messages (freerdp *instance, DWORD id)
 
static BOOL freerdp_send_channel_data (freerdp *instance, UINT16 channelId, const BYTE *data, size_t size)
 
static BOOL freerdp_send_channel_packet (freerdp *instance, UINT16 channelId, size_t totalSize, UINT32 flags, const BYTE *data, size_t chunkSize)
 
BOOL freerdp_disconnect (freerdp *instance)
 
BOOL freerdp_disconnect_before_reconnect (freerdp *instance)
 
BOOL freerdp_disconnect_before_reconnect_context (rdpContext *context)
 
BOOL freerdp_reconnect (freerdp *instance)
 
BOOL freerdp_shall_disconnect (freerdp *instance)
 
BOOL freerdp_shall_disconnect_context (rdpContext *context)
 
BOOL freerdp_focus_required (freerdp *instance)
 
void freerdp_set_focus (freerdp *instance)
 
void freerdp_get_version (int *major, int *minor, int *revision)
 
const char * freerdp_get_version_string (void)
 
const char * freerdp_get_build_config (void)
 
const char * freerdp_get_build_revision (void)
 
BOOL freerdp_context_new (freerdp *instance)
 
BOOL freerdp_context_new_ex (freerdp *instance, rdpSettings *settings)
 
BOOL freerdp_context_reset (freerdp *instance)
 
void freerdp_context_free (freerdp *instance)
 
int freerdp_get_disconnect_ultimatum (rdpContext *context)
 
UINT32 freerdp_error_info (freerdp *instance)
 
void freerdp_set_error_info (rdpRdp *rdp, UINT32 error)
 
BOOL freerdp_send_error_info (rdpRdp *rdp)
 
UINT32 freerdp_get_last_error (rdpContext *context)
 
const char * freerdp_get_last_error_name (UINT32 code)
 
const char * freerdp_get_last_error_string (UINT32 code)
 
const char * freerdp_get_last_error_category (UINT32 code)
 
void freerdp_set_last_error_ex (rdpContext *context, UINT32 lastError, const char *fkt, const char *file, int line)
 
const char * freerdp_get_logon_error_info_type_ex (UINT32 type, char *buffer, size_t size)
 
const char * freerdp_get_logon_error_info_type (UINT32 type)
 
const char * freerdp_get_logon_error_info_data (UINT32 data)
 
const char * freerdp_get_logon_error_info_data_ex (UINT32 data, char *buffer, size_t size)
 
freerdp * freerdp_new (void)
 
void freerdp_free (freerdp *instance)
 
ULONG freerdp_get_transport_sent (rdpContext *context, BOOL resetCount)
 
BOOL freerdp_nla_impersonate (rdpContext *context)
 
BOOL freerdp_nla_revert_to_self (rdpContext *context)
 
UINT32 freerdp_get_nla_sspi_error (rdpContext *context)
 
HANDLE getChannelErrorEventHandle (rdpContext *context)
 
BOOL checkChannelErrorEvent (rdpContext *context)
 
UINT getChannelError (rdpContext *context)
 
const char * getChannelErrorDescription (rdpContext *context)
 
void clearChannelError (rdpContext *context)
 
void setChannelError (rdpContext *context, UINT errorNum, WINPR_FORMAT_ARG const char *format,...)
 
const char * freerdp_nego_get_routing_token (rdpContext *context, DWORD *length)
 
BOOL freerdp_io_callback_set_event (rdpContext *context, BOOL set)
 
const rdpTransportIo * freerdp_get_io_callbacks (rdpContext *context)
 
BOOL freerdp_set_io_callbacks (rdpContext *context, const rdpTransportIo *io_callbacks)
 
BOOL freerdp_set_io_callback_context (rdpContext *context, void *usercontext)
 
void * freerdp_get_io_callback_context (rdpContext *context)
 
CONNECTION_STATE freerdp_get_state (const rdpContext *context)
 returns the current CONNECTION_STATE of the context. More...
 
const char * freerdp_state_string (CONNECTION_STATE state)
 returns a string representation of a CONNECTION_STATE More...
 
BOOL freerdp_is_active_state (const rdpContext *context)
 Queries if the current CONNECTION_STATE of the context is an active connection. More...
 
BOOL freerdp_channels_from_mcs (rdpSettings *settings, const rdpContext *context)
 
HANDLE freerdp_abort_event (rdpContext *context)
 
static void test_mcs_free (rdpMcs *mcs)
 
static rdpMcs * test_mcs_new (void)
 
BOOL freerdp_is_valid_mcs_create_request (const BYTE *data, size_t size)
 
BOOL freerdp_is_valid_mcs_create_response (const BYTE *data, size_t size)
 

Variables

static wEventType FreeRDP_Events []
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("core")

FreeRDP: A Remote Desktop Protocol Implementation FreeRDP Core

Copyright 2011 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015 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

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

◆ checkChannelErrorEvent()

BOOL checkChannelErrorEvent ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearChannelError()

void clearChannelError ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_abort_connect()

BOOL freerdp_abort_connect ( freerdp *  instance)
Here is the call graph for this function:

◆ freerdp_abort_connect_context()

BOOL freerdp_abort_connect_context ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_abort_event()

HANDLE freerdp_abort_event ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_channels_from_mcs()

BOOL freerdp_channels_from_mcs ( rdpSettings *  settings,
const rdpContext *  context 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_check_event_handles()

BOOL freerdp_check_event_handles ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_check_fds()

BOOL freerdp_check_fds ( freerdp *  instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_connect()

BOOL freerdp_connect ( freerdp *  instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_connect_begin()

static int freerdp_connect_begin ( freerdp *  instance)
static

Creates a new connection based on the settings found in the "instance" parameter It will use the callbacks registered on the structure to process the pre/post connect operations that the caller requires.

See also
struct rdp_freerdp in freerdp.h
Parameters
instance- pointer to a rdp_freerdp structure that contains base information to establish the connection. On return, this function will be initialized with the new connection's settings.
Returns
TRUE if successful. FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_context_free()

void freerdp_context_free ( freerdp *  instance)

Deallocator function for a rdp context. The function will deallocate the resources from the 'instance' parameter that were allocated from a call to freerdp_context_new(). If the ContextFree callback is set in the 'instance' parameter, it will be called before deallocation occurs.

Parameters
instance- Pointer to the rdp_freerdp structure that was initialized by a call to freerdp_context_new(). On return, the fields associated to the context are invalid.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_context_new()

BOOL freerdp_context_new ( freerdp *  instance)

Allocator function for a rdp context. The function will allocate a rdpRdp structure using rdp_new(), then copy its contents to the appropriate fields in the rdp_freerdp structure given in parameters. It will also initialize the 'context' field in the rdp_freerdp structure as needed. If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function.

Parameters
instance- Pointer to the rdp_freerdp structure that will be initialized with the new context.
Here is the call graph for this function:

◆ freerdp_context_new_ex()

BOOL freerdp_context_new_ex ( freerdp *  instance,
rdpSettings *  settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_context_reset()

BOOL freerdp_context_reset ( freerdp *  instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_disconnect()

BOOL freerdp_disconnect ( freerdp *  instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_disconnect_before_reconnect()

BOOL freerdp_disconnect_before_reconnect ( freerdp *  instance)
Here is the call graph for this function:

◆ freerdp_disconnect_before_reconnect_context()

BOOL freerdp_disconnect_before_reconnect_context ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_error_info()

UINT32 freerdp_error_info ( freerdp *  instance)
Here is the caller graph for this function:

◆ freerdp_focus_required()

BOOL freerdp_focus_required ( freerdp *  instance)
Here is the caller graph for this function:

◆ freerdp_free()

void freerdp_free ( freerdp *  instance)

Deallocator function for the rdp_freerdp structure.

Parameters
instance- pointer to the rdp_freerdp structure to deallocate. On return, this pointer is not valid anymore.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_build_config()

const char* freerdp_get_build_config ( void  )
Here is the caller graph for this function:

◆ freerdp_get_build_revision()

const char* freerdp_get_build_revision ( void  )
Here is the caller graph for this function:

◆ freerdp_get_disconnect_ultimatum()

int freerdp_get_disconnect_ultimatum ( rdpContext *  context)
Here is the caller graph for this function:

◆ freerdp_get_event_handles()

DWORD freerdp_get_event_handles ( rdpContext *  context,
HANDLE *  events,
DWORD  count 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_io_callback_context()

void* freerdp_get_io_callback_context ( rdpContext *  context)
Here is the call graph for this function:

◆ freerdp_get_io_callbacks()

const rdpTransportIo* freerdp_get_io_callbacks ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_last_error()

UINT32 freerdp_get_last_error ( rdpContext *  context)
Here is the caller graph for this function:

◆ freerdp_get_last_error_category()

const char* freerdp_get_last_error_category ( UINT32  code)
Here is the call graph for this function:

◆ freerdp_get_last_error_name()

const char* freerdp_get_last_error_name ( UINT32  code)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_last_error_string()

const char* freerdp_get_last_error_string ( UINT32  code)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_logon_error_info_data()

const char* freerdp_get_logon_error_info_data ( UINT32  data)
Here is the caller graph for this function:

◆ freerdp_get_logon_error_info_data_ex()

const char* freerdp_get_logon_error_info_data_ex ( UINT32  data,
char *  buffer,
size_t  size 
)
Here is the call graph for this function:

◆ freerdp_get_logon_error_info_type()

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

◆ freerdp_get_logon_error_info_type_ex()

const char* freerdp_get_logon_error_info_type_ex ( UINT32  type,
char *  buffer,
size_t  size 
)
Here is the call graph for this function:

◆ freerdp_get_message_queue()

wMessageQueue* freerdp_get_message_queue ( freerdp *  instance,
DWORD  id 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_message_queue_event_handle()

HANDLE freerdp_get_message_queue_event_handle ( freerdp *  instance,
DWORD  id 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_nla_sspi_error()

UINT32 freerdp_get_nla_sspi_error ( rdpContext *  context)
Here is the call graph for this function:

◆ freerdp_get_state()

CONNECTION_STATE freerdp_get_state ( const rdpContext *  context)

returns the current CONNECTION_STATE of the context.

Parameters
contextA pointer to the context to query state
Returns
A CONNECTION_STATE the context is currently in
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_get_transport_sent()

ULONG freerdp_get_transport_sent ( rdpContext *  context,
BOOL  resetCount 
)
Here is the call graph for this function:

◆ freerdp_get_version()

void freerdp_get_version ( int *  major,
int *  minor,
int *  revision 
)
Here is the caller graph for this function:

◆ freerdp_get_version_string()

const char* freerdp_get_version_string ( void  )
Here is the caller graph for this function:

◆ freerdp_io_callback_set_event()

BOOL freerdp_io_callback_set_event ( rdpContext *  context,
BOOL  set 
)
Here is the call graph for this function:

◆ freerdp_is_active_state()

BOOL freerdp_is_active_state ( const rdpContext *  context)

Queries if the current CONNECTION_STATE of the context is an active connection.

A connection is active, if the connection sequence has been passed, no disconnection requests have been received and no network or other errors have forced a disconnect.

Parameters
contextA pointer to the context to query state
Returns
TRUE if the connection state indicates an active connection, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_is_valid_mcs_create_request()

BOOL freerdp_is_valid_mcs_create_request ( const BYTE data,
size_t  size 
)
Here is the call graph for this function:

◆ freerdp_is_valid_mcs_create_response()

BOOL freerdp_is_valid_mcs_create_response ( const BYTE data,
size_t  size 
)
Here is the call graph for this function:

◆ freerdp_message_queue_process_message()

int freerdp_message_queue_process_message ( freerdp *  instance,
DWORD  id,
wMessage *  message 
)
Here is the call graph for this function:

◆ freerdp_message_queue_process_pending_messages()

int freerdp_message_queue_process_pending_messages ( freerdp *  instance,
DWORD  id 
)
Here is the call graph for this function:

◆ freerdp_nego_get_routing_token()

const char* freerdp_nego_get_routing_token ( rdpContext *  context,
DWORD *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_new()

freerdp* freerdp_new ( void  )

Allocator function for the rdp_freerdp structure.

Returns
an allocated structure filled with 0s. Need to be deallocated using freerdp_free()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_nla_impersonate()

BOOL freerdp_nla_impersonate ( rdpContext *  context)
Here is the call graph for this function:

◆ freerdp_nla_revert_to_self()

BOOL freerdp_nla_revert_to_self ( rdpContext *  context)
Here is the call graph for this function:

◆ freerdp_prevent_session_lock()

static BOOL freerdp_prevent_session_lock ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_reconnect()

BOOL freerdp_reconnect ( freerdp *  instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_send_channel_data()

static BOOL freerdp_send_channel_data ( freerdp *  instance,
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_send_channel_packet()

static BOOL freerdp_send_channel_packet ( freerdp *  instance,
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_send_error_info()

BOOL freerdp_send_error_info ( rdpRdp *  rdp)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_set_error_info()

void freerdp_set_error_info ( rdpRdp *  rdp,
UINT32  error 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_set_focus()

void freerdp_set_focus ( freerdp *  instance)
Here is the caller graph for this function:

◆ freerdp_set_io_callback_context()

BOOL freerdp_set_io_callback_context ( rdpContext *  context,
void *  usercontext 
)
Here is the call graph for this function:

◆ freerdp_set_io_callbacks()

BOOL freerdp_set_io_callbacks ( rdpContext *  context,
const rdpTransportIo *  io_callbacks 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_set_last_error_ex()

void freerdp_set_last_error_ex ( rdpContext *  context,
UINT32  lastError,
const char *  fkt,
const char *  file,
int  line 
)
Here is the call graph for this function:

◆ freerdp_shall_disconnect()

BOOL freerdp_shall_disconnect ( freerdp *  instance)
Here is the call graph for this function:

◆ freerdp_shall_disconnect_context()

BOOL freerdp_shall_disconnect_context ( rdpContext *  context)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_state_string()

const char* freerdp_state_string ( CONNECTION_STATE  state)

returns a string representation of a CONNECTION_STATE

Parameters
statethe CONNECTION_STATE to stringify
Returns
The string representation of the CONNECTION_STATE
Here is the call graph for this function:

◆ getChannelError()

UINT getChannelError ( rdpContext *  context)

Function description

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

◆ getChannelErrorDescription()

const char* getChannelErrorDescription ( rdpContext *  context)

◆ getChannelErrorEventHandle()

HANDLE getChannelErrorEventHandle ( rdpContext *  context)
Here is the caller graph for this function:

◆ setChannelError()

void setChannelError ( rdpContext *  context,
UINT  errorNum,
WINPR_FORMAT_ARG const char *  format,
  ... 
)
Here is the call graph for this function:

◆ sig_abort_connect()

static void sig_abort_connect ( int  signum,
const char *  signame,
void *  ctx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_mcs_free()

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

◆ test_mcs_new()

static rdpMcs* test_mcs_new ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ FreeRDP_Events

wEventType FreeRDP_Events[]
static
Initial value:
= {
DEFINE_EVENT_ENTRY(WindowStateChange), DEFINE_EVENT_ENTRY(ResizeWindow),
DEFINE_EVENT_ENTRY(LocalResizeWindow), DEFINE_EVENT_ENTRY(EmbedWindow),
DEFINE_EVENT_ENTRY(PanningChange), DEFINE_EVENT_ENTRY(ZoomingChange),
DEFINE_EVENT_ENTRY(ErrorInfo), DEFINE_EVENT_ENTRY(Terminate),
DEFINE_EVENT_ENTRY(ConnectionResult), DEFINE_EVENT_ENTRY(ChannelConnected),
DEFINE_EVENT_ENTRY(ChannelDisconnected), DEFINE_EVENT_ENTRY(MouseEvent),
}
#define DEFINE_EVENT_ENTRY(name)
Definition: collections.h:839