Compartilhar via


3.1.5.2.2.1 Reassembly of Chunked Virtual Channel Data

Virtual channel data can span multiple Virtual Channel PDUs (section 3.1.5.2.1). If this is the case, the embedded length field of the channelPduHeader field (the Channel PDU Header structure is specified in section 2.2.6.1.1) specifies the total length of the uncompressed virtual channel data spanned across all of the associated Virtual Channel PDUs. This length is referred to as totalLength. For example, assume that the virtual channel chunking size specified in the Virtual Channel Capability Set (section 2.2.7.1.10) is 1,000 bytes and that 2,062 bytes need to be transmitted on a given virtual channel. In this example, the following sequence of Virtual Channel PDUs will be sent (only relevant fields are listed):

 Virtual Channel PDU 1:
 CHANNEL_PDU_HEADER::length = 2062 bytes
 CHANNEL_PDU_HEADER::flags = CHANNEL_FLAG_FIRST
 Actual virtual channel data is 1000 bytes (the chunking size).
  
 Virtual Channel PDU 2: 
 CHANNEL_PDU_HEADER::length = 2062 bytes
 CHANNEL_PDU_HEADER::flags = 0
 Actual virtual channel data is 1000 bytes (the chunking size).
  
 Virtual Channel PDU 3: 
 CHANNEL_PDU_HEADER::length = 2062 bytes
 CHANNEL_PDU_HEADER::flags = CHANNEL_FLAG_LAST
 Actual virtual channel data is 62 bytes.

The size of the virtual channel data in the last PDU (the data in the virtualChannelData field) is determined by subtracting the offset of the virtualChannelData field in the encapsulating Virtual Channel PDU from the total size specified in the tpktHeader field. This length is referred to as chunkLength.

Upon receiving each Virtual Channel PDU, the server MUST dispatch the virtual channel data to the appropriate virtual channel endpoint. The sequencing of the chunk (whether it is first, intermediate, or last), totalLength, chunkLength, and the virtualChannelData fields MUST be dispatched to the virtual channel endpoint so that the data can be correctly reassembled. If the CHANNEL_FLAG_SHOW_PROTOCOL (0x00000010) flag is specified in the Channel PDU Header, then the channelPduHeader field MUST also be dispatched to the virtual channel endpoint.

A reassembly buffer MUST be created by the virtual channel endpoint using the size specified by totalLength when the first chunk is received. After the reassembly buffer has been created the first chunk MUST be copied into the front of the buffer. Subsequent chunks MUST then be copied into the reassembly buffer in the order in which they are received. Upon receiving the last chunk of virtual channel data, the reassembled data is processed by the virtual channel endpoint.