consomme

Struct Access

Source
pub struct Access<'a, T> { /* private fields */ }
Expand description

An accessor for consomme.

Implementations§

Source§

impl<T: Client> Access<'_, T>

Source

pub fn poll(&mut self, cx: &mut Context<'_>)

Polls for work, transmitting any ready packets to the client.

Source

pub fn refresh_driver(&mut self)

Update all sockets to use the new client’s IO driver. This must be called if the previous driver is no longer usable or if the client otherwise wants existing connections to be polled on a new IO driver.

Source

pub fn send( &mut self, data: &[u8], checksum: &ChecksumState, ) -> Result<(), DropReason>

Sends an Ethernet frame to the network.

If checksum.ipv4, checksum.tcp, or checksum.udp are set, then skips validating the IPv4, TCP, and UDP checksums. Otherwise, these checksums are validated as normal and packets with invalid checksums are dropped.

If checksum.tso.is_some(), then perform TCP segmentation offset on the frame. Practically speaking, this means that the frame contains a TCP packet with these caveats:

  • The IP header length may be invalid and will be ignored. The TCP packet payload is assumed to end at the end of data.
  • The TCP segment’s payload size may be larger than the advertized TCP MSS value.

This allows for sending TCP data that is much larger than the MSS size via a single call.

TODO:

  1. allow for discontiguous packets
  2. allow for packets in guest memory (including lifetime model, if necessary–currently TCP transmits only happen in poll, but this may not be necessary. If the underlying socket implementation performs a copy (as the standard kernel socket APIs do), then no lifetime model is necessary, but if an implementation wants zerocopy support then some mechanism to allow the guest memory to be released later will be necessary.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Access<'a, T>

§

impl<'a, T> !RefUnwindSafe for Access<'a, T>

§

impl<'a, T> Send for Access<'a, T>
where T: Send,

§

impl<'a, T> Sync for Access<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Access<'a, T>

§

impl<'a, T> !UnwindSafe for Access<'a, T>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more