Trait redbpf_probes::net::NetworkBuffer[][src]

pub trait NetworkBuffer where
    Self: Clone + Sized
{ fn data_start(&self) -> usize;
fn data_end(&self) -> usize; fn len(&self) -> usize { ... }
unsafe fn ptr_at<U>(&self, addr: usize) -> NetworkResult<*const U> { ... }
unsafe fn ptr_after<T, U>(&self, prev: *const T) -> NetworkResult<*const U> { ... }
fn check_bounds(&self, start: usize, end: usize) -> NetworkResult<()> { ... }
fn eth(&self) -> NetworkResult<*const ethhdr> { ... }
fn ip(&self) -> NetworkResult<*const iphdr> { ... }
fn transport(&self) -> NetworkResult<Transport> { ... }
fn data(&self) -> NetworkResult<Data<Self>> { ... } }

Required methods

Provided methods

Returns the packet length.

Returns a raw pointer to a given address inside the buffer.

Safety

This method uses NetworkBuffer::check_bounds to ensure the given address addr is within the buffer and allows enough following space to point to something of type U. However no checks are done to ensure the returned pointer points to a valid bit pattern of type U, nor are any alignments checked. Ensuring proper alignment is followed and pointed to address is a valid bit pattern of type U is left up to the caller.

Returns a raw pointer to the address following prev plus the size of a T

Safety

This method uses NetworkBuffer::check_bounds to ensure the given address addr is within the buffer and allows enough following space to point to something of type U. However no checks are done to ensure the returned pointer points to a valid bit pattern of type U, nor are any alignments checked. Ensuring proper alignment is followed and pointed to address is a valid bit pattern of type U is left up to the caller.

Returns the packet’s Ethernet header if present.

Returns the packet’s IP header if present.

Returns the packet’s transport header if present.

Returns the packet’s data starting after the transport headers.

Implementors