pub struct StampedSocket { /* private fields */ }Expand description
Sends and receives the payloads of Ethernet frames of one ethertype on one interface, with hardware time stamps.
Implementations§
Source§impl StampedSocket
impl StampedSocket
Sourcepub fn open(interface: &str, ethertype: u16) -> Result<Self>
pub fn open(interface: &str, ethertype: u16) -> Result<Self>
Opens interface for frames of ethertype, stamping each frame
received. On Linux this needs CAP_NET_RAW.
Sourcepub fn join_multicast(&self, group: MacAddress) -> Result<()>
pub fn join_multicast(&self, group: MacAddress) -> Result<()>
Receives frames sent to group as well.
Sourcepub fn send(&self, destination: MacAddress, payload: &[u8]) -> Result<()>
pub fn send(&self, destination: MacAddress, payload: &[u8]) -> Result<()>
Sends payload to destination, unstamped.
Sourcepub fn send_stamped(
&self,
destination: MacAddress,
payload: &[u8],
) -> Result<()>
pub fn send_stamped( &self, destination: MacAddress, payload: &[u8], ) -> Result<()>
Sends payload to destination and has the interface stamp it;
when it has gone out, transmit_time gives
the time. Times of frames sent before that came too late for
transmit_time are dropped first, so the next it gives is this
frame’s.
Sourcepub fn transmit_time(&self, timeout: Duration) -> Result<Option<Duration>>
pub fn transmit_time(&self, timeout: Duration) -> Result<Option<Duration>>
The time the last frame sent with
send_stamped went out, by the interface’s
hardware clock, waiting up to timeout for the interface to say.
None when it did not say in time. Where the kernel numbers the
times sent (SOF_TIMESTAMPING_OPT_ID), one come too late for an
earlier frame is dropped, never taken for this one.