|
|
@ -1,25 +1,26 @@ |
|
|
# Packet Structure |
|
|
# Packet Structure |
|
|
|
|
|
|
|
|
| Field | Size (bytes) | Description | |
|
|
| Field | Size (bytes) | Description | |
|
|
|--------------|------------------------|-------------| |
|
|
|----------|----------------------------------|-----------------------------------------------------------| |
|
|
| `header` | 1 | Contains routing type, payload type, and payload version. | |
|
|
| header | 1 | Contains routing type, payload type, and payload version. | |
|
|
| `payload_len` | 2 | Length of the payload in bytes. | |
|
|
| path_len | 1 | Length of the path field in bytes. | |
|
|
| `path_len` | 2 | Length of the path field in bytes. | |
|
|
| path | up to 64 (`MAX_PATH_SIZE`) | Stores the routing path if applicable. | |
|
|
| `path` | `MAX_PATH_SIZE` | Stores the routing path if applicable. | |
|
|
| payload | up to 184 (`MAX_PACKET_PAYLOAD`) | The actual data being transmitted. | |
|
|
| `payload` | `MAX_PACKET_PAYLOAD` | The actual data being transmitted. | |
|
|
|
|
|
|
|
|
Note: see the [payloads doc](./payloads.md) for more information about the content of payload. |
|
|
|
|
|
|
|
|
## Header Breakdown |
|
|
## Header Breakdown |
|
|
|
|
|
|
|
|
| Bits | Mask | Field | Description | |
|
|
| Bits | Mask | Field | Description | |
|
|
|-------|---------------|----------------|-------------| |
|
|
|-------|--------|-----------------|-----------------------------------------------| |
|
|
| 0-1 | `0x03` | Route Type | Specifies the routing type (Flood, Direct, Reserved). | |
|
|
| 0-1 | `0x03` | Route Type | Flood, Direct, Reserved - see below. | |
|
|
| 2-5 | `0x0F` | Payload Type | Specifies the type of payload (Request, Response, Text, ACK, etc.). | |
|
|
| 2-5 | `0x0F` | Payload Type | Request, Response, ACK, etc. - see below. | |
|
|
| 6-7 | `0x03` | Payload Version | Versioning of the payload format. | |
|
|
| 6-7 | `0x03` | Payload Version | Versioning of the payload format - see below. | |
|
|
|
|
|
|
|
|
## Route Type Values |
|
|
## Route Type Values |
|
|
|
|
|
|
|
|
| Value | Name | Description | |
|
|
| Value | Name | Description | |
|
|
|--------|-------------------------|-------------| |
|
|
|--------|------------------------|--------------------------------------| |
|
|
| `0x00` | `ROUTE_TYPE_RESERVED1` | Reserved for future use. | |
|
|
| `0x00` | `ROUTE_TYPE_RESERVED1` | Reserved for future use. | |
|
|
| `0x01` | `ROUTE_TYPE_FLOOD` | Flood routing mode (builds up path). | |
|
|
| `0x01` | `ROUTE_TYPE_FLOOD` | Flood routing mode (builds up path). | |
|
|
| `0x02` | `ROUTE_TYPE_DIRECT` | Direct route (path is supplied). | |
|
|
| `0x02` | `ROUTE_TYPE_DIRECT` | Direct route (path is supplied). | |
|
|
@ -28,7 +29,7 @@ |
|
|
## Payload Type Values |
|
|
## Payload Type Values |
|
|
|
|
|
|
|
|
| Value | Name | Description | |
|
|
| Value | Name | Description | |
|
|
|--------|-------------------------|-------------| |
|
|
|--------|---------------------------|-----------------------------------------------| |
|
|
| `0x00` | `PAYLOAD_TYPE_REQ` | Request (destination/source hashes + MAC). | |
|
|
| `0x00` | `PAYLOAD_TYPE_REQ` | Request (destination/source hashes + MAC). | |
|
|
| `0x01` | `PAYLOAD_TYPE_RESPONSE` | Response to REQ or ANON_REQ. | |
|
|
| `0x01` | `PAYLOAD_TYPE_RESPONSE` | Response to REQ or ANON_REQ. | |
|
|
| `0x02` | `PAYLOAD_TYPE_TXT_MSG` | Plain text message. | |
|
|
| `0x02` | `PAYLOAD_TYPE_TXT_MSG` | Plain text message. | |
|
|
@ -42,9 +43,9 @@ |
|
|
|
|
|
|
|
|
## Payload Version Values |
|
|
## Payload Version Values |
|
|
|
|
|
|
|
|
| Value | Name | Description | |
|
|
| Value | Version | Description | |
|
|
|--------|---------------|-------------| |
|
|
|--------|---------|---------------------------------------------------| |
|
|
| `0x00` | `PAYLOAD_VER_1` | 1-byte src/dest hashes, 2-byte MAC. | |
|
|
| `0x00` | 1 | 1-byte src/dest hashes, 2-byte MAC. | |
|
|
| `0x01` | `PAYLOAD_VER_2` | Future version (e.g., 2-byte hashes, 4-byte MAC). | |
|
|
| `0x01` | 2 | Future version (e.g., 2-byte hashes, 4-byte MAC). | |
|
|
| `0x02` | `PAYLOAD_VER_3` | Future version. | |
|
|
| `0x02` | 3 | Future version. | |
|
|
| `0x03` | `PAYLOAD_VER_4` | Future version. | |
|
|
| `0x03` | 4 | Future version. | |
|
|
|