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
Application-defined context pointer. Store your private state here.
The owning RDP context.
Format ID from the most recent
FormatDataRequest. Useful in ServerFormatDataRequest to know what to provide.Inbound callbacks (server → client)
generalFlags (e.g. CB_USE_LONG_FORMAT_NAMES, CB_STREAM_FILECLIP_ENABLED) to determine feature support.ClientCapabilities then ClientFormatList.formatList->formats[i] (each has formatId and optional formatName) to decide which formats you can handle.ClientFormatDataResponse with the data.ClientFormatDataRequest.Outbound calls (client → server)
MonitorReady.ServerFormatDataResponse.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
Set to
TRUE to negotiate long format names (CB_USE_LONG_FORMAT_NAMES).Enable file clipboard streaming (
CB_STREAM_FILECLIP_ENABLED).Advertise support for clipboard data locking (
CB_CAN_LOCK_CLIPDATA).When
TRUE, the implementation automatically sends ServerCapabilities and MonitorReady on channel open.Channel control
Opens the SVC. Must be called before
Start.Starts the server clipboard worker thread.
Stops the worker thread.
Returns a waitable event handle for the server clipboard channel.
Processes pending clipboard PDUs — call when the event handle is signalled.
Protocol Data Types
Clipboard Capability Flags
| Flag | Value | Meaning |
|---|---|---|
CB_USE_LONG_FORMAT_NAMES | 0x00000002 | Long clipboard format name support |
CB_STREAM_FILECLIP_ENABLED | 0x00000004 | File clipboard streaming enabled |
CB_FILECLIP_NO_FILE_PATHS | 0x00000008 | No file paths in file clipboard |
CB_CAN_LOCK_CLIPDATA | 0x00000010 | Clipboard data locking supported |
CB_HUGE_FILE_SUPPORT_ENABLED | 0x00000020 | Files larger than 4 GB supported |
Typical Client-Side Flow
Channel activation
The CLIPRDR channel is loaded via
freerdp_channels_load_plugin(). The framework invokes MonitorReady when the server is ready.Send capabilities
In your
MonitorReady handler, build a CLIPRDR_CAPABILITIES with a CLIPRDR_GENERAL_CAPABILITY_SET and call context->ClientCapabilities(context, &caps).Announce formats
Call
context->ClientFormatList(context, &list) with the formats currently on the local clipboard.Respond to data requests
When
ServerFormatDataRequest fires, serialize the clipboard content for requestedFormatId and call context->ClientFormatDataResponse(context, &response).Build with
-DCHANNEL_CLIPRDR=ON (the default) to include the CLIPRDR channel. The channel is enabled at runtime with the /clipboard command-line option.