pub struct NetworkInterface { /* private fields */ }
Expand description
Represents a network device that can send and receive packets. All accesses to the internal C implementation should be done through this module.
Implementations§
source§impl NetworkInterface
impl NetworkInterface
sourcepub fn new(
host_id: HostId,
addr: Ipv4Addr,
name: &OsStr,
pcap_options: Option<PcapOptions>,
qdisc: QDiscMode,
) -> NetworkInterface
pub fn new( host_id: HostId, addr: Ipv4Addr, name: &OsStr, pcap_options: Option<PcapOptions>, qdisc: QDiscMode, ) -> NetworkInterface
Create a new network interface for host_id
with the assigned addr
.
pub fn associate( &self, socket_ptr: &InetSocket, protocol_type: ProtocolType, port: u16, peer_addr: SocketAddrV4, )
pub fn disassociate( &self, protocol_type: ProtocolType, port: u16, peer_addr: SocketAddrV4, )
pub fn is_addr_in_use( &self, protocol: ProtocolType, port: u16, peer: SocketAddrV4, ) -> bool
pub fn add_data_source(&self, socket: &InetSocket)
sourcepub fn remove_all_sockets(&self)
pub fn remove_all_sockets(&self)
Disassociate all bound sockets and remove sockets from the sending queue. This should be called as part of the host’s cleanup procedure.
Trait Implementations§
source§impl Drop for NetworkInterface
impl Drop for NetworkInterface
Auto Trait Implementations§
impl Freeze for NetworkInterface
impl RefUnwindSafe for NetworkInterface
impl Send for NetworkInterface
impl Sync for NetworkInterface
impl Unpin for NetworkInterface
impl UnwindSafe for NetworkInterface
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more