2.2.3 MESSAGE_HEADER

The MESSAGE_HEADER is prefixed to all messages associated with this protocol. Messages can be one of two types: request-type or response-type as follows.

Request-type messages include MSG_NEGO_REQ (section 2.2.4.1), MSG_GETBLKLIST (section 2.2.4.2), MSG_GETBLKS (section 2.2.4.3), and MSG_GETSEGLIST (section 2.2.4.4). Request-type messages initiate a communication session between two peers. A request-type message can be delivered only as an HTTP request.

Response-type messages include MSG_NEGO_RESP (section 2.2.5.1), MSG_BLKLIST (section 2.2.5.2), MSG_BLK (section 2.2.5.3), and MSG_SEGLIST (section 2.2.5.4). Response-type messages are sent only in response to a Request-type message (see Protocol Details (section 3) for more details). A response-type message can be delivered only as an HTTP response to an incoming HTTP request.

The layout of the message header is as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

ProtVer

MsgType

MsgSize

CryptoAlgoId

ProtVer (4 bytes): Protocol version number, formed by concatenating the protocol major version number and protocol minor version number, encoded as follows (where MSB is Most Significant Byte and LSB is Least Significant Byte).

1st byte (Addr: X)

2nd byte (Addr: X+1)

3rd byte (Addr: X+2)

4th byte (Addr: X+3)

Minor version MSB

Minor version LSB

Major version MSB

Major version LSB

The major version number is encoded in the least significant word of the protocol version's DWORD.

The minor version number is encoded in the most significant word of the protocol version's DWORD.

Both the major and minor version number can express the version range of 0x0000 to 0xFFFF. The value of the ProtVer field is determined by the message type specified in the MsgType field, rather than the greatest version number supported by the client.

MsgType (4 bytes): The type of message in the message body, expressed as a binary integer. MUST be set to one of the following values.

Value

Meaning

MSG_NEGO_REQ

0x00000000

A protocol version negotiation request. The request declares the minimum and maximum version numbers supported by the requesting client-role peer.<2> To use the MSG_NEGO_REQ value, the value of the ProtVer field MUST be set to 1.0.

MSG_NEGO_RESP

0x00000001

A protocol version negotiation response. It is sent in response to any protocol version negotiation request or to any other request with protocol version not supported by the server-role peer.

The response declares the minimum and maximum version numbers supported by the responding server-role peer. To use the MSG_NEGO_RESP value, the value of the ProtVer field MUST be set to 1.0.

MSG_GETBLKLIST

0x00000002

A request for a list of block hashes of blocks in the target segment that are possessed by the destination server-role peer (list expressed as a block range array), and intersecting the list of block hashes specified in the request itself. To use the MSG_GETBLKLIST value, the value of the ProtVer field MUST be set to 1.0.

MSG_GETBLKS

0x00000003

A request for an array of block hashes (specified by a block range array). Since only one block will be returned, a MSG_GETBLKS message SHOULD specify only a single range containing only a single block. To use the MSG_GETBLKS value, the value of the ProtVer field MUST be set to 1.0.

MSG_BLKLIST

0x00000004

A response message containing a list of block hashes of blocks in the target segment that are possessed by the destination server-role peer (list expressed as a block range array), and intersecting the list of block hashes specified in the previous request from the client-role peer. To use the MSG_BLKLIST value, the value of the ProtVer field MUST be set to 1.0.

MSG_BLK

0x00000005

A response message containing the (first) actual block requested by the client-role peer via a block range array in a MSG_GETBLKLIST message. To use the MSG_BLK value, the value of the ProtVer field MUST be set to 1.0.

MSG_GETSEGLIST

0x0000006

A request for a list of segments IDs that are possessed by the destination server-role peer and intersecting the list of segments IDs specified in the request itself. To use the MSG_GETSEGLIST value, the value of the ProtVer field MUST be set to 2.0.

MSG_SEGLIST

0x0000007

A response message containing a list of segments IDs possessed by the destination server-role peer and intersecting the list of segment IDs in the previous request from the client-role peer. To use the MSG_SEGLIST value, the value of the ProtVer field MUST be set to 2.0.

MsgSize (4 bytes): Protocol message total size including the MESSAGE_HEADER, but not including the TRANSPORT_RESPONSE_HEADER. The valid range of the total message size MUST be from 16 bytes to 98,304 bytes (or 96 KB) for request messages, or from 16 bytes to 393,216 bytes (or 384 KB) for response messages.

CryptoAlgoId (4 bytes): The encryption algorithm used by the server-role peer to encrypt data. In the request message to the server-role peer, the client-role peer SHOULD indicate AES_128 as the preferred encryption algorithm; however, the server-role peer can ignore this value. The CryptoAlgoId field MUST be set to one of the following values. Refer to [FIPS197] for the AES standard and [SP800-38A] for the supported block cipher modes listed in the following table.

Value

Meaning

0x00000000

No encryption.

AES_128

0x00000001

AES 128-bit, CBC-mode encryption.

AES_192

0x00000002

AES 192-bit, CBC-mode encryption.

AES_256

0x00000003

AES 256-bit, CBC-mode encryption.