pub struct NetworkInterface { /* private fields */ }Expand description
Represents a network device that can send and receive packets.
Implementations§
Source§impl NetworkInterface
 
impl NetworkInterface
Sourcepub fn new(
    name: &str,
    addr: Ipv4Addr,
    pcap_options: Option<PcapOptions>,
    qdisc: QDiscMode,
) -> Self
 
pub fn new( name: &str, addr: Ipv4Addr, pcap_options: Option<PcapOptions>, qdisc: QDiscMode, ) -> Self
Create a new network interface for the assigned addr. The configured name will be used
to construct a filesystem path for the pcap file (if enabled), so take care in choosing a
filesystem-appropriate static string.
pub fn associate( &self, socket: &InetSocket, protocol: IanaProtocol, port: u16, peer: SocketAddrV4, )
pub fn disassociate( &self, protocol: IanaProtocol, port: u16, peer: SocketAddrV4, )
pub fn is_addr_in_use( &self, protocol: IanaProtocol, 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. We don’t think we need this function for Rust sockets, but we think we need it for the legacy TCP stack which will not otherwise drop due to circular references.
Trait Implementations§
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