Skip to main content
Version: 0.8.0
Docs.rs: ironrdp-session

Overview

The ironrdp-session crate provides state machines for managing an active RDP session after the connection is established. It handles:
  • Fast-path and X.224 PDU processing
  • Graphics output (bitmaps, surface commands, RemoteFX)
  • Pointer (cursor) updates
  • Graceful disconnection
  • Bulk data decompression
Like ironrdp-connector, this crate is transport-agnostic and operates on byte buffers.

Core Types

ActiveStage

Parameters:
u16
MCS user channel ID from connection result
u16
MCS I/O channel ID from connection result
bool
If true, render pointer locally instead of using server-provided cursor
bool
Use software rendering for pointer updates
DesktopSize
Initial desktop dimensions

ActiveStageOutput

Output events from processing a PDU. Variants:
variant
Graphics data was decoded into the DecodedImage
variant
Use the default system pointer
variant
Hide the pointer
variant
Move pointer to (x, y)
variant
Update pointer to a custom bitmap
variant
Server requested graceful disconnection

GracefulDisconnectReason

Image Handling

DecodedImage Trait

Implement this trait to receive decoded graphics updates. Example Implementation:

BitmapRegion

PDU Processing Modules

Fast-Path

Processes fast-path output PDUs (most graphics updates).

X.224

Processes X.224-framed PDUs (licensing, capability sets).

Legacy

Handles legacy graphics orders.

Pointer

Pointer/cursor update processing.

RemoteFX

RemoteFX tile decoding.

Usage Example

Error Handling

Bulk Compression

The session automatically handles bulk decompression when the server sends compressed PDUs:
  • MPPC (8 KB or 64 KB history)
  • NCRUSH (RDP 6.0)
  • XCRUSH (RDP 6.1)
Compression is negotiated during connection via Config::compression_type in ironrdp-connector.

Features

feature
Enable QOI image codec support
feature
Enable QOI + Zstd compressed image support (requires qoi)

Dependencies

  • ironrdp-core - Core traits (public)
  • ironrdp-pdu - PDU structures (public)
  • ironrdp-graphics - Image processing (public)
  • ironrdp-connector - Connection result types (public)
  • ironrdp-svc - Virtual channel support (public)
  • ironrdp-dvc - Dynamic virtual channels (public)
  • ironrdp-bulk - Bulk decompression
  • ironrdp-displaycontrol - Display control channel

Usage Notes

Image Ownership:
The DecodedImage is owned by the caller. The session decodes graphics updates directly into your image buffer, avoiding unnecessary copies.
PDU Framing:
The session expects complete PDUs (after TPKT/X.224/MCS unwrapping). Use ironrdp_pdu::find_size() to detect PDU boundaries in your framing layer.
Output Buffer:
Reuse the WriteBuf across calls:

See Also