pub struct IcmpSocket {
icmp_layer: Weak<IcmpLayer>,
identifier: u16,
sequence: AtomicU16,
expected_sequence: AtomicU16,
local_addr: Mutex<Option<SocketAddress>>,
remote_addr: RwLock<Option<SocketAddress>>,
recv_queue: Mutex<VecDeque<(Vec<u8>, SocketAddress)>>,
recv_waker: Waker,
nonblocking: RwLock<bool>,
}Fields§
§icmp_layer: Weak<IcmpLayer>§identifier: u16§sequence: AtomicU16§expected_sequence: AtomicU16§local_addr: Mutex<Option<SocketAddress>>§remote_addr: RwLock<Option<SocketAddress>>§recv_queue: Mutex<VecDeque<(Vec<u8>, SocketAddress)>>§recv_waker: Waker§nonblocking: RwLock<bool>Implementations§
Source§impl IcmpSocket
impl IcmpSocket
fn new(icmp_layer: Weak<IcmpLayer>, identifier: u16) -> Arc<Self>
fn deliver_reply(&self, payload: Vec<u8>, src_ip: Ipv4Address, sequence: u16)
Trait Implementations§
Source§impl ControlOps for IcmpSocket
impl ControlOps for IcmpSocket
Source§impl SocketControl for IcmpSocket
impl SocketControl for IcmpSocket
Source§fn bind(&self, address: &SocketAddress) -> Result<(), SocketError>
fn bind(&self, address: &SocketAddress) -> Result<(), SocketError>
Bind socket to an address
Source§fn connect(&self, address: &SocketAddress) -> Result<(), SocketError>
fn connect(&self, address: &SocketAddress) -> Result<(), SocketError>
Connect to a remote address
Source§fn listen(&self, _backlog: usize) -> Result<(), SocketError>
fn listen(&self, _backlog: usize) -> Result<(), SocketError>
Listen for incoming connections (for stream sockets)
Source§fn accept(&self) -> Result<Arc<dyn SocketObject>, SocketError>
fn accept(&self) -> Result<Arc<dyn SocketObject>, SocketError>
Accept an incoming connection (for listening sockets)
Returns a new socket for the accepted connection
Source§fn getpeername(&self) -> Result<SocketAddress, SocketError>
fn getpeername(&self) -> Result<SocketAddress, SocketError>
Get socket peer address
Source§fn getsockname(&self) -> Result<SocketAddress, SocketError>
fn getsockname(&self) -> Result<SocketAddress, SocketError>
Get socket local address
Source§fn shutdown(&self, _how: ShutdownHow) -> Result<(), SocketError>
fn shutdown(&self, _how: ShutdownHow) -> Result<(), SocketError>
Shutdown socket for reading, writing, or both
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if socket is connected
Source§fn state(&self) -> SocketState
fn state(&self) -> SocketState
Get socket state
Source§impl SocketObject for IcmpSocket
impl SocketObject for IcmpSocket
Source§fn socket_type(&self) -> SocketType
fn socket_type(&self) -> SocketType
Get socket type (Stream, Datagram, etc.)
Source§fn socket_domain(&self) -> SocketDomain
fn socket_domain(&self) -> SocketDomain
Get socket domain (Local, Inet, Inet6, etc.)
Source§fn socket_protocol(&self) -> SocketProtocol
fn socket_protocol(&self) -> SocketProtocol
Get socket protocol
Source§fn as_control_ops(&self) -> Option<&dyn ControlOps>
fn as_control_ops(&self) -> Option<&dyn ControlOps>
Optional capability: expose control operations interface
Source§fn sendto(
&self,
data: &[u8],
address: &SocketAddress,
_flags: u32,
) -> Result<usize, SocketError>
fn sendto( &self, data: &[u8], address: &SocketAddress, _flags: u32, ) -> Result<usize, SocketError>
Send data to a specific address (for datagram sockets)
For stream sockets, address is ignored and data is sent to connected peer
Source§fn recvfrom(
&self,
buffer: &mut [u8],
_flags: u32,
) -> Result<(usize, SocketAddress), SocketError>
fn recvfrom( &self, buffer: &mut [u8], _flags: u32, ) -> Result<(usize, SocketAddress), SocketError>
Receive data with source address (for datagram sockets)
For stream sockets, returns Unspecified address
Source§fn as_selectable(&self) -> Option<&dyn Selectable>
fn as_selectable(&self) -> Option<&dyn Selectable>
Optional capability: expose select/pselect readiness/wait interface
Source§impl StreamIpcOps for IcmpSocket
impl StreamIpcOps for IcmpSocket
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the stream IPC object is still connected/valid
Source§fn peer_count(&self) -> usize
fn peer_count(&self) -> usize
Get the number of active peers (readers/writers/endpoints)
Source§fn description(&self) -> String
fn description(&self) -> String
Get a human-readable description of this IPC object
Source§impl StreamOps for IcmpSocket
impl StreamOps for IcmpSocket
Source§fn read(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
fn read(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
Read data from the stream
Source§fn write(&self, data: &[u8]) -> Result<usize, StreamError>
fn write(&self, data: &[u8]) -> Result<usize, StreamError>
Write data to the stream