diff --git a/docs/payloads.md b/docs/payloads.md index 5a41e69c..e23cbb83 100644 --- a/docs/payloads.md +++ b/docs/payloads.md @@ -11,7 +11,6 @@ Inside of each [meshcore packet](./packet_structure.md) is a payload, identified * Group text message (unverified). * Group datagram (unverified). * Multi-part packet -* Control data packet * Custom packet (raw bytes, custom encryption). This document defines the structure of each of these payload types. @@ -58,7 +57,7 @@ Appdata Flags # Acknowledgement -An acknowledgement that a message was received. Note that for returned path messages, an acknowledgement can be sent in the "extra" payload (see [Returned Path](#returned-path)) instead of as a separate ackowledgement packet. CLI commands do not cause acknowledgement responses, neither discrete nor extra. +An acknowledgement that a message was received. Note that for returned path messages, an acknowledgement will be sent in the "extra" payload (see [Returned Path](#returned-path)) and not as a discrete acknowledgement. CLI commands do not require an acknowledgement, neither discrete nor extra. | Field | Size (bytes) | Description | |----------|--------------|------------------------------------------------------------| @@ -141,13 +140,13 @@ Request data about sensors on the node, including battery level. ## Plain text message -| Field | Size (bytes) | Description | -|--------------------|-----------------|--------------------------------------------------------------| -| timestamp | 4 | send time (unix timestamp) | -| txt_type + attempt | 1 | upper six bits are txt_type (see below), lower two bits are attempt number (0..3) | -| message | rest of payload | the message content, see next table | +| Field | Size (bytes) | Description | +|-----------------|-----------------|--------------------------------------------------------------| +| timestamp | 4 | send time (unix timestamp) | +| flags + attempt | 1 | upper six bits are flags (see below), lower two bits are attempt number (0..3) | +| message | rest of payload | the message content, see next table | -txt_type +Flags | Value | Description | Message content | |--------|---------------------------|------------------------------------------------------------| @@ -164,20 +163,13 @@ txt_type | cipher MAC | 2 | MAC for encrypted data in next field | | ciphertext | rest of payload | encrypted message, see below for details | -## Room server login +Plaintext message | Field | Size (bytes) | Description | |----------------|-----------------|-------------------------------------------------------------------------------| -| timestamp | 4 | sender time (unix timestamp) | -| sync timestamp | 4 | sender's "sync messages SINCE x" timestamp | -| password | rest of message | password for room | - -## Repeater/Sensor login - -| Field | Size (bytes) | Description | -|----------------|-----------------|-------------------------------------------------------------------------------| -| timestamp | 4 | sender time (unix timestamp) | -| password | rest of message | password for repeater/sensor | +| timestamp | 4 | send time (unix timestamp) | +| sync timestamp | 4 | NOTE: room server only! - sender's "sync messages SINCE x" timestamp | +| password | rest of message | password for repeater/room | # Group text message / datagram @@ -190,32 +182,8 @@ txt_type The plaintext contained in the ciphertext matches the format described in [plain text message](#plain-text-message). Specifically, it consists of a four byte timestamp, a flags byte, and the message. The flags byte will generally be `0x00` because it is a "plain text message". The message will be of the form `: ` (eg., `user123: I'm on my way`). -# Control data - -| Field | Size (bytes) | Description | -|--------------|-----------------|--------------------------------------------| -| flags | 1 | upper 4 bits is sub_type | -| data | rest of payload | typically unencrypted data | - -## DISCOVER_REQ (sub_type) - -| Field | Size (bytes) | Description | -|--------------|-----------------|----------------------------------------------| -| flags | 1 | 0x8 (upper 4 bits), prefix_only (lowest bit) | -| type_filter | 1 | bit for each ADV_TYPE_* | -| tag | 4 | randomly generate by sender | -| since | 4 | (optional) epoch timestamp (0 by default) | - -## DISCOVER_RESP (sub_type) - -| Field | Size (bytes) | Description | -|--------------|-----------------|--------------------------------------------| -| flags | 1 | 0x9 (upper 4 bits), node_type (lower 4) | -| snr | 1 | signed, SNR*4 | -| tag | 4 | reflected back from DISCOVER_REQ | -| pubkey | 8 or 32 | node's ID (or prefix) | - +TODO: describe what datagram looks like # Custom packet -Custom packets have no defined format. \ No newline at end of file +Custom packets have no defined format.