FreeRDP
pf_client.c File Reference
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/utils/signal.h>
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h>
#include <freerdp/log.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include "pf_channels.h"
#include "pf_gdi.h"
#include "pf_graphics.h"
#include "pf_common.h"
#include "pf_client.h"
#include "pf_context.h"
#include "pf_update.h"
#include "pf_log.h"

Macros

#define TAG   PROXY_TAG("client")
 

Functions

static void proxy_server_reactivate (rdpContext *ps, const rdpContext *target)
 
static void pf_OnErrorInfo (void *ctx, ErrorInfoEventArgs *e)
 
static BOOL pf_client_pre_connect (freerdp *instance)
 
static BOOL pf_client_post_connect (freerdp *instance)
 
static void pf_client_post_disconnect (freerdp *instance)
 
static DWORD WINAPI pf_client_thread_proc (LPVOID arg)
 
static BOOL pf_client_global_init (void)
 
static int pf_logon_error_info (freerdp *instance, UINT32 data, UINT32 type)
 
static DWORD pf_client_verify_certificate_ex (freerdp *instance, const char *host, UINT16 port, const char *common_name, const char *subject, const char *issuer, const char *fingerprint, DWORD flags)
 
static DWORD pf_client_verify_changed_certificate_ex (freerdp *instance, const char *host, UINT16 port, const char *common_name, const char *subject, const char *issuer, const char *fingerprint, const char *old_subject, const char *old_issuer, const char *old_fingerprint, DWORD flags)
 
static BOOL pf_client_client_new (freerdp *instance, rdpContext *context)
 
static int pf_client_client_stop (rdpContext *context)
 
int RdpClientEntry (RDP_CLIENT_ENTRY_POINTS *pEntryPoints)
 
DWORD WINAPI pf_client_start (LPVOID arg)
 

Macro Definition Documentation

#define TAG   PROXY_TAG("client")

FreeRDP: A Remote Desktop Protocol Implementation FreeRDP Proxy Server

Copyright 2019 Mati Shabtay matis.nosp@m.habt.nosp@m.ay@gm.nosp@m.ail..nosp@m.com Copyright 2019 Kobi Mizrachi kmizr.nosp@m.achi.nosp@m.18@gm.nosp@m.ail..nosp@m.com Copyright 2019 Idan Freiberg speid.nosp@m.y@gm.nosp@m.ail.c.nosp@m.om

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

static BOOL pf_client_client_new ( freerdp *  instance,
rdpContext *  context 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int pf_client_client_stop ( rdpContext *  context)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL pf_client_global_init ( void  )
static

Optional global initializer. Here we just register a signal handler to print out stack traces if available.

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL pf_client_post_connect ( freerdp *  instance)
static

Called after a RDP connection was successfully established. Settings might have changed during negotiation of client / server feature support.

Set up local framebuffers and painting callbacks. If required, register pointer callbacks to change the local mouse cursor when hovering over the RDP window

Here is the call graph for this function:

Here is the caller graph for this function:

static void pf_client_post_disconnect ( freerdp *  instance)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL pf_client_pre_connect ( freerdp *  instance)
static

Called before a connection is established.

TODO: Take client to proxy settings and use channel whitelist to filter out unwanted channels.

settings->OrderSupport is initialized at this point. Only override it if you plan to implement custom order callbacks or deactiveate certain features.

Register the channel listeners. They are required to set up / tear down channels if they are loaded.

Load all required plugins / channels / libraries specified by current settings.

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI pf_client_start ( LPVOID  arg)

Starts running a client connection towards target server.

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD WINAPI pf_client_thread_proc ( LPVOID  arg)
static

RDP main loop. Connects RDP, loops while running and handles event and dispatch, cleans up after the connection ends.

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD pf_client_verify_certificate_ex ( freerdp *  instance,
const char *  host,
UINT16  port,
const char *  common_name,
const char *  subject,
const char *  issuer,
const char *  fingerprint,
DWORD  flags 
)
static

Callback set in the rdp_freerdp structure, and used to make a certificate validation when the connection requires it. This function will actually be called by tls_verify_certificate().

See also
rdp_client_connect() and tls_connect()
Parameters
instancepointer to the rdp_freerdp structure that contains the connection settings
hostThe host currently connecting to
portThe port currently connecting to
common_nameThe common name of the certificate, should match host or an alias of it
subjectThe subject of the certificate
issuerThe certificate issuer name
fingerprintThe fingerprint of the certificate
flagsSee VERIFY_CERT_FLAG_* for possible values.
Returns
1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise.

Here is the caller graph for this function:

static DWORD pf_client_verify_changed_certificate_ex ( freerdp *  instance,
const char *  host,
UINT16  port,
const char *  common_name,
const char *  subject,
const char *  issuer,
const char *  fingerprint,
const char *  old_subject,
const char *  old_issuer,
const char *  old_fingerprint,
DWORD  flags 
)
static

Callback set in the rdp_freerdp structure, and used to make a certificate validation when a stored certificate does not match the remote counterpart. This function will actually be called by tls_verify_certificate().

See also
rdp_client_connect() and tls_connect()
Parameters
instancepointer to the rdp_freerdp structure that contains the connection settings
hostThe host currently connecting to
portThe port currently connecting to
common_nameThe common name of the certificate, should match host or an alias of it
subjectThe subject of the certificate
issuerThe certificate issuer name
fingerprintThe fingerprint of the certificate
old_subjectThe subject of the previous certificate
old_issuerThe previous certificate issuer name
old_fingerprintThe fingerprint of the previous certificate
flagsSee VERIFY_CERT_FLAG_* for possible values.
Returns
1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise.

Here is the caller graph for this function:

static int pf_logon_error_info ( freerdp *  instance,
UINT32  data,
UINT32  type 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void pf_OnErrorInfo ( void ctx,
ErrorInfoEventArgs *  e 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void proxy_server_reactivate ( rdpContext *  ps,
const rdpContext *  target 
)
static

Re-negotiate with original client after negotiation between the proxy and the target has finished.

Here is the call graph for this function:

Here is the caller graph for this function:

int RdpClientEntry ( RDP_CLIENT_ENTRY_POINTS pEntryPoints)

Client Interface

Here is the call graph for this function: