pub struct PacketRc { /* private fields */ }
Implementations§
source§impl PacketRc
impl PacketRc
pub fn new() -> Self
sourcepub fn set_tcp(&mut self, header: &TcpHeader)
pub fn set_tcp(&mut self, header: &TcpHeader)
Set TCP headers for this packet. Will panic if the packet already has a header.
pub fn get_tcp(&self) -> Option<TcpHeader>
sourcepub fn set_udp(&mut self, src: SocketAddrV4, dst: SocketAddrV4)
pub fn set_udp(&mut self, src: SocketAddrV4, dst: SocketAddrV4)
Set UDP headers for this packet. Will panic if the packet already has a header.
sourcepub fn set_payload(&mut self, payload: &[u8], priority: FifoPacketPriority)
pub fn set_payload(&mut self, payload: &[u8], priority: FifoPacketPriority)
Set the packet payload. Will panic if the packet already has a payload.
sourcepub fn get_payload(&self, buffer: &mut [u8]) -> usize
pub fn get_payload(&self, buffer: &mut [u8]) -> usize
Copy the packet payload to a buffer. Will truncate if the buffer is not large enough.
sourcepub fn copy_payload<'a>(
&self,
iovs: impl IntoIterator<Item = &'a IoVec>,
mem: &mut MemoryManager,
) -> Result<usize, Errno>
pub fn copy_payload<'a>( &self, iovs: impl IntoIterator<Item = &'a IoVec>, mem: &mut MemoryManager, ) -> Result<usize, Errno>
Copy the payload to the managed process. Even if this returns an error, some unspecified number of bytes may have already been copied.
pub fn total_size(&self) -> usize
pub fn header_size(&self) -> usize
pub fn payload_size(&self) -> usize
pub fn add_status(&mut self, status: PacketStatus)
pub fn src_address(&self) -> SocketAddrV4
pub fn dst_address(&self) -> SocketAddrV4
pub fn priority(&self) -> FifoPacketPriority
sourcepub fn from_raw(c_ptr: *mut Packet) -> Self
pub fn from_raw(c_ptr: *mut Packet) -> Self
Transfers ownership of the given c_ptr reference into a new rust packet object.
sourcepub fn into_inner(self) -> *mut Packet
pub fn into_inner(self) -> *mut Packet
Transfers ownership of the inner c_ptr reference to the caller while dropping the rust packet object.
pub fn borrow_inner(&self) -> *mut Packet
Trait Implementations§
source§impl From<PacketEventData> for PacketRc
impl From<PacketEventData> for PacketRc
source§fn from(data: PacketEventData) -> Self
fn from(data: PacketEventData) -> Self
Converts to this type from the input type.
source§impl PacketDisplay for PacketRc
impl PacketDisplay for PacketRc
impl Eq for PacketRc
Auto Trait Implementations§
impl Freeze for PacketRc
impl RefUnwindSafe for PacketRc
impl Send for PacketRc
impl Sync for PacketRc
impl Unpin for PacketRc
impl UnwindSafe for PacketRc
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more