Skip to main content

libc/new/apple/xnu/net/
bpf.rs

1//! Header: `net/bpf.h`
2//!
3//! <https://github.com/apple-oss-distributions/xnu/blob/main/bsd/net/bpf.h>
4
5use crate::prelude::*;
6use crate::sys::ioccom::*;
7
8s! {
9    pub struct bpf_insn {
10        pub code: c_ushort,
11        pub jt: c_uchar,
12        pub jf: c_uchar,
13        pub k: u32,
14    }
15
16    pub struct bpf_program {
17        pub bf_len: c_uint,
18        pub bf_insns: *mut bpf_insn,
19    }
20}
21
22s_no_extra_traits! {
23    #[repr(packed(4))]
24    pub struct bpf_dltlist {
25        pub bfl_len: u32,
26        pub bfl_u: __c_anonymous_bfl_u,
27    }
28
29    pub union __c_anonymous_bfl_u {
30        pub bflu_list: *mut u32,
31        pub bflu_pad: u64,
32    }
33}
34
35pub const DLT_NULL: c_uint = 0; // no link-layer encapsulation
36pub const DLT_EN10MB: c_uint = 1; // Ethernet (10Mb)
37pub const DLT_EN3MB: c_uint = 2; // Experimental Ethernet (3Mb)
38pub const DLT_AX25: c_uint = 3; // Amateur Radio AX.25
39pub const DLT_PRONET: c_uint = 4; // Proteon ProNET Token Ring
40pub const DLT_CHAOS: c_uint = 5; // Chaos
41pub const DLT_IEEE802: c_uint = 6; // IEEE 802 Networks
42pub const DLT_ARCNET: c_uint = 7; // ARCNET
43pub const DLT_SLIP: c_uint = 8; // Serial Line IP
44pub const DLT_PPP: c_uint = 9; // Point-to-point Protocol
45pub const DLT_FDDI: c_uint = 10; // FDDI
46pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm
47pub const DLT_RAW: c_uint = 12; // raw IP
48pub const DLT_LOOP: c_uint = 108;
49
50pub const BPF_ALIGNMENT: c_int = size_of::<i32>() as c_int;
51
52pub const BIOCGRSIG: c_ulong = _IOR::<c_uint>('B' as c_ulong, 114);
53pub const BIOCSRSIG: c_ulong = _IOW::<c_uint>('B' as c_ulong, 115);
54pub const BIOCGSEESENT: c_ulong = _IOR::<c_uint>('B' as c_ulong, 118);
55pub const BIOCSSEESENT: c_ulong = _IOW::<c_uint>('B' as c_ulong, 119);
56pub const BIOCSDLT: c_ulong = _IOW::<c_uint>('B' as c_ulong, 120);
57pub const BIOCGDLTLIST: c_ulong = _IOWR::<bpf_dltlist>('B' as c_ulong, 121);