use libc::{c_uint, c_char, c_int, time_t, c_uchar, timeval};
use super::constants::PFRingChunkType;
pub enum PFRing{}
#[repr(C)]
pub struct PFRingPacketHeader {
pub ts: timeval,
pub caplen: u32,
pub len: u32,
extended_hdr: [u8; 512]
}
#[repr(C)]
pub struct PFRingCardSettings{
pub max_packet_size: u32,
pub rx_ring_slots: u32,
pub tx_ring_slots: u32,
}
#[repr(C)]
pub struct PFRingStat{
pub recv: u64,
pub drop: u64,
pub shunt: u64
}
#[repr(C)]
pub struct PFRingChunkInfo{
pub length: u32,
pub chunk_type: PFRingChunkType,
}
#[repr(C)]
pub struct PFRingBpfProgram {
bf_len: c_uint,
bf_insns: * const ()
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct BusId {
pub slot: c_int,
pub bus: c_int,
pub device: c_int,
pub function: c_int
}
#[derive(Debug)]
#[repr(C)]
pub struct PFRingInterface {
pub name: * const c_char,
pub system_name: * const c_char,
pub module: * const c_char,
pub sn: * const c_char,
pub mac: [c_char; 6],
pub bus_id: BusId,
pub status: c_int,
pub license: c_int,
pub license_expiration: time_t,
pub next: * const PFRingInterface
}
#[repr(C)]
pub struct PFRingModuleInfo {
pub name: c_int,
pub open: unsafe extern "C" fn (* const PFRing) -> c_int,
pub findalldevs : unsafe extern "C" fn () -> * const PFRingInterface
}
#[repr(C)]
pub struct ThirdpartyFunc {
pub name: * const c_char,
pub ptr: unsafe extern "C" fn() -> ()
}
#[repr(C)]
pub struct PFRingStats{
recv: u64,
drop: u64,
shunt: u64
}
#[repr(C)]
pub enum PacketDirection {
RxAndTx = 0,
RxOnly,
TxOnly
}
pub type PFRingProcessPacket = unsafe extern "C" fn(h: * const PFRingPacketHeader, p: * const c_uchar, user_bytes: * const c_uchar);
#[repr(C)]
pub enum ChunkType{
PCapChunk = 0,
PCapNsecChunk,
PCapngNsecChunk,
UnknownChunkType
}
#[repr(C)]
pub struct ChunkInfo{
pub length: u32,
pub chunk_type: ChunkType
}