3.1.5.6 Receiving a Negotiate Request Message
The first message received by the listening side of the connection is a Negotiate Request Message.
The receiver of the message MUST verify:
The length of the received message is at least 20 bytes.
If the preceding condition is not satisfied, the receiver MUST terminate the connection and stop processing the message.
The receiver of the message MUST further verify:
The range of values between MinVersion and MaxVersion inclusive MUST include 0x0100.
If the preceding condition is not satisfied, the receiver MUST generate a Negotiate Response failure message by invoking the processing specified in section 3.1.5.3 and passing a Status argument set to STATUS_NOT_SUPPORTED.
Otherwise, both MinVersion and MaxVersion SHOULD<4> be ignored.
The receiver of the message MUST further verify:
The CreditsRequested field is greater than 0.
The MaxReceiveSize field is at least 128 bytes.
The MaxFragmentedSize field is at least 131,072 bytes.
If any of the preceding conditions are not satisfied, the receiver MUST terminate the connection and stop processing the message.
The receiver SHOULD<5> set Connection.MaxReceiveSize to the smaller of Connection.MaxReceiveSize and the value of the received PreferredSendSize field. If the result is less than 128, then Connection.MaxReceiveSize MUST be set to 128.
The receiver MUST:
Set the Connection.Protocol to 0x0100.
Set the Connection.ReceiveCreditTarget to the value of the received CreditsRequested field.
Set Connection.MaxSendSize to the smaller of Connection.MaxSendSize and the value of the received MaxReceiveSize field.
Set Connection.MaxFragmentedSendSize to MaxFragmentedSize.
The receive operations and credits MUST be initialized as specified in section 3.1.5.9. If the resulting Connection.ReceiveCredits is zero, the receiver MUST generate a Negotiate Response failure message by invoking the processing specified in section 3.1.5.3 and passing a Status argument set to any of those defined in [MS-ERREF] section 2.3 with a Severity of STATUS_SEVERITY_ERROR.
Otherwise, a Negotiate Response MUST be sent as specified in section 3.1.5.3, passing a Status of 0x0000, and the new Connection MUST be indicated to the upper layer as specified in section 3.1.7.2, after which the Negotiation Timer MUST be canceled.
The idle Connection Timer MUST be set to a value of Connection.KeepaliveInterval seconds, and Connection.Role MUST be set to "ESTABLISHED".