Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
4.4 Serialization of an IDSET Structure Example

4.4 Serialization of an IDSET Structure Example

To efficiently transfer large numbers of Message ID structures ([MS-OXCDATA] section 2.2.1.2) and Folder ID structures ([MS-OXCDATA] section 2.2.1.1) that identify changed or new messaging objects, the Message ID values and the Folder ID values are serialized into an IDSET structure for transfer across the wire. The following example shows how to format and serialize an IDSET. Because of the variability of the GLOBSET structure encoding commands that are used within the serialization of an IDSET, an IDSET can be encoded in many different ways. There is no single correct way to encode a GLOBSET as long as the GLOBSET, when decoded, contains the same set of GLOBCNT values, as specified in section 2.2.2.5. The following is just one way to encode an IDSET.

This example uses an IDSET with the four following Message ID values:

IDSET Structure

Message name

Value

REPLID

GLOBCNT

MessageID1

01 00 00 00 00 00 00 05

0001

000000000005

MessageID2

01 00 00 00 00 00 00 06

0001

000000000006

MessageID3

01 00 00 00 00 00 00 10

0001

000000000010

MessageID4

02 00 00 00 00 00 00 09

0002

000000000009

The IDSET has to be properly formatted for serializations. For more details about how to format an IDSET, see section 3.1.5.4.1.

The following diagram represents how the IDSET has to be arranged for serialization. The individual ID values have been arranged by REPLID and the GLOBCNT values have been reduced to a GLOBSET for each REPLID. Within the GLOBSET, the GLOBCNT values are placed into contiguous ranges.

Ee237368.690b59ca-dc4a-49c3-9baa-9e829a8ab6d1(en-us,EXCHG.80).jpg

Figure 7: Arranging the IDSET structure for serialization

This example serializes the IDSET by using the REPLID format. For more details about the different serialization formats of an IDSET, see section 2.2.2.4.

For each REPLID/GLOBSET pair, the REPLID has to be added to the serialization buffer before the encoded GLOBSET. They have to be ordered based on the REPLID value where they are ordered from lowest to highest value.

The serialization buffer resembles the following:

Serialization Buffer

01 00 <encoded GLOBSET 1> 02 00 <encoded GLOBSET 2>

GLOBSET 1 contains four GLOBCNT values; two in each GLOBCNT range. The encoding has to be performed based on the same order in which they are arranged in GLOBCNT ranges: from lowest to highest value. The following table is a list of all the GLOBCNT values in the order in which they have to be encoded.

#

GLOBCNT

1

00 00 00 00 00 05

2

00 00 00 00 00 06

3

00 00 00 00 00 10

4

00 00 00 00 00 10

Because all values have the same five bytes in common, the Push command can be used to push the five common bytes onto the common byte stack.

Current Encoding Buffer

05 00 00 00 00 00

Low and high GLOBCNT values in all ranges have to be evaluated in pairs. Because value 1 is close to value 2, it is possible to continue to evaluate subsequent ranges of GLOBCNT values to see if the Bitmask command can be used. However, values 3 and 4 are not close enough to value 1 to use the Bitmask command. Because only one GLOBCNT range is put into a Bitmask command, either the Bitmask command or the Range command could be used. Because they both occupy the same number of bytes in the encoded buffer, whether to use a Bitmask or Range command is an implementation decision. Both methods when decoded result in the same GLOBCNT range. In this example, the Range command is used with the values 0x05 and 0x06 following it.

Current Encoding Buffer

05 00 00 00 00 00 52 05 06

This results in encodings to generate GLOBCNT values 1 and 2 if decoded. For GLOBCNT value 3 and 4, because they both have five bytes in common that are already in the common byte stack, no Pop or Push command has to be used. Because values 3 and 4 are close in value (in this particular case, they are identical), the Bitmask command could be used. Because there are no more GLOBCNT ranges to encode, the Bitmask command only contains one range that takes 3 bytes of encoding. This is the same size a Range command would be to encode the same range. However, because the range is a singleton, it is more efficient to use the Push command to fill in the common byte stack. This generates two identical GLOBCNT values when decoded.

Current Encoding Buffer

05 00 00 00 00 00 52 05 06 01 10

This results in encodings in the encoding buffer to generate all GLOBCNT values in the GLOBSET. To complete the encoding, an End command has to be added. Before the End command can be added, any bytes on the common byte stack have to be removed. Because all bytes on the common byte stack were pushed with a single Push command, only one Pop command is required to remove them.

Current Encoding Buffer

05 00 00 00 00 00 52 05 06 01 10 50

The End command can now be added.

Current Encoding Buffer

05 00 00 00 00 00 52 05 06 01 10 50 00

The GLOBSET 1 encoding can be added to the serialization buffer to produce the following:

Serialization Buffer

01 00 05 00 00 00 00 00 52 05 06 01 10 50 00 02 00 <encoded GLOBSET 2>

The last step is to encode GLOBSET 2. GLOBSET 2 contains two GLOBCNT values. The following table is a list of all the GLOBCNT values in the order in which they have to be encoded.

#

GLOBCNT

1

00 00 00 00 00 09

2

00 00 00 00 00 09

Because both GLOBCNT values 1 and 2 are identical, the Push command can be used, followed by the full 6 bytes to add to the common byte stack. Because this fills the common array, it generates two identical GLOBCNT values when decoded, producing a singleton GLOBCNT range.

Current Encoding Buffer

06 00 00 00 00 00 09

Encodings in the encoding buffer now exist to generate all GLOBCNT values in the GLOBSET. To complete the encoding, an End command has to be added.

Current Encoding Buffer

06 00 00 00 00 00 09 00

The GLOBSET 2 encoding can be added to the serialization buffer to produce the following:

Serialization Buffer

01 00 05 00 00 00 00 00 52 05 06 01 10 50 00 02 00 06 00 00 00 00 00 09 00

This completes the serialization of the IDSET.

Show:
© 2015 Microsoft