3.1.5.1 Sending Upper Layer Messages
The processing specified in this section is to be used only when Connection.Role is "ESTABLISHED", to start or restart sending one or more new or previously deferred Data Transfer messages. The caller passes the Connection to use for the Send message, and zero or more new messages to be sent.
The new messages to be sent, if any, MUST be appended to the list of messages in the Connection.SendQueue. If there are no messages to be sent and Connection.SendImmediate is TRUE, a newly constructed Data Transfer Message MUST be added to Connection.SendQueue.
For each message in Connection.SendQueue:
If Connection.SendCredits is 0, stop processing.
If CreditsGranted field of the first message in Connection.SendQueue is zero, the credit processing specified in section 3.1.5.9 MUST be performed, and the CreditsGranted field of the message MUST be set to the number of new credits returned.
If Connection.SendCredits is 1 and the CreditsGranted field of the message is 0, stop processing.
The first message MUST be removed from Connection.SendQueue.
The value of Connection.SendCredits MUST be decremented by one.
The value of the CreditsRequested field of the message MUST be set to Connection.SendCreditTarget.
If Connection.KeepaliveRequested is "PENDING", the Flags field of the message MUST be set to SMB_DIRECT_RESPONSE_REQUESTED, Connection.KeepaliveRequested MUST be set to "SENT", and the Idle Connection Timer SHOULD<3> be set to an implementation-specific value. Otherwise, the Flags field of the message MUST be set to 0x0000.
If the message to be sent was provided with an optional remote memory token to be invalidated on the receiving peer, the token SHOULD be provided in an implementation-specific manner to the RDMA provider when sending. If sending of remote invalidation is not supported by the RDMA provider, the token MAY be ignored.
The message MUST be sent on the connection in an implementation-specific manner.
Connection.SendImmediate MUST be set to FALSE.