Skip to content
Youx edited this page Sep 13, 2010 · 12 revisions

Types of packets

The first two bytes indicate the type of packet :

The next two bytes (in a control packet) indicate the function of the packet

Checksums

Some of the packets have a checksum field. The checksum field is a 32 bit integer. You can get an implementation of the crc32 function from zlib sources.

You have to do the checksum of the whole packet, with the checksum left nulled, then copy the checksum into the field.

Endianness

All the integers of 16 and 32 bits are transmitted as little endian (x86), for example 0×1234 (4660 base ten) would be transmitted as 0×3412, and 0×12345678 (305419896 base ten) as 0×78563412.

For more details on endianness, see Wikipedia

Glib provides some nice C macros to change endianness Glib reference for endianness

Clone this wiki locally