| Type | Purpose |
|---|---|
rdpContext | Core context embedded in every session |
rdpClientContext | Extended context for client-side use; embeds rdpContext |
Lifecycle
Fill in entry points
Populate an
RDP_CLIENT_ENTRY_POINTS struct with the sizes and callbacks for your client.Allocate the context
freerdp_client_context_new() allocates the context using the size specified in ep.ContextSize, calls global init, then calls ClientNew.Use the context
Access
context->settings, context->instance, etc. to configure and drive the session.If you are not using the higher-level
freerdp_client_context_new() wrapper, you can allocate a bare freerdp instance with freerdp_new(), set instance->ContextSize, and then call freerdp_context_new() / freerdp_context_free() directly. The client-common wrapper is recommended for new code.rdpContext Fields
The rdpContext struct is defined in include/freerdp/freerdp.h. Its key members are:
Back-pointer to the owning
freerdp (rdp_freerdp) instance. Set by freerdp_context_new(). Use this to reach instance-level callbacks from context callbacks.Pointer to the RDP settings for this session. Owned by the internal
rdpRdp object; do not free separately. Use the freerdp_settings_* accessor functions to read and write values.Virtual channel manager. Used internally to route channel data; clients typically interact with it through channel plug-in callbacks.
Input interface. Send keyboard, mouse, and touch events to the remote server through this. Owned by
rdpRdp.Update/display interface. Register
BeginPaint, EndPaint, DesktopResize callbacks here in PostConnect.GDI (graphics device interface) state. Allocated by
gdi_init() during PostConnect; freed by gdi_free() during PostDisconnect.Bitmap/glyph/pointer cache. Managed internally.
Graphics registration (bitmap/pointer/glyph codecs). Managed internally.
Publish/subscribe bus. Use
PubSub_SubscribeChannelConnected and PubSub_SubscribeChannelDisconnected here in PreConnect to react to dynamic channel events.WLog logger associated with this context.
Last error code recorded on this context. Use
freerdp_get_last_error() to read it.rdpClientContext Fields
rdpClientContext (defined in include/freerdp/client.h) embeds rdpContext as its first member and adds client-specific fields:
Must be the first field. The embedded base context. Cast between
rdpContext* and rdpClientContext* freely.Handle to the client thread created by
freerdp_client_start().Last known mouse cursor position (client coordinates).
Whether the local mouse is currently captured/grabbed by the RDP window.
Active touch contacts (up to
FREERDP_MAX_TOUCH_CONTACTS = 10). Updated by freerdp_client_handle_touch().Active pen devices (up to
FREERDP_MAX_PEN_DEVICES = 10). Updated by freerdp_client_handle_pen().Context Extension Pattern
The idiomatic FreeRDP pattern for carrying application-specific data is to embedrdpClientContext as the first member of your own struct, then tell FreeRDP about the larger size via ep.ContextSize.
ClientNew / ClientFree Callbacks
These callbacks are set on RDP_CLIENT_ENTRY_POINTS and called by FreeRDP during context allocation and deallocation:
