diff options
author | Ali Abdulkadir <autostart.ini@gmail.com> | 2018-06-11 17:48:01 +0300 |
---|---|---|
committer | Ali Abdulkadir <autostart.ini@gmail.com> | 2018-06-11 17:48:01 +0300 |
commit | 8858606f0017a96acec22da7128fe39d264bc94b (patch) | |
tree | c092759e60442787c523088fb194cbef7daba9e0 | |
parent | b90f52bb40d6206e53be9d2cc5ec137789c6f37f (diff) | |
download | libnet-8858606f0017a96acec22da7128fe39d264bc94b.tar.gz |
Windows: Don't pull in pcap/bpf.h
Instead, define needed DLT_* values locally
-rw-r--r-- | libnet/src/common.h | 7 | ||||
-rw-r--r-- | libnet/src/libnet_link_win32.c | 63 |
2 files changed, 69 insertions, 1 deletions
diff --git a/libnet/src/common.h b/libnet/src/common.h index 2787df1..32b36cd 100644 --- a/libnet/src/common.h +++ b/libnet/src/common.h @@ -32,7 +32,12 @@ /* MSVC warns about snprintf */ #define _CRT_SECURE_NO_WARNINGS + /* don't pull in pcap/bpf.h */ + #define PCAP_DONT_INCLUDE_PCAP_BPF_H #include <pcap/pcap.h> + + /* don't pull in Packet32's locol bpf definitions */ + // #define BPF_MAJOR_VERSION #include <Packet32.h> #include <malloc.h> /* alloca() */ @@ -54,7 +59,7 @@ #endif -#include "../include/config.h" +#include <config.h> #include "../include/libnet.h" /* IPPROTO_ and sockaddr_ definitions are here. They are often diff --git a/libnet/src/libnet_link_win32.c b/libnet/src/libnet_link_win32.c index 1368bac..dea09bf 100644 --- a/libnet/src/libnet_link_win32.c +++ b/libnet/src/libnet_link_win32.c @@ -40,6 +40,69 @@ #include "common.h" +/* + * These are the types that are the same on all platforms, and that + * have been defined by <net/bpf.h> for ages. + */ + +#ifndef DLT_NULL +#define DLT_NULL 0 /* BSD loopback encapsulation */ +#endif + +#ifndef DLT_EN10MB +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#endif + +#ifndef DLT_EN3MB +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#endif + +#ifndef DLT_AX25 +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#endif + +#ifndef DLT_PRONET +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#endif + +#ifndef DLT_CHAOS +#define DLT_CHAOS 5 /* Chaos */ +#endif + +#ifndef DLT_IEEE802 +#define DLT_IEEE802 6 /* 802.5 Token Ring */ +#endif + +#ifndef DLT_ARCNET +#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ +#endif + +#ifndef DLT_SLIP +#define DLT_SLIP 8 /* Serial Line IP */ +#endif + +#ifndef DLT_PPP +#define DLT_PPP 9 /* Point-to-point Protocol */ +#endif + +#ifndef DLT_FDDI +#define DLT_FDDI 10 /* FDDI */ +#endif + +/* + * These are types that are different on some platforms, and that + * have been defined by <net/bpf.h> for ages. We use #ifdefs to + * detect the BSDs that define them differently from the traditional + * libpcap <net/bpf.h> + * + * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, + * but I don't know what the right #define is for BSD/OS. + */ + +#ifndef DLT_ATM_RFC1483 +#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ +#endif + int libnet_open_link(libnet_t *l) { |