#[repr(packed(1))]pub struct OfpHeader { /* private fields */ }
Expand description
OpenFlow Header
The first fields of every OpenFlow message, no matter the protocol version. This is parsed to determine version and length of the remaining message, so that it can be properly handled.
Implementations§
Source§impl OfpHeader
impl OfpHeader
Sourcepub fn new(version: u8, typ: u8, length: u16, xid: u32) -> OfpHeader
pub fn new(version: u8, typ: u8, length: u16, xid: u32) -> OfpHeader
Create an OfpHeader
out of the arguments.
Sourcepub fn marshal(bytes: &mut Vec<u8>, header: OfpHeader)
pub fn marshal(bytes: &mut Vec<u8>, header: OfpHeader)
Fills a message buffer with the header fields of an OfpHeader
.
Sourcepub fn parse(buf: [u8; 8]) -> Self
pub fn parse(buf: [u8; 8]) -> Self
Takes a message buffer (sized for an OfpHeader
) and returns an OfpHeader
.
Sourcepub fn type_code(&self) -> MsgCode
pub fn type_code(&self) -> MsgCode
Return the OpenFlow message type code of a header.
§Safety
The typ
field of the self
header is expected to be a u8
within the
defined range of the MsgCode
enum.
Auto Trait Implementations§
impl Freeze for OfpHeader
impl RefUnwindSafe for OfpHeader
impl Send for OfpHeader
impl Sync for OfpHeader
impl Unpin for OfpHeader
impl UnwindSafe for OfpHeader
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