#[repr(C)]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
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.
Trait Implementations§
Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for Mpls
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for Mpls
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for Mpls
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for Mpls
Source§impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for Mpls
impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for Mpls
Source§fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes, but allows the caller to provide a custom configuration.Source§fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes_mut, but allows the caller to provide a custom configuration.impl Copy for Mpls
Auto Trait Implementations§
impl Freeze for Mpls
impl RefUnwindSafe for Mpls
impl Send for Mpls
impl Sync for Mpls
impl Unpin for Mpls
impl UnsafeUnpin for Mpls
impl UnwindSafe for Mpls
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
Source§impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
Source§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.Source§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.Source§impl<T, C> Serialize<C> for T
impl<T, C> Serialize<C> for T
Source§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Writer.