Skip to content

feat(pdu)!: route auto-detect PDUs through ShareDataPdu dispatch#1176

Merged
Benoît Cortier (CBenoit) merged 1 commit intoDevolutions:masterfrom
lamco-admin:feat/autodetect-share-data-routing
Mar 18, 2026
Merged

feat(pdu)!: route auto-detect PDUs through ShareDataPdu dispatch#1176
Benoît Cortier (CBenoit) merged 1 commit intoDevolutions:masterfrom
lamco-admin:feat/autodetect-share-data-routing

Conversation

@glamberson
Copy link
Contributor

Follow-up to #1168 (auto-detect PDU types).

Wires AutoDetectRequest and AutoDetectResponse into the ShareDataPdu
decode/encode path so they are handled correctly when sent via the
slow path (pduType2 0x3B per MS-RDPBCGR 2.2.14).

Currently, if a Windows server sends an auto-detect request as a Share
Data PDU, the client fails at decode time with an unknown pduType2. This
change adds ShareDataPduType::AutoDetect (0x3B) and decodes it into the
appropriate variant using the headerTypeId byte to discriminate direction
(0x00 for server-to-client requests, 0x01 for client-to-server responses).

No behavioral change in the connector or session layer: auto-detect PDUs
are not yet acted upon, but they now decode cleanly instead of causing
errors. This enables future integration on both client and server sides.

28 lines, 1 file (ironrdp-pdu/src/rdp/headers.rs).

Follow-up to Devolutions#1168 (auto-detect PDU types). Wires AutoDetectRequest
and AutoDetectResponse into the ShareDataPdu decode/encode path so
they are handled correctly when sent via the slow path (pduType2 0x3B).

The headerTypeId byte (0x00 for request, 0x01 for response) is used
to discriminate direction during decode.

No behavioral change: the connector and session layer do not act on
auto-detect PDUs yet, but they now decode cleanly instead of failing
with an unknown pduType2 error.
Greg Lamberson (glamberson) added a commit to lamco-admin/IronRDP that referenced this pull request Mar 18, 2026
Add server-side RTT measurement using the protocol-standard auto-detect
mechanism (MS-RDPBCGR 2.2.14). Depends on Devolutions#1176 for ShareDataPdu routing.

New AutoDetectManager tracks outstanding RTT probes and computes
min/max/avg statistics over a sliding window. Wired into the server
event loop via ServerEvent::AutoDetectRttRequest and IO channel
response handling.

Public API: enable_autodetect() / rtt_snapshot() on RdpServer.
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

Routes MS-RDPBCGR Auto-Detect PDUs (pduType2 0x3B) through the existing ShareDataPdu slow-path dispatch so Windows servers sending auto-detect via Share Data no longer fail decoding.

Changes:

  • Add ShareDataPdu::AutoDetectReq / ShareDataPdu::AutoDetectRsp variants and wire them into encode/size.
  • Add ShareDataPduType::AutoDetect = 0x3B and implement decode dispatch based on the headerTypeId byte.
  • Update short-name/typing helpers (as_short_name, share_header_type) to include the new variants.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +334 to +337
/// Auto-Detect Request (server to client)
AutoDetectReq(AutoDetectRequest),
/// Auto-Detect Response (client to server)
AutoDetectRsp(AutoDetectResponse),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ironrdp-pdu is publish = false, so adding variants isn't a semver concern for external consumers. The existing enum already has many Vec passthrough variants for the same pattern. Adding #[non_exhaustive] is a separate design discussion for when the crate is eventually published.

Copy link
Member

@CBenoit Benoît Cortier (CBenoit) Mar 18, 2026

Choose a reason for hiding this comment

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

ironrdp-pdu is not publish = false, and is already published: https://lib.rs/crates/ironrdp-pdu

That being said, we’re fine with breaking changes until we release a v1, so we can either add #[non_exhaustive] (in a follow up PR) or not, I’m okay!

Copy link
Member

@CBenoit Benoît Cortier (CBenoit) left a comment

Choose a reason for hiding this comment

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

LGTM!

@CBenoit Benoît Cortier (CBenoit) changed the title feat(pdu): route auto-detect PDUs through ShareDataPdu dispatch feat(pdu)!: route auto-detect PDUs through ShareDataPdu dispatch Mar 18, 2026
@CBenoit Benoît Cortier (CBenoit) merged commit e5f2f36 into Devolutions:master Mar 18, 2026
14 checks passed
Lamco Development Office Staff (lamco-office) pushed a commit to lamco-admin/IronRDP that referenced this pull request Mar 18, 2026
Add server-side RTT measurement using the protocol-standard auto-detect
mechanism (MS-RDPBCGR 2.2.14). Depends on Devolutions#1176 for ShareDataPdu routing.

New AutoDetectManager tracks outstanding RTT probes and computes
min/max/avg statistics over a sliding window. Wired into the server
event loop via ServerEvent::AutoDetectRttRequest and IO channel
response handling.

Public API: enable_autodetect() / rtt_snapshot() on RdpServer.
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.

3 participants