pub(crate) struct NetworkStrate {Show 17 fields
pub(crate) device: Strat9NetDevice,
pub(crate) interface: Interface,
pub(crate) sockets: SocketSet<'static>,
pub(crate) dhcp_handle: SocketHandle,
pub(crate) dns_handle: SocketHandle,
pub(crate) icmp_handle: SocketHandle,
pub(crate) ip_config: Option<IpConfig>,
pub(crate) open_handles: BTreeMap<u64, String>,
pub(crate) tcp_listeners: BTreeMap<u64, TcpListenerState>,
pub(crate) tcp_connections: BTreeMap<u64, TcpConnState>,
pub(crate) udp_bound: BTreeMap<u64, UdpBoundState>,
pub(crate) udp_connections: BTreeMap<u64, UdpConnState>,
pub(crate) next_fid: u64,
pub(crate) pending_ping: Option<PendingPing>,
pub(crate) ping_reply: Option<(u16, u64)>,
pub(crate) ping_ident: u16,
pub(crate) dhcp_enabled: bool,
}Fields§
§device: Strat9NetDevice§interface: Interface§sockets: SocketSet<'static>§dhcp_handle: SocketHandle§dns_handle: SocketHandle§icmp_handle: SocketHandle§ip_config: Option<IpConfig>§open_handles: BTreeMap<u64, String>VFS handles: file_id → virtual path (“/net/*”)
tcp_listeners: BTreeMap<u64, TcpListenerState>§tcp_connections: BTreeMap<u64, TcpConnState>§udp_bound: BTreeMap<u64, UdpBoundState>§udp_connections: BTreeMap<u64, UdpConnState>§next_fid: u64§pending_ping: Option<PendingPing>Last ping that was sent, waiting for reply
ping_reply: Option<(u16, u64)>Received reply: (seq, rtt_us)
ping_ident: u16§dhcp_enabled: boolImplementations§
Source§impl NetworkStrate
impl NetworkStrate
Sourcepub(crate) fn udp_port_in_use(&self, port: u16) -> bool
pub(crate) fn udp_port_in_use(&self, port: u16) -> bool
Returns true if a local UDP port is already in use by an opened UDP handle.
Sourcepub(crate) fn alloc_udp_ephemeral_port(&self) -> Option<u16>
pub(crate) fn alloc_udp_ephemeral_port(&self) -> Option<u16>
Allocates an ephemeral UDP local port from the dynamic range.
Sourcepub(crate) fn create_udp_socket(
&mut self,
local_port: u16,
) -> Result<SocketHandle, i32>
pub(crate) fn create_udp_socket( &mut self, local_port: u16, ) -> Result<SocketHandle, i32>
Creates and binds an internal UDP transport endpoint on local_port,
then registers it in the smoltcp socket set.
Sourcepub(crate) fn tcp_state_name(state: State) -> &'static str
pub(crate) fn tcp_state_name(state: State) -> &'static str
Returns a textual name for a TCP state.
Sourcepub(crate) fn process_dhcp(&mut self)
pub(crate) fn process_dhcp(&mut self)
Implements process dhcp.
Sourcepub(crate) fn refresh_dns_servers(&mut self)
pub(crate) fn refresh_dns_servers(&mut self)
Implements refresh dns servers.
Sourcepub(crate) fn apply_ipv4_config(
&mut self,
address: Ipv4Cidr,
gateway: Option<Ipv4Address>,
dns: [Option<Ipv4Address>; 3],
)
pub(crate) fn apply_ipv4_config( &mut self, address: Ipv4Cidr, gateway: Option<Ipv4Address>, dns: [Option<Ipv4Address>; 3], )
Implements apply ipv4 config.
Sourcepub(crate) fn resolve_hostname_blocking(
&mut self,
name: &str,
) -> Result<Ipv4Address, i32>
pub(crate) fn resolve_hostname_blocking( &mut self, name: &str, ) -> Result<Ipv4Address, i32>
Implements resolve hostname blocking.
Sourcepub(crate) fn process_icmp(&mut self)
pub(crate) fn process_icmp(&mut self)
Implements process icmp.
Sourcepub(crate) fn send_ping(&mut self, target: Ipv4Address, seq: u16) -> bool
pub(crate) fn send_ping(&mut self, target: Ipv4Address, seq: u16) -> bool
Implements send ping.
Sourcepub(crate) fn handle_open(&mut self, msg: &IpcMessage) -> IpcMessage
pub(crate) fn handle_open(&mut self, msg: &IpcMessage) -> IpcMessage
Implements handle open.
Sourcepub(crate) fn handle_tcp_read(
&mut self,
sender: u64,
listener: TcpListenerState,
) -> IpcMessage
pub(crate) fn handle_tcp_read( &mut self, sender: u64, listener: TcpListenerState, ) -> IpcMessage
Implements handle tcp read.
Sourcepub(crate) fn handle_tcp_write(
&mut self,
sender: u64,
listener: TcpListenerState,
msg: &IpcMessage,
) -> IpcMessage
pub(crate) fn handle_tcp_write( &mut self, sender: u64, listener: TcpListenerState, msg: &IpcMessage, ) -> IpcMessage
Implements handle tcp write.
Sourcepub(crate) fn handle_tcp_conn_read(
&mut self,
sender: u64,
conn: TcpConnState,
) -> IpcMessage
pub(crate) fn handle_tcp_conn_read( &mut self, sender: u64, conn: TcpConnState, ) -> IpcMessage
Read from an outgoing TCP connection.
Sourcepub(crate) fn handle_tcp_conn_write(
&mut self,
sender: u64,
conn: TcpConnState,
msg: &IpcMessage,
) -> IpcMessage
pub(crate) fn handle_tcp_conn_write( &mut self, sender: u64, conn: TcpConnState, msg: &IpcMessage, ) -> IpcMessage
Write to an outgoing TCP connection.
Sourcepub(crate) fn handle_udp_bound_read(
&mut self,
sender: u64,
state: UdpBoundState,
) -> IpcMessage
pub(crate) fn handle_udp_bound_read( &mut self, sender: u64, state: UdpBoundState, ) -> IpcMessage
Read from a UDP scheme handle bound on a local port.
Returned bytes are encoded as:
- [0..4] source IPv4
- [4..6] source UDP port (big-endian)
- [6..] datagram payload (truncated to fit inline IPC reply)
Sourcepub(crate) fn handle_udp_bound_write(
&mut self,
sender: u64,
state: UdpBoundState,
msg: &IpcMessage,
) -> IpcMessage
pub(crate) fn handle_udp_bound_write( &mut self, sender: u64, state: UdpBoundState, msg: &IpcMessage, ) -> IpcMessage
Write to a bound UDP scheme handle is not supported directly.
Use /net/udp/connect/<ip>/<port> for bidirectional traffic or
/net/udp/send/<ip>/<port> for datagram sends with a fixed peer.
Sourcepub(crate) fn handle_udp_conn_read(
&mut self,
sender: u64,
conn: UdpConnState,
) -> IpcMessage
pub(crate) fn handle_udp_conn_read( &mut self, sender: u64, conn: UdpConnState, ) -> IpcMessage
Read from a connected UDP scheme handle.
Sourcepub(crate) fn handle_udp_conn_write(
&mut self,
sender: u64,
conn: UdpConnState,
msg: &IpcMessage,
) -> IpcMessage
pub(crate) fn handle_udp_conn_write( &mut self, sender: u64, conn: UdpConnState, msg: &IpcMessage, ) -> IpcMessage
Write to a connected UDP scheme handle.
Sourcepub(crate) fn handle_read(&mut self, msg: &IpcMessage) -> IpcMessage
pub(crate) fn handle_read(&mut self, msg: &IpcMessage) -> IpcMessage
Implements handle read.
Sourcepub(crate) fn handle_write(&mut self, msg: &IpcMessage) -> IpcMessage
pub(crate) fn handle_write(&mut self, msg: &IpcMessage) -> IpcMessage
Implements handle write.
Sourcepub(crate) fn handle_close(&mut self, msg: &IpcMessage) -> IpcMessage
pub(crate) fn handle_close(&mut self, msg: &IpcMessage) -> IpcMessage
Implements handle close.