@@ -10,13 +10,16 @@ Inside of each [meshcore packet](./packet_structure.md) is a payload, identified
1010*  Anonymous request.
1111*  Group text message (unverified).
1212*  Group datagram (unverified).
13+ *  Multi-part packet
1314*  Custom packet (raw bytes, custom encryption).
1415
15- This document defines the structure of each of these payload types
16+ This document defines the structure of each of these payload types.
17+ 
18+ NOTE: all 16 and 32-bit integer fields are Little Endian.
1619
1720## Important concepts:  
1821
19- *  Node/channel  hash: the first byte of the node or channel 's public key
22+ *  Node hash: the first byte of the node's public key
2023
2124# Node advertisement  
2225This kind of payload notifies receivers that a node exists, and gives information about the node
@@ -33,10 +36,10 @@ Appdata
3336|  Field         |  Size (bytes)    |  Description                                           | 
3437| ---------------| -----------------| -------------------------------------------------------| 
3538|  flags         |  1               |  specifies which of the fields are present, see below  | 
36- |  latitude      |  4                |  decimal latitude multiplied by 1000000, integer       | 
37- |  longitude     |  4                |  decimal longitude multiplied by 1000000, integer      | 
38- |  feature 1     |  2                |  reserved for future use                               | 
39- |  feature 2     |  2                |  reserved for future use                               | 
39+ |  latitude      |  4 (optional)     |  decimal latitude multiplied by 1000000, integer       | 
40+ |  longitude     |  4 (optional)     |  decimal longitude multiplied by 1000000, integer      | 
41+ |  feature 1     |  2  (optional)    |  reserved for future use                               | 
42+ |  feature 2     |  2  (optional)    |  reserved for future use                               | 
4043|  name          |  rest of appdata |  name of the node                                      | 
4144
4245Appdata Flags
@@ -46,6 +49,7 @@ Appdata Flags
4649|  ` 0x01 `  |  is chat node   |  advert is for a chat node             | 
4750|  ` 0x02 `  |  is repeater    |  advert is for a repeater              | 
4851|  ` 0x03 `  |  is room server |  advert is for a room server           | 
52+ |  ` 0x04 `  |  is sensor      |  advert is for a sensor server         | 
4953|  ` 0x10 `  |  has location   |  appdata contains lat/long information | 
5054|  ` 0x20 `  |  has feature 1  |  Reserved for future use.              | 
5155|  ` 0x40 `  |  has feature 2  |  Reserved for future use.              | 
@@ -92,13 +96,15 @@ Returned path messages provide a description of the route a packet took from the
9296
9397Request type
9498
95- |  Value  |  Name               |  Description                           | 
96- | --------| --------------------| ---------------------------------------| 
97- |  ` 0x01 `  |  get status         |  get status of repeater or room server | 
98- |  ` 0x02 `  |  keepalive          |  TODO | 
99- |  ` 0x03 `  |  get telemetry data |  TODO | 
99+ |  Value  |  Name                 |  Description                           | 
100+ | --------| ----------------------| ---------------------------------------| 
101+ |  ` 0x01 `  |  get stats            |  get stats of repeater or room server  | 
102+ |  ` 0x02 `  |  keepalive            |  (deprecated) | 
103+ |  ` 0x03 `  |  get telemetry data   |  TODO | 
104+ |  ` 0x04 `  |  get min,max,avg data |  sensor nodes - get min, max, average for given time span | 
105+ |  ` 0x05 `  |  get access list      |  get node's approved access list       | 
100106
101- ### Get status   
107+ ### Get stats   
102108
103109Gets information about the node, possibly including the following:
104110
@@ -121,10 +127,6 @@ Gets information about the node, possibly including the following:
121127*  Number posted (?)
122128*  Number of post pushes (?)
123129
124- ### Keepalive  
125- 
126- No-op request.
127- 
128130### Get telemetry data  
129131
130132Request data about sensors on the node, including battery level.
@@ -138,19 +140,19 @@ Request data about sensors on the node, including battery level.
138140
139141## Plain text message  
140142
141- |  Field        |  Size (bytes)    |  Description                                                  | 
142- | --------------| -----------------| --------------------------------------------------------------| 
143- |  timestamp    |  4               |  send time (unix timestamp)                                   | 
144- |  flags + TODO  |  1               |  first  six bits are flags (see below), last  two bits are TODO  | 
145- |  message      |  rest of payload |  the message content, see next table                          | 
143+ |  Field            |  Size (bytes)    |  Description                                                  | 
144+ | ----------------- | -----------------| --------------------------------------------------------------| 
145+ |  timestamp        |  4               |  send time (unix timestamp)                                   | 
146+ |  flags + attempt  |  1               |  upper  six bits are flags (see below), lower  two bits are attempt number (0..3)  | 
147+ |  message          |  rest of payload |  the message content, see next table                          | 
146148
147149Flags
148150
149151|  Value  |  Description               |  Message content                                            | 
150152| --------| ---------------------------| ------------------------------------------------------------| 
151153|  ` 0x00 `  |  plain text message        |  the plain text of the message                              | 
152154|  ` 0x01 `  |  CLI command               |  the command text of the message                            | 
153- |  ` 0x02 `  |  signed plain text message |  two  bytes of  sender prefix, followed by plain text message | 
155+ |  ` 0x02 `  |  signed plain text message |  first four  bytes is  sender pubkey  prefix, followed by plain text message | 
154156
155157# Anonymous request  
156158
@@ -166,14 +168,14 @@ Plaintext message
166168|  Field          |  Size (bytes)    |  Description                                                                   | 
167169| ----------------| -----------------| -------------------------------------------------------------------------------| 
168170|  timestamp      |  4               |  send time (unix timestamp)                                                    | 
169- |  sync timestamp |  4               |  for  room server, otherwise absent:  sender's "sync messages SINCE x" timestamp | 
171+ |  sync timestamp |  4               |  NOTE:  room server only! -  sender's "sync messages SINCE x" timestamp | 
170172|  password       |  rest of message |  password for repeater/room                                                    | 
171173
172174# Group text message / datagram  
173175
174176|  Field        |  Size (bytes)    |  Description                                | 
175177| --------------| -----------------| --------------------------------------------| 
176- |  channel hash |  1               |  the  first byte of the  channel's public  key |   
178+ |  channel hash |  1               |  first byte of SHA256 of  channel's shared  key   | 
177179|  cipher MAC   |  2               |  MAC for encrypted data in next field       | 
178180|  ciphertext   |  rest of payload |  encrypted message, see below for details   | 
179181
0 commit comments