use thiserror::Error;
#[repr(C)]
#[derive(Error, Debug)]
pub enum PcaptureError {
#[error("unhandled channel type")]
UnhandledChannelType,
#[error("unable to create channel: {e}")]
UnableCreateChannel { e: String },
#[error("std io error")]
IOError(#[from] std::io::Error),
#[error("get system time error")]
SystemTimeError(#[from] std::time::SystemTimeError),
#[error("interface [{name}] not found, available interfaces: {available_interface}")]
InterfaceNotFound {
name: String,
available_interface: String,
},
#[error("unknown linktype [{linktype}]")]
UnknownLinkType { linktype: u32 },
#[error("get cpu model info error")]
GetSystemInfoError,
#[error("unknown block type [{blocktype}]")]
UnknownBlockType { blocktype: u32 },
#[error("unsupported block type [{blockname}]")]
UnsupportedBlockType { blockname: String },
#[error("{msg}")]
IncompleteFilter { msg: String },
#[error("parse [{parameter}] to [{target}] error: {e}")]
ValueError {
parameter: String,
target: String,
e: String,
},
#[error("unknown operator [{op}]")]
UnknownOperator { op: String },
#[error("call libpcap get error: {msg}")]
LibpcapError { msg: String },
#[error("ffi nul error")]
NulError(#[from] std::ffi::NulError),
#[error("send stop singal failed")]
SendError(#[from] std::sync::mpsc::SendError<bool>),
}