Skip to main content

Crate ruvix_net

Crate ruvix_net 

Source
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

LayerModulePurpose
LinkethernetEthernet II frame handling
Networkarp, ipv4, icmpAddress resolution and IP routing
TransportudpConnectionless datagram transport

§Architecture

+------------------+
|   Application    |
+------------------+
         |
+------------------+
|       UDP        |
+------------------+
         |
+------------------+
|    IPv4 + ICMP   |
+------------------+
         |
+------------------+
|  ARP Resolution  |
+------------------+
         |
+------------------+
|    Ethernet      |
+------------------+
         |
+------------------+
|  NetworkDevice   |  <-- Hardware abstraction
+------------------+

§Features

  • std: Enable standard library support
  • alloc: 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.