summaryrefslogtreecommitdiff
path: root/src/unix/bsd/apple/mod.rs
diff options
context:
space:
mode:
authorluozijun <gnulinux@126.com>2017-12-26 16:02:17 +0800
committerluozijun <gnulinux@126.com>2017-12-27 04:04:46 +0800
commit536b5cfa865691465b86942113bfdab082fd2ae3 (patch)
tree0a45441981ed4c7a8e99c65e607915a0ce6e34f0 /src/unix/bsd/apple/mod.rs
parent629908abe33f4594a04dd4b4091e6eaca4056302 (diff)
downloadrust-libc-536b5cfa865691465b86942113bfdab082fd2ae3.tar.gz
Add bpf constant on macOS
Diffstat (limited to 'src/unix/bsd/apple/mod.rs')
-rw-r--r--src/unix/bsd/apple/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 5584b17439..7281f91968 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -2167,6 +2167,26 @@ pub const MH_MAGIC_64: u32 = 0xfeedfacf;
pub const UTUN_OPT_FLAGS: ::c_int = 1;
pub const UTUN_OPT_IFNAME: ::c_int = 2;
+// net/bpf.h
+pub const DLT_NULL: ::c_uint = 0; // no link-layer encapsulation
+pub const DLT_EN10MB: ::c_uint = 1; // Ethernet (10Mb)
+pub const DLT_EN3MB: ::c_uint = 2; // Experimental Ethernet (3Mb)
+pub const DLT_AX25: ::c_uint = 3; // Amateur Radio AX.25
+pub const DLT_PRONET: ::c_uint = 4; // Proteon ProNET Token Ring
+pub const DLT_CHAOS: ::c_uint = 5; // Chaos
+pub const DLT_IEEE802: ::c_uint = 6; // IEEE 802 Networks
+pub const DLT_ARCNET: ::c_uint = 7; // ARCNET
+pub const DLT_SLIP: ::c_uint = 8; // Serial Line IP
+pub const DLT_PPP: ::c_uint = 9; // Point-to-point Protocol
+pub const DLT_FDDI: ::c_uint = 10; // FDDI
+pub const DLT_ATM_RFC1483: ::c_uint = 11; // LLC/SNAP encapsulated atm
+pub const DLT_RAW: ::c_uint = 12; // raw IP
+pub const DLT_LOOP: ::c_uint = 108;
+
+// https://github.com/apple/darwin-xnu/blob/master/bsd/net/bpf.h#L100
+// sizeof(int32_t)
+pub const BPF_ALIGNMENT: ::c_int = 4;
+
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8