cliprdr (CLIPRDR_CHANNEL_NAME)
Client header: <freerdp/client/cliprdr.h>Server header:
<freerdp/server/cliprdr.h>Protocol types:
<freerdp/channels/cliprdr.h>
Client Context
CliprdrClientContext
typedef struct s_cliprdr_client_context CliprdrClientContext
The client-side clipboard context. Obtain it via the dynamic virtual channel manager after the CLIPRDR channel is loaded. Function-pointer fields are split into:
- Server → Client callbacks (prefixed
Server*): set by the channel implementation; called when the server sends a message. - Client → Server calls (prefixed
Client*): set by the channel implementation; called by your application to send a message to the server.
Key fields
void*
Application-defined context pointer. Store your private state here.
rdpContext*
The owning RDP context.
UINT32
Format ID from the most recent
FormatDataRequest. Useful in ServerFormatDataRequest to know what to provide.Inbound callbacks (server → client)
pcCliprdrServerCapabilities
generalFlags (e.g. CB_USE_LONG_FORMAT_NAMES, CB_STREAM_FILECLIP_ENABLED) to determine feature support.pcCliprdrMonitorReady
ClientCapabilities then ClientFormatList.pcCliprdrServerFormatList
formatList->formats[i] (each has formatId and optional formatName) to decide which formats you can handle.pcCliprdrServerFormatDataRequest
ClientFormatDataResponse with the data.pcCliprdrServerFormatDataResponse
ClientFormatDataRequest.Outbound calls (client → server)
pcCliprdrClientCapabilities
MonitorReady.pcCliprdrClientFormatList
pcCliprdrClientFormatDataRequest
ServerFormatDataResponse.pcCliprdrClientFormatDataResponse
ServerFormatDataRequest.Server Context
CliprdrServerContext
typedef struct s_cliprdr_server_context CliprdrServerContext
The server-side context. Created with cliprdr_server_context_new() and destroyed with cliprdr_server_context_free().
vcm is the virtual channel manager handle from the WTS API (e.g. WTSVirtualChannelManagerNew).
Server capability flags
BOOL
Set to
TRUE to negotiate long format names (CB_USE_LONG_FORMAT_NAMES).BOOL
Enable file clipboard streaming (
CB_STREAM_FILECLIP_ENABLED).BOOL
Advertise support for clipboard data locking (
CB_CAN_LOCK_CLIPDATA).BOOL
When
TRUE, the implementation automatically sends ServerCapabilities and MonitorReady on channel open.Channel control
psCliprdrOpen
Opens the SVC. Must be called before
Start.psCliprdrStart
Starts the server clipboard worker thread.
psCliprdrStop
Stops the worker thread.
psCliprdrGetEventHandle
Returns a waitable event handle for the server clipboard channel.
psCliprdrCheckEventHandle
Processes pending clipboard PDUs — call when the event handle is signalled.
Protocol Data Types
Clipboard Capability Flags
Typical Client-Side Flow
1
Channel activation
The CLIPRDR channel is loaded via
freerdp_channels_load_plugin(). The framework invokes MonitorReady when the server is ready.2
Send capabilities
In your
MonitorReady handler, build a CLIPRDR_CAPABILITIES with a CLIPRDR_GENERAL_CAPABILITY_SET and call context->ClientCapabilities(context, &caps).3
Announce formats
Call
context->ClientFormatList(context, &list) with the formats currently on the local clipboard.4
Respond to data requests
When
ServerFormatDataRequest fires, serialize the clipboard content for requestedFormatId and call context->ClientFormatDataResponse(context, &response).5
Request remote data
To paste from the remote side, call
context->ClientFormatDataRequest(context, &request) after receiving ServerFormatList. Handle the data in ServerFormatDataResponse.Build with
-DCHANNEL_CLIPRDR=ON (the default) to include the CLIPRDR channel. The channel is enabled at runtime with the /clipboard command-line option.