#include "config.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#if HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_STDINT_H
#endif
#include <sys/types.h>
#include <sys/socket.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
-/*
- * XXX - why was this included even on UNIX?
- */
-#ifdef __MINGW32__
-#include "ip6_misc.h"
-#endif
-
-#ifndef WIN32
+#ifndef _WIN32
#ifdef __NetBSD__
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdlib.h>
#include <string.h>
#define offsetof(s, e) ((size_t)&((s *)0)->e)
#endif
#ifdef INET6
-#ifndef WIN32
+#ifndef _WIN32
#include <netdb.h> /* for "struct addrinfo" */
-#endif /* WIN32 */
+#endif /* _WIN32 */
#endif /*INET6*/
#include <pcap/namedb.h>
static pcap_t *bpf_pcap;
/* Hack for handling VLAN and MPLS stacks. */
-#ifdef WIN32
+#ifdef _WIN32
static u_int label_stack_depth = (u_int)-1, vlan_stack_depth = (u_int)-1;
#else
static u_int label_stack_depth = -1U, vlan_stack_depth = -1U;
* UN*X, if the platform supports pthreads? If that requires
* a separate -lpthread, we might not want to do that.
*/
-#ifdef WIN32
- extern int wsockinit (void);
+#ifdef _WIN32
static int done = 0;
if (!done)
- wsockinit();
+ pcap_wsockinit();
done = 1;
EnterCriticalSection(&g_PcapCompileCriticalSection);
#endif
quit:
-#ifdef WIN32
+#ifdef _WIN32
LeaveCriticalSection(&g_PcapCompileCriticalSection);
#endif
/*
* For DLT_PPI captures, generate a check of the per-packet
* DLT value to make sure it's DLT_IEEE802_11.
+ *
+ * XXX - TurboCap cards use DLT_PPI for Ethernet.
+ * Can we just define some DLT_ETHERNET_WITH_PHDR pseudo-header
+ * with appropriate Ethernet information and use that rather
+ * than using something such as DLT_PPI where you don't know
+ * the link-layer header type until runtime, which, in the
+ * general case, would force us to generate both Ethernet *and*
+ * 802.11 code (*and* anything else for which PPI is used)
+ * and choose between them early in the BPF program?
*/
ppi_dlt_check = gen_ppi_dlt_check();
if (ppi_dlt_check != NULL)
int reg2 = alloc_reg();
memset(s, 0, sizeof(s));
- fix2 = fix3 = fix4 = fix5 = 0;
+ fix3 = fix4 = fix5 = 0;
switch (proto) {
case Q_IP:
/* check for VLAN, including QinQ */
b0 = gen_linktype(ETHERTYPE_8021Q);
+ b1 = gen_linktype(ETHERTYPE_8021AD);
+ gen_or(b0,b1);
+ b0 = b1;
b1 = gen_linktype(ETHERTYPE_8021QINQ);
gen_or(b0,b1);
b0 = b1;