#ifndef _NAMESER_H_
#define _NAMESER_H_
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
int r_number; /* rpc program number */
};
-#ifndef WIN32
+#ifndef _WIN32
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
#define __NETDB_MAXALIASES 35
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <ws2tcpip.h>
return "Unknown error";
}
-#endif /* gai_strerror */
\ No newline at end of file
+#endif /* gai_strerror */
#ifdef NEED_ADDRINFO_H
#include "addrinfo.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "ip6_misc.h"
#endif
#endif
char * const *nargv;
const char *ostr;
{
-#ifdef WIN32
+#ifdef _WIN32
char *__progname="windump";
#else
extern char *__progname;
#include <errno.h>
-#ifdef WIN32
+#ifdef _WIN32
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 97 /* not present in errno.h provided with VC */
#endif
#include "config.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#if HAVE_INTTYPES_H
#include <inttypes.h>
# define MLEN(m) ((m)->m_len)
#endif /* defined(__hpux) || SOLARIS */
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <pcap/bpf.h>
#endif
#ifndef LBL_ALIGN
-#ifndef WIN32
+#ifndef _WIN32
#include <netinet/in.h>
#endif
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdio.h>
#include <string.h>
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <ctype.h>
#include <memory.h>
#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?
#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
+#ifdef _WIN32
extern int wsockinit (void);
static int done = 0;
quit:
-#ifdef WIN32
+#ifdef _WIN32
LeaveCriticalSection(&g_PcapCompileCriticalSection);
#endif
#include "config.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdlib.h>
-#ifndef WIN32
+#ifndef _WIN32
#if __STDC__
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <arpa/inet.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdio.h>
#include "config.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#include <sys/param.h>
#ifndef MSDOS
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h>
#include <netinet/in.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if !defined(WIN32) && !defined(__BORLANDC__)
+#if !defined(_WIN32) && !defined(__BORLANDC__)
#include <unistd.h>
-#endif /* !WIN32 && !__BORLANDC__ */
+#endif /* !_WIN32 && !__BORLANDC__ */
#ifdef HAVE_LIMITS_H
#include <limits.h>
#else
}
}
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
/*
* Return the name of a network interface attached to the system, or NULL
return (0);
}
-#elif defined(WIN32)
+#elif defined(_WIN32)
/*
* Return the name of a network interface attached to the system, or NULL
return (0);
}
-#endif /* !WIN32 && !MSDOS */
+#endif /* !_WIN32 && !MSDOS */
#include <netdnet/dnetdb.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#include <sys/param.h>
#include <sys/types.h> /* concession to AIX */
#include <sys/time.h>
#include <netinet/in.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
-#ifndef WIN32
+#ifndef _WIN32
#ifdef HAVE_ETHER_HOSTTON
/*
* XXX - do we need any of this if <netinet/if_ether.h> doesn't declare
#endif /* HAVE_ETHER_HOSTTON */
#include <arpa/inet.h>
#include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <ctype.h>
#include <errno.h>
bpf_u_int32
pcap_nametonetaddr(const char *name)
{
-#ifndef WIN32
+#ifndef _WIN32
struct netent *np;
if ((np = getnetbyname(name)) != NULL)
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdio.h>
#include <stdlib.h>
#define ffs _w32_ffs
#endif
-#if defined(WIN32) && defined (_MSC_VER)
+#if defined(_WIN32) && defined (_MSC_VER)
int ffs(int mask);
#endif
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include "pcap-int.h"
#include "pcap/usb.h"
extern "C" {
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <Packet32.h>
extern CRITICAL_SECTION g_PcapCompileCriticalSection;
-#endif /* WIN32 */
+#endif /* _WIN32 */
#ifdef MSDOS
#include <fcntl.h>
typedef int (*getnonblock_op_t)(pcap_t *, char *);
typedef int (*setnonblock_op_t)(pcap_t *, int, char *);
typedef int (*stats_op_t)(pcap_t *, struct pcap_stat *);
-#ifdef WIN32
+#ifdef _WIN32
typedef int (*setbuff_op_t)(pcap_t *, int);
typedef int (*setmode_op_t)(pcap_t *, int);
typedef int (*setmintocopy_op_t)(pcap_t *, int);
*/
int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **);
-#ifdef WIN32
+#ifdef _WIN32
ADAPTER *adapter;
LPPACKET Packet;
int nonblock;
#else
int fd;
int selectable_fd;
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Read buffer.
*/
pcap_handler oneshot_callback;
-#ifdef WIN32
+#ifdef _WIN32
/*
* These are, at least currently, specific to the Win32 NPF
* driver.
/*
* Routines that most pcap implementations can use for non-blocking mode.
*/
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
int pcap_getnonblock_fd(pcap_t *, char *);
int pcap_setnonblock_fd(pcap_t *p, int, char *);
#endif
*/
void pcap_oneshot(u_char *, const struct pcap_pkthdr *, const u_char *);
-#ifdef WIN32
+#ifdef _WIN32
char *pcap_win32strerror(void);
#endif
#define WIN32_DEFAULT_USER_BUFFER_SIZE 256000
/*dimension of the buffer in the kernel driver NPF */
-#define WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000
+#define _WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000
/* Equivalent to ntohs(), but a lot faster under Windows */
#define SWAPS(_X) ((_X & 0xff) << 8) | (_X >> 8)
* WIN32_DEFAULT_USER_BUFFER_SIZE.
*/
if (p->opt.buffer_size == 0)
- p->opt.buffer_size = WIN32_DEFAULT_KERNEL_BUFFER_SIZE;
+ p->opt.buffer_size = _WIN32_DEFAULT_KERNEL_BUFFER_SIZE;
if(PacketSetBuff(p->adapter,p->opt.buffer_size)==FALSE)
{
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <stdio.h>
#include <stdlib.h>
return (PCAP_ERROR_NOT_ACTIVATED);
}
-#ifdef WIN32
+#ifdef _WIN32
Adapter *
pcap_no_adapter(pcap_t *pcap _U_)
{
p->getnonblock_op = (getnonblock_op_t)pcap_not_initialized;
p->setnonblock_op = (setnonblock_op_t)pcap_not_initialized;
p->stats_op = (stats_op_t)pcap_not_initialized;
-#ifdef WIN32
+#ifdef _WIN32
p->setbuff_op = (setbuff_op_t)pcap_not_initialized;
p->setmode_op = (setmode_op_t)pcap_not_initialized;
p->setmintocopy_op = (setmintocopy_op_t)pcap_not_initialized;
*/
p = (pcap_t *)chunk;
-#ifndef WIN32
+#ifndef _WIN32
p->fd = -1; /* not opened yet */
p->selectable_fd = -1;
#endif
int
pcap_fileno(pcap_t *p)
{
-#ifndef WIN32
+#ifndef _WIN32
return (p->fd);
#else
if (p->adapter != NULL)
#endif
}
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
int
pcap_get_selectable_fd(pcap_t *p)
{
* We don't look at "p->nonblock", in case somebody tweaked the FD
* directly.
*/
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
int
pcap_getnonblock_fd(pcap_t *p, char *errbuf)
{
return (ret);
}
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
/*
* Set non-blocking mode, under the assumption that it's just the
* standard POSIX non-blocking flag. (This can be called by the
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
/*
* Generate a string for the last Win32-specific error (i.e. an error generated when
* calling a Win32 API).
return (-1);
}
-#ifdef WIN32
+#ifdef _WIN32
int
pcap_setbuff(pcap_t *p, int dim)
{
p->tstamp_precision_count = 0;
}
pcap_freecode(&p->fcode);
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
if (p->fd >= 0) {
close(p->fd);
p->fd = -1;
p->linktype = linktype;
p->opt.tstamp_precision = precision;
p->stats_op = pcap_stats_dead;
-#ifdef WIN32
+#ifdef _WIN32
p->setbuff_op = pcap_setbuff_dead;
p->setmode_op = pcap_setmode_dead;
p->setmintocopy_op = pcap_setmintocopy_dead;
static const char pcap_version_string[] = "libpcap version 1.x.y";
#endif
-#ifdef WIN32
+#ifdef _WIN32
/*
* XXX - it'd be nice if we could somehow generate the WinPcap and libpcap
* version numbers when building WinPcap. (It'd be nice to do so for
#ifndef lib_pcap_pcap_h
#define lib_pcap_pcap_h
-#if defined(WIN32)
+#if defined(_WIN32)
#include <pcap-stdinc.h>
#elif defined(MSDOS)
#include <sys/types.h>
#else /* UN*X */
#include <sys/types.h>
#include <sys/time.h>
-#endif /* WIN32/MSDOS/UN*X */
+#endif /* _WIN32/MSDOS/UN*X */
#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
#include <pcap/bpf.h>
u_int ps_recv; /* number of packets received */
u_int ps_drop; /* number of packets dropped */
u_int ps_ifdrop; /* drops by interface -- only supported on some platforms */
-#ifdef WIN32
+#ifdef _WIN32
u_int bs_capt; /* number of packets that reach the application */
-#endif /* WIN32 */
+#endif /* _WIN32 */
};
#ifdef MSDOS
pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
pcap_t *pcap_open_offline(const char *, char *);
-#if defined(WIN32)
+#if defined(_WIN32)
pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
pcap_t *pcap_hopen_offline(intptr_t, char *);
#if !defined(LIBPCAP_EXPORTS)
static pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
static pcap_t *pcap_fopen_offline(FILE *, char *);
#endif
-#else /*WIN32*/
+#else /*_WIN32*/
pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
pcap_t *pcap_fopen_offline(FILE *, char *);
-#endif /*WIN32*/
+#endif /*_WIN32*/
void pcap_close(pcap_t *);
int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
char *bpf_image(const struct bpf_insn *, int);
void bpf_dump(const struct bpf_program *, int);
-#if defined(WIN32)
+#if defined(_WIN32)
/*
* Win32 definitions
int pcap_get_selectable_fd(pcap_t *);
-#endif /* WIN32/MSDOS/UN*X */
+#endif /* _WIN32/MSDOS/UN*X */
#ifdef __cplusplus
}
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <errno.h>
#include <memory.h>
/*
* Setting O_BINARY on DOS/Windows is a bit tricky
*/
-#if defined(WIN32)
+#if defined(_WIN32)
#define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY)
#elif defined(MSDOS)
#if defined(__HIGHC__)
return (-1);
}
-#ifdef WIN32
+#ifdef _WIN32
static int
sf_setbuff(pcap_t *p, int dim)
{
if (fname[0] == '-' && fname[1] == '\0')
{
fp = stdin;
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
/*
* We're reading from the standard input, so put it in binary
* mode, as savefiles are binary files.
#endif
}
else {
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
fp = fopen(fname, "r");
#else
fp = fopen(fname, "rb");
PCAP_TSTAMP_PRECISION_MICRO, errbuf));
}
-#ifdef WIN32
+#ifdef _WIN32
pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision,
char *errbuf)
{
#define N_FILE_TYPES (sizeof check_headers / sizeof check_headers[0])
-#ifdef WIN32
+#ifdef _WIN32
static
#endif
pcap_t *
/* Padding only needed for live capture fcode */
p->fddipad = 0;
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
/*
* You can do "select()" and "poll()" on plain files on most
* platforms, and should be able to do so on pipes.
p->getnonblock_op = sf_getnonblock;
p->setnonblock_op = sf_setnonblock;
p->stats_op = sf_stats;
-#ifdef WIN32
+#ifdef _WIN32
p->setbuff_op = sf_setbuff;
p->setmode_op = sf_setmode;
p->setmintocopy_op = sf_setmintocopy;
return (p);
}
-#ifdef WIN32
+#ifdef _WIN32
static
#endif
pcap_t *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
#if HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_STDINT_H
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <ctype.h>
#include <string.h>
#include "gencode.h"
#ifdef INET6
-#ifdef WIN32
+#ifdef _WIN32
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "ip6_misc.h"
#endif
-#else /* WIN32 */
+#else /* _WIN32 */
#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */
#include <netdb.h> /* for "struct addrinfo" */
-#endif /* WIN32 */
+#endif /* _WIN32 */
/* Workaround for AIX 4.3 */
#if !defined(AI_NUMERICHOST)
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <errno.h>
#include <memory.h>
#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
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
#include <errno.h>
#include <memory.h>
/*
* Setting O_BINARY on DOS/Windows is a bit tricky
*/
-#if defined(WIN32)
+#if defined(_WIN32)
#define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY)
#elif defined(MSDOS)
#if defined(__HIGHC__)
pcap_setup_dump(pcap_t *p, int linktype, FILE *f, const char *fname)
{
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
/*
* If we're writing to the standard output, put it in binary
* mode, as savefiles are binary files.
f = stdout;
fname = "standard output";
} else {
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
f = fopen(fname, "w");
#else
f = fopen(fname, "wb");
if (fname[0] == '-' && fname[1] == '\0')
return (pcap_setup_dump(p, linktype, stdout, "standard output"));
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
f = fopen(fname, "r+");
#else
f = fopen(fname, "rb+");
}
}
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
/*
* We turn off buffering.
* XXX - why? And why not on the standard output?
pcap_t *pd;
struct bpf_program fcode;
-#ifdef WIN32
+#ifdef _WIN32
if(wsockinit() != 0) return 1;
-#endif /* WIN32 */
+#endif /* _WIN32 */
#ifndef BDEBUG
dflag = 1;