LlcHdr

Struct LlcHdr 

Source
#[repr(C, packed(1))]
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: u8

Destination SAP address

§ssap: u8

Source 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

Source

pub const LEN: usize = 4usize

Source

pub fn dsap_addr(&self) -> u8

Gets the 7-bit DSAP address part.

Source

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.

Source

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.

Source

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.

Source

pub fn ssap_address(&self) -> u8

Gets the 7-bit SSAP address part.

Source

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.

Source

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.

Source

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.

Source

pub fn frame_type(&self) -> LlcFrameType

Determines the LLC PDU frame type based on the control field’s first byte.

Source

pub fn is_i_format(&self) -> bool

Returns true if the control field is I-format (16 bits).

Source

pub fn is_s_format(&self) -> bool

Returns true if the control field is S-format (16 bits).

Source

pub fn is_u_format(&self) -> bool

Returns true if the control field is U-format (8 bits).

Source

pub fn control_byte0(&self) -> u8

Gets the raw value of the first byte of the control field.

Source

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 Clone for LlcHdr

Source§

fn clone(&self) -> LlcHdr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LlcHdr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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 UnwindSafe for LlcHdr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.