pub struct NetworkTap<T: AsRawFd> { /* private fields */ }
Expand description

An instance of the socket/stream.

Trait Implementations§

source§

impl<T: Debug + AsRawFd> Debug for NetworkTap<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl SocketTap for NetworkTap<TcpStream>

source§

fn connect(&mut self, timeout: Option<Duration>) -> CDnsResult<()>

Connects to the remote host.
If timeout is not set, the socket is initialized in non blocking mode and [PollFd] is created to use with poll(2).
If timeout is set, then the socket is initialized in blocking mode with timeout. Tht [PollFd] is not generated!
source§

fn is_tcp(&self) -> bool

Tells if current instance is TcpStream if true, or UdpSocket if false
source§

fn is_conncected(&self) -> bool

Tells if socket/stream is connected to remote host
source§

fn get_fd(&self) -> Option<BorrowedFd<'_>>

Returns the raw fd of the socket.
source§

fn get_remote_addr(&self) -> &SocketAddr

Returns the remote host Ip and port.
source§

fn send(&mut self, sndbuf: &[u8]) -> CDnsResult<usize>

Sends data over wire.
source§

fn recv(&mut self, rcvbuf: &mut [u8]) -> CDnsResult<usize>

Receives data transmitted from remote host. In nonblocking mode it should be called only after the event was polled In blocking mode it will block until received or timeout.
source§

impl SocketTap for NetworkTap<UdpSocket>

source§

fn connect(&mut self, timeout: Option<Duration>) -> CDnsResult<()>

Connects to the remote host.
If timeout is not set, the socket is initialized in non blocking mode and [PollFd] is created to use with poll(2).
If timeout is set, then the socket is initialized in blocking mode with timeout. Tht [PollFd] is not generated!
source§

fn is_tcp(&self) -> bool

Tells if current instance is TcpStream if true, or UdpSocket if false
source§

fn is_conncected(&self) -> bool

Tells if socket/stream is connected to remote host
source§

fn get_fd(&self) -> Option<BorrowedFd<'_>>

Returns the raw fd of the socket.
source§

fn get_remote_addr(&self) -> &SocketAddr

Returns the remote host Ip and port.
source§

fn send(&mut self, sndbuf: &[u8]) -> CDnsResult<usize>

Sends data over wire.
source§

fn recv(&mut self, rcvbuf: &mut [u8]) -> CDnsResult<usize>

Receives data transmitted from remote host. In nonblocking mode it should be called only after the event was polled In blocking mode it will block until received or timeout.

Auto Trait Implementations§

§

impl<T> Freeze for NetworkTap<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for NetworkTap<T>
where T: RefUnwindSafe,

§

impl<T> Send for NetworkTap<T>
where T: Send,

§

impl<T> Sync for NetworkTap<T>
where T: Sync,

§

impl<T> Unpin for NetworkTap<T>
where T: Unpin,

§

impl<T> UnwindSafe for NetworkTap<T>
where T: UnwindSafe,

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
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.

source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V