feat(pdu)!: route auto-detect PDUs through ShareDataPdu dispatch#1176
Conversation
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.
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.
There was a problem hiding this comment.
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::AutoDetectRspvariants and wire them intoencode/size. - Add
ShareDataPduType::AutoDetect = 0x3Band implement decode dispatch based on theheaderTypeIdbyte. - 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.
| /// Auto-Detect Request (server to client) | ||
| AutoDetectReq(AutoDetectRequest), | ||
| /// Auto-Detect Response (client to server) | ||
| AutoDetectRsp(AutoDetectResponse), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
e5f2f36
into
Devolutions:master
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.
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).