#[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: 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 = 4usize
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.