3.1.3 Initialization

The figure in this section shows the message flow between server and client during the lifetime of the connection initialization. All dynamic virtual channel errors that are returned due to sending or receiving messages result in a protocol error. The connection state starts with version negotiation. On successful version negotiation, channels are open and messages exchanged. At the end of the session, the server MUST close the session by closing all channels and then the connection.

Version negotiation is done in two steps: first, the server asks the client for a list of supported versions, and then the server tells the client which version MUST be used. The process is synchronous, and the connection is not fully usable until this process is completed. If the server opens multiple connections to the client, each connection MAY negotiate a separate protocol version.

The first message in this sequence is MILCTRLCMD_VERSIONREQUEST. After sending this message, the server MUST wait for a reply for at least 20 seconds before sending another message or terminating the connection. If the reply does not arrive within 20 seconds, the server MAY stop waiting and terminate the connection.

When the client receives this message, it MUST send back to the server a MILCTRLCMD_CONNECTIONNOTIFICATION message containing a MILMSG_VERSIONREPLY notification, with the payload listing all of the protocol versions that the client supports. For the version of the protocol specified in this document, the client MUST include the value MIL_SDK_VERSION (0x1042EA27) as specified in section 2.2.9.3 MILMSG_VERSIONREPLY.

After the server receives the notification, it MUST decide which supported version to use. If none of the returned versions are understood by the server, the connection MUST be closed by terminating the dynamic virtual channel as specified in [MS-RDPEDYC]. Otherwise, the server MUST issue a MILCTRLCMD_VERSIONANNOUNCEMENT message to complete the handshake with the client. The protocolVersion field of the message MUST be set to the selected protocol version, which MUST be one of the values returned by the client in the MILCTRLCMD_CONNECTIONNOTIFICATION message. For the version of the protocol specified in this document, this value MUST be MIL_SDK_VERSION (0x1042EA27). From this point on, the server is also done with versioning, and it MUST assume that the connection has been successfully established.

Upon receiving the MILCTRLCMD_VERSIONANNOUNCEMENT message, the client MUST validate that the specified protocol version is valid. All further messages MUST be interpreted according to the specification of the protocol for the given version. From this point on the connection is fully established.

Initializing a connection – message flow

Figure 6: Initializing a connection – message flow