Skip to main content

dlep_core/
lib.rs

1//! Wire types, data items and byte-level codec for DLEP (RFC 8175).
2//!
3//! This crate is the foundation of the workspace. It has no dependencies on
4//! tokio, rustls or socket2 — only `bytes`, `thiserror` and `ipnet`. Anything
5//! that touches I/O or state machines lives in sibling crates.
6
7#![allow(dead_code)]
8
9pub mod codec;
10pub mod data_item;
11pub mod error;
12pub mod ids;
13pub mod mac;
14pub mod message;
15pub mod metrics;
16pub mod signal;
17pub mod status;
18
19pub use data_item::{DataItem, RawDataItem};
20pub use error::{CodecError, ExpectedLen};
21pub use ids::{DataItemType, ExtensionId, MessageType, SignalType};
22pub use mac::{MacAddress, MacAddressFormat};
23pub use message::Message;
24pub use metrics::{LinkCharacteristics, LinkMetrics};
25pub use signal::Signal;
26pub use status::StatusCode;
27
28/// ASCII prefix used on every DLEP UDP discovery signal (RFC 8175 §11.1).
29pub const SIGNAL_PREFIX: &[u8; 4] = b"DLEP";
30
31/// Default IANA-assigned TCP/UDP port for DLEP.
32pub const DEFAULT_PORT: u16 = 854;
33
34/// RFC 8175 §7.3.1 requires the heartbeat interval to be at least one second.
35pub const MIN_HEARTBEAT_INTERVAL_MS: u32 = 1_000;
36
37/// IANA-assigned IPv4 link-local multicast group for discovery.
38pub const DISCOVERY_IPV4_GROUP: std::net::Ipv4Addr = std::net::Ipv4Addr::new(224, 0, 0, 117);
39
40/// IANA-assigned IPv6 link-local multicast group for discovery.
41pub const DISCOVERY_IPV6_GROUP: std::net::Ipv6Addr =
42    std::net::Ipv6Addr::new(0xff02, 0, 0, 0, 0, 0, 0x1, 0x7);