pub enum DataItem {
Show 21 variants
Status {
code: StatusCode,
text: String,
},
Ipv4ConnectionPoint {
flags: ConnectionPointFlags,
addr: Ipv4Addr,
port: Option<u16>,
},
Ipv6ConnectionPoint {
flags: ConnectionPointFlags,
addr: Ipv6Addr,
port: Option<u16>,
},
PeerType {
flags: PeerFlags,
description: String,
},
HeartbeatInterval(Duration),
ExtensionsSupported(Vec<ExtensionId>),
MacAddress(MacAddress),
Ipv4Address {
add: bool,
addr: Ipv4Addr,
},
Ipv6Address {
add: bool,
addr: Ipv6Addr,
},
Ipv4AttachedSubnet {
add: bool,
subnet: Ipv4Net,
},
Ipv6AttachedSubnet {
add: bool,
subnet: Ipv6Net,
},
MaxDataRateReceive(u64),
MaxDataRateTransmit(u64),
CurrentDataRateReceive(u64),
CurrentDataRateTransmit(u64),
Latency(Duration),
Resources(u8),
RelativeLinkQualityReceive(u8),
RelativeLinkQualityTransmit(u8),
Mtu(u16),
Unknown(RawDataItem),
}Expand description
Typed DLEP Data Item. Unknown preserves forward compatibility: the
decoder never fails on an unrecognized type_id and extension code paths
can introspect the raw bytes.
Variants§
Status
Ipv4ConnectionPoint
Ipv6ConnectionPoint
PeerType
HeartbeatInterval(Duration)
ExtensionsSupported(Vec<ExtensionId>)
MacAddress(MacAddress)
Ipv4Address
Ipv6Address
Ipv4AttachedSubnet
Ipv6AttachedSubnet
MaxDataRateReceive(u64)
MaxDataRateTransmit(u64)
CurrentDataRateReceive(u64)
CurrentDataRateTransmit(u64)
Latency(Duration)
Resources(u8)
RelativeLinkQualityReceive(u8)
RelativeLinkQualityTransmit(u8)
Mtu(u16)
Unknown(RawDataItem)
Implementations§
Source§impl DataItem
impl DataItem
Sourcepub fn encode(&self, out: &mut BytesMut) -> Result<(), CodecError>
pub fn encode(&self, out: &mut BytesMut) -> Result<(), CodecError>
Encode this typed Data Item — including its 4-byte TLV header —
onto out. Writes directly into the caller’s buffer; on error out
is restored to its starting length so the caller can recover.
Returns an error for values that cannot be expressed on the wire:
Resources/RelativeLinkQuality{Receive,Transmit}outside0..=100(per RFC 8175 §13.17–§13.19)HeartbeatIntervalwhose milliseconds exceedu32::MAXLatencywhose microseconds exceedu64::MAX
Ipv4AttachedSubnet / Ipv6AttachedSubnet always emit the network
address (host bits truncated to the prefix), per RFC 8175 §13.10–§13.11.
decode symmetrically truncates non-canonical input, so a peer that
puts host bits on the wire is normalized in memory rather than silently
re-canonicalized on the next encode.
Sourcepub fn decode(raw: RawDataItem) -> Result<Self, CodecError>
pub fn decode(raw: RawDataItem) -> Result<Self, CodecError>
Lift a parsed RawDataItem into a typed DataItem. Unknown type ids
fall through to DataItem::Unknown for negotiated extension dispatch.
The session layer rejects unclaimed items under RFC 8175 §12.1.
Length errors and value-range errors are reported here.
Ipv4AttachedSubnet / Ipv6AttachedSubnet are normalized to network
form here — host bits in non-canonical wire input are zeroed so the
in-memory representation matches what encode would produce, and
equality comparisons across peer-sent subnets are stable.