Skip to main content

NetworkStrate

Struct NetworkStrate 

Source
pub(crate) struct NetworkStrate {
Show 23 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) ipv6_config: Option<Ipv6Config>, pub(crate) dns_servers: [Option<IpAddress>; 3], pub(crate) dns_from_dhcp: bool, pub(crate) link_local_addr: Ipv6Address, pub(crate) open_handles: BTreeMap<u64, OpenedFile>, 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) lingering_sockets: Vec<SocketHandle>, pub(crate) next_fid: u64, pub(crate) ping_ident: u16, pub(crate) next_ping_token: u64, pub(crate) pending_pings: Vec<PendingPing>, pub(crate) ping_replies: Vec<(u16, u64)>, 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>§ipv6_config: Option<Ipv6Config>§dns_servers: [Option<IpAddress>; 3]§dns_from_dhcp: bool§link_local_addr: Ipv6Address§open_handles: BTreeMap<u64, OpenedFile>§tcp_listeners: BTreeMap<u64, TcpListenerState>§tcp_connections: BTreeMap<u64, TcpConnState>§udp_bound: BTreeMap<u64, UdpBoundState>§udp_connections: BTreeMap<u64, UdpConnState>§lingering_sockets: Vec<SocketHandle>§next_fid: u64§ping_ident: u16§next_ping_token: u64§pending_pings: Vec<PendingPing>§ping_replies: Vec<(u16, u64)>§dhcp_enabled: bool

Implementations§

Source§

impl NetworkStrate

Source

pub(crate) fn process_dhcp(&mut self)

Source

pub(crate) fn refresh_dns_servers(&mut self)

Source

pub(crate) fn apply_ipv4_config( &mut self, address: Ipv4Cidr, gateway: Option<Ipv4Address>, )

Source

pub(crate) fn apply_ipv6_config( &mut self, address: Ipv6Cidr, gateway: Option<Ipv6Address>, )

Source

pub(crate) fn resolve_hostname_query( &mut self, name: &str, q_type: DnsQueryType, ) -> Result<IpAddress, i32>

Source

pub(crate) fn resolve_hostname_blocking( &mut self, name: &str, ) -> Result<IpAddress, i32>

Source

pub(crate) fn process_ipv6_slaac(&mut self)

Source§

impl NetworkStrate

Source

pub(crate) fn generate_content( &mut self, _file_id: u64, path: &str, ) -> Result<Vec<u8>, i32>

Source§

impl NetworkStrate

Source

pub(crate) fn process_icmp(&mut self)

Source

pub(crate) fn is_local_ipv4(&self, target: Ipv4Address) -> bool

Source

pub(crate) fn is_local_ipv6(&self, target: Ipv6Address) -> bool

Source

pub(crate) fn send_ping( &mut self, target: Ipv4Address, seq: u16, _file_id: u64, ) -> bool

Source

pub(crate) fn send_ping6( &mut self, target: Ipv6Address, seq: u16, _file_id: u64, ) -> bool

Source§

impl NetworkStrate

Source

pub(crate) fn new(mac: [u8; 6]) -> Self

Source

pub(crate) fn clear_ipv4_runtime_config(&mut self)

Source

pub(crate) fn drain_spilled_read( &mut self, sender: u64, file_id: u64, requested: usize, ) -> Option<IpcMessage>

Source

pub(crate) fn reply_read_spilling( &mut self, sender: u64, file_id: u64, requested: usize, data: Vec<u8>, ) -> IpcMessage

Source

pub(crate) fn reset_dhcp_socket(&mut self)

Source

pub(crate) fn enable_dhcp(&mut self)

Source

pub(crate) fn alloc_ping_token(&mut self) -> u64

Source

pub(crate) fn udp_port_in_use(&self, port: u16) -> bool

Source

pub(crate) fn alloc_udp_ephemeral_port(&self) -> Option<u16>

Source

pub(crate) fn create_udp_socket( &mut self, local_port: u16, ) -> Result<SocketHandle, i32>

Source

pub(crate) fn tcp_state_name(state: State) -> &'static str

Source

pub(crate) fn alloc_fid(&mut self) -> u64

Source§

impl NetworkStrate

Source

pub(crate) fn handle_tcp_read( &mut self, sender: u64, listener: TcpListenerState, requested: usize, ) -> IpcMessage

Source

pub(crate) fn handle_tcp_write( &mut self, sender: u64, listener: TcpListenerState, msg: &IpcMessage, ) -> IpcMessage

Source

pub(crate) fn handle_tcp_conn_read( &mut self, sender: u64, conn: TcpConnState, requested: usize, ) -> IpcMessage

Source

pub(crate) fn handle_tcp_conn_write( &mut self, sender: u64, conn: TcpConnState, msg: &IpcMessage, ) -> IpcMessage

Source

pub(crate) fn handle_udp_bound_read( &mut self, sender: u64, file_id: u64, requested: usize, ) -> IpcMessage

Source

pub(crate) fn handle_udp_bound_write( &mut self, sender: u64, file_id: u64, msg: &IpcMessage, ) -> IpcMessage

Source

pub(crate) fn handle_udp_conn_read( &mut self, sender: u64, file_id: u64, conn: UdpConnState, requested: usize, ) -> IpcMessage

Source

pub(crate) fn handle_udp_conn_write( &mut self, sender: u64, conn: UdpConnState, msg: &IpcMessage, ) -> IpcMessage

Source§

impl NetworkStrate

Source

fn insert_open_handle(&mut self, path: &str) -> u64

Source

fn reply_open_path(&mut self, sender: u64, path: &str, flags: u32) -> IpcMessage

Source

fn open_tcp_listener_handle( &mut self, sender: u64, path: &str, port: u16, auto_relisten: bool, ) -> IpcMessage

Source

fn open_tcp_connection_handle( &mut self, sender: u64, path: &str, remote_ip: IpAddress, remote_port: u16, local_port: u16, ) -> IpcMessage

Source

fn open_udp_connection_handle( &mut self, sender: u64, path: &str, remote: IpEndpoint, ) -> IpcMessage

Source

pub(crate) fn handle_open(&mut self, msg: &IpcMessage) -> IpcMessage

Source

pub(crate) fn handle_read(&mut self, msg: &IpcMessage) -> IpcMessage

Source

pub(crate) fn handle_write(&mut self, msg: &IpcMessage) -> IpcMessage

Source

pub(crate) fn handle_close(&mut self, msg: &IpcMessage) -> IpcMessage

Source§

impl NetworkStrate

Source

pub(crate) fn serve(&mut self, port: u64) -> !

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.