ndn-tlv
Provides abstractions for working with TLV-encoded data.
It defines the core traits for encoding, decoding, and representing TLV records, so higher-level NDN crates can (de)serialize their packet types without hand-rolling the wire format themselves.
Installation
cargo add ndn-tlv
How it works
- [
Tlv] should be implemented on types that represent a whole TLV record -- ones that, in their encoded form, start with a type and a length. - [
TlvEncode] and [TlvDecode] are implemented on any type that can be encoded/decoded as part of a TLV record's value, including all types that implement [Tlv]. - A
Tlvderive macro (fromndn-tlv-derive) implements all three traits for you, so you rarely have to write them by hand. See its documentation for how to use it.
Example
Here is a quick example of how the library may be used:
use ;
use ;
Related crates
ndn-appis an application framework for building NDN producers and consumers, built on top ofndn-protocol,ndn-ndnlp, andndn-nfd-mgmt.ndn-tlv-deriveprovides the derive macrosndn-tlvuses to generate TLV encoding/decoding for structs and enums.ndn-protocolimplements the core NDN packet types (Interest, Data, Names, signatures) on top ofndn-tlv.ndn-ndnlpimplements NDNLPv2, the link-layer protocol used to send NDN packets over a transport.ndn-nfd-mgmtimplements the NFD management protocol, used e.g. to register routes with a local forwarder.
ndn-tlv is the base layer of the stack -- every other crate here builds on it.
License
MIT
Produced as part of a Master's thesis in Computer Science.