auip is a async uip stack.
MAC Layer support these packet type:
- EthernetII
- IEEE802.3
- VLAN (802.3q)
- QinQ (802.3q)
Network support these packet and function:
- Ipv4
- Arp
- Ip Fragment
- ICMP
- Ipv6
- ICMPv6 (NDP)
- UDP
- DHCP
- DHCPv6
- DNS
Device is work on mac layer. It only have two function:
- Recv frame, then input to auip. Use poll mode.
- Send frame from auip.
Device is only a trait, you must bind a device to a interface.
pub trait Device {
fn send(&mut self, buffer: &[u8]) -> Result<()>;
fn recv(&mut self) -> Result<Option<&[u8]>>;
fn medium(&self) -> Medium;
}
Currently support these device:
- Tap (Linux, MacOS)
- Tun (Linux, MacOS)
- Loopback
- Sub-port (For macvtap, vlan)
Interface same as linux's interface.
Interface have these functions
- Set CIDR and MAC Address.
- Bind with a Device
- Receive packet from device, then send to socket.
- Send ip packet to device.
- Drop or accept packet based on
- Vlan ID
- Mac Address
- IP Address
- Hook baseed on process pcaket.
Beacuse auip support both nostd and alloc, all storage declared as trait.
- AddrsStorage: Storage addresses for interface, include 1 mac address and multiple cidr.
- Layer3PacketStorage: As a buffer to store layer3 packet need send to device.
Based on packet process, interface can register a hook. Hook will include some function, these function will called when packet is procedded.
Throw hook, we can build macvlan, vlan device, bridge, switch or some other special network interface. Also, we can use hook to build cross interface packet route, 6lowpan gateway, ipv6 on ble gateway and so on.
Beacuse the fundamental of auip is direct stack model, we need use hook to cross packet.