2.2.1 Frame Format, Player Indexes Header

All DirectPlay 4 Protocol frames begin with source and destination player indexes. A player index value is the raw index assigned to the player as specified in [MC-DPL4CS] section 3.2.5.4. The index value is the same as the player ID except that the index does not have the XOR mask applied to achieve uniqueness, as defined in [MC-DPL4CS] section 3.2.5.4.

Each player index is encoded in a sequence that is one to three bytes in length. The sequence is based on how many bytes it takes to represent the unsigned 0-0xFFFF ID index value by using 7-bit chunks, ordered from least to most significant. The most significant bit in each byte indicates whether another byte follows in the sequence. Depending on the index value, the bytes are populated by using the following formatting rules:

  • If the index value is less than 128 (seven bits), the player index is encoded by using a single byte and the most significant bit is not set. For larger values, the least significant seven bits are stored in the first byte and the high bit is set to indicate that another byte follows in the sequence.

  • If the index value is less than 16,384, the second byte contains the most significant seven bits and the high bit is not set.

  • If the index value is greater than 16,384, the second byte contains the next most significant seven bits and the high bit is set to indicate that another byte follows in the sequence.

  • When the third byte is present, it contains the most significant bits of the player index, but only the lowest two bits are set. The high bit MUST NOT be set to indicate additional bytes in the sequence, and the decoded index value MUST NOT be larger than 0xFFFF.

For example, a player index value of 0x01 is encoded by using a single byte (0x01), and a player index value of 0xFFFE is encoded by using three bytes (0xFE, 0xFF, 0x03).


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

IdFrom (variable)

IdTo (variable)

...

IdFrom (variable): The player index of the source encoded by using one to three bytes according to the formatting rules described in this section.

IdTo (variable): The player index of the destination encoded by using one to three bytes according to the formatting rules described in this section.