3.1.5.2.6 Large (Multipacket) Payload Processing

When a data frame (DFRAME) arrives with the PACKET_COMMAND_NEW_MSG flag set but not the PACKET_COMMAND_END_MSG flag set in bCommand, the complete data payload spans more than one packet. The PACKET_CONTROL_COALESCE flag MUST NOT also be set. The receiver SHOULD save the received payload without indicating it to the upper layer and prepare to collect future packets.

Future DFRAME that arrive without the PACKET_COMMAND_END_MSG flag MUST NOT also have PACKET_CONTROL_COALESCE enabled. Their payloads SHOULD be added to the buffer or list.

When the next DFRAME in sequence that contains the PACKET_COMMAND_END_MSG flag arrives without any gaps in the sequence space, the implementation SHOULD indicate the payloads to the upper layer as a contiguous buffer in the same order in which they arrived.

If a DFRAME arrives in sequence after one that has the PACKET_COMMAND_END_MSG flag set but it does not have the PACKET_COMMAND_NEW_MSG set, the receiver SHOULD behave as if the PACKET_COMMAND_NEW_MSG flag were set but MAY terminate the connection. Similarly, if a DFRAME arrives in sequence with the PACKET_COMMAND_NEW_MSG flag set but the previous one did not have the PACKET_COMMAND_END_MSG flag set, the receiver SHOULD behave as if the previous packet had the PACKET_COMMAND_END_MSG flag set but MAY terminate the connection.

An implementation SHOULD provide an upper limit for the number of packets that can be used to send a large message, or the number of bytes that such a message can contain. If it receives the specified number of packets or bytes without any missing sequence numbers and it still has not encountered a PACKET_COMMAND_END_MSG flag, it SHOULD terminate the connection. The values for such limits SHOULD be appropriate for, and specific to, the application's intended resource consumption and sending patterns; no particular value is recommended in this specification.