Skip to main content

Crate ax_net

Crate ax_net 

Source
Expand description

Unified network stack for TGOSKits systems.

ax-net provides the socket-facing API used by kernels and syscall layers, while delegating TCP/IP protocol mechanics to smoltcp. The crate exposes TCP, UDP, raw IPv4/IPv6 sockets, Unix domain sockets, optional vsock, DNS, DHCP helpers, readiness polling, and interface/control-plane queries.

§Architecture

The stack intentionally uses one smoltcp Interface and one global SocketSet. Multiple physical or virtual devices are aggregated below that protocol core by router::Router, which acts as a multi-device smoltcp Device. This keeps socket ownership, port tables, listen queues, and routing decisions centralized instead of duplicating socket state per NIC.

§Execution Model

A unique CPU-pinned protocol executor owns every smoltcp poll. Socket methods publish generations with request_poll() and then rely on poll/waker readiness; they never synchronously become a second protocol owner. Separate CPU-pinned queue executors own hard-IRQ continuation, DMA reclaim/refill, and bounded queue polling. Preallocated SPSC rings transfer move-only frame tokens between those two ownership domains.

§Main Modules

  • service: owns the smoltcp interface and control plane.
  • poll_runtime: owns generation-based protocol scheduling.
  • queue_runtime: owns IRQ affinity domains and queue executors.
  • router: aggregates protocol ports, route lookup, and loopback.
  • socket, tcp, udp, raw: POSIX-like IP socket surface.
  • listen_table, orphan, wrapper: side tables around smoltcp sockets.
  • unix and vsock: local transports outside the smoltcp IP path.

Modules§

options
Socket option types and the Configurable trait. Socket option data structures and dispatch traits.
raw
Raw socket implementation. Raw IP socket implementation for ICMP-style traffic.
tcp
TCP socket implementation. TCP socket implementation.
udp
UDP socket implementation. UDP socket implementation.
unix
Unix domain socket implementation. Unix domain socket facade.

Structs§

ArpEntry
DeviceBinding
Ordinary socket interface binding.
InterfaceConfig
Per-interface network configuration.
InterfaceFlags
Runtime interface flags.
InterfaceId
Stable network interface identifier.
InterfaceInfo
Public snapshot of a network interface.
Ipv4InterfaceConfig
Runtime IPv4 configuration of a network interface.
NetDevStats
Per-interface cumulative RX/TX byte and packet counters.
NetQueueStats
Observable queue statistics used by SMP contract tests.
NetworkConfig
Network initialization configuration.
NetworkDeviceInput
One prepared device and its complete, resolved IRQ source map.
NetworkQueueRuntime
Live queue runtime. Dropping it masks IRQs before stopping executors.
NetworkRuntimeBuilder
Builder for an all-at-once network queue runtime.
PinnedNetIrqAction
Move-only callback installed by the OS IRQ adapter.
RecvFlags
Flags for receiving data from a socket.
RecvOptions
Options for receiving data from a socket.
ResolvedNetIrqSource
Resolved driver source-id to physical IRQ mapping.
RouteInfo
Public route snapshot.
SendFlags
Flags for sending data to a socket.
SendOptions
Options for sending data to a socket.
SocketWaitPolicy
OS-facing policy for driving one task-neutral socket future.
StaticIpConfig
Static IP configuration.
WifiLinkPolicy
Wireless link policy a device reports for itself, so the protocol stack can apply it without any Wi-Fi/SoftAP-specific knowledge.
WifiTransaction
One atomic wireless reconfiguration transaction.
Wpa2Pmk
One owned wireless control operation.

Enums§

ConnectStatus
Progress of a connection attempt whose completion is readiness-driven.
InterfaceKind
Network interface kind.
InterfaceMatcher
Interface matching rule for explicit configuration.
IpCmsg
IP ancillary data reported through recvmsg.
NetDeviceError
NetError
Errors owned by the network and socket domain.
NetworkRuntimeError
Runtime initialization or lifecycle error.
PinnedNetIrqError
OS-specific fixed-affinity IRQ registration error.
PinnedNetIrqOutcome
Result of a bounded hard-IRQ callback.
Shutdown
Kind of shutdown operation to perform on a socket.
Socket
Network socket abstraction.
SocketAddrEx
Extended socket address supporting IP, Unix, and vsock address families.
SocketCmsg
Transport-independent socket-level ancillary data reported through recvmsg.
TxQueueDiscipline
Protocol-side transmit queue policy for one network device.
WifiOperation

Traits§

EthernetFramePort
Device-level protocol endpoint backed by one or more queue-group SPSC pipelines.
PinnedNetIrqRegistrar
OS adapter that accepts fixed affinity only.
PinnedNetIrqRegistration
Move-only registration lease. It is created disabled.
SocketOps
Operations that can be performed on a socket.

Functions§

arp_entries
Returns ARP/neighbor entries collected from all devices.
default_routes
Returns public snapshots of configured IPv4 default routes.
dns_query
Resolves an A record using the default DNS timeout.
dns_query_timeout
Resolves an A record using the configured DNS servers and timeout.
dns_servers
Returns the list of configured DNS servers.
init_network
Initializes the network subsystem by NIC devices.
interface_by_id
Looks up an interface snapshot by stable interface id.
interface_by_name
Looks up an interface snapshot by name.
interfaces
Returns a snapshot of all configured network interfaces.
ipv4_config
Returns the IPv4 configuration for an interface by name.
net_dev_stats
Returns per-interface RX/TX byte and packet counters for /proc/net/dev.
poll_socket_io
Repeats one non-blocking operation after race-free readiness registration.
reconfigure_wifi
Atomically reconfigures one wireless interface through its fixed-CPU queue owner, then commits the matching protocol-side IP/DHCP role.
remove_interface_ipv4
Removes a configured IPv4 address from an interface at runtime.
request_poll
Request network polling.
set_interface_ipv4
Assigns a static IPv4 address to an interface at runtime.

Type Aliases§

CMsgData
Type alias for ancillary control message data.
EthernetFramePortList
Protocol endpoints handed to the unique smoltcp owner during startup.
NetDeviceResult
NetResult
A result returned by the network and socket domain.