cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

freerdp.h (26081B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * FreeRDP Interface
      4 *
      5 * Copyright 2009-2011 Jay Sorg
      6 * Copyright 2015 Thincast Technologies GmbH
      7 * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
      8 *
      9 * Licensed under the Apache License, Version 2.0 (the "License");
     10 * you may not use this file except in compliance with the License.
     11 * You may obtain a copy of the License at
     12 *
     13 *     http://www.apache.org/licenses/LICENSE-2.0
     14 *
     15 * Unless required by applicable law or agreed to in writing, software
     16 * distributed under the License is distributed on an "AS IS" BASIS,
     17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18 * See the License for the specific language governing permissions and
     19 * limitations under the License.
     20 */
     21
     22#ifndef FREERDP_H
     23#define FREERDP_H
     24
     25typedef struct rdp_rdp rdpRdp;
     26typedef struct rdp_gdi rdpGdi;
     27typedef struct rdp_rail rdpRail;
     28typedef struct rdp_cache rdpCache;
     29typedef struct rdp_channels rdpChannels;
     30typedef struct rdp_graphics rdpGraphics;
     31typedef struct rdp_metrics rdpMetrics;
     32typedef struct rdp_codecs rdpCodecs;
     33
     34typedef struct rdp_freerdp freerdp;
     35typedef struct rdp_context rdpContext;
     36typedef struct rdp_freerdp_peer freerdp_peer;
     37
     38typedef struct rdp_client_context rdpClientContext;
     39typedef struct rdp_client_entry_points_v1 RDP_CLIENT_ENTRY_POINTS_V1;
     40typedef RDP_CLIENT_ENTRY_POINTS_V1 RDP_CLIENT_ENTRY_POINTS;
     41
     42#include <freerdp/api.h>
     43#include <freerdp/types.h>
     44#include <freerdp/error.h>
     45#include <freerdp/event.h>
     46#include <freerdp/codecs.h>
     47#include <freerdp/metrics.h>
     48#include <freerdp/settings.h>
     49#include <freerdp/extension.h>
     50
     51#include <winpr/stream.h>
     52
     53#include <freerdp/input.h>
     54#include <freerdp/update.h>
     55#include <freerdp/message.h>
     56#include <freerdp/autodetect.h>
     57#include <freerdp/heartbeat.h>
     58
     59#ifdef __cplusplus
     60extern "C"
     61{
     62#endif
     63
     64/* Flags used by certificate callbacks */
     65#define VERIFY_CERT_FLAG_NONE 0x00
     66#define VERIFY_CERT_FLAG_LEGACY 0x02
     67#define VERIFY_CERT_FLAG_REDIRECT 0x10
     68#define VERIFY_CERT_FLAG_GATEWAY 0x20
     69#define VERIFY_CERT_FLAG_CHANGED 0x40
     70#define VERIFY_CERT_FLAG_MISMATCH 0x80
     71#define VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 0x100
     72
     73	typedef enum
     74	{
     75		CONNECTION_STATE_INITIAL,
     76		CONNECTION_STATE_NEGO,
     77		CONNECTION_STATE_NLA,
     78		CONNECTION_STATE_MCS_CONNECT,
     79		CONNECTION_STATE_MCS_ERECT_DOMAIN,
     80		CONNECTION_STATE_MCS_ATTACH_USER,
     81		CONNECTION_STATE_MCS_CHANNEL_JOIN,
     82		CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT,
     83		CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE,
     84		CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT,
     85		CONNECTION_STATE_LICENSING,
     86		CONNECTION_STATE_MULTITRANSPORT_BOOTSTRAPPING,
     87		CONNECTION_STATE_CAPABILITIES_EXCHANGE,
     88		CONNECTION_STATE_FINALIZATION,
     89		CONNECTION_STATE_ACTIVE
     90	} CONNECTION_STATE;
     91
     92/* Message types used by gateway messaging callback */
     93#define GATEWAY_MESSAGE_CONSENT 1
     94#define GATEWAY_MESSAGE_SERVICE 2
     95
     96	typedef BOOL (*pContextNew)(freerdp* instance, rdpContext* context);
     97	typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
     98
     99	typedef BOOL (*pPreConnect)(freerdp* instance);
    100	typedef BOOL (*pPostConnect)(freerdp* instance);
    101	typedef void (*pPostDisconnect)(freerdp* instance);
    102	typedef BOOL (*pAuthenticate)(freerdp* instance, char** username, char** password,
    103	                              char** domain);
    104
    105#if !defined(DEFINE_NO_DEPRECATED)
    106	/** @brief Callback used if user interaction is required to accept
    107	 *         an unknown certificate.
    108	 *
    109	 *  @deprecated Use pVerifyCertificateEx
    110	 *  @param common_name      The certificate registered hostname.
    111	 *  @param subject          The common name of the certificate.
    112	 *  @param issuer           The issuer of the certificate.
    113	 *  @param fingerprint      The fingerprint of the certificate.
    114	 *  @param host_mismatch    A flag indicating the certificate
    115	 *                          subject does not match the host connecting to.
    116	 *
    117	 *  @return 1 to accept and store a certificate, 2 to accept
    118	 *          a certificate only for this session, 0 otherwise.
    119	 */
    120	typedef DWORD (*pVerifyCertificate)(freerdp* instance, const char* common_name,
    121	                                    const char* subject, const char* issuer,
    122	                                    const char* fingerprint, BOOL host_mismatch);
    123#endif
    124	/** @brief Callback used if user interaction is required to accept
    125	 *         an unknown certificate.
    126	 *
    127	 *  @param host             The hostname connecting to.
    128	 *  @param port             The port connecting to.
    129	 *  @param common_name      The certificate registered hostname.
    130	 *  @param subject          The common name of the certificate.
    131	 *  @param issuer           The issuer of the certificate.
    132	 *  @param fingerprint      The fingerprint of the certificate.
    133	 *  @param flags            Flags of type VERIFY_CERT_FLAG*
    134	 *
    135	 *  @return 1 to accept and store a certificate, 2 to accept
    136	 *          a certificate only for this session, 0 otherwise.
    137	 */
    138	typedef DWORD (*pVerifyCertificateEx)(freerdp* instance, const char* host, UINT16 port,
    139	                                      const char* common_name, const char* subject,
    140	                                      const char* issuer, const char* fingerprint, DWORD flags);
    141
    142#if !defined(DEFINE_NO_DEPRECATED)
    143	/** @brief Callback used if user interaction is required to accept
    144	 *         a changed certificate.
    145	 *
    146	 *  @deprecated Use pVerifyChangedCertificateEx
    147	 *  @param common_name      The certificate registered hostname.
    148	 *  @param subject          The common name of the new certificate.
    149	 *  @param issuer           The issuer of the new certificate.
    150	 *  @param fingerprint      The fingerprint of the new certificate.
    151	 *  @param old_subject      The common name of the old certificate.
    152	 *  @param old_issuer       The issuer of the new certificate.
    153	 *  @param old_fingerprint  The fingerprint of the old certificate.
    154	 *
    155	 *  @return 1 to accept and store a certificate, 2 to accept
    156	 *          a certificate only for this session, 0 otherwise.
    157	 */
    158
    159	typedef DWORD (*pVerifyChangedCertificate)(freerdp* instance, const char* common_name,
    160	                                           const char* subject, const char* issuer,
    161	                                           const char* new_fingerprint, const char* old_subject,
    162	                                           const char* old_issuer, const char* old_fingerprint);
    163#endif
    164
    165	/** @brief Callback used if user interaction is required to accept
    166	 *         a changed certificate.
    167	 *
    168	 *  @param host             The hostname connecting to.
    169	 *  @param port             The port connecting to.
    170	 *  @param common_name      The certificate registered hostname.
    171	 *  @param subject          The common name of the new certificate.
    172	 *  @param issuer           The issuer of the new certificate.
    173	 *  @param fingerprint      The fingerprint of the new certificate.
    174	 *  @param old_subject      The common name of the old certificate.
    175	 *  @param old_issuer       The issuer of the new certificate.
    176	 *  @param old_fingerprint  The fingerprint of the old certificate.
    177	 *  @param flags            Flags of type VERIFY_CERT_FLAG*
    178	 *
    179	 *  @return 1 to accept and store a certificate, 2 to accept
    180	 *          a certificate only for this session, 0 otherwise.
    181	 */
    182
    183	typedef DWORD (*pVerifyChangedCertificateEx)(freerdp* instance, const char* host, UINT16 port,
    184	                                             const char* common_name, const char* subject,
    185	                                             const char* issuer, const char* new_fingerprint,
    186	                                             const char* old_subject, const char* old_issuer,
    187	                                             const char* old_fingerprint, DWORD flags);
    188
    189	/** @brief Callback used if user interaction is required to accept
    190	 *         a certificate.
    191	 *
    192	 *  @param instance         Pointer to the freerdp instance.
    193	 *  @param data             Pointer to certificate data in PEM format.
    194	 *  @param length           The length of the certificate data.
    195	 *  @param hostname         The hostname connecting to.
    196	 *  @param port             The port connecting to.
    197	 *  @param flags            Flags of type VERIFY_CERT_FLAG*
    198	 *
    199	 *  @return 1 to accept and store a certificate, 2 to accept
    200	 *          a certificate only for this session, 0 otherwise.
    201	 */
    202	typedef int (*pVerifyX509Certificate)(freerdp* instance, const BYTE* data, size_t length,
    203	                                      const char* hostname, UINT16 port, DWORD flags);
    204
    205	typedef int (*pLogonErrorInfo)(freerdp* instance, UINT32 data, UINT32 type);
    206
    207	typedef BOOL (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
    208	                                 size_t size);
    209	typedef BOOL (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
    210	                                    size_t size, UINT32 flags, size_t totalSize);
    211
    212	/* type can be one of the GATEWAY_MESSAGE_ type defines */
    213	typedef BOOL (*pPresentGatewayMessage)(freerdp* instance, UINT32 type, BOOL isDisplayMandatory,
    214	                                       BOOL isConsentMandatory, size_t length,
    215	                                       const WCHAR* message);
    216
    217	/**
    218	 * Defines the context for a given instance of RDP connection.
    219	 * It is embedded in the rdp_freerdp structure, and allocated by a call to
    220	 * freerdp_context_new(). It is deallocated by a call to freerdp_context_free().
    221	 */
    222	struct rdp_context
    223	{
    224		ALIGN64 freerdp* instance;  /**< (offset 0)
    225		                       Pointer to a rdp_freerdp structure.
    226		                       This is a back-link to retrieve the freerdp instance from the context.
    227		                       It is set by the freerdp_context_new() function */
    228		ALIGN64 freerdp_peer* peer; /**< (offset 1)
    229		                       Pointer to the client peer.
    230		                       This is set by a call to freerdp_peer_context_new() during peer
    231		                       initialization. This field is used only on the server side. */
    232		ALIGN64 BOOL ServerMode;    /**< (offset 2) true when context is in server mode */
    233
    234		ALIGN64 UINT32 LastError; /* 3 */
    235
    236		UINT64 paddingA[16 - 4]; /* 4 */
    237
    238		ALIGN64 int argc;    /**< (offset 16)
    239		                Number of arguments given to the program at launch time.
    240		                Used to keep this data available and used later on, typically just before
    241		                connection initialization.
    242		                @see freerdp_parse_args() */
    243		ALIGN64 char** argv; /**< (offset 17)
    244		                List of arguments given to the program at launch time.
    245		                Used to keep this data available and used later on, typically just before
    246		                connection initialization.
    247		                @see freerdp_parse_args() */
    248
    249		ALIGN64 wPubSub* pubSub; /* (offset 18) */
    250
    251		ALIGN64 HANDLE channelErrorEvent; /* (offset 19)*/
    252		ALIGN64 UINT channelErrorNum;     /*(offset 20)*/
    253		ALIGN64 char* errorDescription;   /*(offset 21)*/
    254
    255		UINT64 paddingB[32 - 22]; /* 22 */
    256
    257		ALIGN64 rdpRdp*
    258		    rdp;                           /**< (offset 32)
    259		                              Pointer to a rdp_rdp structure used to keep the connection's parameters.
    260		                              It is allocated by freerdp_context_new() and deallocated by
    261		                              freerdp_context_free(), at the same		       time that this rdp_context
    262		                              structure -		       there is no need to specifically allocate/deallocate this. */
    263		ALIGN64 rdpGdi* gdi;               /**< (offset 33)
    264		                              Pointer to a rdp_gdi structure used to keep the gdi settings.
    265		                              It is allocated by gdi_init() and deallocated by gdi_free().
    266		                              It must be deallocated before deallocating this rdp_context structure. */
    267		ALIGN64 rdpRail* rail;             /* 34 */
    268		ALIGN64 rdpCache* cache;           /* 35 */
    269		ALIGN64 rdpChannels* channels;     /* 36 */
    270		ALIGN64 rdpGraphics* graphics;     /* 37 */
    271		ALIGN64 rdpInput* input;           /* 38 */
    272		ALIGN64 rdpUpdate* update;         /* 39 */
    273		ALIGN64 rdpSettings* settings;     /* 40 */
    274		ALIGN64 rdpMetrics* metrics;       /* 41 */
    275		ALIGN64 rdpCodecs* codecs;         /* 42 */
    276		ALIGN64 rdpAutoDetect* autodetect; /* 43 */
    277		ALIGN64 HANDLE abortEvent;         /* 44 */
    278		ALIGN64 int disconnectUltimatum;   /* 45 */
    279		UINT64 paddingC[64 - 46];          /* 46 */
    280
    281		UINT64 paddingD[96 - 64];  /* 64 */
    282		UINT64 paddingE[128 - 96]; /* 96 */
    283	};
    284
    285	/**
    286	 *  Defines the possible disconnect reasons in the MCS Disconnect Provider
    287	 *  Ultimatum PDU
    288	 */
    289
    290	enum Disconnect_Ultimatum
    291	{
    292		Disconnect_Ultimatum_domain_disconnected = 0,
    293		Disconnect_Ultimatum_provider_initiated = 1,
    294		Disconnect_Ultimatum_token_purged = 2,
    295		Disconnect_Ultimatum_user_requested = 3,
    296		Disconnect_Ultimatum_channel_purged = 4
    297	};
    298
    299#include <freerdp/client.h>
    300
    301	/** Defines the options for a given instance of RDP connection.
    302	 *  This is built by the client and given to the FreeRDP library to create the connection
    303	 *  with the expected options.
    304	 *  It is allocated by a call to freerdp_new() and deallocated by a call to freerdp_free().
    305	 *  Some of its content need specific allocation/deallocation - see field description for
    306	 * details.
    307	 */
    308	struct rdp_freerdp
    309	{
    310		ALIGN64
    311		rdpContext* context; /**< (offset 0)
    312		                  Pointer to a rdpContext structure.
    313		                  Client applications can use the ContextSize field to register a
    314		                  context bigger than the rdpContext structure. This allow clients to
    315		                  use additional context information. When using this capability, client
    316		                  application should ALWAYS declare their structure with the rdpContext
    317		                  field first, and any additional content following it. Can be allocated
    318		                  by a call to freerdp_context_new(). Must be deallocated by a call to
    319		                  freerdp_context_free() before deallocating the current instance. */
    320
    321		ALIGN64 RDP_CLIENT_ENTRY_POINTS* pClientEntryPoints;
    322
    323		UINT64 paddingA[16 - 2]; /* 2 */
    324
    325		ALIGN64 rdpInput* input; /* (offset 16)
    326		                    Input handle for the connection.
    327		                    Will be initialized by a call to freerdp_context_new() */
    328		ALIGN64 rdpUpdate*
    329		    update;                        /* (offset 17)
    330		                              Update display parameters. Used to register display events callbacks and settings.
    331		                              Will be initialized by a call to freerdp_context_new() */
    332		ALIGN64 rdpSettings* settings;     /**< (offset 18)
    333		                                Pointer to a rdpSettings structure. Will be used to maintain the
    334		                                required RDP	 settings.		              Will be
    335		                                initialized by	 a call to freerdp_context_new()
    336		                              */
    337		ALIGN64 rdpAutoDetect* autodetect; /* (offset 19)
    338		                                Auto-Detect handle for the connection.
    339		                                Will be initialized by a call to freerdp_context_new() */
    340		ALIGN64 rdpHeartbeat* heartbeat;   /* (offset 21) */
    341
    342		UINT64 paddingB[32 - 21]; /* 21 */
    343
    344		ALIGN64 size_t
    345		    ContextSize; /* (offset 32)
    346		             Specifies the size of the 'context' field. freerdp_context_new() will use this
    347		             size to allocate the context buffer. freerdp_new() sets it to
    348		             sizeof(rdpContext). If modifying it, there should always be a minimum of
    349		             sizeof(rdpContext), as the freerdp library will assume it can use the 'context'
    350		             field to set the required informations in it. Clients will typically make it
    351		             bigger, and use a context structure embedding the rdpContext, and adding
    352		             additional information after that.
    353		          */
    354
    355		ALIGN64 pContextNew
    356		    ContextNew; /**< (offset 33)
    357		             Callback for context allocation
    358		             Can be set before calling freerdp_context_new() to have it executed after
    359		             allocation and initialization. Must be set to NULL if not needed. */
    360
    361		ALIGN64 pContextFree
    362		    ContextFree;          /**< (offset 34)
    363		                       Callback for context deallocation
    364		                       Can be set before calling freerdp_context_free() to have it executed before
    365		                       deallocation.		  Must be set to NULL if not needed. */
    366		UINT64 paddingC[47 - 35]; /* 35 */
    367
    368		ALIGN64 UINT ConnectionCallbackState; /* 47 */
    369
    370		ALIGN64 pPreConnect
    371		    PreConnect; /**< (offset 48)
    372		             Callback for pre-connect operations.
    373		             Can be set before calling freerdp_connect() to have it executed before the
    374		             actual connection happens. Must be set to NULL if not needed. */
    375
    376		ALIGN64 pPostConnect
    377		    PostConnect; /**< (offset 49)
    378		              Callback for post-connect operations.
    379		              Can be set before calling freerdp_connect() to have it executed after the
    380		              actual connection has succeeded. Must be set to NULL if not needed. */
    381
    382		ALIGN64 pAuthenticate Authenticate;                         /**< (offset 50)
    383		                                                         Callback for authentication.
    384		                                                         It is used to get the username/password when it was not
    385		                                                         provided at connection time. */
    386#if !defined(DEFINE_NO_DEPRECATED)
    387		WINPR_DEPRECATED(ALIGN64 pVerifyCertificate VerifyCertificate); /**< (offset 51)
    388		                                           Callback for certificate validation.
    389		                                           Used to verify that an unknown certificate is
    390	 trusted. DEPRECATED: Use VerifyChangedCertificateEx*/
    391		WINPR_DEPRECATED(
    392		    ALIGN64 pVerifyChangedCertificate VerifyChangedCertificate); /**< (offset 52)
    393		                                            Callback for changed certificate
    394		         validation. Used when a certificate differs from stored fingerprint.
    395		         DEPRECATED: Use VerifyChangedCertificateEx */
    396#endif
    397
    398		ALIGN64 pVerifyX509Certificate
    399		    VerifyX509Certificate; /**< (offset 53)  Callback for X509 certificate verification (PEM
    400		                              format) */
    401
    402		ALIGN64 pLogonErrorInfo
    403		    LogonErrorInfo; /**< (offset 54)  Callback for logon error info, important for logon
    404		                       system messages with RemoteApp */
    405
    406		ALIGN64 pPostDisconnect
    407		    PostDisconnect; /**< (offset 55)
    408		                                                                Callback for cleaning up
    409		                       resources allocated by connect callbacks. */
    410
    411		ALIGN64 pAuthenticate GatewayAuthenticate; /**< (offset 56)
    412		                                 Callback for gateway authentication.
    413		                                 It is used to get the username/password when it was not
    414		                                 provided at connection time. */
    415
    416		ALIGN64 pPresentGatewayMessage PresentGatewayMessage; /**< (offset 57)
    417		                                  Callback for gateway consent messages.
    418		                                  It is used to present consent messages to the user. */
    419
    420		UINT64 paddingD[64 - 58]; /* 58 */
    421
    422		ALIGN64 pSendChannelData
    423		    SendChannelData; /* (offset 64)
    424		                Callback for sending data to a channel.
    425		                By default, it is set by freerdp_new() to freerdp_send_channel_data(), which
    426		                eventually calls freerdp_channel_send() */
    427		ALIGN64 pReceiveChannelData
    428		    ReceiveChannelData; /* (offset 65)
    429		                   Callback for receiving data from a channel.
    430		                   This is called by freerdp_channel_process() (if not NULL).
    431		                   Clients will typically use a function that calls freerdp_channels_data()
    432		                   to perform the needed tasks. */
    433
    434		ALIGN64 pVerifyCertificateEx
    435		    VerifyCertificateEx; /**< (offset 66)
    436		                  Callback for certificate validation.
    437		                  Used to verify that an unknown certificate is trusted. */
    438		ALIGN64 pVerifyChangedCertificateEx
    439		    VerifyChangedCertificateEx; /**< (offset 67)
    440		                         Callback for changed certificate validation.
    441		                         Used when a certificate differs from stored fingerprint. */
    442		UINT64 paddingE[80 - 68];       /* 68 */
    443	};
    444
    445	struct rdp_channel_handles
    446	{
    447		wListDictionary* init;
    448		wListDictionary* open;
    449	};
    450	typedef struct rdp_channel_handles rdpChannelHandles;
    451
    452	FREERDP_API BOOL freerdp_context_new(freerdp* instance);
    453	FREERDP_API void freerdp_context_free(freerdp* instance);
    454
    455	FREERDP_API BOOL freerdp_connect(freerdp* instance);
    456	FREERDP_API BOOL freerdp_abort_connect(freerdp* instance);
    457	FREERDP_API BOOL freerdp_shall_disconnect(freerdp* instance);
    458	FREERDP_API BOOL freerdp_disconnect(freerdp* instance);
    459
    460	FREERDP_API BOOL freerdp_disconnect_before_reconnect(freerdp* instance);
    461	FREERDP_API BOOL freerdp_reconnect(freerdp* instance);
    462
    463	FREERDP_API UINT freerdp_channel_add_init_handle_data(rdpChannelHandles* handles,
    464	                                                      void* pInitHandle, void* pUserData);
    465	FREERDP_API void* freerdp_channel_get_init_handle_data(rdpChannelHandles* handles,
    466	                                                       void* pInitHandle);
    467	FREERDP_API void freerdp_channel_remove_init_handle_data(rdpChannelHandles* handles,
    468	                                                         void* pInitHandle);
    469
    470	FREERDP_API UINT freerdp_channel_add_open_handle_data(rdpChannelHandles* handles,
    471	                                                      DWORD openHandle, void* pUserData);
    472	FREERDP_API void* freerdp_channel_get_open_handle_data(rdpChannelHandles* handles,
    473	                                                       DWORD openHandle);
    474	FREERDP_API void freerdp_channel_remove_open_handle_data(rdpChannelHandles* handles,
    475	                                                         DWORD openHandle);
    476
    477	FREERDP_API UINT freerdp_channels_attach(freerdp* instance);
    478	FREERDP_API UINT freerdp_channels_detach(freerdp* instance);
    479
    480	FREERDP_API BOOL freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds,
    481	                                 int* wcount);
    482	FREERDP_API BOOL freerdp_check_fds(freerdp* instance);
    483
    484	FREERDP_API DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count);
    485	FREERDP_API BOOL freerdp_check_event_handles(rdpContext* context);
    486
    487	FREERDP_API wMessageQueue* freerdp_get_message_queue(freerdp* instance, DWORD id);
    488	FREERDP_API HANDLE freerdp_get_message_queue_event_handle(freerdp* instance, DWORD id);
    489	FREERDP_API int freerdp_message_queue_process_message(freerdp* instance, DWORD id,
    490	                                                      wMessage* message);
    491	FREERDP_API int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id);
    492
    493	FREERDP_API UINT32 freerdp_error_info(freerdp* instance);
    494	FREERDP_API void freerdp_set_error_info(rdpRdp* rdp, UINT32 error);
    495	FREERDP_API BOOL freerdp_send_error_info(rdpRdp* rdp);
    496	FREERDP_API BOOL freerdp_get_stats(rdpRdp* rdp, UINT64* inBytes, UINT64* outBytes,
    497	                                   UINT64* inPackets, UINT64* outPackets);
    498
    499	FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
    500	FREERDP_API const char* freerdp_get_version_string(void);
    501	FREERDP_API const char* freerdp_get_build_date(void);
    502	FREERDP_API const char* freerdp_get_build_revision(void);
    503	FREERDP_API const char* freerdp_get_build_config(void);
    504
    505	FREERDP_API freerdp* freerdp_new(void);
    506	FREERDP_API void freerdp_free(freerdp* instance);
    507
    508	FREERDP_API BOOL freerdp_focus_required(freerdp* instance);
    509	FREERDP_API void freerdp_set_focus(freerdp* instance);
    510
    511	FREERDP_API int freerdp_get_disconnect_ultimatum(rdpContext* context);
    512
    513	FREERDP_API UINT32 freerdp_get_last_error(rdpContext* context);
    514	FREERDP_API const char* freerdp_get_last_error_name(UINT32 error);
    515	FREERDP_API const char* freerdp_get_last_error_string(UINT32 error);
    516	FREERDP_API const char* freerdp_get_last_error_category(UINT32 error);
    517
    518	FREERDP_API void freerdp_set_last_error(rdpContext* context, UINT32 lastError);
    519
    520#define freerdp_set_last_error_if_not(context, lastError)             \
    521	do                                                                \
    522	{                                                                 \
    523		if (freerdp_get_last_error(context) == FREERDP_ERROR_SUCCESS) \
    524			freerdp_set_last_error_log(context, lastError);           \
    525	} while (0)
    526
    527#define freerdp_set_last_error_log(context, lastError) \
    528	freerdp_set_last_error_ex((context), (lastError), __FUNCTION__, __FILE__, __LINE__)
    529	FREERDP_API void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError,
    530	                                           const char* fkt, const char* file, int line);
    531
    532	FREERDP_API const char* freerdp_get_logon_error_info_type(UINT32 type);
    533	FREERDP_API const char* freerdp_get_logon_error_info_data(UINT32 data);
    534
    535	FREERDP_API ULONG freerdp_get_transport_sent(rdpContext* context, BOOL resetCount);
    536
    537	FREERDP_API BOOL freerdp_nla_impersonate(rdpContext* context);
    538	FREERDP_API BOOL freerdp_nla_revert_to_self(rdpContext* context);
    539
    540	FREERDP_API void clearChannelError(rdpContext* context);
    541	FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context);
    542	FREERDP_API UINT getChannelError(rdpContext* context);
    543	FREERDP_API const char* getChannelErrorDescription(rdpContext* context);
    544	FREERDP_API void setChannelError(rdpContext* context, UINT errorNum, char* description);
    545	FREERDP_API BOOL checkChannelErrorEvent(rdpContext* context);
    546
    547	FREERDP_API const char* freerdp_nego_get_routing_token(rdpContext* context, DWORD* length);
    548
    549	FREERDP_API CONNECTION_STATE freerdp_get_state(rdpContext* context);
    550	FREERDP_API const char* freerdp_state_string(CONNECTION_STATE state);
    551
    552#ifdef __cplusplus
    553}
    554#endif
    555
    556#endif /* FREERDP_H */