Skip to main content

fips_core/protocol/
mod.rs

1//! FIPS Protocol Messages
2//!
3//! Wire format definitions for FIPS protocol communication across two layers:
4//!
5//! ## Link Layer (peer-to-peer, hop-by-hop)
6//!
7//! Messages exchanged between directly connected peers over Noise-encrypted
8//! links. Includes spanning tree gossip, bloom filter propagation, discovery
9//! protocol, and forwarding of session-layer datagrams.
10//!
11//! Link-layer peer authentication uses Noise IK (see `noise.rs`), which
12//! establishes the encrypted channel before any of these messages are sent.
13//!
14//! ## Session Layer (end-to-end, between FIPS addresses)
15//!
16//! Messages exchanged between source and destination FIPS nodes, encrypted
17//! with session keys that intermediate nodes cannot read. Includes session
18//! establishment, IPv6 datagram encapsulation, and routing errors.
19//!
20//! Session-layer datagrams are carried as opaque payloads through the link
21//! layer, encrypted end-to-end independently of per-hop link encryption.
22
23mod discovery;
24mod error;
25mod filter;
26mod link;
27mod session;
28mod tree;
29
30// Re-export all public types at protocol:: level
31pub use discovery::{LookupRequest, LookupResponse};
32pub use error::ProtocolError;
33pub use filter::FilterAnnounce;
34pub use link::{
35    Disconnect, DisconnectReason, HandshakeMessageType, LinkMessageType,
36    SESSION_DATAGRAM_HEADER_SIZE, SessionDatagram, SessionDatagramRef,
37};
38pub use session::{
39    COORDS_REQUIRED_SIZE, CoordsRequired, FspFlags, FspInnerFlags, MTU_EXCEEDED_SIZE, MtuExceeded,
40    PATH_MTU_NOTIFICATION_SIZE, PathBroken, PathMtuNotification, SESSION_RECEIVER_REPORT_SIZE,
41    SESSION_SENDER_REPORT_SIZE, SessionAck, SessionFlags, SessionMessageType, SessionMsg3,
42    SessionReceiverReport, SessionSenderReport, SessionSetup,
43};
44pub(crate) use session::{coords_wire_size, decode_optional_coords, encode_coords};
45pub use tree::TreeAnnounce;
46
47/// Protocol version for message compatibility.
48pub const PROTOCOL_VERSION: u8 = 1;
49
50// Legacy type alias re-export
51#[allow(deprecated)]
52pub use link::MessageType;