#[repr(C)]pub struct LlcHdr {
pub dsap: u8,
pub ssap: u8,
pub ctrl: [u8; 2],
}Expand description
Represents Logical Link Control according to ISO/IEC 8802-2 Definition
Fields§
§dsap: u8Destination SAP address
ssap: u8Source SAP address
ctrl: [u8; 2]Byte array for Control field. ctrl[0] is always used. ctrl[1] is used for I-format and S-format (16-bit control fields). For U-format (8-bit control field), ctrl[1] is not part of the logical control field.
Implementations§
Source§impl LlcHdr
impl LlcHdr
pub const LEN: usize
Sourcepub fn dsap_is_individual_addr(&self) -> bool
pub fn dsap_is_individual_addr(&self) -> bool
Checks if the DSAP I/G (Individual/Group) bit is set (Individual address). true if Individual address, false if Group address.
Sourcepub fn dsap_is_group_addr(&self) -> bool
pub fn dsap_is_group_addr(&self) -> bool
Checks if the DSAP I/G (Individual/Group) bit is set (Group address). true if Group address, false if Individual address.
Sourcepub fn set_dsap(&mut self, addr: u8, is_group: bool)
pub fn set_dsap(&mut self, addr: u8, is_group: bool)
Sets the DSAP field.
addr should be a 7-bit value.
is_group sets the I/G bit.
Sourcepub fn ssap_address(&self) -> u8
pub fn ssap_address(&self) -> u8
Gets the 7-bit SSAP address part.
Sourcepub fn ssap_is_command(&self) -> bool
pub fn ssap_is_command(&self) -> bool
Checks if the SSAP C/R (Command/Response) bit is set (Command PDU).
Returns true if it’s a Command PDU, false if it’s a Response PDU.
Sourcepub fn ssap_is_response(&self) -> bool
pub fn ssap_is_response(&self) -> bool
Checks if the SSAP C/R (Command/Response) bit is set (Response PDU).
Returns true if it’s a Response PDU, false if it’s a Command PDU.
Sourcepub fn set_ssap(&mut self, address: u8, is_response: bool)
pub fn set_ssap(&mut self, address: u8, is_response: bool)
Sets the SSAP field.
address should be a 7-bit value.
is_response sets the C/R bit.
Sourcepub fn frame_type(&self) -> LlcFrameType
pub fn frame_type(&self) -> LlcFrameType
Determines the LLC PDU frame type based on the control field’s first byte.
Sourcepub fn is_i_format(&self) -> bool
pub fn is_i_format(&self) -> bool
Returns true if the control field is I-format (16 bits).
Sourcepub fn is_s_format(&self) -> bool
pub fn is_s_format(&self) -> bool
Returns true if the control field is S-format (16 bits).
Sourcepub fn is_u_format(&self) -> bool
pub fn is_u_format(&self) -> bool
Returns true if the control field is U-format (8 bits).
Sourcepub fn control_byte0(&self) -> u8
pub fn control_byte0(&self) -> u8
Gets the raw value of the first byte of the control field.
Sourcepub fn control_byte1(&self) -> Option<u8>
pub fn control_byte1(&self) -> Option<u8>
Gets the raw value of the second byte of the control field, if applicable. Returns Some(u8) for I-Frames and S-Frames, None for U-Frames or Invalid.
Trait Implementations§
Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for LlcHdr
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for LlcHdr
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for LlcHdr
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for LlcHdr
Source§impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for LlcHdr
impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for LlcHdr
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 LlcHdr
Auto Trait Implementations§
impl Freeze for LlcHdr
impl RefUnwindSafe for LlcHdr
impl Send for LlcHdr
impl Sync for LlcHdr
impl Unpin for LlcHdr
impl UnsafeUnpin for LlcHdr
impl UnwindSafe for LlcHdr
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.