[−][src]Struct capsule::Mbuf
A DPDK message buffer that carries the network packet.
Remarks
Multi-segment Mbuf is not supported. It's the application's responsibilty
to ensure that the ethernet device's MTU is less than the default size
of a single Mbuf segment (RTE_MBUF_DEFAULT_DATAROOM
= 2048).
Implementations
impl Mbuf
[src]
pub fn new() -> Fallible<Self>
[src]
Creates a new message buffer.
The Mbuf is allocated from the Mempool
assigned to the current
executing thread by the Runtime
. The call will fail if invoked
from a thread not managed by the Runtime
.
pub fn from_bytes(data: &[u8]) -> Fallible<Self>
[src]
Creates a new message buffer from a byte array.
pub fn data_len(&self) -> usize
[src]
Returns amount of data stored in the buffer.
pub fn extend(&mut self, offset: usize, len: usize) -> Fallible<()>
[src]
Extends the data buffer at offset by len
bytes.
If the offset is not at the end of the data. The data after the offset is shifted down to make room.
pub fn shrink(&mut self, offset: usize, len: usize) -> Fallible<()>
[src]
Shrinks the data buffer at offset by len
bytes.
The data at offset is shifted up.
pub fn resize(&mut self, offset: usize, len: isize) -> Fallible<()>
[src]
Resizes the data buffer.
pub fn truncate(&mut self, to_len: usize) -> Fallible<()>
[src]
Truncates the data buffer to len.
pub fn read_data<T: SizeOf>(&self, offset: usize) -> Fallible<NonNull<T>>
[src]
Reads the data at offset as T
and returns it as a raw pointer.
pub fn write_data<T: SizeOf>(
&mut self,
offset: usize,
item: &T
) -> Fallible<NonNull<T>>
[src]
&mut self,
offset: usize,
item: &T
) -> Fallible<NonNull<T>>
Writes T
to the data buffer at offset and returns the new copy
as a raw pointer.
Before writing to the data buffer, should call Mbuf::extend
first
to make sure enough space is allocated for the write and data is not
being overridden.
pub fn read_data_slice<T: SizeOf>(
&self,
offset: usize,
count: usize
) -> Fallible<NonNull<[T]>>
[src]
&self,
offset: usize,
count: usize
) -> Fallible<NonNull<[T]>>
Reads the data at offset as a slice of T
and returns the slice as
a raw pointer.
pub fn write_data_slice<T: SizeOf>(
&mut self,
offset: usize,
slice: &[T]
) -> Fallible<NonNull<[T]>>
[src]
&mut self,
offset: usize,
slice: &[T]
) -> Fallible<NonNull<[T]>>
Writes a slice of T
to the data buffer at offset and returns the
new copy as a raw pointer.
Before writing to the data buffer, should call Mbuf::extend
first
to make sure enough space is allocated for the write and data is not
being overridden.
pub fn alloc_bulk(len: usize) -> Fallible<Vec<Mbuf>>
[src]
Allocates a Vec of Mbuf
s of len
size.
Trait Implementations
impl Arbitrary for Mbuf
[src]
type Parameters = ()
The type of parameters that [arbitrary_with
] accepts for configuration of the generated [Strategy
]. Parameters must implement [Default
]. Read more
type Strategy = fn() -> Self
The type of [Strategy
] used to generate values of type Self
. Read more
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
[src]
fn arbitrary() -> Self::Strategy
[src]
impl Debug for Mbuf
[src]
impl Drop for Mbuf
[src]
impl Packet for Mbuf
[src]
type Envelope = Mbuf
The preceding packet type that encapsulates this packet. Read more
fn envelope(&self) -> &Self::Envelope
[src]
fn envelope_mut(&mut self) -> &mut Self::Envelope
[src]
fn mbuf(&self) -> &Mbuf
[src]
fn mbuf_mut(&mut self) -> &mut Mbuf
[src]
fn offset(&self) -> usize
[src]
fn header_len(&self) -> usize
[src]
unsafe fn clone(&self, _internal: Internal) -> Self
[src]
fn try_parse(envelope: Self::Envelope, _internal: Internal) -> Fallible<Self>
[src]
fn try_push(envelope: Self::Envelope, _internal: Internal) -> Fallible<Self>
[src]
fn deparse(self) -> Self::Envelope
[src]
fn remove(self) -> Fallible<Self::Envelope>
[src]
fn reset(self) -> Mbuf
[src]
fn reconcile_all(&mut self)
[src]
fn payload_offset(&self) -> usize
[src]
fn len(&self) -> usize
[src]
fn payload_len(&self) -> usize
[src]
fn parse<T: Packet<Envelope = Self>>(self) -> Fallible<T> where
Self: Sized,
[src]
Self: Sized,
fn peek<T: Packet<Envelope = Self>>(&self) -> Fallible<Immutable<T>> where
Self: Sized,
[src]
Self: Sized,
fn push<T: Packet<Envelope = Self>>(self) -> Fallible<T> where
Self: Sized,
[src]
Self: Sized,
fn remove_payload(&mut self) -> Fallible<()>
[src]
fn reconcile(&mut self)
[src]
impl Send for Mbuf
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,