2.2 Message Syntax
The protocol is composed of, and driven by, message exchanges between peers in the following categories:
Connection negotiation: request, response
Data transfer
The two connection negotiation messages are exchanged exactly once as the first two messages on a connection. Following that successful exchange, data transfer messages are exchanged in an arbitrary peer-to-peer fashion, under control of an upper layer. Contained in each data transfer message body is optional upper-layer data. A message is therefore of variable length, with the total length depending on the type of message and any upper-layer payload.
Unless otherwise specified, multiple-byte fields (16-bit, 32-bit, and 64-bit fields) in any message MUST be transmitted in little-endian order (least-significant byte first).
Unless otherwise specified, numeric fields in any message are unsigned integers of the specified byte length.
Unless otherwise specified, fields marked as "Reserved" in any message SHOULD be set to 0 when being sent and MUST be ignored when received. These fields MUST NOT be used for implementation-specific functionality.
When it is necessary to insert padding bytes in after any message for data alignment purposes, such bytes SHOULD be set to 0 when being sent and MUST be ignored when received.