Skip to main content

Crate ndn_protocol

Crate ndn_protocol 

Source
Expand description

Implements the core Named Data Networking (NDN) packet types – Name, Interest, Data, signatures, and certificates – on top of the TLV encoding provided by ndn-tlv.

Name represents a hierarchical NDN name and can be built from a URI with Name::from_str. Interest and Data are the two packet types that make up NDN’s request/response exchange; both are generic over their payload type so application data can be encoded and decoded through the same ndn_tlv::TlvEncode/ndn_tlv::TlvDecode traits used everywhere else in the stack. Signing and verifying either packet type goes through the SignMethod and SignatureVerifier traits, with DigestSha256 and SignatureSha256WithRsa as the two signature schemes implemented here.

use ndn_protocol::{DigestSha256, Interest, Name, SignSettings};

let mut interest = Interest::<()>::new(Name::from_str("/hello/world").unwrap());
let mut signer = DigestSha256::new();
interest.sign(&mut signer, SignSettings::default());
assert!(interest.verify(&signer).is_ok());

This crate implements the packet types themselves; it doesn’t talk to a forwarder. ndn-app builds an application framework on top of these types.

Re-exports§

pub use data::Content;
pub use data::ContentType;
pub use data::Data;
pub use data::FinalBlockId;
pub use data::FreshnessPeriod;
pub use data::MetaInfo;
pub use interest::CanBePrefix;
pub use interest::ForwardingHint;
pub use interest::HopLimit;
pub use interest::Interest;
pub use interest::InterestLifetime;
pub use interest::MustBeFresh;
pub use interest::Nonce;
pub use interest::SignSettings;
pub use name::GenericNameComponent;
pub use name::ImplicitSha256DigestComponent;
pub use name::Name;
pub use name::NameComponent;
pub use name::OtherNameComponent;
pub use signature::DigestSha256;
pub use signature::KeyDigest;
pub use signature::KeyLocator;
pub use signature::SignatureInfo;
pub use signature::SignatureSha256WithRsa;
pub use signature::SignatureType;
pub use signature::SignatureValue;
pub use certificate::Certificate;
pub use certificate::RsaCertificate;
pub use certificate::SafeBag;

Modules§

certificate
NDN certificates: Certificate, a signed Data packet carrying a public key, and SafeBag, the format NDN tools export a certificate and its matching private key in together.
data
Data, the packet returned in response to an Interest.
error
Error types returned by this crate’s fallible operations.
interest
Interest, the packet used to request Data by name.
name
Name, the hierarchical name every NDN packet is addressed by, and NameComponent, the individual /-separated pieces a name is made of.
signature
Signing and verifying Interests and Datas.