3.1.5.5 MTAG_CONNECTION_REQ (MsgTag 0x00000005)

When this message is received over a Session object, the implementation of the multiplexing protocol specified in [MS-CMP] MUST first compare the number of Connection objects in the Incoming Connection Table on the Session object with the Count of Allocated Incoming Connections on the Session object. If the Count of Allocated Incoming Connections is equal to the number of Connection objects in the table, then the implementation of the multiplexing protocol MUST ignore this message.

Otherwise, the implementation of the multiplexing protocol MUST look at the dwConnectionId field of the MsgHeader field of the message and attempt to retrieve the Connection object with the matching Connection ID from the Incoming Connection Table of the Session object. If a Connection object is found, then this message MUST be silently ignored.

Otherwise, the implementation of the multiplexing protocol MUST allocate a Connection object, initializing the connection type field to the dwUserMsgType field of the MsgHeader field of the message, the Accepted field to false, and the Connection ID field to the dwConnectionId field of the MsgHeader field of the message. It MUST add the Connection object to the Incoming Connection Table of the Session object. If the Idle Timer is active, then it MUST be canceled.

The implementation MUST then notify the higher-layer protocol of the incoming connection, providing the Connection object and its connection type. The higher-layer protocol MUST either accept or reject the connection.

If the higher-layer protocol rejects the connection, then it MUST provide a protocol-specific, 32-bit unsigned integer that specifies the reason for the rejection. The implementation MUST then allocate a new MTAG_CONNECTION_REQ_DENIED message (section 3.1.5.3), initializing the dwConnectionId field of the MsgHeader field to the Connection ID of the Connection object and the Reason field to the unsigned integer provided by the higher-layer protocol. It MUST then enqueue this message on the Session object as specified in section 3.1.7.1.

If the higher-layer protocol accepts the connection, then the implementation of the multiplexing protocol MUST set the Accepted field of the Connection object to true.