pub struct Access<'a, T> { /* private fields */ }
Expand description
An accessor for consomme.
Implementations§
Source§impl<T: Client> Access<'_, T>
impl<T: Client> Access<'_, T>
Sourcepub fn poll(&mut self, cx: &mut Context<'_>)
pub fn poll(&mut self, cx: &mut Context<'_>)
Polls for work, transmitting any ready packets to the client.
Sourcepub fn refresh_driver(&mut self)
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.
Sourcepub fn send(
&mut self,
data: &[u8],
checksum: &ChecksumState,
) -> Result<(), DropReason>
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:
- allow for discontiguous packets
- 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.