Difference between revisions of "Packet Layout"
Jump to navigation
Jump to search
Which Linden (talk | contribs) (Corrected because in 1.18 the message numbers are in the template.) |
(added reference to AW Grojupies documentation) |
||
Line 42: | Line 42: | ||
See also: [http://www.libsecondlife.org/wiki/Protocol_%28network%29 libsecondlife documentation] | See also: | ||
:[http://www.libsecondlife.org/wiki/Protocol_%28network%29 libsecondlife documentation] | |||
:[[AW_Groupies#Documenting_current_protocols|AW Groupies documentation]] |
Revision as of 07:04, 25 February 2008
Header (Packet ID)
+-+-+-+-+----+--------+--------+--------+--------+--------+-----...-----+ |Z|R|R|A| | | | Extra | |E|E|E|C| | Sequence number (4 bytes) | Extra | Header | |R|L|S|K| | | (byte) | (N bytes) | +-+-+-+-+----+--------+--------+--------+--------+--------+-----...-----+
- Byte 0 Flags
- LL_ZERO_CODE_FLAG 0x80 -- 0's in packet body are run length encoded, such that series of 1 to 255 zero bytes are encoded to take 2 bytes.
- LL_RELIABLE_FLAG 0x40 -- This packet was sent reliably (implies please ack this packet)
- LL_RESENT_FLAG 0x20 -- This packet is a resend from the source.
- LL_ACK_FLAG 0x10 -- This packet contains appended acks.
- Byte 0, 4 least significant bits: currently unused
- Bytes 1-4: Sequence number
- Byte 5: How many bytes of extra header is available
If byte 5 is non-zero, then there is some extra header information. Clients which are not expecting that header information may skip it by jumping forward 'Extra' bytes into the message payload.
The term "Packet ID" is sometimes used to refer to all 4 bytes and sometimes just the sequence number.
For further discussion of the bits in the header, see Messages and Packet Accounting
Body
- Bytes 6+extra to 6+extra+(data length)
- Message number. This is a numeric encoding of the message types defined in the message_template.msg file. It may be 1, 2 or 4 bytes in length, depending on the message frequency (High, Medium, Low or Fixed).
- High frequency messages are assigned (from the template file) numbers 0x01 - 0xFE.
- Medium frequency messages are assigned (derived from numbers in the template file) numbers 0xFF01 - 0xFFFE.
- Low frequency messages are assigned (derived from numbers in the template file) numbers 0xFFFF0001 and up.
- Messages with "Fixed" frequency are really those with fixed message numbers, i.e. the numbers are assigned in the message_template.msg file itself. There are currently 6 of these, 0xFFFFFFFA - 0xFFFFFFFF. Even though all messages have numbers assigned to them in the template file, the Fixed frequency is kept around for legacy reasons.
- Message data. This is different for each message type, and is defined in the message_template.msg file. A message template defines one or more blocks. The block names in the template are for human readers; they are not encoded in the message. If a block is marked Variable, one byte is stored in the message indicating how many times that block has been repeated. For blocks marked single or multiple, no block header bytes are added.
- Message number. This is a numeric encoding of the message types defined in the message_template.msg file. It may be 1, 2 or 4 bytes in length, depending on the message frequency (High, Medium, Low or Fixed).
Appended Acks
- Bytes 6+extra+(data length) thru acks
- Rest of packet is filled with as many acks from previous reliable messages as will fit.
See also: