3.1.8.2.2.2 Setting Compression and Extended Compression Flags

Once data has been compressed, the RDP6.1-BC compressor (the level-1 compressor) MUST call (or chain) another compressor (the level-2 compressor) to further compress the compressed output. The L1_INNER_COMPRESSION flag (0x10) MUST be set in the Level1ComprFlags field (see section 2.2.2.4.1) if a level-2 compressor is called.

If the level-1 compressor determines that applying compression will result in an expansion of the data size, it MAY instead pass the original data that it was asked to compress directly to the level-2 compressor. If the RDP6.1-BC compressor compresses the original data it MUST set the L1 COMPRESSED flag (0x01). If the RDP6.1-BC compressor reverts to the original data (no compression is possible) it MUST set the L1_NO_COMPRESSION flag (0x02). Either one of these flags MUST be set if the RDP6.1-BC compressor updates the level-1 history buffer. This ensures that the receiver is able to update its level-1 history buffer accordingly.

If either the L1_COMPRESSED (0x01) or L1_NO_COMPRESSION (0x02) flags are set (that is, the RDP6.1-BC compressor has touched its level-1 history buffer), then the PDU which encapsulates the level-1 output data MUST set the PACKET_COMPRESSED flag (0x20) in the header field appropriate to the type of data payload, such as Fast-Path output data (see [MS-RDPBCGR] section 2.2.9.1.2.1), virtual channel data (see [MS-RDPBCGR] section 2.2.6.1), or Slow-Path data (see [MS-RDPBCGR] section 2.2.9.1.1). Hence, it is valid for the PACKET_COMPRESSED flag (0x20) to be set when the L1_NO_COMPRESSION flag (0x02) is also set.

If there is not enough space in the level-1 history buffer to add the data to be compressed at the current history offset, then the history buffer offset MUST be reset to the start position (0) before the data is inserted. If a reset of this type occurs, then the level-1 L1_PACKET_AT_FRONT flag (0x04) MUST be set to notify the receiver that an update to the level-1 history buffer offset is required. Unlike RDP6.0-BC, this is a simple reset of the history offset and no sliding window semantics are involved (see section 3.1.8.1.2 for a description of RDP6.0-BC semantics).

The level-1 compression flags are produced by performing a logical OR operation of one or more of the following flags.

Compression flag

Meaning

L1_PACKET_AT_FRONT

0x04

The level-1 history buffer MUST be reinitialized (by filling it with zeros). After it has been reinitialized, the entire history buffer is immediately regarded as valid. This flag MUST be set if the data to be compressed will not fit in the history buffer at the current offset.

L1_NO_COMPRESSION

0x02

No compression was performed. The output data consists of raw literals, and there is no match data. This occurs when the input data has no corresponding matches available in the history buffer long enough to produce a reduction in data size by RDP6.1-BC compression. The output data MUST be appended to the level-1 history buffer.

L1_COMPRESSED

0x01

Compression with the level-1 compressor was performed. The output data MUST contain at least one match. The output data MUST be appended to the level-1 history buffer.

L1_INNER_COMPRESSION

0x10

Indicates that additional level-2 compression (using RDP 5.0 bulk compression) has been performed on the level-1 compressor output. The level-2 compression flags MUST contain the result of the chained compression.

The level-2 compression flags are described in [MS-RDPBCGR] sections 3.1.8.2.1 and 3.1.8.3.