Expand description
§RuVix Network Stack
This crate provides a minimal networking stack for the RuVix Cognition Kernel
as specified in ADR-087 Phase E. It is designed to be no_std compatible with
optional alloc support for dynamic allocation.
§Network Layers
| Layer | Module | Purpose |
|---|---|---|
| Link | ethernet | Ethernet II frame handling |
| Network | arp, ipv4, icmp | Address resolution and IP routing |
| Transport | udp | Connectionless datagram transport |
§Architecture
+------------------+
| Application |
+------------------+
|
+------------------+
| UDP |
+------------------+
|
+------------------+
| IPv4 + ICMP |
+------------------+
|
+------------------+
| ARP Resolution |
+------------------+
|
+------------------+
| Ethernet |
+------------------+
|
+------------------+
| NetworkDevice | <-- Hardware abstraction
+------------------+§Features
std: Enable standard library supportalloc: Enable alloc crate support for heap allocation
§Example
use ruvix_net::{MacAddress, Ipv4Addr, UdpSocket, NetworkStack};
// Create a network stack with device
// let stack = NetworkStack::new(device, mac, ip);
// Send UDP datagram
// let socket = stack.udp_bind(8080).unwrap();
// socket.send_to(&data, dest_addr, dest_port);Re-exports§
pub use arp::ArpCache;pub use arp::ArpOperation;pub use arp::ArpPacket;pub use device::NetworkDevice;pub use error::NetError;pub use ethernet::EtherType;pub use ethernet::EthernetFrame;pub use ethernet::MacAddress;pub use icmp::IcmpHeader;pub use icmp::IcmpType;pub use ipv4::Ipv4Addr;pub use ipv4::Ipv4Header;pub use ipv4::Protocol;pub use stack::NetworkStack;pub use udp::UdpHeader;pub use udp::UdpSocket;
Modules§
- arp
- Address Resolution Protocol (ARP) handling.
- device
- Network device abstraction.
- error
- Network error types.
- ethernet
- Ethernet II frame handling.
- icmp
- Internet Control Message Protocol (ICMP) handling.
- ipv4
- IPv4 header handling.
- stack
- Network stack integration.
- udp
- User Datagram Protocol (UDP) handling.
Constants§
- ARP_
PACKET_ SIZE - ARP packet size in bytes (for Ethernet/IPv4).
- ETHERNET_
HEADER_ SIZE - Ethernet header size in bytes.
- ICMP_
HEADER_ SIZE - ICMP header size in bytes.
- IPV4_
HEADER_ MIN_ SIZE - IPv4 header minimum size in bytes.
- MAX_
UDP_ PAYLOAD - Maximum UDP payload size for standard Ethernet.
- MTU
- Maximum Transmission Unit (standard Ethernet).
- UDP_
HEADER_ SIZE - UDP header size in bytes.