Skip to main content
Version: 0.6.0
Docs.rs: ironrdp-svc

Overview

The ironrdp-svc crate provides traits and utilities for implementing RDP Static Virtual Channels (SVCs). Static channels are:
  • Established during connection setup (up to 31 custom channels)
  • Lossless, ordered byte streams
  • Used for clipboard, file transfer, audio, device redirection, etc.
This crate handles:
  • PDU chunkification (splitting large messages into ~1600 byte chunks)
  • Channel framing headers
  • MCS/X.224 wrapping

Core Traits

SvcProcessor

Implement this trait to create a custom static virtual channel. Methods:
fn(&self) -> ChannelName
Returns the 7-character channel name (e.g., “CLIPRDR”, “RDPDR”)
fn(&self) -> CompressionCondition
Defines when channel data should be compressed (default: Never)
fn(&mut self) -> PduResult<Vec<SvcMessage>>
Called after the channel is joined. Returns initial PDUs to send (default: empty)
fn(&mut self, payload: &[u8]) -> PduResult<Vec<SvcMessage>>
Process a received PDU (fully de-chunkified). Returns response PDUs to send.

SvcClientProcessor & SvcServerProcessor

Marker traits to distinguish client and server channel implementations.

Core Types

StaticVirtualChannel

Wrapper around a SvcProcessor that handles chunking and framing.

SvcMessage

A message to send over a static virtual channel. Automatically converted from any SvcEncode type.

SvcEncode

Marker trait for types that can be sent as SVC messages. Automatically implemented for types that implement Encode. Example:

StaticChannelSet

A set holding at most one channel per SvcProcessor type. Maps between:
  • Type IDs (from TypeId::of::<T>())
  • Channel names
  • Channel IDs (assigned by the server during connection)

CompressionCondition

Defines when virtual channel data should be compressed.

Channel Encoding

Client-Side Encoding

Encode messages for sending from client to server. Handles:
  1. Chunkifying messages
  2. Adding Channel PDU Headers
  3. Wrapping in MCS Send Data Request
  4. Adding X.224 and TPKT framing
Returns fully encoded bytes ready to send over the transport.

Server-Side Encoding

Same as client encoding but uses MCS Send Data Indication.

Channel Definitions

make_channel_definition

Create the ChannelDef structure to advertise during connection negotiation.

Implementation Example

Usage Example

Channel Framing

ChannelFlags

Flags in the Channel PDU Header. FIRST and LAST are set automatically during chunkification.

Chunk Size

Default maximum chunk size. Servers may advertise a larger size in capability sets.

Re-exports

Usage Notes

Automatic Chunkification:
You don’t need to manually chunk messages. StaticVirtualChannel handles it:
Type-Safe Channel Access:
Use StaticChannelSet to safely manage multiple channels:
No string comparisons or manual casting needed.
Channel Limits:
RDP supports up to 31 custom static virtual channels plus the mandatory I/O channel (32 total). Choose channel names carefully.

See Also