BNETDocs
Notational Convention (Sizes & Types)

This document covers the standard sizes and data types that this site references across other documents and packets.

Data types

Arrays of fields generally are only used when another field in the packet specifies how many entries there are or if the definition specifies a fixed size. The lack of a specified size in the definition indicates that the size is variable/non-fixed or unknown.

All numeric Battle.net types are little-endian. Battle.net uses the following types:

  • STRING - A null-terminated array of characters. The encoding varies from packet to packet, but generally will either be ISO 8859-1 or less commonly UTF-8.
  • STRINGLIST - A series of STRING values. This is like an array of STRING values in every way, except it is always variable/non-fixed size and terminated by an empty item at the end of the array (or otherwise double null-terminated).
  • UINT8 - 8 bit (1 byte) unsigned integer, also known as u8 in C.
  • UINT16 - 16 bit (2 byte) unsigned integer, also known as u16 in C.
  • UINT32 - 32 bit (4 byte) unsigned integer, also known as u32 in C.
  • UINT64 - 64 bit (8 byte) unsigned integer, also known as u64 in C.
  • BOOL or BOOLEAN - An unsigned 8 bit or 32 bit (depending on packet) integer whose value is always 0 (FALSE) or 1 (TRUE).
  • VOID - Data marked as VOID has no particular type or length. Where data is marked as VOID, additional information is given on its use.
  • FILETIME - A Windows struct, used to store filetime information. It can be read as a UINT64 or two UINT32s.

If the field is defined with square brackets, then this is an array of that type. For example, UINT32[] is an array of UINT32 values. The number of array elements should be specified in the format, or if not, is specified by the value of another field, often preceeding the variable-length array of fields.

"UINT32-strings"

Some data which may at first appear to be strings are in fact UINT32s; product & platform identification codes, for example. Since all data is little-endian, on little-endian systems this can be specified by the platform-dependant 'ABCD' code in C, for instance. On the wire, the value appears in reverse of what is written/should be interpreted due to the endian.

Examples of "UINT32-string" values seen throughout Battle.net's protocol:

Packet Field Example value(s)
C>S 0x50 SID_AUTH_INFO Platform 'IX86'
C>S 0x50 SID_AUTH_INFO Product 'SEXP'
C>S 0x50 SID_AUTH_INFO Language 'enUS'
all clan packets Clan Tag 'ABC\0'
S>C 0x05 PKT_SERVERPING UDP Code 'bnet'
S>C 0x44 SID_WARCRAFTGENERAL Ladder Type 'SOLO'

Common fields

Sizes and information of other fields commonly seen on Battle.net.

Item Max. Length (bytes) Notes
Username 15 Appended characters to enforce unique usernames (ex. #2) can increase the length of a username by 3 characters. In addition, Diablo II can have very long usernames, due to characters names/realms. The format is "Character@Realm*Username@Realm" and the length for these are [15]@[6]*[18]@6. This results in a maximum possible username length, as received from Battle.net, of 48 characters. Official Blizzard clients assign a 64-character variable for usernames, so the use of a variable of at least that length is advisable for future compatibility. When creating an account, any username longer than 15 characters is truncated.
Character name 15
Channel name 31 Any channel name whose length exceeds this value is truncated.
CD-Key owner 15 Any key owner whose length exceeds this value is truncated.
Statstring 128 A series of mostly numeric values usually separated by a single space character.
Chat text 224 This is the maximum for game clients. Chat clients can receive up to 255 bytes of chat text. This includes the null terminator. Longer text is truncated.
| Edited: Sixen
Comments
xpeh

>Please also note that Battle.net only Unicode-encodes strings for Starcraft and Brood War.

It's a little outdated, at least Warcraft 3 uses UTF-8. In addition, unicode support in Starcraft is broken, text is always encoded/decoded using cp1252<->utf8 schema, that's why utf-8 encoded text will be broken for all OSes that don't have locale set to cp1252 (Westeuropean). Because of that, using of non-ascii symbols in converstaion between game and non-game client with non-cp1252 OS locale is impossible.

You should really add last change date to pages :)

Caaaaarrrrlll

Changes to documents, news posts, packets, and servers are now being tracked, as part of the new BNETDocs Phoenix website.

This includes timestamps and content of before and after. :)

I will see about adding that information to the page template so it's easily viewable.