modem-mgmt 0.3.0

The management plane of zenoh-modem as a library: serve every device on a host over Zenoh, for any driver that links the contract
Documentation
//! The smallest driver that serves the whole contract (#119): a host with one
//! netdev and no lane code linked anywhere.
//!
//! This is the shape the owner's IP driver takes — build a `Device`, wrap it
//! in a `Node`, call `serve` — and it exists here so that shape is compiled
//! and tested in this repository rather than described. Run it beside a
//! router and read it with `zenctl`:
//!
//! ```text
//! cargo run -p modem-mgmt --example netdev-host -- tcp/127.0.0.1:7447
//! zenctl service call h-<origin> modem wwan0/lanes --connect tcp/127.0.0.1:7447
//! ```
//!
//! `lanes` answers `error/gated`, because a netdev has no SDU plane; `introspect`
//! serves the registry, `describe` its schemas, and the roster shows one
//! producer. `modem-mgmt` does not depend on `modem-driver`, so nothing about
//! lanes, sockets or a scheduler is in this binary at all.

use std::sync::Arc;

use fake_medium::StubNetdev;
use modem_mgmt::{Host, MgmtConfig, Node};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    tracing_subscriber::fmt().init();
    let connect = std::env::args()
        .nth(1)
        .unwrap_or_else(|| "tcp/127.0.0.1:7447".to_string());

    let host = Host::new().with(Node::netdev("wwan0", Arc::new(StubNetdev::new("wwan0"))));
    let mgmt = modem_mgmt::serve(
        &MgmtConfig {
            connect: vec![connect],
            ..MgmtConfig::default()
        },
        Arc::new(host),
    )
    .await?;

    tokio::signal::ctrl_c().await?;
    mgmt.shutdown().await;
    Ok(())
}