consomme

Trait Client

Source
pub trait Client {
    // Required methods
    fn driver(&self) -> &dyn Driver;
    fn recv(&mut self, data: &[u8], checksum: &ChecksumState);
    fn rx_mtu(&mut self) -> usize;
}
Expand description

A consomme client.

Required Methods§

Source

fn driver(&self) -> &dyn Driver

Gets the driver to use for handling new connections.

TODO: generalize connection creation to allow pluggable model (not just OS sockets) and remove this.

Source

fn recv(&mut self, data: &[u8], checksum: &ChecksumState)

Transmits a packet to the client.

If checksum.ipv4, checksum.tcp, or checksum.udp are set, then the packet contains an IPv4 header, TCP header, and/or UDP header with a valid checksum.

TODO:

  1. support >MTU sized packets (RSC/LRO/GRO)
  2. allow discontiguous data to eliminate the extra copy from the TCP window.
Source

fn rx_mtu(&mut self) -> usize

Specifies the maximum size for the next call to recv.

This is the MTU including the Ethernet frame header. This must be at least MIN_MTU.

Return 0 to indicate that there are no buffers available for receiving data.

Implementors§