#[repr(C, packed(1))]pub struct Mpls {
pub lbl_tc_s: [u8; 3],
pub ttl: u8,
}Expand description
Represents a Multiprotocol Label Switching (MPLS) header to RFC 3032 https://www.rfc-editor.org/rfc/rfc3032.html. This header format applies to all MPLS messages. 20 bits for Label - 3 for TC - 1 for S - 8 for TTL
Fields§
§lbl_tc_s: [u8; 3]The first 3 bytes of the MPLS header containing Label (20 bits), Traffic Class (3 bits), and Bottom of Stack (1 bit) fields in network byte order
ttl: u8The Time to Live (TTL) field indicating maximum hop count
Implementations§
Source§impl Mpls
impl Mpls
pub const LEN: usize = 4usize
Sourcepub fn set_label(&mut self, label: u32)
pub fn set_label(&mut self, label: u32)
Sets the 20-bit Label value.
Input label_value should be a 20-bit integer (0 to 0xFFFFF).
Sourcepub fn tc(&self) -> u8
pub fn tc(&self) -> u8
Gets the 3-bit Traffic Class value.
Assumes self is a valid reference to an MPLS header.
Sourcepub fn set_tc(&mut self, tc_value: u8)
pub fn set_tc(&mut self, tc_value: u8)
Sets the 3-bit Traffic Class value.
Input tc_value should be a 3-bit integer (0-7).
Assumes self is a valid, mutable reference to an MPLS header.
Sourcepub fn s(&self) -> u8
pub fn s(&self) -> u8
Gets the 1-bit Bottom of Stack flag. Returns 0 or 1.
Assumes self is a valid reference to an MPLS header.