ratman_netmod/lib.rs
1//! # A network module abstraction for Ratman
2//!
3//! Netmod provides an async interface to interact with endpoints
4//! basic data frame definitions, and frame sequencing.
5//!
6//! The interface itself makes no assumption about underlying address
7//! spacing or resend behaviour. Using netmod as a library allows you
8//! to write Ratman compatible network adapters.
9//!
10//! ## Frames, Sequences and Signatures
11//!
12//! A `Frame` is a single packet that is sent over a network
13//! connection. It corresponds (for example) to a UDP packet in other
14//! protocols. It contains sender, recipient information, and a
15//! sequence indicator (seqid), which is constructed over data slices,
16//! and can be reassembled on the other side of a circuit.
17//!
18//! When constructing a `Frame` sequence, the payload is split into
19//! appropriately sized chunks, then hashed, and those signature
20//! hashes are entered into the sequence ID `next` sequentially. The
21//! following diagram explains the concept further.
22//!
23//! ```norun
24//! |--------------| |--------------| |--------------|
25//! | Frame #1 | | Frame #2 | | Frame #2 |
26//! | next: f4aa | ------ | next: bb61 | ------ | next: NONE |
27//! | sig: a1a1 | | sig: f4aa | | sig: bb61 |
28//! |--------------| |--------------| |--------------|
29//! ```
30//!
31//! The payload signature is used to validate transport layer
32//! integrity (resends are up to a user of this interface to
33//! implement, as well as associating sequential frames into a data
34//! set.
35#![allow(warnings)]
36
37#[macro_use]
38extern crate serde;
39
40mod endpoint;
41mod frame;
42mod result;
43mod seq;
44
45pub use endpoint::Endpoint;
46pub use frame::{Frame, Recipient, Target};
47pub use result::{Error, Result};
48pub use seq::{SeqBuilder, SeqData, SeqId};