User Tools

Site Tools


mosh:protocol_details

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mosh:protocol_details [2026/05/02 03:07] – [Overview] moshmosh:protocol_details [2026/06/10 13:54] (current) mosh
Line 1: Line 1:
 +<WRAP important>
 +This page is retained for historical reference and may not reflect the current MOSH/IMC/MTRP architecture.
 +See [[guide:architecture_map]] for the current model.
 +</WRAP>
 ====== MOSH Protocol Specification (v1 Draft) ====== ====== MOSH Protocol Specification (v1 Draft) ======
  
 ===== Overview ===== ===== Overview =====
-MOSH (Modern Offline Smart Home) is a lightweight, transport-agnostic messaging protocol designed for embedded systems and distributed smart-home environments. 
- 
-The protocol is optimized for: 
-  * Small microcontrollers (e.g., ATmega128) 
-  * Deterministic parsing 
-  * Minimal memory usage 
-  * Transport independence (nRF24, ESP-NOW, UART, etc.) 
-  * Decentralized operation (no required central coordinator) 
  
 MOSH separates responsibilities into: MOSH separates responsibilities into:
-  * [[mosh:protocol:layers:core|Core Layer]]+  * [[mosh:protocol:layers:core|Core System]] 
 +    * [[mosh:protocol:layers:core:element_manager|Element Manager]] 
 +    * [[mosh:protocol:layers:core:message_router|Message Router]] 
 +    * [[mosh:protocol:layers:core:node_manager|Node Manager]] 
 +    * [[mosh:protocol:layers:core:state_manager|State Manager]] 
 +    * [[mosh:protocol:layers:core:system_services|System Services]]
     * [[mosh:protocol:layers:core:transport_manager|Transport Manager]]     * [[mosh:protocol:layers:core:transport_manager|Transport Manager]]
-    * [[mosh:protocol:layers:core:transport_manager|Node Manager]] +    * [[mosh:protocol:layers:core:trust_manager|Trust Manager]] 
-    * [[mosh:protocol:layers:core:transport_manager|Element Manager]] +    * [[mosh:protocol:layers:core:vwire_manager|Virtual Wire Manager]] 
-    * [[mosh:protocol:layers:core:transport_manager|Virtual Wire Manager]] +
-  * [[mosh:protocol:layers:state|State Layer]] +
-    * [[mosh:protocol:layers:state:state_manager|State Manager]]+
   * [[mosh:protocol:layers:transport|Transport Layer]]   * [[mosh:protocol:layers:transport|Transport Layer]]
 +    * [[mosh:protocol:layers:transport:addressing|Addressing]]
 +    * [[mosh:protocol:layers:transport:duplicate_detection|Duplicate Detection]]
     * [[mosh:protocol:layers:transport:framing|Framing]]     * [[mosh:protocol:layers:transport:framing|Framing]]
     * [[mosh:protocol:layers:transport:fragmentation|Fragmentation]]     * [[mosh:protocol:layers:transport:fragmentation|Fragmentation]]
-    * [[mosh:protocol:layers:transport:reliability|Delivery]]+    * [[mosh:protocol:layers:transport:medium_adapter|Medium Adapter]]
     * [[mosh:protocol:layers:transport:reliability|Reliability]]     * [[mosh:protocol:layers:transport:reliability|Reliability]]
------ +    * [[mosh:protocol:layers:transport:ttl_hop_handling|TTL/Hop Handling]]
- +
-===== Frame Structure ===== +
- +
-A MOSH frame is a maximum 1470 bytes. Depending on the transport, frames can/will be segmented if the frames length is longer than the [[.:transports:transport_maximums|transport maximum]]. +
- +
-All MOSH packets follow this structure: +
- +
-| Header (12 Btyes) | +
-| Payload | +
-| Footer (CRC16) (2 Bytes) | +
- +
- +
-===== Header Layout (12 Bytes) ===== +
- +
-^ Field                 ^ Length (Bytes) ^ Description ^ +
-| Start of Frame       | 1   | Fixed marker for frame synchronization | +
-| TTL                  | 1   | Time-to-live (decremented on forwarding) | +
-| Message ID           | 2   | Unique ID per message (for ACK/retry/dedupe) | +
-| Version + Flags      | 1   | Upper 4 bits = protocol version, lower 4 bits = flags | +
-| Source Address       | 2   | 6-bit Network ID + 10-bit Node ID | +
-| Destination Address  | 2   | 6-bit Network ID + 10-bit Node ID | +
-| Context              | 1   | Message domain (SYSTEM/NODE/ELEMENT/VWIRE) | +
-| Op Code              | 1   | Operation within context | +
-| Payload Length       | 1   | Length of payload in bytes | +
- +
-===== Footer (2 Bytes) ===== +
- +
-^ Field ^ Size (Bytes) ^ Description ^ +
-| CRC16 | 2   | Frame integrity check | +
- +
------ +
- +
-===== Version and Flags ===== +
- +
-==== Version (Upper Nibble) ==== +
-Protocol version (0–15). +
- +
-==== Flags (Lower Nibble) ==== +
- +
-^ Bit ^ Name          ^ Description ^ +
-| 0   | ACK_REQUIRED  | Sender requests acknowledgment | +
-| 1   | ACK           | Frame is an acknowledgment     +
-| 2   | IS_RETRY      | Frame is a retransmission      | +
-| 3   | RESERVED      | Reserved for future use        | +
- +
------ +
- +
-===== Addressing ===== +
- +
-Each address field is 16 bits: +
-[ Network ID (6 bits) | Node ID (10 bits) ] +
- +
- +
-==== Network ID ==== +
-  Range: 0–63 +
-  * Used to segment MOSH domains +
- +
-==== Node ID ==== +
-  * Range: 0–1023 +
-  * Unique within a network +
- +
------ +
- +
-===== Context and Op Codes ===== +
- +
-The Context byte determines which core manager processes the payload. +
- +
-^ Value ^ Context  ^ Description ^ +
-| 0     [[mosh:protocol:op_codes:system_op_codes|Core]]   | Core/system messages (discovery, sync, error) | +
-| 1     | [[mosh:protocol:op_codes:node_op_codes|Node]]       | Node-level operations | +
-| 2     | [[mosh:protocol:op_codes:element_op_codes|Element]] | Element-level operations | +
-| 3     | [[mosh:protocol:op_codes:vwire_op_codes|VWire]]     | Virtual wire messaging | +
-| 4–7   | RESERVED | Future expansion | +
- +
------ +
- +
- +
- +
- +
- +
- +
-===== Payload ===== +
- +
-The payload format will vary based on the various [[mosh:protocol:message_library|message types]]. +
- +
-The transport layer does not interpret payload contents. +
- +
------ +
- +
-===== Footer (CRC16) ===== +
-16-bit error detection code generated per frame +
------ +
  
 +  * [[mosh:protocol:layers:platform_hal|Platform Hardware Abstraction Layer (HAL)]]
 +    * [[mosh:protocol:layers:platform_hal:logging|Logging]]
 +    * [[mosh:protocol:layers:platform_hal:random_entropy|Random/Entropy]]
 +    * [[mosh:protocol:layers:platform_hal:time|Time]]
 +    * [[mosh:protocol:layers:platform_hal:transport_drivers|Transport Drivers]]
  
  
/var/www/wiki.moshnetworks.com/data/attic/mosh/protocol_details.1777691224.txt.gz · Last modified: by mosh

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki