IcmpSocket

Struct IcmpSocket 

Source
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

Source

fn new(icmp_layer: Weak<IcmpLayer>, identifier: u16) -> Arc<Self>

Source

fn deliver_reply(&self, payload: Vec<u8>, src_ip: Ipv4Address, sequence: u16)

Trait Implementations§

Source§

impl ControlOps for IcmpSocket

Source§

fn control(&self, command: u32, arg: usize) -> Result<i32, &'static str>

Perform a control operation Read more
Source§

fn supported_control_commands(&self) -> Vec<(u32, &'static str)>

Get a list of supported control commands Read more
Source§

impl SocketControl for IcmpSocket

Source§

fn bind(&self, address: &SocketAddress) -> Result<(), SocketError>

Bind socket to an address
Source§

fn connect(&self, address: &SocketAddress) -> Result<(), SocketError>

Connect to a remote address
Source§

fn listen(&self, _backlog: usize) -> Result<(), SocketError>

Listen for incoming connections (for stream sockets)
Source§

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>

Get socket peer address
Source§

fn getsockname(&self) -> Result<SocketAddress, SocketError>

Get socket local address
Source§

fn shutdown(&self, _how: ShutdownHow) -> Result<(), SocketError>

Shutdown socket for reading, writing, or both
Source§

fn is_connected(&self) -> bool

Check if socket is connected
Source§

fn state(&self) -> SocketState

Get socket state
Source§

impl SocketObject for IcmpSocket

Source§

fn socket_type(&self) -> SocketType

Get socket type (Stream, Datagram, etc.)
Source§

fn socket_domain(&self) -> SocketDomain

Get socket domain (Local, Inet, Inet6, etc.)
Source§

fn socket_protocol(&self) -> SocketProtocol

Get socket protocol
Source§

fn as_any(&self) -> &dyn Any

Cast to Any for safe downcasting
Source§

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>

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>

Receive data with source address (for datagram sockets) For stream sockets, returns Unspecified address
Source§

fn as_selectable(&self) -> Option<&dyn Selectable>

Optional capability: expose select/pselect readiness/wait interface
Source§

impl StreamIpcOps for IcmpSocket

Source§

fn is_connected(&self) -> bool

Check if the stream IPC object is still connected/valid
Source§

fn peer_count(&self) -> usize

Get the number of active peers (readers/writers/endpoints)
Source§

fn description(&self) -> String

Get a human-readable description of this IPC object
Source§

impl StreamOps for IcmpSocket

Source§

fn read(&self, buffer: &mut [u8]) -> Result<usize, StreamError>

Read data from the stream
Source§

fn write(&self, data: &[u8]) -> Result<usize, StreamError>

Write data to the stream

Auto Trait Implementations§

§

impl !Freeze for IcmpSocket

§

impl !RefUnwindSafe for IcmpSocket

§

impl Send for IcmpSocket

§

impl Sync for IcmpSocket

§

impl Unpin for IcmpSocket

§

impl !UnwindSafe for IcmpSocket

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.