Skip to content

Conversation

@glamberson
Copy link
Contributor

Adds ZGFX segment wrapping utilities for encoding data in RDP8 format.

Summary

  • wrap_uncompressed(): Wraps raw data in ZGFX segment structure without compression
  • wrap_compressed(): Wraps pre-compressed data with the COMPRESSED flag set

Supports both single segments (up to 65535 bytes) and multipart segments for larger payloads per MS-RDPEGFX section 2.2.5.3.

Use Case

Enables server implementations to send EGFX PDUs in spec-compliant ZGFX format. This is the wrapping layer; compression support will follow in a separate PR.

Refs: #1067

@glamberson glamberson force-pushed the zgfx-wrapper branch 2 times, most recently from ae5c877 to 98f8205 Compare January 13, 2026 19:10
@glamberson
Copy link
Contributor Author

Since this is just the scaffolding, I'm going to go ahead and submit the core compression PR so you can see the whole package.

Add wrapper.rs providing ZGFX segment framing utilities for both
uncompressed and compressed data:

- wrap_uncompressed(): Wraps raw data in ZGFX segment format
- wrap_compressed(): Wraps ZGFX-compressed data with COMPRESSED flag

Supports both single segments (≤65535 bytes) and multipart segments
for larger data. Fully compliant with MS-RDPEGFX specification.

This enables server implementations to send EGFX PDUs without
compression while maintaining protocol compliance.

Refs: Devolutions#1067
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds server-side ZGFX (RDP8) segment framing helpers to produce spec-shaped ZGFX “segmented data” PDUs, primarily for sending EGFX payloads without compression.

Changes:

  • Introduces wrap_uncompressed() to wrap raw bytes into single or multipart ZGFX segmented PDUs.
  • Introduces wrap_compressed() to wrap already-compressed payloads with the COMPRESSED flag set.
  • Exposes the new wrapper helpers via ironrdp_graphics::zgfx.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
crates/ironrdp-graphics/src/zgfx/wrapper.rs New ZGFX segment wrapping implementation plus unit tests (mostly for uncompressed).
crates/ironrdp-graphics/src/zgfx/mod.rs Wires the wrapper module and re-exports wrap_uncompressed / wrap_compressed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall, but can you double check Copilot’s comments? Thanks!

@glamberson
Copy link
Contributor Author

Looks good to me overall, but can you double check Copilot’s comments? Thanks!

Yes I'm wading through it now. Thanks.

- Restrict wrap_compressed() to single-segment only — a compressed
  bitstream can't be split at arbitrary byte boundaries
- Remove intermediate Vec allocation in multipart path
- Add tests for compressed wrapping and oversized rejection
- Update module docs to reflect both compressed and uncompressed support
@glamberson
Copy link
Contributor Author

OK I think it's done now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants