Module network

Module network 

Source
Expand description

Network functionality for Scarlet

This module provides network capabilities including sockets and protocol stacks. It follows the existing patterns established by VfsManager and DeviceManager.

§Architecture

  • SocketObject: KernelObject type representing network endpoints
  • NetworkManager: Global manager handling socket lifecycle and connections
  • Socket Implementations: Provided by ABI modules (Linux, xv6, etc.)

§Design Philosophy

Scarlet’s core provides only abstract socket infrastructure. Specific socket implementations (Unix domain sockets, TCP/IP, etc.) are delegated to ABI modules. This maintains Scarlet’s OS-agnostic nature while allowing each ABI to provide the socket semantics expected by its applications.

§Usage

ABI modules implement SocketObject trait and register socket implementations with the NetworkManager.

Re-exports§

pub use protocol_stack::LayerContext;
pub use protocol_stack::NetworkLayer;
pub use protocol_stack::NetworkLayerStats;
pub use protocol_stack::ProtocolStack;
pub use protocol_stack::ProtocolStackManager;
pub use protocol_stack::ProtocolStackStats;
pub use protocol_stack::SocketConfig;
pub use socket::Inet4SocketAddress;
pub use socket::Inet6SocketAddress;
pub use socket::LocalSocketAddress;
pub use socket::ShutdownHow;
pub use socket::SocketAddress;
pub use socket::SocketControl;
pub use socket::SocketDomain;
pub use socket::SocketError;
pub use socket::SocketObject;
pub use socket::SocketProtocol;
pub use socket::SocketState;
pub use socket::SocketType;
pub use socket::UnixSocketAddress;

Modules§

arp
ARP (Address Resolution Protocol)
config
Network configuration helpers.
ethernet
Ethernet protocol layer
ethernet_interface
Ethernet network interface adapter.
icmp
ICMP protocol layer
ipv4
IPv4 protocol layer
local
Local Socket Implementation
protocol_stack
Protocol stack abstraction for network protocols
socket
Socket abstraction and common types
syscall
Socket System Calls for Scarlet Native
tcp
TCP protocol layer (Complete implementation)
udp
UDP protocol layer

Structs§

InterfaceStats
Interface statistics
NetworkConfig
Network configuration
NetworkManager
Network Manager - Global socket and connection manager

Statics§

GLOBAL_NETWORK_MANAGER 🔒
Global network manager instance

Traits§

NetworkInterface
Network interface trait

Functions§

get_network_manager
Get the global network manager

Type Aliases§

SocketFactory
Socket factory function type
SocketId
Unique socket identifier