Crate mavrouter

Crate mavrouter 

Source
Expand description

§mavrouter

High-performance, intelligent MAVLink router for embedded systems.

§Features

  • Intelligent Routing: Learns network topology, routes messages efficiently
  • Multi-Protocol: TCP, UDP, Serial support
  • Reliability: Automatic endpoint restart, deduplication, filtering
  • Performance: 50ns routing lookup, 34kHz+ throughput tested

§Quick Start

The simplest way to use mavrouter as a library is with the high-level Router API:

use mavrouter::Router;

// Start from a TOML string
let router = Router::from_str(r#"
    [[endpoint]]
    type = "udp"
    address = "0.0.0.0:14550"
    mode = "server"
"#).await?;

// Or from a configuration file
// let router = Router::from_file("mavrouter.toml").await?;

// Access the message bus to subscribe to messages
let mut rx = router.bus().subscribe();

// ... do your work ...

// Gracefully shut down
router.stop().await;

§Configuration

See config::Config for TOML configuration structure. You can also create configurations programmatically using config::Config::parse or the standard FromStr trait.

§Re-exported Dependencies

For convenience, commonly needed dependencies are re-exported:

§Architecture

  • Router: High-level API for starting and managing the router
  • router: Low-level message bus and routing primitives
  • routing: Intelligent routing table
  • endpoints: TCP/UDP/Serial endpoint implementations
  • filter: Per-endpoint message filtering
  • config: Configuration parsing and validation

Modules§

config
Router configuration and parsing utilities.
dedup
Message deduplication logic. Message deduplication logic for MAVLink messages.
endpoint_core
Core logic for generic endpoint operations. Core logic for MAVLink endpoints.
endpoints
Various MAVLink endpoint implementations (TCP, UDP, Serial, TLOG).
error
Custom error types for structured error handling. Custom error types for mavrouter-rs.
filter
Message filtering capabilities for endpoints. Message filtering logic for MAVLink messages based on various criteria.
framing
MAVLink message framing and parsing from byte streams. MAVLink framing and parsing utilities.
mavlink_utils
Utility functions for MAVLink message processing. MAVLink protocol utilities for target extraction and routing
router
Core message routing logic and types.
routing
Routing table implementation for MAVLink messages.
stats
Statistics history tracking and aggregation. Statistics history tracking for MAVLink router.

Structs§

CancellationToken
Re-export of tokio_util::sync::CancellationToken for graceful shutdown control. A token which can be used to signal a cancellation request to one or more tasks.
Router
A high-level handle to a running MAVLink router.

Type Aliases§

RwLock
Re-export of parking_lot::RwLock used by the routing table. A reader-writer lock