VTPSocketBuf

Struct VTPSocketBuf 

Source
pub struct VTPSocketBuf {
    pub packet_count: u64,
    /* private fields */
}
Expand description

A high performance VDIF/VTP packet receiver designed to handle large input data rates.

Internally uses the recvmmsg system call to reduce the overhead of going through the OS with repeated calls to recv.

Fields§

§packet_count: u64

Counts the number of packets received so far

Implementations§

Source§

impl VTPSocketBuf

Source

pub fn new(socket: UdpSocket, frame_size: usize, framebuf_size: usize) -> Self

Create a new socket buffer attached to socket.

The internal buffer can hold a total of framebuf_size frames of size frame_size at any point.

Source

pub fn recv_batch(&mut self) -> Result<usize>

Attempt to fill the internal buffer with packets from the socket by calling recvmmsg.

This will overwrite the contents of the buffer, so ensure that you have fetched all the data you need before calling this.

Source

pub fn recv_frame(&mut self) -> Result<(u64, VDIFFrame)>

Receive a VDIFFrame from the internal buffer, along with its VTP sequence number.

If all frames have been received, this function will automatically call recv_batch to retrieve more data. Therefore, the user shouldn’t need to ever worry about calling recv_batch.

Source

pub fn recv_frame_to(&mut self, dest: &mut [u32]) -> Result<u64>

Receive a single frame from the internal buffer directed to dest. Directly returns the VTP sequence number in Ok.

If all frames have been received, this function will automatically call recv_batch to retrieve more data. Therefore, the user shouldn’t need to ever worry about calling recv_batch.

Trait Implementations§

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.