3.1.5.1.1 SYN Datagrams

The following steps specify the creation of a SYN datagram:

  1. An RDPUDP_FEC_HEADER structure (section 2.2.2.1) MUST be appended to the UDP datagram.

    • The snSourceAck variable MUST be set to -1.

    • The uReceiveWindowSize variable MUST be set to the size of the receive buffer. The receive buffer is the number of packets the receiver specified it can buffer.

    • The uFlags variable MUST be set as follows:

      • The RDPUDP_FLAG_SYN flag MUST be set.

      • The RDPUDP_FLAG_SYNLOSSY flag MUST be set by the client only when neither endpoint requires retransmission of lost datagrams.

      • The RDPUDP_FLAG_CORRELATION_ID flag MUST be set only when the RDPUDP_CORRELATION_ID_PAYLOAD structure (section 2.2.2.8) is included.

      • The RDPUDP_FLAG_SYNEX flag MUST be set only when the RDPUDP_SYNDATAEX_PAYLOAD structure (section 2.2.2.9) is included.

  2. The RDPUDP_SYNDATA_PAYLOAD structure (section 2.2.2.5) MUST be appended to the UDP datagram.

    • The snInitialSequenceNumber variable MUST be set to a 32-bit number generated by using a truly random function.

    • The uUpStreamMtu field MUST be set to a value in the range of 1132 to 1232.

    • The uDownStreamMtu field MTU MUST be set to a value in the range of 1132 to 1232.

  3. The RDPUDP_CORRELATION_ID_PAYLOAD structure (section 2.2.2.8) MUST be appended to the UDP datagram if the RDPUDP_FLAG_CORRELATION_ID flag is set in uFlags.

    • The uCorrelationId variable MUST be filled with 8-bit numbers generated by using a truly random function, except that: The value MUST be transmitted in big-endian byte order. The most-significant byte is not to have a value of 0x00 or 0xF4. None of the bytes are to have the value 0x0D. This value is to be the same as provided in the RDP_NEG_CORRELATION_INFO structure ([MS-RDPBCGR] section 2.2.1.1.2).

    • The uReserved variable MUST be filled with 16 8-bit numbers, all with value 0x00.

  4. The RDPUDP_SYNDATAEX_PAYLOAD structure (section 2.2.2.9) MUST be appended to the UDP datagram if the RDPUDP_FLAG_SYNEX flag is set in uFlags. Not appending this structure implies that RDPUDP_PROTOCOL_VERSION_1 is the highest protocol version supported. This structure SHOULD NOT be appended if this datagram is in response to a SYN from the other endpoint where the RDPUDP_FLAG_SYNEX flag was not specified. The uSynExFlags field MUST be set as follows:

    • The RDPUDP_VERSION_INFO_VALID flag MUST be set only if the structure contains a valid RDP-UDP protocol version.

    • If the RDPUDP_VERSION_INFO_VALID flag is present, the uUdpVer field MUST be set to the highest RDP-UDP protocol version supported by the endpoint, or if the other endpoint has already sent a SYN, the highest version supported by both endpoints.

  5. If uUdpVer equals RDPUDP_PROTOCOL_VERSION_3 (0x0101), a 32-byte SHA-256 hash of the securityCookie field of the Initiate Multitransport Request PDU ([MS-RDPBCGR] section 2.2.15.1) MUST be present in the cookieHash field. This hash value MUST NOT be present in any other case. The server MUST confirm that the hash value is correct. If the hash is not valid, the connection MUST reset the RDP-UDP protocol version to RDPUDP_PROTOCOL_VERSION_2 (0x0002).

  6. This datagram MUST be zero-padded to increase the size of this datagram to uUpStreamMtu or uDownStreamMtu, whichever is smaller.