Directory Game Server Protocol
ABSTRACT: This document will explain the details needed to send zone data to the directory server.
Some background information, this system relies on the UDP protocol, port 4991. Max length of the packet is only limited to the directory server software itself (so it varies from each application). However, the specific lengths of fields are pretty much final, the zone description should be the only length that varies. The following is based off examination of the open-source Directory Server by Catid; and discussions with him about this topic.
Offset Length Description =================================== 0×00 [ 0] 4 IP address. (Must be NULL: 00 00 00 00) 0×04 [ 4] 2 Server Port 0×06 [ 6] 2 Population 0×08 [ 8] 2 Scoring? (0×00 - no; 0×01 - yes) 0×0A [ 10] 4 Version (134) 0×0E [ 14] 32 Zone Name (31 characters, null-terminated.) Must also be a valid name. 0×2E [ 46] 16 Zone Password (15 characters, null-terminated.) 0×3E [ 62] 32 Unknown NULL field. (*** see discussion) 0×5E [ 94] VARIES Zone Description (varied length, null-terminated.)
- Offsets are given in HEX [ DEC].
- 32 byte NULL field Discussion - I was surprised to see this in the validation function of Catid’s directory server. After some discussion with him, he assures me there is a 32 length NULL field. As of Catids Distributed Directory Server build 4, these 32 bytes MUST BE NULL. It is enforced. However, after some testing done by 2dragons - having non-null bytes in this section does not affect the directory server writen by PriitK. Later thoughts were that VIE may have planned on adding more fields into the directory server protocol; but never got around to it.
- Further Discussion - PriitK’s directory server records descriptions to the stats file with a max length of 490 bytes.
- Validation - The following are conditions that I took apart from Catid’s validating function as well.
The length of the packet must be greater than 0×5F The first 4 bytes must be null, or zero. The last byte of the packet must be NULL (0×00) The byte[0×2D] must be 0×00 The byte[0×3D] must be 0×00 The byte[0×08] must be either 0×00, or 0×01 The byte[0×3E] to byte[0×5D]
- Validating Name ***
There are also conditions on what determines a validName, etc. This part may or may not be correct. I just threw it in here quickly.
Catids Directory Server says: validName would be: len(name) > 0 no leading spaces no more than 1 space in a row Any character between ‘ ‘ and ‘~’ No trailing spaces