-
Notifications
You must be signed in to change notification settings - Fork 0
04 Autonomous Routing and Policy Engine
Corresponding Specifications:
sys-arch/03-transport-routing-policy-engine-architecture.md,sys-arch/12-multipath-networking-architecture.md
Key Crates:crates/siar-routing-policy,crates/siar-routing,crates/siar-connectivity
Unlike traditional IP routers that route solely on minimum hop counts or static OSPF costs, SIAR evaluates paths dynamically across six real-time physical dimensions:
| Metric Dimension | Notation | Weight ( |
Description |
|---|---|---|---|
| Latency ( |
Milliseconds ( |
Medium | Round-trip time (RTT) measured via micro-probes. |
| Bandwidth ( |
Megabits/sec ( |
Medium | Available link throughput capacity. |
| Energy Cost ( |
Milliwatts ( |
High (on battery) | Energy drain of radio interface (BLE vs Wi-Fi vs Cellular). |
| Packet Delivery Ratio ( |
Fraction ( |
High | Historical delivery success over last 60 seconds. |
| Financial Cost ( |
Score ( |
High | Metered cellular data ( |
| Link Stability ( |
Contact Duration ( |
Medium | Expected time before peer moves out of physical radio range. |
graph TD
InboundFrame[Inbound Outbox Message] --> Classify{Traffic Class}
Classify -->|Emergency SOS| ForceBroadcast[Low-Power Multi-Radio Flood]
Classify -->|Realtime Voice/Call| LowLatency[Opt for LAN / Wi-Fi Aware / Lowest RTT]
Classify -->|Large File Blob| HighBandwidth[Opt for Unmetered Wi-Fi / LAN / Batch DTN]
Classify -->|Standard Text Chat| LowEnergy[Opt for BLE Mesh / Opportunistic Mule]
LowLatency --> PathScorer[Dynamic Path Scorer]
HighBandwidth --> PathScorer
LowEnergy --> PathScorer
PathScorer --> Dispatch[Radio Link Dispatcher]
The LinkHealthMonitor in siar-routing-policy maintains active telemetry for each peer link:
pub struct LinkMetrics {
pub rtt_ms: u32,
pub smoothed_rtt_ms: u32,
pub packet_loss_rate: f32,
pub tx_bytes_per_sec: u64,
pub rx_bytes_per_sec: u64,
pub last_seen: Instant,
pub is_metered: bool,
pub signal_rssi: Option<i8>,
}- Active Probes: Lightweight 32-byte keepalive pings sent on high-bandwidth links every 5–15 seconds.
- Passive Probes: Piggyback telemetry on routine message ACKs and DTN custody signals to conserve radio airtime.
-
Degradation Detection: If packet loss exceeds 25% or RSSI drops below -85 dBm, the link is flagged as
Degradedand the scheduler switches traffic to a standby warm path in$< 50\text{ms}$ .
SIAR's multipath engine avoids single-point-of-failure routing by maintaining primary, secondary, and fallback routes simultaneously:
[Outbox Dispatcher]
|
+---> [Active Path: Wi-Fi Direct] (Primary: High Throughput)
|
+---> [Standby Path: BLE GATT] (Warm Backup: Zero-Setup Failover)
|
+---> [Cold Path: DTN Relay] (Asynchronous Storage Queue)
- Warm Failover: If the Wi-Fi Direct socket disconnects due to physical distance, outgoing frames instantly divert to the active BLE connection without application-layer timeouts.
- Deduplication Barrier: Monotonic sequence IDs and message hashes ensure that if duplicate frames arrive over multiple paths, the destination storage layer idempotently acknowledges and ignores copies.
To prevent route flapping and handle intermittent links gracefully:
-
Stickiness & Hysteresis (
HysteresisPolicy): Requires candidate routes to exceed the current active route's score by a minimum threshold margin (e.g. 15%) before triggering a switch, avoiding wasteful connection thrashing. -
Exponential Retry Backoff (
RetryPolicy): Failed transmission attempts incur randomized exponential backoff with jitter to protect congested mesh airwaves. -
Priority-Fair Dispatch Queue (
RouteDispatchQueue): Combines traffic classification (SOS > Voice > Messages > Blobs) with fair queue scheduling (FairSchedulerfromsiar-protocol-ext), ensuring critical signaling always preempts bulk transfers. -
Pooled Socket Multiplexing:
siar-transportmanages pooled peer connections so that high-volume message exchanges reuse existing multiplexed streams instead of incurring round-trip handshake penalties on each packet.
SIAR — Survivable Identity & Autonomous Routing
Open Source Mesh & DTN Communications Platform | Dual Licensed under MIT / Apache-2.0 / Commercial
Documentation Index • GitHub Repository • System Specifications
- 04-Autonomous-Routing-and-Policy-Engine
- 05-Proximity-and-Hardware-Transports
- 06-Delay-Tolerant-Networking-and-Bundle-Forwarding
- 07-Battery-Aware-Scheduling-and-Emergency-Mesh
- 08-Offline-Event-Log-and-Outbox-Engine
- 09-Robust-Blob-Storage-and-Chunk-Transfers
- 10-Crash-Recovery-and-Data-Portability
- 11-Realtime-Audio-Video-Calling-Architecture
- 12-Cross-Platform-Client-Architecture
- 13-Messaging-Timeline-Composer-and-Inbox
- 14-Contacts-Groups-and-Security-Center
- 15-Nearby-Discovery-and-Out-of-Band-Pairing
- 16-Notifications-Presence-and-Background-Lifecycle
- 17-Local-Knowledge-Retrieval-and-Search
- 25-Design-System-Tokens-and-Responsive-Layouts
- 26-UI-UX-Performance-Testing-and-Quality-Gates
- 18-Protocol-Extensions-and-WASM-Plugins
- 19-Headless-Daemons-and-Embedded-Nodes
- 20-C-ABI-FFI-and-Native-Language-Bindings
- 21-Testing-Fuzzing-and-Network-Diagnostics
- 22-Getting-Started-and-Developer-Guide
- 23-Off-Grid-Survival-and-Field-Operations-Guide
- 24-System-Comparison-and-Benchmarking