Struct OfpHeader

Source
#[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

Source

pub fn new(version: u8, typ: u8, length: u16, xid: u32) -> OfpHeader

Create an OfpHeader out of the arguments.

Source

pub fn size() -> usize

Return the byte-size of an OfpHeader.

Source

pub fn marshal(bytes: &mut Vec<u8>, header: OfpHeader)

Fills a message buffer with the header fields of an OfpHeader.

Source

pub fn parse(buf: [u8; 8]) -> Self

Takes a message buffer (sized for an OfpHeader) and returns an OfpHeader.

Source

pub fn version(&self) -> u8

Return the version field of a header.

Source

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.

Source

pub fn length(&self) -> usize

Return the length field of a header. Includes the length of the header itself.

Source

pub fn xid(&self) -> u32

Return the xid field of a header, the transaction id associated with this packet. Replies use the same id to facilitate pairing.

Auto Trait Implementations§

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> 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.