3.2.5.4 DPSP_MSG_REQUESTPLAYERID

When a DirectPlay host receives a DPSP_MSG_REQUESTPLAYERID (section 2.2.49) message, it MUST inspect the Flags field of the DPSP_MSG_REQUESTPLAYERID request. If the DPLAYI_PLAYER_SYSTEMPLAYER flag is set, this request is a request to join the game. If the DPLAYI_PLAYER_SYSTEMPLAYER flag is not set, the request is a request to add a normal player from an existing member of the game session.

When adding a normal player to the game session, the game host MUST check to see if the number of current players identified in Session.CurrentPlayers is equal to the maximum number of players specified in Session.MaxPlayers or if the Session.NewPlayersDisabled flag is set. If it is set, the game host MUST format and transmit a DPSP_MSG_REQUESTPLAYERREPLY (section 2.2.50) with the Result field set to DPERR_NONEWPLAYERS (0x8877014A). Otherwise, the game host MUST reserve a new player ID for the new player and the game host MUST add the player to the Player List. The game host MUST then format and transmit a DPSP_MSG_REQUESTPLAYERREPLY message with the ID field set to the new player ID. The SecDesc field in the DPSP_MSG_REQUESTPLAYERREPLY structure MUST be filled with 0s, and the Result field MUST be set to S_OK (0x00000000).

Note The 32-bit player and group identifiers are constructed as follows:

  1. A zero-based value not shared by an existing identifier is assigned in the lowest 16 bits of the identifier.

  2. A zero-based value that is incremented to provide uniqueness for each identifier is assigned in the highest 16 bits of the identifier.

  3. The resulting 32-bit identifier value is bitwise XOR'd with the unique value specified in the Reserved1 field of the DPSESSIONDESC2 message.

    Although player IDs are allocated sequentially (and starting from a random value), because the random value is XOR'd with this unique value, there is no guarantee that the distributed player ID values will be sequential. For more information, see section 5.1.

When a client is joining a game session, the game host MUST check to see if Session.CurrentPlayers is equal to the Session.MaxPlayers constraint or if the Session.JoinDisabled flag is set. If it is set, the game host MUST format and transmit a DPSP_MSG_REQUESTPLAYERREPLY with the Result field set to DPERR_NONEWPLAYERS (0x8877014A). Otherwise, the game host MUST reserve a new player ID for the new player and the game host MUST add the player to the Player List. The game host MUST then format and transmit a DPSP_MSG_REQUESTPLAYERREPLY message with the ID field set to the new player ID and the Result field MUST be set to S_OK (0x00000000). If the Session.Authenticated flag is not set, the SecDesc field in the DPSP_MSG_REQUESTPLAYERREPLY structure MUST be filled with 0s. If the Session.Authenticated flag is set, the SecDesc field MUST be filled in with the SSPIProvider field set to Game.SSPIProvider value for the authentication.<21>

The CAPIProvider field MUST be set to the cryptographic service specified in Game.CAPIProvider, the CAPIProviderType field MUST be set to the cryptographic provider capabilities identified in Game.CAPIProviderType, and the Encryption Algorithm MUST be set to the algorithm indicated in Game.EncryptionAlgorithm.