pub struct HdlcFrame {
pub destination: HdlcAddress,
pub source: HdlcAddress,
pub control: Control,
pub information: Vec<u8>,
pub segmented: bool,
}Expand description
A decoded HDLC frame.
Fields§
§destination: HdlcAddressThe destination address.
source: HdlcAddressThe source address.
control: ControlThe control field.
information: Vec<u8>The information field (may be empty for supervisory/unnumbered frames).
segmented: boolThe segmentation bit of the frame format field.
Implementations§
Source§impl HdlcFrame
impl HdlcFrame
Sourcepub fn new(
destination: HdlcAddress,
source: HdlcAddress,
control: Control,
information: Vec<u8>,
) -> Self
pub fn new( destination: HdlcAddress, source: HdlcAddress, control: Control, information: Vec<u8>, ) -> Self
Builds a frame without the segmentation bit set.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encodes the frame, including the opening/closing flags, HCS and FCS.
Sourcepub fn decode(frame: &[u8]) -> Result<HdlcFrame, HdlcError>
pub fn decode(frame: &[u8]) -> Result<HdlcFrame, HdlcError>
Decodes a single frame that begins and ends with a flag octet.
Sourcefn peek_addresses(frame: &[u8]) -> Result<(HdlcAddress, HdlcAddress), HdlcError>
fn peek_addresses(frame: &[u8]) -> Result<(HdlcAddress, HdlcAddress), HdlcError>
Destination/source addresses when the control field is unknown but the rest of the header (and FCS) is intact — used to reply with FRMR.
Trait Implementations§
impl Eq for HdlcFrame
impl StructuralPartialEq for HdlcFrame
Auto Trait Implementations§
impl Freeze for HdlcFrame
impl RefUnwindSafe for HdlcFrame
impl Send for HdlcFrame
impl Sync for HdlcFrame
impl Unpin for HdlcFrame
impl UnsafeUnpin for HdlcFrame
impl UnwindSafe for HdlcFrame
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
Mutably borrows from an owned value. Read more