| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | syntax = "proto3";
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-17 11:03:10 +00:00
										 |  |  | package meshtastic;
 | 
					
						
							| 
									
										
										
										
											2021-05-24 00:31:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-06 16:14:04 +00:00
										 |  |  | option csharp_namespace = "Meshtastic.Protobufs";
 | 
					
						
							| 
									
										
										
										
											2023-05-20 09:29:34 +00:00
										 |  |  | option go_package = "github.com/meshtastic/go/generated";
 | 
					
						
							|  |  |  | option java_outer_classname = "ChannelProtos";
 | 
					
						
							|  |  |  | option java_package = "com.geeksville.mesh";
 | 
					
						
							| 
									
										
										
										
											2023-01-21 15:26:47 +00:00
										 |  |  | option swift_prefix = "";
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:43:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2023-04-03 21:23:45 +00:00
										 |  |  |  * This information can be encoded as a QRcode/url so that other users can configure
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |  * their radio to join the same channel.
 | 
					
						
							| 
									
										
										
										
											2023-04-03 21:23:45 +00:00
										 |  |  |  * A note about how channel names are shown to users: channelname-X
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |  * poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
 | 
					
						
							|  |  |  |  * Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
 | 
					
						
							|  |  |  |  * channel - so that if the user changes anything about the channel (which does
 | 
					
						
							|  |  |  |  * force a new PSK) this letter will also change. Thus preventing user confusion if
 | 
					
						
							|  |  |  |  * two friends try to type in a channel name of "BobsChan" and then can't talk
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |  * because their PSKs will be different.
 | 
					
						
							|  |  |  |  * The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |  * This also allows the option of someday if people have the PSK off (zero), the
 | 
					
						
							|  |  |  |  * users COULD type in a channel name and be able to talk.
 | 
					
						
							|  |  |  |  * FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |  * FIXME: explain how apps use channels for security.
 | 
					
						
							|  |  |  |  * explain how remote settings and remote gpio are managed as an example
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |  */
 | 
					
						
							|  |  |  | message ChannelSettings {
 | 
					
						
							| 
									
										
										
										
											2023-07-26 00:09:08 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * Deprecated in favor of LoraConfig.channel_num
 | 
					
						
							|  |  |  |    */
 | 
					
						
							|  |  |  |   uint32 channel_num = 1 [deprecated = true];
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |   /*
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * A simple pre-shared key for now for crypto.
 | 
					
						
							|  |  |  |    * Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    * A special shorthand is used for 1 byte long psks.
 | 
					
						
							|  |  |  |    * These psks should be treated as only minimally secure,
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * because they are listed in this source code.
 | 
					
						
							|  |  |  |    * Those bytes are mapped using the following scheme:
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |    * `0` = No crypto
 | 
					
						
							| 
									
										
										
										
											2023-04-03 21:23:45 +00:00
										 |  |  |    * `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0x01}
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * `2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
 | 
					
						
							|  |  |  |    * Shown to user as simple1 through 10
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:13:54 +00:00
										 |  |  |   bytes psk = 2;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * A SHORT name that will be packed into the URL.
 | 
					
						
							|  |  |  |    * Less than 12 bytes.
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    * Something for end users to call the channel
 | 
					
						
							|  |  |  |    * If this is the empty string it is assumed that this channel
 | 
					
						
							|  |  |  |    * is the special (minimally secure) "Default"channel.
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * In user interfaces it should be rendered as a local language translation of "X".
 | 
					
						
							|  |  |  |    * For channel_num hashing empty string will be treated as "X".
 | 
					
						
							| 
									
										
										
										
											2022-05-07 09:28:54 +00:00
										 |  |  |    * Where "X" is selected based on the English words listed above for ModemPreset
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:13:54 +00:00
										 |  |  |   string name = 3;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * Used to construct a globally unique channel ID.
 | 
					
						
							|  |  |  |    * The full globally unique ID will be: "name.id" where ID is shown as base36.
 | 
					
						
							|  |  |  |    * Assuming that the number of meshtastic users is below 20K (true for a long time)
 | 
					
						
							|  |  |  |    * the chance of this 64 bit random number colliding with anyone else is super low.
 | 
					
						
							|  |  |  |    * And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    * try multiple candidate channels.
 | 
					
						
							|  |  |  |    * Any time a non wire compatible change is made to a channel, this field should be regenerated.
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * There are a small number of 'special' globally known (and fairly) insecure standard channels.
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    * Those channels do not have a numeric id included in the settings, but instead it is pulled from
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * a table of well known IDs.
 | 
					
						
							|  |  |  |    * (see Well Known Channels FIXME)
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:13:54 +00:00
										 |  |  |   fixed32 id = 4;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:13:54 +00:00
										 |  |  |   bool uplink_enabled = 5;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * If true, messages seen on the internet will be forwarded to the local mesh.
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:13:54 +00:00
										 |  |  |   bool downlink_enabled = 6;
 | 
					
						
							| 
									
										
										
										
											2024-02-22 06:31:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * Per-channel module settings.
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2024-03-29 09:23:22 +00:00
										 |  |  |   ModuleSettings module_settings = 7;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-21 21:13:54 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This message is specifically for modules to store per-channel configuration data.
 | 
					
						
							|  |  |  |  */
 | 
					
						
							|  |  |  | message ModuleSettings {
 | 
					
						
							| 
									
										
										
										
											2024-03-29 09:23:22 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * Bits of precision for the location sent in position packets.
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2024-02-21 21:13:54 +00:00
										 |  |  |   uint32 position_precision = 1;
 | 
					
						
							| 
									
										
										
										
											2024-04-30 00:35:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * Controls whether or not the phone / clients should mute the current channel
 | 
					
						
							|  |  |  |    * Useful for noisy public channels you don't necessarily want to disable
 | 
					
						
							|  |  |  |    */
 | 
					
						
							|  |  |  |   bool is_client_muted = 2;
 | 
					
						
							| 
									
										
										
										
											2024-02-21 21:13:54 +00:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * A pair of a channel number, mode and the (sharable) settings for that channel
 | 
					
						
							|  |  |  |  */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | message Channel {
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * How this channel is being used (or not).
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * Note: this field is an enum to give us options for the future.
 | 
					
						
							|  |  |  |    * In particular, someday we might make a 'SCANNING' option.
 | 
					
						
							|  |  |  |    * SCANNING channels could have different frequencies and the radio would
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |    * occasionally check that freq to see if anything is being transmitted.
 | 
					
						
							|  |  |  |    * For devices that have multiple physical radios attached, we could keep multiple PRIMARY/SCANNING channels active at once to allow
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |    * cross band routing as needed.
 | 
					
						
							|  |  |  |    * If a device has only a single radio (the common case) only one channel can be PRIMARY at a time
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |    * (but any number of SECONDARY channels can't be sent received on that common frequency)
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |   enum Role {
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |     /*
 | 
					
						
							|  |  |  |      * This channel is not in use right now
 | 
					
						
							|  |  |  |      */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |     DISABLED = 0;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |     /*
 | 
					
						
							|  |  |  |      * This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY
 | 
					
						
							|  |  |  |      */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |     PRIMARY = 1;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |     /*
 | 
					
						
							| 
									
										
										
										
											2021-04-20 09:08:28 +00:00
										 |  |  |      * Secondary channels are only used for encryption/decryption/authentication purposes.
 | 
					
						
							| 
									
										
										
										
											2021-11-30 19:45:01 +00:00
										 |  |  |      * Their radio settings (freq etc) are ignored, only psk is used.
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |      */
 | 
					
						
							|  |  |  |     SECONDARY = 2;
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1)
 | 
					
						
							| 
									
										
										
										
											2021-11-30 19:45:01 +00:00
										 |  |  |    * (Someday - not currently implemented) An index of -1 could be used to mean "set by name",
 | 
					
						
							|  |  |  |    * in which case the target node will find and set the channel by settings.name.
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2021-03-11 02:40:33 +00:00
										 |  |  |   int32 index = 1;
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 08:28:48 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * The new settings, or NULL to disable that channel
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |   ChannelSettings settings = 2;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-21 07:48:42 +00:00
										 |  |  |   /*
 | 
					
						
							|  |  |  |    * TODO: REPLACE
 | 
					
						
							|  |  |  |    */
 | 
					
						
							| 
									
										
										
										
											2021-02-27 05:16:43 +00:00
										 |  |  |   Role role = 3;
 | 
					
						
							| 
									
										
										
										
											2024-02-21 21:13:54 +00:00
										 |  |  | }
 |