#![allow(clippy::unused_self, clippy::unnecessary_wraps)]
use std::io;
use std::time::Duration;
use crate::bpf::Program;
use crate::config::{Clock, Config, Timestamping};
use crate::packet::{MacAddr, Packet, RxPath, Stats, TxErrors};
fn unsupported() -> io::Error {
io::Error::new(
io::ErrorKind::Unsupported,
"raw Ethernet sockets are supported on Linux, macOS and the BSDs only",
)
}
#[derive(Debug)]
pub(crate) struct Inner(core::convert::Infallible);
impl Inner {
pub(crate) fn open(_: &Config, _: Option<&Program>) -> io::Result<Inner> {
Err(unsupported())
}
pub(crate) fn interface(&self) -> &str {
match self.0 {}
}
pub(crate) fn index(&self) -> u32 {
match self.0 {}
}
pub(crate) fn mac(&self) -> MacAddr {
match self.0 {}
}
pub(crate) fn rx_path(&self) -> RxPath {
match self.0 {}
}
pub(crate) fn recv(&mut self, _: Option<Duration>) -> io::Result<Option<Packet<'_>>> {
match self.0 {}
}
pub(crate) fn send(&self, _: &[u8]) -> io::Result<()> {
match self.0 {}
}
pub(crate) fn send_at(&self, _: &[u8], _: u64) -> io::Result<()> {
match self.0 {}
}
pub(crate) fn send_batch(&mut self, _: &[&[u8]]) -> io::Result<usize> {
match self.0 {}
}
pub(crate) fn stats(&mut self) -> io::Result<Stats> {
match self.0 {}
}
pub(crate) fn timestamping(&self) -> Timestamping {
match self.0 {}
}
pub(crate) fn tx_errors(&mut self) -> io::Result<TxErrors> {
match self.0 {}
}
pub(crate) fn set_nonblocking(&mut self, _: bool) -> io::Result<()> {
match self.0 {}
}
#[cfg(unix)]
pub(crate) fn as_fd(&self) -> std::os::fd::BorrowedFd<'_> {
match self.0 {}
}
}
pub(crate) fn clock_now(_: Clock) -> io::Result<Duration> {
Err(unsupported())
}
pub(crate) fn drop_capabilities() -> io::Result<()> {
Ok(())
}