Skip to main content

Crate ndn_app

Crate ndn_app 

Source
Expand description

An application framework for building Named Data Networking (NDN) applications on top of tokio, modeled after the producer/consumer split used by the NDN client libraries in other languages (ndn-cxx, python-ndn, etc).

The framework owns the connection to a local NFD forwarder, route registration, Interest/Data matching and dispatch, and NDNLPv2 link-layer framing, so application code only needs to describe routes and write async handlers for them. See app::App for the entry point and the crate’s README for a worked example.

use ndn_app::{app::App, verifier::ForbidUnsigned};
use ndn_protocol::{Data, DigestSha256, Interest};

App::new(DigestSha256::new(), ())
    .route("example", ForbidUnsigned, |_handler, interest: Interest<()>, _ctx| async move {
        Some(Data::new(interest.name().clone(), ()))
    })
    .start()
    .await
    .unwrap();

Modules§

app
The application runtime: connecting to NFD, registering routes, dispatching Interests to handlers, and expressing Interests as a consumer.
error
The error type shared by every fallible operation in this crate.
verifier
Composable acceptance policies for Interests and Data packets.

Type Aliases§

Result
The Result type returned by fallible operations across this crate, with the error type fixed to Error so callers don’t need to name it at every call site.