184.108.40.206 Data Frame Processing
When a Data frame (section 2.2.2) arrives, the value of its messageid field MUST be compared to the list of receiving messages using 8-bit unsigned integer math, and according to the following rules:
Note When processing Data frames, the receiver MUST keep track of the last messageid that was received reliably.
If there are no ongoing receives or completed receives, then this messageid MUST become the first ongoing receive.
If the value of the messageid field is outside the range of the messageid of the earliest ongoing or completed receive (and that messageid+23), the Data frame MUST be ignored.
If no message with the messageid value is currently being received, the messageid of this message MUST be added to the list of receiving messages.
The only exception to this rule is when a reliable Data frame is received and the value of its messageid is the same as the last reliable message received. In this case, an acknowledgment (ACK) message MUST be sent back to the sender. This exception handles the situation where an ACK that was sent for a previously received message was lost. Because a message that was previously received is now being received again, it is possible that the ACK that was previously sent was lost and needs to be retransmitted.
When the messageid of a message is initially added to the list of receiving messages, a new message buffer MAY be allocated for the message. This buffer is used for assembling the message according to the sequence numbers associated with the messageid as necessary. When all of the following Data frames have been received, the Data (variable) areas of those messages are concatenated in sequence order to make up the receive data for that message:
A Data frame with a particular messageid, a starting sequence, and a STA bit set.
A Data frame with the same messageid, an ending sequence, and an EOM set.
All Data frames with the same messageid in the contiguous intervening sequence space.
Note Using 8-bit unsigned integer math, if a message is not received reliably and not all parts of the message have been received, and the currently receiving messageid is equal to the messageid+24 of this unreliable message, then the unreliable message SHOULD be discarded.
During assembly of the receive data, a NACK or ACK MUST be sent in the following circumstances:
If the sequence number is not the current expected sequence number, a NACK packet MUST be sent back to the sender. It is at the discretion of the implementation to send the NACK immediately or to wait for more time or more receive data before sending the NACK.<7> Delaying the NACK might result in efficiency gains.
If the Data frame has its SAK bit set, an ACK or NACK MUST be sent back to the sender without waiting for more time to elapse or more data to be received.<8>
When the final part in a multipart message is received, an ACK MUST be sent back to the sender without waiting for more time to elapse or more data to be received.
After the receive data is fully assembled, the data is indicated to the higher layers, and the messageid of the message MUST be removed from the list of receiving messages.