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 ofSTRING
values. This is like an array ofSTRING
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 asu8
in C.UINT16
- 16 bit (2 byte) unsigned integer, also known asu16
in C.UINT32
- 32 bit (4 byte) unsigned integer, also known asu32
in C.UINT64
- 64 bit (8 byte) unsigned integer, also known asu64
in C.BOOL
orBOOLEAN
- An unsigned 8 bit or 32 bit (depending on packet) integer whose value is always 0 (FALSE) or 1 (TRUE).VOID
- Data marked asVOID
has no particular type or length. Where data is marked asVOID
, additional information is given on its use.FILETIME
- A Windows struct, used to store filetime information. It can be read as aUINT64
or twoUINT32
s.
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 UINT32
s; 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\x00 |
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 |
---|---|---|
Account name | 15 | When creating an account, names longer than 15 bytes are truncated by the server. |
Character name | 15 | |
Username | 64 | (a.k.a. online name) This string is a concatenation set by the server that follows the format: Character#Realm*w#Account#Serial#Realm . Note that prior to 2018, the format was: Character@Realm*w#Account#Serial@Realm The w# part of the string is normally not present, but can be seen in invisible fields when using WarCraft III accounts, such as the username field of an EID_INFO chat event.The Character#Realm* part of the string is present only when the client is connected as Diablo II or its expansion. In addition, Character#Realm is present only if the user is on a closed realm character, and is missing if using an open realm character; open realm usernames appear as *Account#Serial#Realm .The #Serial part of the string is added only when the account is logged on multiple times and needs a unique online name, it begins at 2 and is incremented until a number is available that is unique.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. |
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. |
Comments
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 :)
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.