From 6eaea1dd314355a18b94722dd4e4adcad01aad8d Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Mon, 29 May 2017 22:55:31 -0400 Subject: [PATCH 1/7] make libpcap optional on mac --- Makefile | 12 +- src/main.c | 4 +- src/rawsock-pcap.c | 416 +++++++++++++++++++++++ src/rawsock-pcap.h | 96 ++++++ src/rawsock.c | 64 ++-- src/siphash24.c | 6 +- xcode4/masscan.xcodeproj/project.pbxproj | 22 +- 7 files changed, 577 insertions(+), 43 deletions(-) create mode 100644 src/rawsock-pcap.c create mode 100644 src/rawsock-pcap.h diff --git a/Makefile b/Makefile index 92621926..96f103ac 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ endif # environment where things likely will work -- as well as anything # works on the bajillion of different Linux environments ifneq (, $(findstring linux, $(SYS))) -LIBS = -lpcap -lm -lrt -ldl -lpthread +LIBS = -lm -lrt -ldl -lpthread INCLUDES = FLAGS2 = endif @@ -23,7 +23,7 @@ endif # my regularly regression-test environment. That means at any point # in time, something might be minorly broken in Mac OS X. ifneq (, $(findstring darwin, $(SYS))) -LIBS = -lpcap -lm +LIBS = -lm INCLUDES = -I. FLAGS2 = INSTALL_DATA = -pm755 @@ -37,7 +37,7 @@ endif # intended environment, so it make break in the future. ifneq (, $(findstring mingw, $(SYS))) INCLUDES = -Ivs10/include -LIBS = -L vs10/lib -lwpcap -lIPHLPAPI -lWs2_32 +LIBS = -L vs10/lib -lIPHLPAPI -lWs2_32 FLAGS2 = -march=i686 endif @@ -47,20 +47,20 @@ endif # head with a hammer and want to feel a different sort of pain. ifneq (, $(findstring cygwin, $(SYS))) INCLUDES = -I. -LIBS = -lwpcap +LIBS = FLAGS2 = endif # OpenBSD ifneq (, $(findstring openbsd, $(SYS))) -LIBS = -lpcap -lm -pthread +LIBS = -lm -pthread INCLUDES = -I. FLAGS2 = endif # FreeBSD ifneq (, $(findstring freebsd, $(SYS))) -LIBS = -lpcap -lm -pthread +LIBS = -lm -pthread INCLUDES = -I. FLAGS2 = endif diff --git a/src/main.c b/src/main.c index caf2745e..2e5b8701 100644 --- a/src/main.c +++ b/src/main.c @@ -1428,6 +1428,7 @@ main_scan(struct Masscan *masscan) +void pcap_init(void); /*************************************************************************** ***************************************************************************/ @@ -1435,7 +1436,7 @@ int main(int argc, char *argv[]) { struct Masscan masscan[1]; unsigned i; - + usec_start = pixie_gettime(); #if defined(WIN32) {WSADATA x; WSAStartup(0x101, &x);} @@ -1506,6 +1507,7 @@ int main(int argc, char *argv[]) /* We need to do a separate "raw socket" initialization step. This is * for Windows and PF_RING. */ + pcap_init(); rawsock_init(); /* Init some protocol parser data structures */ diff --git a/src/rawsock-pcap.c b/src/rawsock-pcap.c new file mode 100644 index 00000000..8909c46b --- /dev/null +++ b/src/rawsock-pcap.c @@ -0,0 +1,416 @@ +/* Copyright (c) 2007 by Errata Security, All Rights Reserved + * Copyright (c) 2017 by Robert David Graham + * Programer(s): Robert David Graham [rdg] + */ +/* + PCAPLIVE + + This code links the 'libpcap' module at RUNTIME rather than LOADTIME. + This allows us to: + (a) run this program on capture files without needing libpcap installed. + (b) give more user friendly diagnostic to the users who don't realize + that they need to install libpcap separately. + + On Windows, this uses the LoadLibrary/GetProcAddress functions to + load the library. + + On Linux, this uses the dlopen/dlsym functions to do essentially + the same thing. + */ +#include "logger.h" + +#if _MSC_VER==1200 +#pragma warning(disable:4115 4201) +#include +#endif +#include "rawsock-pcap.h" + +#ifdef WIN32 +#include +#else +#include +#endif + +#include +#include +#include + +#ifndef UNUSEDPARM +#ifdef __GNUC__ +#define UNUSEDPARM(x) x=(x) +#endif +#endif + +struct pcap_if { + struct pcap_if *next; + char *name; /* name to hand to "pcap_open_live()" */ + char *description; /* textual description of interface, or NULL */ + void *addresses; + unsigned flags; /* PCAP_IF_ interface flags */ +}; + +static void seterr(char *errbuf, const char *msg) +{ + size_t length = strlen(msg); + + if (length > PCAP_ERRBUF_SIZE-1) + length = PCAP_ERRBUF_SIZE-1; + memcpy(errbuf, msg, length); + errbuf[length] = '\0'; +} + +static void null_PCAP_CLOSE(void *hPcap) +{ +#ifdef STATICPCAP + pcap_close(hPcap); + return; +#endif + UNUSEDPARM(hPcap); +} + + +static unsigned null_PCAP_DATALINK(void *hPcap) +{ +#ifdef STATICPCAP + return pcap_datalink(hPcap); +#endif + UNUSEDPARM(hPcap); + return 0; +} + + +static unsigned null_PCAP_DISPATCH(void *hPcap, unsigned how_many_packets, PCAP_HANDLE_PACKET handler, void *handle_data) +{ +#ifdef STATICPCAP + return pcap_dispatch(hPcap, how_many_packets, handler, handle_data); +#endif + UNUSEDPARM(hPcap);UNUSEDPARM(how_many_packets);UNUSEDPARM(handler);UNUSEDPARM(handle_data); + return 0; +} + + +static int null_PCAP_FINDALLDEVS(pcap_if_t **alldevs, char *errbuf) +{ +#ifdef STATICPCAP + return pcap_findalldevs(alldevs, errbuf); +#endif + *alldevs = 0; + seterr(errbuf, "libpcap not loaded"); + return -1; +} + + +static void null_PCAP_FREEALLDEVS(pcap_if_t *alldevs) +{ +#ifdef STATICPCAP + return pcap_freealldevs(alldevs); +#endif + UNUSEDPARM(alldevs); + return; +} + + +static char *null_PCAP_LOOKUPDEV(char *errbuf) +{ +#ifdef STATICPCAP + return pcap_lookupdev(errbuf); +#endif + seterr(errbuf, "libpcap not loaded"); + return ""; +} + + +static void * null_PCAP_OPEN_LIVE(const char *devicename, unsigned snap_length, unsigned is_promiscuous, unsigned read_timeout, char *errbuf) +{ +#ifdef STATICPCAP + return pcap_open_live(devicename, snap_length, is_promiscuous, read_timeout, errbuf); +#endif + seterr(errbuf, "libpcap not loaded"); + UNUSEDPARM(devicename);UNUSEDPARM(snap_length);UNUSEDPARM(is_promiscuous);UNUSEDPARM(read_timeout); + return NULL; +} + +static int null_PCAP_MAJOR_VERSION(void *p) +{ +#ifdef STATICPCAP + return pcap_major_version(p); +#endif + UNUSEDPARM(p); + return 0; +} + + +static int null_PCAP_MINOR_VERSION(void *p) +{ +#ifdef STATICPCAP + return pcap_minor_version(p); +#endif + UNUSEDPARM(p); + return 0; +} + +static const char *null_PCAP_LIB_VERSION(void) +{ +#ifdef STATICPCAP + return pcap_lib_version(); +#endif + + return "stub/0.0"; +} + +#ifdef WIN32 +static void *null_PCAP_GET_AIRPCAP_HANDLE(void *p) +{ + UNUSEDPARM(p); + return NULL; +} +#endif + +#ifdef WIN32 +static unsigned null_AIRPCAP_SET_DEVICE_CHANNEL(void *p, unsigned channel) +{ + UNUSEDPARM(p);UNUSEDPARM(channel); + + return 0; /*0=failure, 1=success*/ +} +#endif + + +static unsigned null_CAN_TRANSMIT(const char *devicename) +{ +#if WIN32 + struct DeviceCapabilities { + unsigned AdapterId; /* An Id that identifies the adapter model.*/ + char AdapterModelName; /* String containing a printable adapter model.*/ + unsigned AdapterBus; /* The type of bus the adapter is plugged to. */ + unsigned CanTransmit; /* TRUE if the adapter is able to perform frame injection.*/ + unsigned CanSetTransmitPower; /* TRUE if the adapter's transmit power is can be specified by the user application.*/ + unsigned ExternalAntennaPlug; /* TRUE if the adapter supports plugging one or more external antennas.*/ + unsigned SupportedMedia; + unsigned SupportedBands; + } caps; + void * (*myopen)(const char *devicename, char *errbuf); + void (*myclose)(void *h); + unsigned (*mycapabilities)(void *h, struct DeviceCapabilities *caps); + + unsigned result = 0; + void *hAirpcap; + + + hAirpcap = LoadLibraryA("airpcap.dll"); + if (hAirpcap == NULL) + return 0; + + + myopen = (void * (*)(const char *, char*))GetProcAddress(hAirpcap, "AirpcapOpen"); + myclose = (void (*)(void*))GetProcAddress(hAirpcap, "AirpcapClose"); + mycapabilities = (unsigned (*)(void*, struct DeviceCapabilities *))GetProcAddress(hAirpcap, "AirpcapGetDeviceCapabilities"); + if (myopen && mycapabilities && myclose ) { + void *h = myopen(devicename, NULL); + if (h) { + if (mycapabilities(h, &caps)) { + result = caps.CanTransmit; + } + myclose(h); + } + } + + FreeLibrary(hAirpcap); + return result; +#elif defined(__linux__) + return 1; +#elif defined(__APPLE__) || defined(__FreeBSD__) + return 1; +#else +#error unknown os +#endif +} + +struct PcapFunctions PCAP = { + 0,0,0,0,0, + null_PCAP_CLOSE, +}; + + +static void *my_null(int x, ...) +{ + return 0; +} +static pcap_t *null_PCAP_OPEN_OFFLINE(const char *fname, char *errbuf) +{ + return my_null(2, fname, errbuf); +} +static int null_PCAP_SENDPACKET(pcap_t *p, const unsigned char *buf, int size) +{ + return (int)my_null(p, buf, size); +} + +static const unsigned char *null_PCAP_NEXT(pcap_t *p, struct pcap_pkthdr *h) +{ + return 0; +} +static int null_PCAP_SETDIRECTION(pcap_t *p, pcap_direction_t d) +{ + return 0; +} +static const char *null_PCAP_DATALINK_VAL_TO_NAME(int dlt) +{ + return 0; +} +static void null_PCAP_PERROR(pcap_t *p, char *prefix) +{ + perror("pcap"); +} +static const char *null_PCAP_DEV_NAME(const pcap_if_t *dev) +{ + return dev->name; +} +static const char *null_PCAP_DEV_DESCRIPTION(const pcap_if_t *dev) +{ + return dev->description; +} +static const pcap_if_t *null_PCAP_DEV_NEXT(const pcap_if_t *dev) +{ + return dev->next; +} + +/** + * Runtime-load the libpcap shared-object or the winpcap DLL. We + * load at runtime rather than loadtime to allow this program to + * be used to process offline content, and to provide more helpful + * messages to people who don't realize they need to install PCAP. + */ +void pcap_init(void) +{ + struct PcapFunctions *pl = &PCAP; +#ifdef WIN32 + HMODULE hPacket; + HMODULE hLibpcap; + HMODULE hAirpcap; + + pl->is_available = 0; + pl->is_printing_debug = 1; + + /* Look for the Packet.dll */ + hPacket = LoadLibraryA("Packet.dll"); + if (hPacket == NULL) { + if (pl->is_printing_debug) + switch (GetLastError()) { + case ERROR_MOD_NOT_FOUND: + fprintf(stderr, "%s: not found\n", "Packet.dll"); + return; + default: + fprintf(stderr, "%s: couldn't load %d\n", "Packet.dll", (int)GetLastError()); + return; + } + } + + /* Look for the Packet.dll */ + hLibpcap = LoadLibraryA("wpcap.dll"); + if (hLibpcap == NULL) { + if (pl->is_printing_debug) + fprintf(stderr, "%s: couldn't load %d\n", "wpcap.dll", (int)GetLastError()); + return; + } + + /* Look for the Packet.dll */ + hAirpcap = LoadLibraryA("airpcap.dll"); + if (hLibpcap == NULL) { + if (pl->is_printing_debug) + fprintf(stderr, "%s: couldn't load %d\n", "airpcap.dll", (int)GetLastError()); + return; + } + +#define DOLINK(PCAP_DATALINK, datalink) \ +pl->datalink = (PCAP_DATALINK)GetProcAddress(hLibpcap, "pcap_"#datalink); \ +if (pl->datalink == NULL) pl->func_err=1, pl->datalink = null_##PCAP_DATALINK; +#endif + + +#ifndef WIN32 +#ifndef STATICPCAP + void *hLibpcap; + + pl->is_available = 0; + pl->is_printing_debug = 1; + + { + static const char *possible_names[] = { + "libpcap.so", + "libpcap.A.dylib", + "libpcap.dylib", + "libpcap.so.0.9.5", + "libpcap.so.0.9.4", + "libpcap.so.0.8", + 0 + }; + unsigned i; + for (i=0; possible_names[i]; i++) { + hLibpcap = dlopen(possible_names[i], RTLD_LAZY); + if (hLibpcap) { + LOG(1, "pcap: found library: %s\n", possible_names[i]); + break; + } else { + LOG(2, "pcap: failed to load: %s\n", possible_names[i]); + } + } + + if (hLibpcap == NULL) + fprintf(stderr, "pcap: failed to load libpcap\n"); + } + +#define DOLINK(PCAP_DATALINK, datalink) \ +pl->datalink = (PCAP_DATALINK)dlsym(hLibpcap, "pcap_"#datalink); \ + if (pl->datalink == NULL) LOG(1, "pcap: pcap_%s: failed\n", #datalink); \ + if (pl->datalink == NULL) pl->func_err=1, pl->datalink = null_##PCAP_DATALINK; +#else +#define DOLINK(PCAP_DATALINK, datalink) \ +pl->func_err=0, pl->datalink = null_##PCAP_DATALINK; +#endif +#endif + +#ifdef WIN32 + DOLINK(PCAP_GET_AIRPCAP_HANDLE, get_airpcap_handle); + if (pl->func_err) { + pl->func_err = 0; + } + if (hAirpcap) { + pl->airpcap_set_device_channel = (AIRPCAP_SET_DEVICE_CHANNEL)GetProcAddress(hAirpcap, "AirpcapSetDeviceChannel"); + if (pl->airpcap_set_device_channel == NULL) + pl->airpcap_set_device_channel = null_AIRPCAP_SET_DEVICE_CHANNEL; + } +#endif + + + + DOLINK(PCAP_CLOSE , close); + DOLINK(PCAP_DATALINK , datalink); + DOLINK(PCAP_DISPATCH , dispatch); + DOLINK(PCAP_FINDALLDEVS , findalldevs); + DOLINK(PCAP_FREEALLDEVS , freealldevs); + DOLINK(PCAP_LIB_VERSION , lib_version); + DOLINK(PCAP_LOOKUPDEV , lookupdev); + DOLINK(PCAP_MAJOR_VERSION , major_version); + DOLINK(PCAP_MINOR_VERSION , minor_version); + DOLINK(PCAP_OPEN_LIVE , open_live); + + DOLINK(PCAP_OPEN_OFFLINE , open_offline); + DOLINK(PCAP_SENDPACKET , sendpacket); + DOLINK(PCAP_NEXT , next); + DOLINK(PCAP_SETDIRECTION , setdirection); + DOLINK(PCAP_DATALINK_VAL_TO_NAME , datalink_val_to_name); + DOLINK(PCAP_PERROR , perror); + + DOLINK(PCAP_DEV_NAME , dev_name); + DOLINK(PCAP_DEV_DESCRIPTION , dev_description); + DOLINK(PCAP_DEV_NEXT , dev_next); + + + pl->can_transmit = null_CAN_TRANSMIT; + + if (!pl->func_err) + pl->is_available = 1; + else + pl->is_available = 0; +} + diff --git a/src/rawsock-pcap.h b/src/rawsock-pcap.h new file mode 100644 index 00000000..615cceda --- /dev/null +++ b/src/rawsock-pcap.h @@ -0,0 +1,96 @@ +#ifndef RAWSOCK_PCAP_H +#define RAWSOCK_PCAP_H +#include + +struct pcap; +typedef struct pcap pcap_t; +typedef struct pcap_if pcap_if_t; + +enum { + PCAP_ERRBUF_SIZE=256, +}; + +typedef enum { + PCAP_D_INOUT = 0, + PCAP_D_IN, + PCAP_D_OUT +} pcap_direction_t; + +struct pcap_pkthdr { + struct timeval ts; + unsigned caplen; + unsigned len; +#ifdef __APPLE__ + char comment[256]; +#endif +}; + +typedef void (*PCAP_HANDLE_PACKET)(unsigned char *v_seap, const struct pcap_pkthdr *framehdr, const unsigned char *buf); + +typedef void (*PCAP_CLOSE)(void *hPcap); +typedef unsigned (*PCAP_DATALINK)(void *hPcap); +typedef unsigned (*PCAP_DISPATCH)(void *hPcap, unsigned how_many_packets, PCAP_HANDLE_PACKET handler, void *handle_data); +typedef int (*PCAP_FINDALLDEVS)(pcap_if_t **alldevs, char *errbuf); +typedef const char *(*PCAP_LIB_VERSION)(void); +typedef char *(*PCAP_LOOKUPDEV)(char *errbuf); +typedef int (*PCAP_MAJOR_VERSION)(void *p); +typedef int (*PCAP_MINOR_VERSION)(void *p); +typedef void * (*PCAP_OPEN_LIVE)(const char *devicename, unsigned snap_length, unsigned is_promiscuous, unsigned read_timeout, char *errbuf); +typedef void (*PCAP_FREEALLDEVS)(pcap_if_t *alldevs); +typedef void * (*PCAP_GET_AIRPCAP_HANDLE)(void *p); +typedef unsigned (*AIRPCAP_SET_DEVICE_CHANNEL)(void *p, unsigned channel); +typedef unsigned (*CAN_TRANSMIT)(const char *devicename); + +typedef pcap_t *(*PCAP_OPEN_OFFLINE)(const char *fname, char *errbuf); +typedef int (*PCAP_SENDPACKET)(pcap_t *p, const unsigned char *buf, int size); +typedef const unsigned char *(*PCAP_NEXT)(pcap_t *p, struct pcap_pkthdr *h); +typedef int (*PCAP_SETDIRECTION)(pcap_t *, pcap_direction_t); +typedef const char *(*PCAP_DATALINK_VAL_TO_NAME)(int dlt); +typedef void (*PCAP_PERROR)(pcap_t *p, char *prefix); +typedef const char *(*PCAP_DEV_NAME)(const pcap_if_t *dev); +typedef const char *(*PCAP_DEV_DESCRIPTION)(const pcap_if_t *dev); +typedef const pcap_if_t *(*PCAP_DEV_NEXT)(const pcap_if_t *dev); + + + +struct PcapFunctions { + unsigned func_err:1; + unsigned is_available:1; + unsigned is_printing_debug:1; + unsigned status; + unsigned errcode; + + PCAP_CLOSE close; + PCAP_DATALINK datalink; + PCAP_DISPATCH dispatch; + PCAP_FINDALLDEVS findalldevs; + PCAP_FREEALLDEVS freealldevs; + PCAP_LOOKUPDEV lookupdev; + PCAP_LIB_VERSION lib_version; + PCAP_MAJOR_VERSION major_version; + PCAP_MINOR_VERSION minor_version; + PCAP_OPEN_LIVE open_live; + PCAP_GET_AIRPCAP_HANDLE get_airpcap_handle; + AIRPCAP_SET_DEVICE_CHANNEL airpcap_set_device_channel; + //AIRPCAP_SET_FCS_PRESENCE airpcap_set_fcs_presence; + //BOOL AirpcapSetFcsPresence(PAirpcapHandle AdapterHandle, BOOL IsFcsPresent); + + CAN_TRANSMIT can_transmit; + + PCAP_OPEN_OFFLINE open_offline; + PCAP_SENDPACKET sendpacket; + PCAP_NEXT next; + PCAP_SETDIRECTION setdirection; + PCAP_DATALINK_VAL_TO_NAME datalink_val_to_name; + PCAP_PERROR perror; + + PCAP_DEV_NAME dev_name; + PCAP_DEV_DESCRIPTION dev_description; + PCAP_DEV_NEXT dev_next; + +}; + +extern struct PcapFunctions PCAP; +void pcap_init(void); + +#endif diff --git a/src/rawsock.c b/src/rawsock.c index 888c4695..536f52a9 100644 --- a/src/rawsock.c +++ b/src/rawsock.c @@ -12,8 +12,8 @@ #include "rawsock-pfring.h" #include "pixie-timer.h" #include "main-globals.h" - -#include +#include "rawsock-pcap.h" +//#include #include #include @@ -205,30 +205,33 @@ rawsock_init(void) } /*************************************************************************** + * This function prints to the command line a list of all the network + * intefaces/devices. ***************************************************************************/ void rawsock_list_adapters(void) { pcap_if_t *alldevs; char errbuf[PCAP_ERRBUF_SIZE]; - - if (pcap_findalldevs(&alldevs, errbuf) != -1) { + + if (PCAP.findalldevs(&alldevs, errbuf) != -1) { int i; - pcap_if_t *d; + const pcap_if_t *d; i=0; - + if (alldevs == NULL) { fprintf(stderr, "ERR:libpcap: no adapters found, are you sure you are root?\n"); } /* Print the list */ - for(d=alldevs; d; d=d->next) { - fprintf(stderr, " %d %s \t", i++, d->name); - if (d->description) - fprintf(stderr, "(%s)\n", d->description); + for(d=alldevs; d; d=PCAP.dev_next(d)) { + fprintf(stderr, " %d %s \t", i++, PCAP.dev_name(d)); + if (PCAP.dev_description(d)) + fprintf(stderr, "(%s)\n", PCAP.dev_description(d)); else fprintf(stderr, "(No description available)\n"); } fprintf(stderr,"\n"); + PCAP.freealldevs(alldevs); } else { fprintf(stderr, "%s\n", errbuf); } @@ -236,25 +239,24 @@ rawsock_list_adapters(void) /*************************************************************************** ***************************************************************************/ -static char * +static const char * adapter_from_index(unsigned index) { pcap_if_t *alldevs; char errbuf[PCAP_ERRBUF_SIZE]; int x; - x = pcap_findalldevs(&alldevs, errbuf); + x = PCAP.findalldevs(&alldevs, errbuf); if (x != -1) { - pcap_if_t *d; + const pcap_if_t *d; if (alldevs == NULL) { fprintf(stderr, "ERR:libpcap: no adapters found, are you sure you are root?\n"); } /* Print the list */ - for(d=alldevs; d; d=d->next) - { + for(d=alldevs; d; d=PCAP.dev_next(d)) { if (index-- == 0) - return d->name; + return PCAP.dev_name(d); } return 0; } else { @@ -339,7 +341,7 @@ rawsock_send_packet( /* LIBPCAP */ if (adapter->pcap) - return pcap_sendpacket(adapter->pcap, packet, length); + return PCAP.sendpacket(adapter->pcap, packet, length); return 0; } @@ -377,13 +379,13 @@ int rawsock_recv_packet( return 1; *length = hdr.caplen; - *secs = hdr.ts.tv_sec; - *usecs = hdr.ts.tv_usec; + *secs = (unsigned)hdr.ts.tv_sec; + *usecs = (unsigned)hdr.ts.tv_usec; } else if (adapter->pcap) { struct pcap_pkthdr hdr; - *packet = pcap_next(adapter->pcap, &hdr); + *packet = PCAP.next(adapter->pcap, &hdr); if (*packet == NULL) { if (is_pcap_file) { @@ -395,7 +397,7 @@ int rawsock_recv_packet( } *length = hdr.caplen; - *secs = hdr.ts.tv_sec; + *secs = (unsigned)hdr.ts.tv_sec; *usecs = hdr.ts.tv_usec; } @@ -506,9 +508,9 @@ rawsock_ignore_transmits(struct Adapter *adapter, const unsigned char *adapter_m if (adapter->pcap) { int err; - err = pcap_setdirection(adapter->pcap, PCAP_D_IN); + err = PCAP.setdirection(adapter->pcap, PCAP_D_IN); if (err) { - pcap_perror(adapter->pcap, "pcap_setdirection(IN)"); + PCAP.perror(adapter->pcap, "pcap_setdirection(IN)"); } } #else @@ -554,7 +556,7 @@ rawsock_close_adapter(struct Adapter *adapter) PFRING.close(adapter->ring); } if (adapter->pcap) { - pcap_close(adapter->pcap); + PCAP.close(adapter->pcap); } if (adapter->sendq) { pcap_sendqueue_destroy(adapter->sendq); @@ -739,18 +741,18 @@ rawsock_init_adapter(const char *adapter_name, * This is the stanard that should work everywhere. *----------------------------------------------------------------*/ { - LOG(1, "pcap: %s\n", pcap_lib_version()); + LOG(1, "pcap: %s\n", PCAP.lib_version()); LOG(2, "pcap:'%s': opening...\n", adapter_name); if (memcmp(adapter_name, "file:", 5) == 0) { LOG(1, "pcap: file: %s\n", adapter_name+5); is_pcap_file = 1; - adapter->pcap = pcap_open_offline( + adapter->pcap = PCAP.open_offline( adapter_name+5, /* interface name */ errbuf); } else { - adapter->pcap = pcap_open_live( + adapter->pcap = PCAP.open_live( adapter_name, /* interface name */ 65536, /* max packet size */ 8, /* promiscuous mode */ @@ -778,7 +780,7 @@ rawsock_init_adapter(const char *adapter_name, /* Figure out the link-type. We suport Ethernet and IP */ { - int dl = pcap_datalink(adapter->pcap); + int dl = PCAP.datalink(adapter->pcap); switch (dl) { case 1: /* Ethernet */ adapter->link_type = dl; @@ -788,13 +790,13 @@ rawsock_init_adapter(const char *adapter_name, break; default: LOG(0, "unknown data link type: %u(%s)\n", - dl, pcap_datalink_val_to_name(dl)); + dl, PCAP.datalink_val_to_name(dl)); break; } } - +#if 0 /* Set any BPF filters the user might've set */ if (bpf_filter) { int err; @@ -818,7 +820,7 @@ rawsock_init_adapter(const char *adapter_name, exit(1); } } - +#endif } diff --git a/src/siphash24.c b/src/siphash24.c index 4e7d21c0..83f0c502 100644 --- a/src/siphash24.c +++ b/src/siphash24.c @@ -72,7 +72,7 @@ static int crypto_auth( unsigned char *out, const unsigned char *in, unsigned lo for ( ; in != end; in += 8 ) { m = U8TO64_LE( in ); -#ifdef DEBUG +#ifdef xxxDEBUG printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 ); printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 ); printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 ); @@ -104,7 +104,7 @@ static int crypto_auth( unsigned char *out, const unsigned char *in, unsigned lo case 0: break; } -#ifdef DEBUG +#ifdef xxxDEBUG printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 ); printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 ); printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 ); @@ -115,7 +115,7 @@ static int crypto_auth( unsigned char *out, const unsigned char *in, unsigned lo SIPROUND; SIPROUND; v0 ^= b; -#ifdef DEBUG +#ifdef xxxDEBUG printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 ); printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 ); printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 ); diff --git a/xcode4/masscan.xcodeproj/project.pbxproj b/xcode4/masscan.xcodeproj/project.pbxproj index c9bc2bdc..17c5c10d 100644 --- a/xcode4/masscan.xcodeproj/project.pbxproj +++ b/xcode4/masscan.xcodeproj/project.pbxproj @@ -84,6 +84,9 @@ 11BA2967189055CA0064A759 /* script.c in Sources */ = {isa = PBXBuildFile; fileRef = 11BA2966189055CA0064A759 /* script.c */; }; 11BA29691890560C0064A759 /* script-ntp-monlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 11BA29681890560C0064A759 /* script-ntp-monlist.c */; }; 11BA296B189060220064A759 /* proto-ntp.c in Sources */ = {isa = PBXBuildFile; fileRef = 11BA296A189060220064A759 /* proto-ntp.c */; }; + 11C936C31EDCE77F0023D32E /* in-filter.c in Sources */ = {isa = PBXBuildFile; fileRef = 11C936BF1EDCE77F0023D32E /* in-filter.c */; }; + 11C936C41EDCE77F0023D32E /* in-report.c in Sources */ = {isa = PBXBuildFile; fileRef = 11C936C11EDCE77F0023D32E /* in-report.c */; }; + 11C936C71EDCE8B40023D32E /* rawsock-pcap.c in Sources */ = {isa = PBXBuildFile; fileRef = 11C936C51EDCE8B40023D32E /* rawsock-pcap.c */; }; 11E76DB41889BC5200061F45 /* pixie-backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = 11E76DB21889BC5200061F45 /* pixie-backtrace.c */; }; 11F9375419F1A54200C1947F /* script-sslv3.c in Sources */ = {isa = PBXBuildFile; fileRef = 11F9375319F1A54200C1947F /* script-sslv3.c */; }; 11F9375719F1AD5000C1947F /* script-heartbleed.c in Sources */ = {isa = PBXBuildFile; fileRef = 11F9375619F1AD5000C1947F /* script-heartbleed.c */; }; @@ -247,6 +250,12 @@ 11BA29681890560C0064A759 /* script-ntp-monlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "script-ntp-monlist.c"; sourceTree = ""; }; 11BA296A189060220064A759 /* proto-ntp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "proto-ntp.c"; sourceTree = ""; }; 11BA296C189060590064A759 /* proto-ntp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "proto-ntp.h"; sourceTree = ""; }; + 11C936BF1EDCE77F0023D32E /* in-filter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "in-filter.c"; sourceTree = ""; }; + 11C936C01EDCE77F0023D32E /* in-filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "in-filter.h"; sourceTree = ""; }; + 11C936C11EDCE77F0023D32E /* in-report.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "in-report.c"; sourceTree = ""; }; + 11C936C21EDCE77F0023D32E /* in-report.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "in-report.h"; sourceTree = ""; }; + 11C936C51EDCE8B40023D32E /* rawsock-pcap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "rawsock-pcap.c"; sourceTree = ""; }; + 11C936C61EDCE8B40023D32E /* rawsock-pcap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "rawsock-pcap.h"; sourceTree = ""; }; 11E76DB21889BC5200061F45 /* pixie-backtrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pixie-backtrace.c"; sourceTree = ""; }; 11E76DB31889BC5200061F45 /* pixie-backtrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "pixie-backtrace.h"; sourceTree = ""; }; 11F9375319F1A54200C1947F /* script-sslv3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "script-sslv3.c"; sourceTree = ""; }; @@ -284,6 +293,12 @@ 11A9219217DBCC7E00DDFD32 /* src */ = { isa = PBXGroup; children = ( + 11C936C51EDCE8B40023D32E /* rawsock-pcap.c */, + 11C936C61EDCE8B40023D32E /* rawsock-pcap.h */, + 11C936BF1EDCE77F0023D32E /* in-filter.c */, + 11C936C01EDCE77F0023D32E /* in-filter.h */, + 11C936C11EDCE77F0023D32E /* in-report.c */, + 11C936C21EDCE77F0023D32E /* in-report.h */, 11126596197A086B00DC5987 /* out-unicornscan.c */, 11A773E91881BFC700B135DE /* crypto-base64.c */, 11A773EA1881BFC700B135DE /* crypto-base64.h */, @@ -514,6 +529,7 @@ 11A921EE17DBCC7E00DDFD32 /* rawsock-getip.c in Sources */, 11A921EF17DBCC7E00DDFD32 /* rawsock-getmac.c in Sources */, 11A921F017DBCC7E00DDFD32 /* rawsock-getroute.c in Sources */, + 11C936C41EDCE77F0023D32E /* in-report.c in Sources */, 11A921F117DBCC7E00DDFD32 /* rawsock-pcapfile.c in Sources */, 11A921F217DBCC7E00DDFD32 /* rawsock-pfring.c in Sources */, 11A921F317DBCC7E00DDFD32 /* rawsock.c in Sources */, @@ -541,6 +557,7 @@ 11A868181816F3A7008E00B8 /* out-redis.c in Sources */, 11A868191816F3A7008E00B8 /* pixie-file.c in Sources */, 11A8681A1816F3A7008E00B8 /* siphash24.c in Sources */, + 11C936C71EDCE8B40023D32E /* rawsock-pcap.c in Sources */, 11A8681E1819A6F7008E00B8 /* proto-zeroaccess.c in Sources */, 11B22ED518641DCC00DA5438 /* proto-banout.c in Sources */, 11B22ED618641DCC00DA5438 /* proto-ssl-test.c in Sources */, @@ -559,6 +576,7 @@ 11623F6A191E0DB00075EEE6 /* out-certs.c in Sources */, 11126597197A086B00DC5987 /* out-unicornscan.c in Sources */, 11420DD319A2D47A00DB5BFE /* proto-vnc.c in Sources */, + 11C936C31EDCE77F0023D32E /* in-filter.c in Sources */, 11420DD819A8160500DB5BFE /* proto-ftp.c in Sources */, 11420DDB19A84A9F00DB5BFE /* proto-smtp.c in Sources */, 11420DDE19A8FDE300DB5BFE /* proto-pop3.c in Sources */, @@ -592,7 +610,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; @@ -612,7 +630,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = macosx; }; name = Release; From 8367543ac8bcbe233bc94b3267987aa49b92a487 Mon Sep 17 00:00:00 2001 From: Robert Graham Date: Tue, 30 May 2017 03:01:44 -0400 Subject: [PATCH 2/7] Remove libpcap dependency for Windows --- src/rawsock-pcap.c | 45 +- src/rawsock-pcap.h | 35 +- src/rawsock.c | 40 +- vs10/include/Packet32.h | 359 ------------ vs10/include/Win32-Extensions.h | 113 ---- vs10/include/bittypes.h | 137 ----- vs10/include/ip6_misc.h | 165 ------ vs10/include/pcap-bpf.h | 47 -- vs10/include/pcap-namedb.h | 42 -- vs10/include/pcap-stdinc.h | 90 --- vs10/include/pcap.h | 45 -- vs10/include/pcap/bluetooth.h | 48 -- vs10/include/pcap/bpf.h | 934 -------------------------------- vs10/include/pcap/namedb.h | 89 --- vs10/include/pcap/pcap.h | 407 -------------- vs10/include/pcap/sll.h | 129 ----- vs10/include/pcap/usb.h | 90 --- vs10/include/pcap/vlan.h | 46 -- vs10/include/remote-ext.h | 444 --------------- vs10/lib/Packet.lib | Bin 8450 -> 0 bytes vs10/lib/libpacket.a | Bin 20822 -> 0 bytes vs10/lib/libwpcap.a | Bin 53028 -> 0 bytes vs10/lib/wpcap.lib | Bin 18882 -> 0 bytes vs10/lib/x64/Packet.lib | Bin 8290 -> 0 bytes vs10/lib/x64/wpcap.lib | Bin 18466 -> 0 bytes vs10/masscan.vcxproj | 2 + vs10/masscan.vcxproj.filters | 6 + 27 files changed, 90 insertions(+), 3223 deletions(-) delete mode 100644 vs10/include/Packet32.h delete mode 100644 vs10/include/Win32-Extensions.h delete mode 100644 vs10/include/bittypes.h delete mode 100644 vs10/include/ip6_misc.h delete mode 100644 vs10/include/pcap-bpf.h delete mode 100644 vs10/include/pcap-namedb.h delete mode 100644 vs10/include/pcap-stdinc.h delete mode 100644 vs10/include/pcap.h delete mode 100644 vs10/include/pcap/bluetooth.h delete mode 100644 vs10/include/pcap/bpf.h delete mode 100644 vs10/include/pcap/namedb.h delete mode 100644 vs10/include/pcap/pcap.h delete mode 100644 vs10/include/pcap/sll.h delete mode 100644 vs10/include/pcap/usb.h delete mode 100644 vs10/include/pcap/vlan.h delete mode 100644 vs10/include/remote-ext.h delete mode 100644 vs10/lib/Packet.lib delete mode 100644 vs10/lib/libpacket.a delete mode 100644 vs10/lib/libwpcap.a delete mode 100644 vs10/lib/wpcap.lib delete mode 100644 vs10/lib/x64/Packet.lib delete mode 100644 vs10/lib/x64/wpcap.lib diff --git a/src/rawsock-pcap.c b/src/rawsock-pcap.c index 8909c46b..ae03c8a3 100644 --- a/src/rawsock-pcap.c +++ b/src/rawsock-pcap.c @@ -38,6 +38,8 @@ #ifndef UNUSEDPARM #ifdef __GNUC__ #define UNUSEDPARM(x) x=(x) +#else +#define UNUSEDPARM(x) x=(x) #endif #endif @@ -234,6 +236,7 @@ struct PcapFunctions PCAP = { static void *my_null(int x, ...) { + UNUSEDPARM(x); return 0; } static pcap_t *null_PCAP_OPEN_OFFLINE(const char *fname, char *errbuf) @@ -242,23 +245,29 @@ static pcap_t *null_PCAP_OPEN_OFFLINE(const char *fname, char *errbuf) } static int null_PCAP_SENDPACKET(pcap_t *p, const unsigned char *buf, int size) { - return (int)my_null(p, buf, size); + my_null(3, p, buf, size); + return 0; } static const unsigned char *null_PCAP_NEXT(pcap_t *p, struct pcap_pkthdr *h) { + my_null(3, p, h); return 0; } static int null_PCAP_SETDIRECTION(pcap_t *p, pcap_direction_t d) { + my_null(2, p, d); return 0; } static const char *null_PCAP_DATALINK_VAL_TO_NAME(int dlt) { + my_null(1, dlt); return 0; } static void null_PCAP_PERROR(pcap_t *p, char *prefix) { + UNUSEDPARM(p); + fprintf(stderr, "%s\n", prefix); perror("pcap"); } static const char *null_PCAP_DEV_NAME(const pcap_if_t *dev) @@ -274,6 +283,29 @@ static const pcap_if_t *null_PCAP_DEV_NEXT(const pcap_if_t *dev) return dev->next; } +static pcap_send_queue *null_PCAP_SENDQUEUE_ALLOC(size_t size) +{ + UNUSEDPARM(size); + return 0; +} +static unsigned null_PCAP_SENDQUEUE_TRANSMIT(pcap_t *p, pcap_send_queue *queue, int sync) +{ + my_null(3, p, queue, sync); + return 0; +} +static void null_PCAP_SENDQUEUE_DESTROY(pcap_send_queue *queue) +{ + my_null(1, queue); + UNUSEDPARM(queue); +} +static int null_PCAP_SENDQUEUE_QUEUE(pcap_send_queue *queue, + const struct pcap_pkthdr *pkt_header, + const unsigned char *pkt_data) +{ + my_null(4, queue, pkt_header, pkt_data); + return 0; +} + /** * Runtime-load the libpcap shared-object or the winpcap DLL. We * load at runtime rather than loadtime to allow this program to @@ -284,9 +316,9 @@ void pcap_init(void) { struct PcapFunctions *pl = &PCAP; #ifdef WIN32 - HMODULE hPacket; - HMODULE hLibpcap; - HMODULE hAirpcap; + void * hPacket; + void * hLibpcap; + void * hAirpcap; pl->is_available = 0; pl->is_printing_debug = 1; @@ -405,6 +437,11 @@ pl->func_err=0, pl->datalink = null_##PCAP_DATALINK; DOLINK(PCAP_DEV_DESCRIPTION , dev_description); DOLINK(PCAP_DEV_NEXT , dev_next); + DOLINK(PCAP_SENDQUEUE_ALLOC , sendqueue_alloc); + DOLINK(PCAP_SENDQUEUE_TRANSMIT , sendqueue_transmit); + DOLINK(PCAP_SENDQUEUE_DESTROY , sendqueue_destroy); + DOLINK(PCAP_SENDQUEUE_QUEUE , sendqueue_queue); + pl->can_transmit = null_CAN_TRANSMIT; diff --git a/src/rawsock-pcap.h b/src/rawsock-pcap.h index 615cceda..0a5180be 100644 --- a/src/rawsock-pcap.h +++ b/src/rawsock-pcap.h @@ -1,6 +1,11 @@ #ifndef RAWSOCK_PCAP_H #define RAWSOCK_PCAP_H -#include +#include + +struct pcap_timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; struct pcap; typedef struct pcap pcap_t; @@ -17,7 +22,7 @@ typedef enum { } pcap_direction_t; struct pcap_pkthdr { - struct timeval ts; + struct pcap_timeval ts; unsigned caplen; unsigned len; #ifdef __APPLE__ @@ -51,6 +56,21 @@ typedef const char *(*PCAP_DEV_NAME)(const pcap_if_t *dev); typedef const char *(*PCAP_DEV_DESCRIPTION)(const pcap_if_t *dev); typedef const pcap_if_t *(*PCAP_DEV_NEXT)(const pcap_if_t *dev); +/* + * PORTABILITY: Windows supports the "sendq" feature, and is really slow + * without this feature. It's not needed on Linux, so we just create + * equivelent functions that do nothing + */ +struct pcap_send_queue; +typedef struct pcap_send_queue pcap_send_queue; + +typedef pcap_send_queue *(*PCAP_SENDQUEUE_ALLOC)(size_t size); +typedef unsigned (*PCAP_SENDQUEUE_TRANSMIT)(pcap_t *p, pcap_send_queue *queue, int sync); +typedef void (*PCAP_SENDQUEUE_DESTROY)(pcap_send_queue *queue); +typedef int (*PCAP_SENDQUEUE_QUEUE)(pcap_send_queue *queue, const struct pcap_pkthdr *pkt_header, const unsigned char *pkt_data); + + + struct PcapFunctions { @@ -84,10 +104,15 @@ struct PcapFunctions { PCAP_DATALINK_VAL_TO_NAME datalink_val_to_name; PCAP_PERROR perror; - PCAP_DEV_NAME dev_name; + PCAP_DEV_NAME dev_name; PCAP_DEV_DESCRIPTION dev_description; - PCAP_DEV_NEXT dev_next; - + PCAP_DEV_NEXT dev_next; + + PCAP_SENDQUEUE_ALLOC sendqueue_alloc; + PCAP_SENDQUEUE_TRANSMIT sendqueue_transmit; + PCAP_SENDQUEUE_DESTROY sendqueue_destroy; + PCAP_SENDQUEUE_QUEUE sendqueue_queue; + }; extern struct PcapFunctions PCAP; diff --git a/src/rawsock.c b/src/rawsock.c index 536f52a9..921f6bbb 100644 --- a/src/rawsock.c +++ b/src/rawsock.c @@ -12,8 +12,8 @@ #include "rawsock-pfring.h" #include "pixie-timer.h" #include "main-globals.h" + #include "rawsock-pcap.h" -//#include #include #include @@ -21,12 +21,10 @@ static int is_pcap_file = 0; #ifdef WIN32 -#include +#include #include #if defined(_MSC_VER) -#pragma comment(lib, "packet.lib") -#pragma comment(lib, "wpcap.lib") #pragma comment(lib, "IPHLPAPI.lib") #endif @@ -39,20 +37,6 @@ static int is_pcap_file = 0; #include #include -/* - * PORTABILITY: Windows supports the "sendq" feature, and is really slow - * without this feature. It's not needed on Linux, so we just create - * equivelent functions that do nothing - */ -struct pcap_send_queue; -typedef struct pcap_send_queue pcap_send_queue; -static pcap_send_queue *pcap_sendqueue_alloc(size_t size) {return 0;} -static unsigned pcap_sendqueue_transmit( - pcap_t *p, pcap_send_queue *queue, int sync) {return 0;} -static void pcap_sendqueue_destroy(pcap_send_queue *queue) {;} -static int pcap_sendqueue_queue(pcap_send_queue *queue, - const struct pcap_pkthdr *pkt_header, - const unsigned char *pkt_data) {return 0;} #else #endif @@ -78,7 +62,7 @@ int pcap_setdirection(pcap_t *pcap, pcap_direction_t direction) static int (*real_setdirection)(pcap_t *, pcap_direction_t) = 0; if (real_setdirection == 0) { - HMODULE h = LoadLibraryA("wpcap.dll"); + void* h = LoadLibraryA("wpcap.dll"); if (h == NULL) { fprintf(stderr, "couldn't load wpcap.dll: %u\n", (unsigned)GetLastError()); @@ -274,12 +258,12 @@ void rawsock_flush(struct Adapter *adapter) { if (adapter->sendq) { - pcap_sendqueue_transmit(adapter->pcap, adapter->sendq, 0); + PCAP.sendqueue_transmit(adapter->pcap, adapter->sendq, 0); /* Dude, I totally forget why this step is necessary. I vaguely * remember there's a good reason for it though */ - pcap_sendqueue_destroy(adapter->sendq); - adapter->sendq = pcap_sendqueue_alloc(SENDQ_SIZE); + PCAP.sendqueue_destroy(adapter->sendq); + adapter->sendq = PCAP.sendqueue_alloc(SENDQ_SIZE); } } @@ -326,10 +310,10 @@ rawsock_send_packet( hdr.len = length; hdr.caplen = length; - err = pcap_sendqueue_queue(adapter->sendq, &hdr, packet); + err = PCAP.sendqueue_queue(adapter->sendq, &hdr, packet); if (err) { rawsock_flush(adapter); - pcap_sendqueue_queue(adapter->sendq, &hdr, packet); + PCAP.sendqueue_queue(adapter->sendq, &hdr, packet); } if (flush) { @@ -513,7 +497,7 @@ rawsock_ignore_transmits(struct Adapter *adapter, const unsigned char *adapter_m PCAP.perror(adapter->pcap, "pcap_setdirection(IN)"); } } -#else +#elif defined(WIN32xxx) if (adapter->pcap) { int err; char filter[256]; @@ -543,8 +527,6 @@ rawsock_ignore_transmits(struct Adapter *adapter, const unsigned char *adapter_m } } #endif - - } /*************************************************************************** @@ -559,7 +541,7 @@ rawsock_close_adapter(struct Adapter *adapter) PCAP.close(adapter->pcap); } if (adapter->sendq) { - pcap_sendqueue_destroy(adapter->sendq); + PCAP.sendqueue_destroy(adapter->sendq); } free(adapter); @@ -835,7 +817,7 @@ rawsock_init_adapter(const char *adapter_name, adapter->sendq = 0; #if defined(WIN32) if (is_sendq) - adapter->sendq = pcap_sendqueue_alloc(SENDQ_SIZE); + adapter->sendq = PCAP.sendqueue_alloc(SENDQ_SIZE); #endif diff --git a/vs10/include/Packet32.h b/vs10/include/Packet32.h deleted file mode 100644 index 1e0eacd7..00000000 --- a/vs10/include/Packet32.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 - 2007 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @ingroup packetapi - * @{ - */ - -/** @defgroup packet32h Packet.dll definitions and data structures - * Packet32.h contains the data structures and the definitions used by packet.dll. - * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included - * by the applications that use the functions of this library - * @{ - */ - -#ifndef __PACKET32 -#define __PACKET32 - -#include - -#ifdef HAVE_AIRPCAP_API -#include -#else -#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_) -#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ -typedef struct _AirpcapHandle *PAirpcapHandle; -#endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */ -#endif /* HAVE_AIRPCAP_API */ - -#ifdef HAVE_DAG_API -#include -#endif /* HAVE_DAG_API */ - -// Working modes -#define PACKET_MODE_CAPT 0x0 ///< Capture mode -#define PACKET_MODE_STAT 0x1 ///< Statistical mode -#define PACKET_MODE_MON 0x2 ///< Monitoring mode -#define PACKET_MODE_DUMP 0x10 ///< Dump mode -#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode - - -/// Alignment macro. Defines the alignment size. -#define Packet_ALIGNMENT sizeof(int) -/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. -#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) - -#define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent - -// Loopback behaviour definitions -#define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver -#define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver - -/*! - \brief Network type structure. - - This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. -*/ -typedef struct NetType -{ - UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) - ULONGLONG LinkSpeed; ///< The speed of the network in bits per second -}NetType; - - -//some definitions stolen from libpcap - -#ifndef BPF_MAJOR_VERSION - -/*! - \brief A BPF pseudo-assembly program. - - The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. -*/ -struct bpf_program -{ - UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. - struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. -}; - -/*! - \brief A single BPF pseudo-instruction. - - bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. -*/ -struct bpf_insn -{ - USHORT code; ///< Instruction type and addressing mode. - UCHAR jt; ///< Jump if true - UCHAR jf; ///< Jump if false - int k; ///< Generic field used for various purposes. -}; - -/*! - \brief Structure that contains a couple of statistics values on the current capture. - - It is used by packet.dll to return statistics about a capture session. -*/ -struct bpf_stat -{ - UINT bs_recv; ///< Number of packets that the driver received from the network adapter - ///< from the beginning of the current capture. This value includes the packets - ///< lost by the driver. - UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. - ///< Basically, a packet is lost when the the buffer of the driver is full. - ///< In this situation the packet cannot be stored and the driver rejects it. - UINT ps_ifdrop; ///< drops by interface. XXX not yet supported - UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and - ///< thus reach the application. -}; - -/*! - \brief Packet header. - - This structure defines the header associated with every packet delivered to the application. -*/ -struct bpf_hdr -{ - struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. - ///< It is stored in a TimeVal structure. - UINT bh_caplen; ///< Length of captured portion. The captured portion can be different - ///< from the original packet, because it is possible (with a proper filter) - ///< to instruct the driver to capture only a portion of the packets. - UINT bh_datalen; ///< Original length of packet - USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, - ///< a padding could be added between the end of this structure and the packet - ///< data for performance reasons. This filed can be used to retrieve the actual data - ///< of the packet. -}; - -/*! - \brief Dump packet header. - - This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). - It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a - packet in a dump file. This makes straightforward sending WinPcap dump files to the network. -*/ -struct dump_bpf_hdr{ - struct timeval ts; ///< Time stamp of the packet - UINT caplen; ///< Length of captured portion. The captured portion can smaller than the - ///< the original packet, because it is possible (with a proper filter) to - ///< instruct the driver to capture only a portion of the packets. - UINT len; ///< Length of the original packet (off wire). -}; - - -#endif - -struct bpf_stat; - -#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices -#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links -#define NMAX_PACKET 65535 - -/*! - \brief Addresses of a network adapter. - - This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with - an adapter. -*/ -typedef struct npf_if_addr { - struct sockaddr_storage IPAddress; ///< IP address. - struct sockaddr_storage SubnetMask; ///< Netmask for that address. - struct sockaddr_storage Broadcast; ///< Broadcast address. -}npf_if_addr; - - -#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. -#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. -#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. -#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. - - -typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API -typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API - -#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter -#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET -#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card -#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file -#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. -#define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card -#define INFO_FLAG_NPFIM_DEVICE 32 - -/*! - \brief Describes an opened network adapter. - - This structure is the most important for the functioning of packet.dll, but the great part of its fields - should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters -*/ -typedef struct _ADAPTER { - HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. - CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. - int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated - ///< on the wire. - HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. - ///< It can be passed to standard Win32 functions (like WaitForSingleObject - ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some - ///< data. It is particularly useful in GUI applications that need to wait - ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() - ///< function can be used to define the minimum amount of data in the kernel buffer - ///< that will cause the event to be signalled. - - UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and - ///< ReadEvent will be signaled, also if no packets were captured - CHAR Name[ADAPTER_NAME_LENGTH]; - PWAN_ADAPTER pWanAdapter; - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. - -#ifdef HAVE_AIRPCAP_API - PAirpcapHandle AirpcapAd; -#endif // HAVE_AIRPCAP_API - -#ifdef HAVE_NPFIM_API - void* NpfImHandle; -#endif // HAVE_NPFIM_API - -#ifdef HAVE_DAG_API - dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter - PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card - struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure - unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry - DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). -#endif // HAVE_DAG_API -} ADAPTER, *LPADAPTER; - -/*! - \brief Structure that contains a group of packets coming from the driver. - - This structure defines the header associated with every packet delivered to the application. -*/ -typedef struct _PACKET { - HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. - OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. - PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for - ///< details about the organization of the data in this buffer - UINT Length; ///< Length of the buffer - DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data - ///< received by the last call to PacketReceivePacket() - BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. -} PACKET, *LPPACKET; - -/*! - \brief Structure containing an OID request. - - It is used by the PacketRequest() function to send an OID to the interface card driver. - It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, - the list of the multicast groups defined on it, and so on. -*/ -struct _PACKET_OID_DATA { - ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h - ///< for a complete list of valid codes. - ULONG Length; ///< Length of the data field - UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received - ///< from the adapter. -}; -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @} - */ - -/* -BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName, - CHAR *Value, - UINT *pValueLen, - CHAR *DefaultVal); - -BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName, - WCHAR *Value, - UINT *pValueLen, - WCHAR *DefaultVal); -*/ - -//--------------------------------------------------------------------------- -// EXPORTED FUNCTIONS -//--------------------------------------------------------------------------- - -PCHAR PacketGetVersion(); -PCHAR PacketGetDriverVersion(); -BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); -BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); -BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); -BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); -BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); -BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior); -INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); -BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); -BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); -LPADAPTER PacketOpenAdapter(PCHAR AdapterName); -BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); -INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); -LPPACKET PacketAllocatePacket(void); -VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); -VOID PacketFreePacket(LPPACKET lpPacket); -BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); -BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); -BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); -BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); -BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); -HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); -BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); -BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); -BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); -BOOL PacketStopDriver(); -VOID PacketCloseAdapter(LPADAPTER lpAdapter); -BOOLEAN PacketStartOem(PCHAR errorString, UINT errorStringLength); -BOOLEAN PacketStartOemEx(PCHAR errorString, UINT errorStringLength, ULONG flags); -PAirpcapHandle PacketGetAirPcapHandle(LPADAPTER AdapterObject); - -// -// Used by PacketStartOemEx -// -#define PACKET_START_OEM_NO_NETMON 0x00000001 - -#ifdef __cplusplus -} -#endif - -#endif //__PACKET32 diff --git a/vs10/include/Win32-Extensions.h b/vs10/include/Win32-Extensions.h deleted file mode 100644 index d3b063b0..00000000 --- a/vs10/include/Win32-Extensions.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __WIN32_EXTENSIONS_H__ -#define __WIN32_EXTENSIONS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Definitions */ - -/*! - \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). -*/ -struct pcap_send_queue -{ - u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. - u_int len; ///< Current size of the queue, in bytes. - char *buffer; ///< Buffer containing the packets to be sent. -}; - -typedef struct pcap_send_queue pcap_send_queue; - -/*! - \brief This typedef is a support for the pcap_get_airpcap_handle() function -*/ -#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_) -#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ -typedef struct _AirpcapHandle *PAirpcapHandle; -#endif - -#define BPF_MEM_EX_IMM 0xc0 -#define BPF_MEM_EX_IND 0xe0 - -/*used for ST*/ -#define BPF_MEM_EX 0xc0 -#define BPF_TME 0x08 - -#define BPF_LOOKUP 0x90 -#define BPF_EXECUTE 0xa0 -#define BPF_INIT 0xb0 -#define BPF_VALIDATE 0xc0 -#define BPF_SET_ACTIVE 0xd0 -#define BPF_RESET 0xe0 -#define BPF_SET_MEMORY 0x80 -#define BPF_GET_REGISTER_VALUE 0x70 -#define BPF_SET_REGISTER_VALUE 0x60 -#define BPF_SET_WORKING 0x50 -#define BPF_SET_ACTIVE_READ 0x40 -#define BPF_SET_AUTODELETION 0x30 -#define BPF_SEPARATION 0xff - -/* Prototypes */ -pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); - -void pcap_sendqueue_destroy(pcap_send_queue* queue); - -int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); - -u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); - -HANDLE pcap_getevent(pcap_t *p); - -struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); - -int pcap_setuserbuffer(pcap_t *p, int size); - -int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks); - -int pcap_live_dump_ended(pcap_t *p, int sync); - -int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data); - -int pcap_start_oem(char* err_str, int flags); - -PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p); - -#ifdef __cplusplus -} -#endif - -#endif //__WIN32_EXTENSIONS_H__ diff --git a/vs10/include/bittypes.h b/vs10/include/bittypes.h deleted file mode 100644 index 558a0b5c..00000000 --- a/vs10/include/bittypes.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _BITTYPES_H -#define _BITTYPES_H - -#ifndef HAVE_U_INT8_T - -#if SIZEOF_CHAR == 1 -typedef unsigned char u_int8_t; -typedef signed char int8_t; -#elif SIZEOF_INT == 1 -typedef unsigned int u_int8_t; -typedef signed int int8_t; -#else /* XXX */ -#error "there's no appropriate type for u_int8_t" -#endif -#define HAVE_U_INT8_T 1 -#define HAVE_INT8_T 1 - -#endif /* HAVE_U_INT8_T */ - -#ifndef HAVE_U_INT16_T - -#if SIZEOF_SHORT == 2 -typedef unsigned short u_int16_t; -typedef signed short int16_t; -#elif SIZEOF_INT == 2 -typedef unsigned int u_int16_t; -typedef signed int int16_t; -#elif SIZEOF_CHAR == 2 -typedef unsigned char u_int16_t; -typedef signed char int16_t; -#else /* XXX */ -#error "there's no appropriate type for u_int16_t" -#endif -#define HAVE_U_INT16_T 1 -#define HAVE_INT16_T 1 - -#endif /* HAVE_U_INT16_T */ - -#ifndef HAVE_U_INT32_T - -#if SIZEOF_INT == 4 -typedef unsigned int u_int32_t; -typedef signed int int32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long u_int32_t; -typedef signed long int32_t; -#elif SIZEOF_SHORT == 4 -typedef unsigned short u_int32_t; -typedef signed short int32_t; -#else /* XXX */ -#error "there's no appropriate type for u_int32_t" -#endif -#define HAVE_U_INT32_T 1 -#define HAVE_INT32_T 1 - -#endif /* HAVE_U_INT32_T */ - -#ifndef HAVE_U_INT64_T -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long u_int64_t; -typedef long long int64_t; -#elif defined(_MSC_EXTENSIONS) -typedef unsigned _int64 u_int64_t; -typedef _int64 int64_t; -#elif SIZEOF_INT == 8 -typedef unsigned int u_int64_t; -#elif SIZEOF_LONG == 8 -typedef unsigned long u_int64_t; -#elif SIZEOF_SHORT == 8 -typedef unsigned short u_int64_t; -#else /* XXX */ -#error "there's no appropriate type for u_int64_t" -#endif - -#endif /* HAVE_U_INT64_T */ - -#ifndef PRId64 -#ifdef _MSC_EXTENSIONS -#define PRId64 "I64d" -#else /* _MSC_EXTENSIONS */ -#define PRId64 "lld" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRId64 */ - -#ifndef PRIo64 -#ifdef _MSC_EXTENSIONS -#define PRIo64 "I64o" -#else /* _MSC_EXTENSIONS */ -#define PRIo64 "llo" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIo64 */ - -#ifndef PRIx64 -#ifdef _MSC_EXTENSIONS -#define PRIx64 "I64x" -#else /* _MSC_EXTENSIONS */ -#define PRIx64 "llx" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIx64 */ - -#ifndef PRIu64 -#ifdef _MSC_EXTENSIONS -#define PRIu64 "I64u" -#else /* _MSC_EXTENSIONS */ -#define PRIu64 "llu" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIu64 */ - -#endif /* _BITTYPES_H */ diff --git a/vs10/include/ip6_misc.h b/vs10/include/ip6_misc.h deleted file mode 100644 index bbeca07d..00000000 --- a/vs10/include/ip6_misc.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 1993, 1994, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006/01/22 18:02:18 gianluca Exp $ (LBL) - */ - -/* - * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows - */ - -#include - -#ifndef __MINGW32__ -#include -#endif /* __MINGW32__ */ - -#ifndef __MINGW32__ -#define IN_MULTICAST(a) IN_CLASSD(a) -#endif - -#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) - -#define IN_LOOPBACKNET 127 - -#ifdef __MINGW32__ -/* IPv6 address */ -struct in6_addr - { - union - { - u_int8_t u6_addr8[16]; - u_int16_t u6_addr16[8]; - u_int32_t u6_addr32[4]; - } in6_u; -#define s6_addr in6_u.u6_addr8 -#define s6_addr16 in6_u.u6_addr16 -#define s6_addr32 in6_u.u6_addr32 -#define s6_addr64 in6_u.u6_addr64 - }; - -#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } -#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } -#endif /* __MINGW32__ */ - - -#if (defined WIN32) || (defined __MINGW32__) -typedef unsigned short sa_family_t; -#endif - - -#ifdef __MINGW32__ - -#define __SOCKADDR_COMMON(sa_prefix) \ - sa_family_t sa_prefix##family - -/* Ditto, for IPv6. */ -struct sockaddr_in6 - { - __SOCKADDR_COMMON (sin6_); - u_int16_t sin6_port; /* Transport layer port # */ - u_int32_t sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ - }; - -#define IN6_IS_ADDR_V4MAPPED(a) \ - ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ - (((u_int32_t *) (a))[2] == htonl (0xffff))) - -#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) - -#define IN6_IS_ADDR_LINKLOCAL(a) \ - ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) - -#define IN6_IS_ADDR_LOOPBACK(a) \ - (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ - ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) -#endif /* __MINGW32__ */ - -#define ip6_vfc ip6_ctlun.ip6_un2_vfc -#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow -#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen -#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt -#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim -#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim - -#define nd_rd_type nd_rd_hdr.icmp6_type -#define nd_rd_code nd_rd_hdr.icmp6_code -#define nd_rd_cksum nd_rd_hdr.icmp6_cksum -#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] - -/* - * IPV6 extension headers - */ -#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ -#define IPPROTO_IPV6 41 /* IPv6 header. */ -#define IPPROTO_ROUTING 43 /* IPv6 routing header */ -#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ -#define IPPROTO_ESP 50 /* encapsulating security payload */ -#define IPPROTO_AH 51 /* authentication header */ -#define IPPROTO_ICMPV6 58 /* ICMPv6 */ -#define IPPROTO_NONE 59 /* IPv6 no next header */ -#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ -#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ - -#define IPV6_RTHDR_TYPE_0 0 - -/* Option types and related macros */ -#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ -#define IP6OPT_PADN 0x01 /* 00 0 00001 */ -#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ -#define IP6OPT_JUMBO_LEN 6 -#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ - -#define IP6OPT_RTALERT_LEN 4 -#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ -#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ -#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ -#define IP6OPT_MINLEN 2 - -#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ -#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ -#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ -#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ -#define IP6OPT_EID 0x8a /* 10 0 01010 */ - -#define IP6OPT_TYPE(o) ((o) & 0xC0) -#define IP6OPT_TYPE_SKIP 0x00 -#define IP6OPT_TYPE_DISCARD 0x40 -#define IP6OPT_TYPE_FORCEICMP 0x80 -#define IP6OPT_TYPE_ICMP 0xC0 - -#define IP6OPT_MUTABLE 0x20 - - -#ifdef __MINGW32__ -#ifndef EAI_ADDRFAMILY -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif -#endif /* __MINGW32__ */ diff --git a/vs10/include/pcap-bpf.h b/vs10/include/pcap-bpf.h deleted file mode 100644 index 5fe129db..00000000 --- a/vs10/include/pcap-bpf.h +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007/04/01 21:43:55 guy Exp $ (LBL) - */ - -/* - * For backwards compatibility. - * - * Note to OS vendors: do NOT get rid of this file! Some applications - * might expect to be able to include . - */ -#include diff --git a/vs10/include/pcap-namedb.h b/vs10/include/pcap-namedb.h deleted file mode 100644 index 80a2f004..00000000 --- a/vs10/include/pcap-namedb.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1994, 1996 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006/10/04 18:13:32 guy Exp $ (LBL) - */ - -/* - * For backwards compatibility. - * - * Note to OS vendors: do NOT get rid of this file! Some applications - * might expect to be able to include . - */ -#include diff --git a/vs10/include/pcap-stdinc.h b/vs10/include/pcap-stdinc.h deleted file mode 100644 index 870e3349..00000000 --- a/vs10/include/pcap-stdinc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL) - */ - -#define SIZEOF_CHAR 1 -#define SIZEOF_SHORT 2 -#define SIZEOF_INT 4 -#ifndef _MSC_EXTENSIONS -#define SIZEOF_LONG_LONG 8 -#endif - -/* - * Avoids a compiler warning in case this was already defined - * (someone defined _WINSOCKAPI_ when including 'windows.h', in order - * to prevent it from including 'winsock.h') - */ -#ifdef _WINSOCKAPI_ -#undef _WINSOCKAPI_ -#endif -#include - -#include - -#include "bittypes.h" -#include -#include - -#ifndef __MINGW32__ -#include "IP6_misc.h" -#endif - -#define caddr_t char* - -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define strdup _strdup -#define inline __inline - -#ifdef __MINGW32__ -#include -#else /*__MINGW32__*/ -/* MSVC compiler */ -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else -typedef _W64 unsigned int uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif - -#ifndef _INTPTR_T_DEFINED -#ifdef _WIN64 -typedef __int64 intptr_t; -#else -typedef _W64 int intptr_t; -#endif -#define _INTPTR_T_DEFINED -#endif - -#endif /*__MINGW32__*/ diff --git a/vs10/include/pcap.h b/vs10/include/pcap.h deleted file mode 100644 index 935f9494..00000000 --- a/vs10/include/pcap.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL) - */ - -/* - * For backwards compatibility. - * - * Note to OS vendors: do NOT get rid of this file! Many applications - * expect to be able to include , and at least some of them - * go through contortions in their configure scripts to try to detect - * OSes that have "helpfully" moved pcap.h to without - * leaving behind a file. - */ -#include diff --git a/vs10/include/pcap/bluetooth.h b/vs10/include/pcap/bluetooth.h deleted file mode 100644 index 7bf65df0..00000000 --- a/vs10/include/pcap/bluetooth.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006 Paolo Abeni (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * bluetooth data struct - * By Paolo Abeni - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/bluetooth.h,v 1.1 2007/09/22 02:10:17 guy Exp $ - */ - -#ifndef _PCAP_BLUETOOTH_STRUCTS_H__ -#define _PCAP_BLUETOOTH_STRUCTS_H__ - -/* - * Header prepended libpcap to each bluetooth h:4 frame. - * fields are in network byte order - */ -typedef struct _pcap_bluetooth_h4_header { - u_int32_t direction; /* if first bit is set direction is incoming */ -} pcap_bluetooth_h4_header; - - -#endif diff --git a/vs10/include/pcap/bpf.h b/vs10/include/pcap/bpf.h deleted file mode 100644 index 9f4ca33e..00000000 --- a/vs10/include/pcap/bpf.h +++ /dev/null @@ -1,934 +0,0 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)bpf.h 7.1 (Berkeley) 5/7/91 - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19.2.8 2008-09-22 20:16:01 guy Exp $ (LBL) - */ - -/* - * This is libpcap's cut-down version of bpf.h; it includes only - * the stuff needed for the code generator and the userland BPF - * interpreter, and the libpcap APIs for setting filters, etc.. - * - * "pcap-bpf.c" will include the native OS version, as it deals with - * the OS's BPF implementation. - * - * XXX - should this all just be moved to "pcap.h"? - */ - -#ifndef BPF_MAJOR_VERSION - -#ifdef __cplusplus -extern "C" { -#endif - -/* BSD style release date */ -#define BPF_RELEASE 199606 - -#ifdef MSDOS /* must be 32-bit */ -typedef long bpf_int32; -typedef unsigned long bpf_u_int32; -#else -typedef int bpf_int32; -typedef u_int bpf_u_int32; -#endif - -/* - * Alignment macros. BPF_WORDALIGN rounds up to the next - * even multiple of BPF_ALIGNMENT. - */ -#ifndef __NetBSD__ -#define BPF_ALIGNMENT sizeof(bpf_int32) -#else -#define BPF_ALIGNMENT sizeof(long) -#endif -#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) - -#define BPF_MAXBUFSIZE 0x8000 -#define BPF_MINBUFSIZE 32 - -/* - * Structure for "pcap_compile()", "pcap_setfilter()", etc.. - */ -struct bpf_program { - u_int bf_len; - struct bpf_insn *bf_insns; -}; - -/* - * Struct return by BIOCVERSION. This represents the version number of - * the filter language described by the instruction encodings below. - * bpf understands a program iff kernel_major == filter_major && - * kernel_minor >= filter_minor, that is, if the value returned by the - * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the - * results are undefined, meaning an error may be returned or packets - * may be accepted haphazardly. - * It has nothing to do with the source code version. - */ -struct bpf_version { - u_short bv_major; - u_short bv_minor; -}; -/* Current version number of filter architecture. */ -#define BPF_MAJOR_VERSION 1 -#define BPF_MINOR_VERSION 1 - -/* - * Data-link level type codes. - * - * Do *NOT* add new values to this list without asking - * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run - * the risk of using a value that's already being used for some other - * purpose, and of having tools that read libpcap-format captures not - * being able to handle captures with your new DLT_ value, with no hope - * that they will ever be changed to do so (as that would destroy their - * ability to read captures using that value for that other purpose). - */ - -/* - * These are the types that are the same on all platforms, and that - * have been defined by for ages. - */ -#define DLT_NULL 0 /* BSD loopback encapsulation */ -#define DLT_EN10MB 1 /* Ethernet (10Mb) */ -#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ -#define DLT_AX25 3 /* Amateur Radio AX.25 */ -#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ -#define DLT_CHAOS 5 /* Chaos */ -#define DLT_IEEE802 6 /* 802.5 Token Ring */ -#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ -#define DLT_SLIP 8 /* Serial Line IP */ -#define DLT_PPP 9 /* Point-to-point Protocol */ -#define DLT_FDDI 10 /* FDDI */ - -/* - * These are types that are different on some platforms, and that - * have been defined by for ages. We use #ifdefs to - * detect the BSDs that define them differently from the traditional - * libpcap - * - * 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. - */ -#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ - -#ifdef __OpenBSD__ -#define DLT_RAW 14 /* raw IP */ -#else -#define DLT_RAW 12 /* raw IP */ -#endif - -/* - * Given that the only OS that currently generates BSD/OS SLIP or PPP - * is, well, BSD/OS, arguably everybody should have chosen its values - * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they - * didn't. So it goes. - */ -#if defined(__NetBSD__) || defined(__FreeBSD__) -#ifndef DLT_SLIP_BSDOS -#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ -#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ -#endif -#else -#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ -#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ -#endif - -/* - * 17 is used for DLT_OLD_PFLOG in OpenBSD; - * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. - * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. - */ - -#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ - -/* - * Apparently Redback uses this for its SmartEdge 400/800. I hope - * nobody else decided to use it, too. - */ -#define DLT_REDBACK_SMARTEDGE 32 - -/* - * These values are defined by NetBSD; other platforms should refrain from - * using them for other purposes, so that NetBSD savefiles with link - * types of 50 or 51 can be read as this type on all platforms. - */ -#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ -#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ - -/* - * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses - * a link-layer type of 99 for the tcpdump it supplies. The link-layer - * header has 6 bytes of unknown data, something that appears to be an - * Ethernet type, and 36 bytes that appear to be 0 in at least one capture - * I've seen. - */ -#define DLT_SYMANTEC_FIREWALL 99 - -/* - * Values between 100 and 103 are used in capture file headers as - * link-layer types corresponding to DLT_ types that differ - * between platforms; don't use those values for new DLT_ new types. - */ - -/* - * This value was defined by libpcap 0.5; platforms that have defined - * it with a different value should define it here with that value - - * a link type of 104 in a save file will be mapped to DLT_C_HDLC, - * whatever value that happens to be, so programs will correctly - * handle files with that link type regardless of the value of - * DLT_C_HDLC. - * - * The name DLT_C_HDLC was used by BSD/OS; we use that name for source - * compatibility with programs written for BSD/OS. - * - * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, - * for source compatibility with programs written for libpcap 0.5. - */ -#define DLT_C_HDLC 104 /* Cisco HDLC */ -#define DLT_CHDLC DLT_C_HDLC - -#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ - -/* - * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, - * except when it isn't. (I.e., sometimes it's just raw IP, and - * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, - * so that we don't have to worry about the link-layer header.) - */ - -/* - * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides - * with other values. - * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header - * (DLCI, etc.). - */ -#define DLT_FRELAY 107 - -/* - * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except - * that the AF_ type in the link-layer header is in network byte order. - * - * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so - * we don't use 12 for it in OSes other than OpenBSD. - */ -#ifdef __OpenBSD__ -#define DLT_LOOP 12 -#else -#define DLT_LOOP 108 -#endif - -/* - * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's - * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other - * than OpenBSD. - */ -#ifdef __OpenBSD__ -#define DLT_ENC 13 -#else -#define DLT_ENC 109 -#endif - -/* - * Values between 110 and 112 are reserved for use in capture file headers - * as link-layer types corresponding to DLT_ types that might differ - * between platforms; don't use those values for new DLT_ types - * other than the corresponding DLT_ types. - */ - -/* - * This is for Linux cooked sockets. - */ -#define DLT_LINUX_SLL 113 - -/* - * Apple LocalTalk hardware. - */ -#define DLT_LTALK 114 - -/* - * Acorn Econet. - */ -#define DLT_ECONET 115 - -/* - * Reserved for use with OpenBSD ipfilter. - */ -#define DLT_IPFILTER 116 - -/* - * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 - * in SuSE 6.3, so we can't use 17 for it in capture-file headers. - * - * XXX: is there a conflict with DLT_PFSYNC 18 as well? - */ -#ifdef __OpenBSD__ -#define DLT_OLD_PFLOG 17 -#define DLT_PFSYNC 18 -#endif -#define DLT_PFLOG 117 - -/* - * Registered for Cisco-internal use. - */ -#define DLT_CISCO_IOS 118 - -/* - * For 802.11 cards using the Prism II chips, with a link-layer - * header including Prism monitor mode information plus an 802.11 - * header. - */ -#define DLT_PRISM_HEADER 119 - -/* - * Reserved for Aironet 802.11 cards, with an Aironet link-layer header - * (see Doug Ambrisko's FreeBSD patches). - */ -#define DLT_AIRONET_HEADER 120 - -/* - * Reserved for Siemens HiPath HDLC. - */ -#define DLT_HHDLC 121 - -/* - * This is for RFC 2625 IP-over-Fibre Channel. - * - * This is not for use with raw Fibre Channel, where the link-layer - * header starts with a Fibre Channel frame header; it's for IP-over-FC, - * where the link-layer header starts with an RFC 2625 Network_Header - * field. - */ -#define DLT_IP_OVER_FC 122 - -/* - * This is for Full Frontal ATM on Solaris with SunATM, with a - * pseudo-header followed by an AALn PDU. - * - * There may be other forms of Full Frontal ATM on other OSes, - * with different pseudo-headers. - * - * If ATM software returns a pseudo-header with VPI/VCI information - * (and, ideally, packet type information, e.g. signalling, ILMI, - * LANE, LLC-multiplexed traffic, etc.), it should not use - * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump - * and the like don't have to infer the presence or absence of a - * pseudo-header and the form of the pseudo-header. - */ -#define DLT_SUNATM 123 /* Solaris+SunATM */ - -/* - * Reserved as per request from Kent Dahlgren - * for private use. - */ -#define DLT_RIO 124 /* RapidIO */ -#define DLT_PCI_EXP 125 /* PCI Express */ -#define DLT_AURORA 126 /* Xilinx Aurora link layer */ - -/* - * Header for 802.11 plus a number of bits of link-layer information - * including radio information, used by some recent BSD drivers as - * well as the madwifi Atheros driver for Linux. - */ -#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ - -/* - * Reserved for the TZSP encapsulation, as per request from - * Chris Waters - * TZSP is a generic encapsulation for any other link type, - * which includes a means to include meta-information - * with the packet, e.g. signal strength and channel - * for 802.11 packets. - */ -#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ - -/* - * BSD's ARCNET headers have the source host, destination host, - * and type at the beginning of the packet; that's what's handed - * up to userland via BPF. - * - * Linux's ARCNET headers, however, have a 2-byte offset field - * between the host IDs and the type; that's what's handed up - * to userland via PF_PACKET sockets. - * - * We therefore have to have separate DLT_ values for them. - */ -#define DLT_ARCNET_LINUX 129 /* ARCNET */ - -/* - * Juniper-private data link types, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, etc.. - */ -#define DLT_JUNIPER_MLPPP 130 -#define DLT_JUNIPER_MLFR 131 -#define DLT_JUNIPER_ES 132 -#define DLT_JUNIPER_GGSN 133 -#define DLT_JUNIPER_MFR 134 -#define DLT_JUNIPER_ATM2 135 -#define DLT_JUNIPER_SERVICES 136 -#define DLT_JUNIPER_ATM1 137 - -/* - * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund - * . The header that's presented is an Ethernet-like - * header: - * - * #define FIREWIRE_EUI64_LEN 8 - * struct firewire_header { - * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; - * u_char firewire_shost[FIREWIRE_EUI64_LEN]; - * u_short firewire_type; - * }; - * - * with "firewire_type" being an Ethernet type value, rather than, - * for example, raw GASP frames being handed up. - */ -#define DLT_APPLE_IP_OVER_IEEE1394 138 - -/* - * Various SS7 encapsulations, as per a request from Jeff Morriss - * and subsequent discussions. - */ -#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ -#define DLT_MTP2 140 /* MTP2, without pseudo-header */ -#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ -#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ - -/* - * DOCSIS MAC frames. - */ -#define DLT_DOCSIS 143 - -/* - * Linux-IrDA packets. Protocol defined at http://www.irda.org. - * Those packets include IrLAP headers and above (IrLMP...), but - * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy - * framing can be handled by the hardware and depend on the bitrate. - * This is exactly the format you would get capturing on a Linux-IrDA - * interface (irdaX), but not on a raw serial port. - * Note the capture is done in "Linux-cooked" mode, so each packet include - * a fake packet header (struct sll_header). This is because IrDA packet - * decoding is dependant on the direction of the packet (incomming or - * outgoing). - * When/if other platform implement IrDA capture, we may revisit the - * issue and define a real DLT_IRDA... - * Jean II - */ -#define DLT_LINUX_IRDA 144 - -/* - * Reserved for IBM SP switch and IBM Next Federation switch. - */ -#define DLT_IBM_SP 145 -#define DLT_IBM_SN 146 - -/* - * Reserved for private use. If you have some link-layer header type - * that you want to use within your organization, with the capture files - * using that link-layer header type not ever be sent outside your - * organization, you can use these values. - * - * No libpcap release will use these for any purpose, nor will any - * tcpdump release use them, either. - * - * Do *NOT* use these in capture files that you expect anybody not using - * your private versions of capture-file-reading tools to read; in - * particular, do *NOT* use them in products, otherwise you may find that - * people won't be able to use tcpdump, or snort, or Ethereal, or... to - * read capture files from your firewall/intrusion detection/traffic - * monitoring/etc. appliance, or whatever product uses that DLT_ value, - * and you may also find that the developers of those applications will - * not accept patches to let them read those files. - * - * Also, do not use them if somebody might send you a capture using them - * for *their* private type and tools using them for *your* private type - * would have to read them. - * - * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, - * as per the comment above, and use the type you're given. - */ -#define DLT_USER0 147 -#define DLT_USER1 148 -#define DLT_USER2 149 -#define DLT_USER3 150 -#define DLT_USER4 151 -#define DLT_USER5 152 -#define DLT_USER6 153 -#define DLT_USER7 154 -#define DLT_USER8 155 -#define DLT_USER9 156 -#define DLT_USER10 157 -#define DLT_USER11 158 -#define DLT_USER12 159 -#define DLT_USER13 160 -#define DLT_USER14 161 -#define DLT_USER15 162 - -/* - * For future use with 802.11 captures - defined by AbsoluteValue - * Systems to store a number of bits of link-layer information - * including radio information: - * - * http://www.shaftnet.org/~pizza/software/capturefrm.txt - * - * but it might be used by some non-AVS drivers now or in the - * future. - */ -#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, etc.. - */ -#define DLT_JUNIPER_MONITOR 164 - -/* - * Reserved for BACnet MS/TP. - */ -#define DLT_BACNET_MS_TP 165 - -/* - * Another PPP variant as per request from Karsten Keil . - * - * This is used in some OSes to allow a kernel socket filter to distinguish - * between incoming and outgoing packets, on a socket intended to - * supply pppd with outgoing packets so it can do dial-on-demand and - * hangup-on-lack-of-demand; incoming packets are filtered out so they - * don't cause pppd to hold the connection up (you don't want random - * input packets such as port scans, packets from old lost connections, - * etc. to force the connection to stay up). - * - * The first byte of the PPP header (0xff03) is modified to accomodate - * the direction - 0x00 = IN, 0x01 = OUT. - */ -#define DLT_PPP_PPPD 166 - -/* - * Names for backwards compatibility with older versions of some PPP - * software; new software should use DLT_PPP_PPPD. - */ -#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD -#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, cookies, etc.. - */ -#define DLT_JUNIPER_PPPOE 167 -#define DLT_JUNIPER_PPPOE_ATM 168 - -#define DLT_GPRS_LLC 169 /* GPRS LLC */ -#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ -#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ - -/* - * Requested by Oolan Zimmer for use in Gcom's T1/E1 line - * monitoring equipment. - */ -#define DLT_GCOM_T1E1 172 -#define DLT_GCOM_SERIAL 173 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_ is used - * for internal communication to Physical Interface Cards (PIC) - */ -#define DLT_JUNIPER_PIC_PEER 174 - -/* - * Link types requested by Gregor Maier of Endace - * Measurement Systems. They add an ERF header (see - * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of - * the link-layer header. - */ -#define DLT_ERF_ETH 175 /* Ethernet */ -#define DLT_ERF_POS 176 /* Packet-over-SONET */ - -/* - * Requested by Daniele Orlandi for raw LAPD - * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header - * includes additional information before the LAPD header, so it's - * not necessarily a generic LAPD header. - */ -#define DLT_LINUX_LAPD 177 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . - * The DLT_ are used for prepending meta-information - * like interface index, interface name - * before standard Ethernet, PPP, Frelay & C-HDLC Frames - */ -#define DLT_JUNIPER_ETHER 178 -#define DLT_JUNIPER_PPP 179 -#define DLT_JUNIPER_FRELAY 180 -#define DLT_JUNIPER_CHDLC 181 - -/* - * Multi Link Frame Relay (FRF.16) - */ -#define DLT_MFR 182 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . - * The DLT_ is used for internal communication with a - * voice Adapter Card (PIC) - */ -#define DLT_JUNIPER_VP 183 - -/* - * Arinc 429 frames. - * DLT_ requested by Gianluca Varenni . - * Every frame contains a 32bit A429 label. - * More documentation on Arinc 429 can be found at - * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf - */ -#define DLT_A429 184 - -/* - * Arinc 653 Interpartition Communication messages. - * DLT_ requested by Gianluca Varenni . - * Please refer to the A653-1 standard for more information. - */ -#define DLT_A653_ICM 185 - -/* - * USB packets, beginning with a USB setup header; requested by - * Paolo Abeni . - */ -#define DLT_USB 186 - -/* - * Bluetooth HCI UART transport layer (part H:4); requested by - * Paolo Abeni. - */ -#define DLT_BLUETOOTH_HCI_H4 187 - -/* - * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz - * . - */ -#define DLT_IEEE802_16_MAC_CPS 188 - -/* - * USB packets, beginning with a Linux USB header; requested by - * Paolo Abeni . - */ -#define DLT_USB_LINUX 189 - -/* - * Controller Area Network (CAN) v. 2.0B packets. - * DLT_ requested by Gianluca Varenni . - * Used to dump CAN packets coming from a CAN Vector board. - * More documentation on the CAN v2.0B frames can be found at - * http://www.can-cia.org/downloads/?269 - */ -#define DLT_CAN20B 190 - -/* - * IEEE 802.15.4, with address fields padded, as is done by Linux - * drivers; requested by Juergen Schimmer. - */ -#define DLT_IEEE802_15_4_LINUX 191 - -/* - * Per Packet Information encapsulated packets. - * DLT_ requested by Gianluca Varenni . - */ -#define DLT_PPI 192 - -/* - * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; - * requested by Charles Clancy. - */ -#define DLT_IEEE802_16_MAC_CPS_RADIO 193 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . - * The DLT_ is used for internal communication with a - * integrated service module (ISM). - */ -#define DLT_JUNIPER_ISM 194 - -/* - * IEEE 802.15.4, exactly as it appears in the spec (no padding, no - * nothing); requested by Mikko Saarnivala . - */ -#define DLT_IEEE802_15_4 195 - -/* - * Various link-layer types, with a pseudo-header, for SITA - * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). - */ -#define DLT_SITA 196 - -/* - * Various link-layer types, with a pseudo-header, for Endace DAG cards; - * encapsulates Endace ERF records. Requested by Stephen Donnelly - * . - */ -#define DLT_ERF 197 - -/* - * Special header prepended to Ethernet packets when capturing from a - * u10 Networks board. Requested by Phil Mulholland - * . - */ -#define DLT_RAIF1 198 - -/* - * IPMB packet for IPMI, beginning with the I2C slave address, followed - * by the netFn and LUN, etc.. Requested by Chanthy Toeung - * . - */ -#define DLT_IPMB 199 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . - * The DLT_ is used for capturing data on a secure tunnel interface. - */ -#define DLT_JUNIPER_ST 200 - -/* - * Bluetooth HCI UART transport layer (part H:4), with pseudo-header - * that includes direction information; requested by Paolo Abeni. - */ -#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 - -/* - * AX.25 packet with a 1-byte KISS header; see - * - * http://www.ax25.net/kiss.htm - * - * as per Richard Stearn . - */ -#define DLT_AX25_KISS 202 - -/* - * LAPD packets from an ISDN channel, starting with the address field, - * with no pseudo-header. - * Requested by Varuna De Silva . - */ -#define DLT_LAPD 203 - -/* - * Variants of various link-layer headers, with a one-byte direction - * pseudo-header prepended - zero means "received by this host", - * non-zero (any non-zero value) means "sent by this host" - as per - * Will Barker . - */ -#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ -#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ -#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ -#define DLT_LAPB_WITH_DIR 207 /* LAPB */ - -/* - * 208 is reserved for an as-yet-unspecified proprietary link-layer - * type, as requested by Will Barker. - */ - -/* - * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman - * . - */ -#define DLT_IPMB_LINUX 209 - -/* - * FlexRay automotive bus - http://www.flexray.com/ - as requested - * by Hannes Kaelber . - */ -#define DLT_FLEXRAY 210 - -/* - * Media Oriented Systems Transport (MOST) bus for multimedia - * transport - http://www.mostcooperation.com/ - as requested - * by Hannes Kaelber . - */ -#define DLT_MOST 211 - -/* - * Local Interconnect Network (LIN) bus for vehicle networks - - * http://www.lin-subbus.org/ - as requested by Hannes Kaelber - * . - */ -#define DLT_LIN 212 - -/* - * X2E-private data link type used for serial line capture, - * as requested by Hannes Kaelber . - */ -#define DLT_X2E_SERIAL 213 - -/* - * X2E-private data link type used for the Xoraya data logger - * family, as requested by Hannes Kaelber . - */ -#define DLT_X2E_XORAYA 214 - -/* - * IEEE 802.15.4, exactly as it appears in the spec (no padding, no - * nothing), but with the PHY-level data for non-ASK PHYs (4 octets - * of 0 as preamble, one octet of SFD, one octet of frame length+ - * reserved bit, and then the MAC-layer data, starting with the - * frame control field). - * - * Requested by Max Filippov . - */ -#define DLT_IEEE802_15_4_NONASK_PHY 215 - - -/* - * DLT and savefile link type values are split into a class and - * a member of that class. A class value of 0 indicates a regular - * DLT_/LINKTYPE_ value. - */ -#define DLT_CLASS(x) ((x) & 0x03ff0000) - -/* - * NetBSD-specific generic "raw" link type. The class value indicates - * that this is the generic raw type, and the lower 16 bits are the - * address family we're dealing with. Those values are NetBSD-specific; - * do not assume that they correspond to AF_ values for your operating - * system. - */ -#define DLT_CLASS_NETBSD_RAWAF 0x02240000 -#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) -#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) -#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) - - -/* - * The instruction encodings. - */ -/* instruction classes */ -#define BPF_CLASS(code) ((code) & 0x07) -#define BPF_LD 0x00 -#define BPF_LDX 0x01 -#define BPF_ST 0x02 -#define BPF_STX 0x03 -#define BPF_ALU 0x04 -#define BPF_JMP 0x05 -#define BPF_RET 0x06 -#define BPF_MISC 0x07 - -/* ld/ldx fields */ -#define BPF_SIZE(code) ((code) & 0x18) -#define BPF_W 0x00 -#define BPF_H 0x08 -#define BPF_B 0x10 -#define BPF_MODE(code) ((code) & 0xe0) -#define BPF_IMM 0x00 -#define BPF_ABS 0x20 -#define BPF_IND 0x40 -#define BPF_MEM 0x60 -#define BPF_LEN 0x80 -#define BPF_MSH 0xa0 - -/* alu/jmp fields */ -#define BPF_OP(code) ((code) & 0xf0) -#define BPF_ADD 0x00 -#define BPF_SUB 0x10 -#define BPF_MUL 0x20 -#define BPF_DIV 0x30 -#define BPF_OR 0x40 -#define BPF_AND 0x50 -#define BPF_LSH 0x60 -#define BPF_RSH 0x70 -#define BPF_NEG 0x80 -#define BPF_JA 0x00 -#define BPF_JEQ 0x10 -#define BPF_JGT 0x20 -#define BPF_JGE 0x30 -#define BPF_JSET 0x40 -#define BPF_SRC(code) ((code) & 0x08) -#define BPF_K 0x00 -#define BPF_X 0x08 - -/* ret - BPF_K and BPF_X also apply */ -#define BPF_RVAL(code) ((code) & 0x18) -#define BPF_A 0x10 - -/* misc */ -#define BPF_MISCOP(code) ((code) & 0xf8) -#define BPF_TAX 0x00 -#define BPF_TXA 0x80 - -/* - * The instruction data structure. - */ -struct bpf_insn { - u_short code; - u_char jt; - u_char jf; - bpf_u_int32 k; -}; - -/* - * Macros for insn array initializers. - */ -#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } -#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } - -#if __STDC__ || defined(__cplusplus) -extern int bpf_validate(const struct bpf_insn *, int); -extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); -#else -extern int bpf_validate(); -extern u_int bpf_filter(); -#endif - -/* - * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). - */ -#define BPF_MEMWORDS 16 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/vs10/include/pcap/namedb.h b/vs10/include/pcap/namedb.h deleted file mode 100644 index 9002c750..00000000 --- a/vs10/include/pcap/namedb.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1994, 1996 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006/10/04 18:09:22 guy Exp $ (LBL) - */ - -#ifndef lib_pcap_namedb_h -#define lib_pcap_namedb_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * As returned by the pcap_next_etherent() - * XXX this stuff doesn't belong in this interface, but this - * library already must do name to address translation, so - * on systems that don't have support for /etc/ethers, we - * export these hooks since they'll - */ -struct pcap_etherent { - u_char addr[6]; - char name[122]; -}; -#ifndef PCAP_ETHERS_FILE -#define PCAP_ETHERS_FILE "/etc/ethers" -#endif -struct pcap_etherent *pcap_next_etherent(FILE *); -u_char *pcap_ether_hostton(const char*); -u_char *pcap_ether_aton(const char *); - -bpf_u_int32 **pcap_nametoaddr(const char *); -#ifdef INET6 -struct addrinfo *pcap_nametoaddrinfo(const char *); -#endif -bpf_u_int32 pcap_nametonetaddr(const char *); - -int pcap_nametoport(const char *, int *, int *); -int pcap_nametoportrange(const char *, int *, int *, int *); -int pcap_nametoproto(const char *); -int pcap_nametoeproto(const char *); -int pcap_nametollc(const char *); -/* - * If a protocol is unknown, PROTO_UNDEF is returned. - * Also, pcap_nametoport() returns the protocol along with the port number. - * If there are ambiguous entried in /etc/services (i.e. domain - * can be either tcp or udp) PROTO_UNDEF is returned. - */ -#define PROTO_UNDEF -1 - -/* XXX move these to pcap-int.h? */ -int __pcap_atodn(const char *, bpf_u_int32 *); -int __pcap_atoin(const char *, bpf_u_int32 *); -u_short __pcap_nametodnaddr(const char *); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/vs10/include/pcap/pcap.h b/vs10/include/pcap/pcap.h deleted file mode 100644 index ad8fc40a..00000000 --- a/vs10/include/pcap/pcap.h +++ /dev/null @@ -1,407 +0,0 @@ -/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ -/* - * Copyright (c) 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.4.2.11 2008-10-06 15:38:39 gianluca Exp $ (LBL) - */ - -#ifndef lib_pcap_pcap_h -#define lib_pcap_pcap_h - -#if defined(WIN32) - #include -#elif defined(MSDOS) - #include - #include /* u_int, u_char etc. */ -#else /* UN*X */ - #include - #include -#endif /* WIN32/MSDOS/UN*X */ - -#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H -#include -#endif - -#include - -#ifdef HAVE_REMOTE - // We have to define the SOCKET here, although it has been defined in sockutils.h - // This is to avoid the distribution of the 'sockutils.h' file around - // (for example in the WinPcap developer's pack) - #ifndef SOCKET - #ifdef WIN32 - #define SOCKET unsigned int - #else - #define SOCKET int - #endif - #endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define PCAP_VERSION_MAJOR 2 -#define PCAP_VERSION_MINOR 4 - -#define PCAP_ERRBUF_SIZE 256 - -/* - * Compatibility for systems that have a bpf.h that - * predates the bpf typedefs for 64-bit support. - */ -#if BPF_RELEASE - 0 < 199406 -typedef int bpf_int32; -typedef u_int bpf_u_int32; -#endif - -typedef struct pcap pcap_t; -typedef struct pcap_dumper pcap_dumper_t; -typedef struct pcap_if pcap_if_t; -typedef struct pcap_addr pcap_addr_t; - -/* - * The first record in the file contains saved values for some - * of the flags used in the printout phases of tcpdump. - * Many fields here are 32 bit ints so compilers won't insert unwanted - * padding; these files need to be interchangeable across architectures. - * - * Do not change the layout of this structure, in any way (this includes - * changes that only affect the length of fields in this structure). - * - * Also, do not change the interpretation of any of the members of this - * structure, in any way (this includes using values other than - * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" - * field). - * - * Instead: - * - * introduce a new structure for the new format, if the layout - * of the structure changed; - * - * send mail to "tcpdump-workers@lists.tcpdump.org", requesting - * a new magic number for your new capture file format, and, when - * you get the new magic number, put it in "savefile.c"; - * - * use that magic number for save files with the changed file - * header; - * - * make the code in "savefile.c" capable of reading files with - * the old file header as well as files with the new file header - * (using the magic number to determine the header format). - * - * Then supply the changes as a patch at - * - * http://sourceforge.net/projects/libpcap/ - * - * so that future versions of libpcap and programs that use it (such as - * tcpdump) will be able to read your new capture file format. - */ -struct pcap_file_header { - bpf_u_int32 magic; - u_short version_major; - u_short version_minor; - bpf_int32 thiszone; /* gmt to local correction */ - bpf_u_int32 sigfigs; /* accuracy of timestamps */ - bpf_u_int32 snaplen; /* max length saved portion of each pkt */ - bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ -}; - -/* - * Macros for the value returned by pcap_datalink_ext(). - * - * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro - * gives the FCS length of packets in the capture. - */ -#define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) -#define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) -#define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) - -typedef enum { - PCAP_D_INOUT = 0, - PCAP_D_IN, - PCAP_D_OUT -} pcap_direction_t; - -/* - * Generic per-packet information, as supplied by libpcap. - * - * The time stamp can and should be a "struct timeval", regardless of - * whether your system supports 32-bit tv_sec in "struct timeval", - * 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit - * and 64-bit applications. The on-disk format of savefiles uses 32-bit - * tv_sec (and tv_usec); this structure is irrelevant to that. 32-bit - * and 64-bit versions of libpcap, even if they're on the same platform, - * should supply the appropriate version of "struct timeval", even if - * that's not what the underlying packet capture mechanism supplies. - */ -struct pcap_pkthdr { - struct timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ -}; - -/* - * As returned by the pcap_stats() - */ -struct pcap_stat { - u_int ps_recv; /* number of packets received */ - u_int ps_drop; /* number of packets dropped */ - u_int ps_ifdrop; /* drops by interface XXX not yet supported */ -#ifdef HAVE_REMOTE - u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ - u_int ps_sent; /* number of packets sent by the server on the network */ - u_int ps_netdrop; /* number of packets lost on the network */ -#endif /* HAVE_REMOTE */ -}; - -#ifdef MSDOS -/* - * As returned by the pcap_stats_ex() - */ -struct pcap_stat_ex { - u_long rx_packets; /* total packets received */ - u_long tx_packets; /* total packets transmitted */ - u_long rx_bytes; /* total bytes received */ - u_long tx_bytes; /* total bytes transmitted */ - u_long rx_errors; /* bad packets received */ - u_long tx_errors; /* packet transmit problems */ - u_long rx_dropped; /* no space in Rx buffers */ - u_long tx_dropped; /* no space available for Tx */ - u_long multicast; /* multicast packets received */ - u_long collisions; - - /* detailed rx_errors: */ - u_long rx_length_errors; - u_long rx_over_errors; /* receiver ring buff overflow */ - u_long rx_crc_errors; /* recv'd pkt with crc error */ - u_long rx_frame_errors; /* recv'd frame alignment error */ - u_long rx_fifo_errors; /* recv'r fifo overrun */ - u_long rx_missed_errors; /* recv'r missed packet */ - - /* detailed tx_errors */ - u_long tx_aborted_errors; - u_long tx_carrier_errors; - u_long tx_fifo_errors; - u_long tx_heartbeat_errors; - u_long tx_window_errors; - }; -#endif - -/* - * Item in a list of interfaces. - */ -struct pcap_if { - struct pcap_if *next; - char *name; /* name to hand to "pcap_open_live()" */ - char *description; /* textual description of interface, or NULL */ - struct pcap_addr *addresses; - bpf_u_int32 flags; /* PCAP_IF_ interface flags */ -}; - -#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ - -/* - * Representation of an interface address. - */ -struct pcap_addr { - struct pcap_addr *next; - struct sockaddr *addr; /* address */ - struct sockaddr *netmask; /* netmask for that address */ - struct sockaddr *broadaddr; /* broadcast address for that address */ - struct sockaddr *dstaddr; /* P2P destination address for that address */ -}; - -typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, - const u_char *); - -/* - * Error codes for the pcap API. - * These will all be negative, so you can check for the success or - * failure of a call that returns these codes by checking for a - * negative value. - */ -#define PCAP_ERROR -1 /* generic error code */ -#define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ -#define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */ -#define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */ -#define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */ -#define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */ -#define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ -#define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ -#define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ - -/* - * Warning codes for the pcap API. - * These will all be positive and non-zero, so they won't look like - * errors. - */ -#define PCAP_WARNING 1 /* generic warning code */ -#define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ - -char *pcap_lookupdev(char *); -int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); - -pcap_t *pcap_create(const char *, char *); -int pcap_set_snaplen(pcap_t *, int); -int pcap_set_promisc(pcap_t *, int); -int pcap_can_set_rfmon(pcap_t *); -int pcap_set_rfmon(pcap_t *, int); -int pcap_set_timeout(pcap_t *, int); -int pcap_set_buffer_size(pcap_t *, int); -int pcap_activate(pcap_t *); - -pcap_t *pcap_open_live(const char *, int, int, int, char *); -pcap_t *pcap_open_dead(int, int); -pcap_t *pcap_open_offline(const char *, char *); -#if defined(WIN32) -pcap_t *pcap_hopen_offline(intptr_t, char *); -#if !defined(LIBPCAP_EXPORTS) -#define pcap_fopen_offline(f,b) \ - pcap_hopen_offline(_get_osfhandle(_fileno(f)), b) -#else /*LIBPCAP_EXPORTS*/ -static pcap_t *pcap_fopen_offline(FILE *, char *); -#endif -#else /*WIN32*/ -pcap_t *pcap_fopen_offline(FILE *, char *); -#endif /*WIN32*/ - -void pcap_close(pcap_t *); -int pcap_loop(pcap_t *, int, pcap_handler, u_char *); -int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); -const u_char* - pcap_next(pcap_t *, struct pcap_pkthdr *); -int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); -void pcap_breakloop(pcap_t *); -int pcap_stats(pcap_t *, struct pcap_stat *); -int pcap_setfilter(pcap_t *, struct bpf_program *); -int pcap_setdirection(pcap_t *, pcap_direction_t); -int pcap_getnonblock(pcap_t *, char *); -int pcap_setnonblock(pcap_t *, int, char *); -int pcap_inject(pcap_t *, const void *, size_t); -int pcap_sendpacket(pcap_t *, const u_char *, int); -const char *pcap_statustostr(int); -const char *pcap_strerror(int); -char *pcap_geterr(pcap_t *); -void pcap_perror(pcap_t *, char *); -int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, - bpf_u_int32); -int pcap_compile_nopcap(int, int, struct bpf_program *, - const char *, int, bpf_u_int32); -void pcap_freecode(struct bpf_program *); -int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *, - const u_char *); -int pcap_datalink(pcap_t *); -int pcap_datalink_ext(pcap_t *); -int pcap_list_datalinks(pcap_t *, int **); -int pcap_set_datalink(pcap_t *, int); -void pcap_free_datalinks(int *); -int pcap_datalink_name_to_val(const char *); -const char *pcap_datalink_val_to_name(int); -const char *pcap_datalink_val_to_description(int); -int pcap_snapshot(pcap_t *); -int pcap_is_swapped(pcap_t *); -int pcap_major_version(pcap_t *); -int pcap_minor_version(pcap_t *); - -/* XXX */ -FILE *pcap_file(pcap_t *); -int pcap_fileno(pcap_t *); - -pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); -pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); -FILE *pcap_dump_file(pcap_dumper_t *); -long pcap_dump_ftell(pcap_dumper_t *); -int pcap_dump_flush(pcap_dumper_t *); -void pcap_dump_close(pcap_dumper_t *); -void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); - -int pcap_findalldevs(pcap_if_t **, char *); -void pcap_freealldevs(pcap_if_t *); - -const char *pcap_lib_version(void); - -/* XXX this guy lives in the bpf tree */ -u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); -int bpf_validate(const struct bpf_insn *f, int len); -char *bpf_image(const struct bpf_insn *, int); -void bpf_dump(const struct bpf_program *, int); - -#if defined(WIN32) - -/* - * Win32 definitions - */ - -int pcap_setbuff(pcap_t *p, int dim); -int pcap_setmode(pcap_t *p, int mode); -int pcap_setmintocopy(pcap_t *p, int size); - -#ifdef WPCAP -/* Include file with the wpcap-specific extensions */ -#include -#endif /* WPCAP */ - -#define MODE_CAPT 0 -#define MODE_STAT 1 -#define MODE_MON 2 - -#elif defined(MSDOS) - -/* - * MS-DOS definitions - */ - -int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); -void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); -u_long pcap_mac_packets (void); - -#else /* UN*X */ - -/* - * UN*X definitions - */ - -int pcap_get_selectable_fd(pcap_t *); - -#endif /* WIN32/MSDOS/UN*X */ - -#ifdef HAVE_REMOTE -/* Includes most of the public stuff that is needed for the remote capture */ -#include -#endif /* HAVE_REMOTE */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/vs10/include/pcap/sll.h b/vs10/include/pcap/sll.h deleted file mode 100644 index e9d5452a..00000000 --- a/vs10/include/pcap/sll.h +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/sll.h,v 1.2.2.1 2008-05-30 01:36:06 guy Exp $ (LBL) - */ - -/* - * For captures on Linux cooked sockets, we construct a fake header - * that includes: - * - * a 2-byte "packet type" which is one of: - * - * LINUX_SLL_HOST packet was sent to us - * LINUX_SLL_BROADCAST packet was broadcast - * LINUX_SLL_MULTICAST packet was multicast - * LINUX_SLL_OTHERHOST packet was sent to somebody else - * LINUX_SLL_OUTGOING packet was sent *by* us; - * - * a 2-byte Ethernet protocol field; - * - * a 2-byte link-layer type; - * - * a 2-byte link-layer address length; - * - * an 8-byte source link-layer address, whose actual length is - * specified by the previous value. - * - * All fields except for the link-layer address are in network byte order. - * - * DO NOT change the layout of this structure, or change any of the - * LINUX_SLL_ values below. If you must change the link-layer header - * for a "cooked" Linux capture, introduce a new DLT_ type (ask - * "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it - * a value that collides with a value already being used), and use the - * new header in captures of that type, so that programs that can - * handle DLT_LINUX_SLL captures will continue to handle them correctly - * without any change, and so that capture files with different headers - * can be told apart and programs that read them can dissect the - * packets in them. - */ - -#ifndef lib_pcap_sll_h -#define lib_pcap_sll_h - -/* - * A DLT_LINUX_SLL fake link-layer header. - */ -#define SLL_HDR_LEN 16 /* total header length */ -#define SLL_ADDRLEN 8 /* length of address field */ - -struct sll_header { - u_int16_t sll_pkttype; /* packet type */ - u_int16_t sll_hatype; /* link-layer address type */ - u_int16_t sll_halen; /* link-layer address length */ - u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */ - u_int16_t sll_protocol; /* protocol */ -}; - -/* - * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the - * PACKET_ values on Linux, but are defined here so that they're - * available even on systems other than Linux, and so that they - * don't change even if the PACKET_ values change. - */ -#define LINUX_SLL_HOST 0 -#define LINUX_SLL_BROADCAST 1 -#define LINUX_SLL_MULTICAST 2 -#define LINUX_SLL_OTHERHOST 3 -#define LINUX_SLL_OUTGOING 4 - -/* - * The LINUX_SLL_ values for "sll_protocol"; these correspond to the - * ETH_P_ values on Linux, but are defined here so that they're - * available even on systems other than Linux. We assume, for now, - * that the ETH_P_ values won't change in Linux; if they do, then: - * - * if we don't translate them in "pcap-linux.c", capture files - * won't necessarily be readable if captured on a system that - * defines ETH_P_ values that don't match these values; - * - * if we do translate them in "pcap-linux.c", that makes life - * unpleasant for the BPF code generator, as the values you test - * for in the kernel aren't the values that you test for when - * reading a capture file, so the fixup code run on BPF programs - * handed to the kernel ends up having to do more work. - * - * Add other values here as necessary, for handling packet types that - * might show up on non-Ethernet, non-802.x networks. (Not all the ones - * in the Linux "if_ether.h" will, I suspect, actually show up in - * captures.) - */ -#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ -#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ - -#endif diff --git a/vs10/include/pcap/usb.h b/vs10/include/pcap/usb.h deleted file mode 100644 index adcd19c0..00000000 --- a/vs10/include/pcap/usb.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2006 Paolo Abeni (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Basic USB data struct - * By Paolo Abeni - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.6 2007/09/22 02:06:08 guy Exp $ - */ - -#ifndef _PCAP_USB_STRUCTS_H__ -#define _PCAP_USB_STRUCTS_H__ - -/* - * possible transfer mode - */ -#define URB_TRANSFER_IN 0x80 -#define URB_ISOCHRONOUS 0x0 -#define URB_INTERRUPT 0x1 -#define URB_CONTROL 0x2 -#define URB_BULK 0x3 - -/* - * possible event type - */ -#define URB_SUBMIT 'S' -#define URB_COMPLETE 'C' -#define URB_ERROR 'E' - -/* - * USB setup header as defined in USB specification. - * Appears at the front of each packet in DLT_USB captures. - */ -typedef struct _usb_setup { - u_int8_t bmRequestType; - u_int8_t bRequest; - u_int16_t wValue; - u_int16_t wIndex; - u_int16_t wLength; -} pcap_usb_setup; - - -/* - * Header prepended by linux kernel to each event. - * Appears at the front of each packet in DLT_USB_LINUX captures. - */ -typedef struct _usb_header { - u_int64_t id; - u_int8_t event_type; - u_int8_t transfer_type; - u_int8_t endpoint_number; - u_int8_t device_address; - u_int16_t bus_id; - char setup_flag;/*if !=0 the urb setup header is not present*/ - char data_flag; /*if !=0 no urb data is present*/ - int64_t ts_sec; - int32_t ts_usec; - int32_t status; - u_int32_t urb_len; - u_int32_t data_len; /* amount of urb data really present in this event*/ - pcap_usb_setup setup; -} pcap_usb_header; - - -#endif diff --git a/vs10/include/pcap/vlan.h b/vs10/include/pcap/vlan.h deleted file mode 100644 index b0cb7949..00000000 --- a/vs10/include/pcap/vlan.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap/vlan.h,v 1.1.2.2 2008-08-06 07:45:59 guy Exp $ - */ - -#ifndef lib_pcap_vlan_h -#define lib_pcap_vlan_h - -struct vlan_tag { - u_int16_t vlan_tpid; /* ETH_P_8021Q */ - u_int16_t vlan_tci; /* VLAN TCI */ -}; - -#define VLAN_TAG_LEN 4 - -#endif diff --git a/vs10/include/remote-ext.h b/vs10/include/remote-ext.h deleted file mode 100644 index 9f54d697..00000000 --- a/vs10/include/remote-ext.h +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (c) 2002 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef __REMOTE_EXT_H__ -#define __REMOTE_EXT_H__ - - -#ifndef HAVE_REMOTE -#error Please do not include this file directly. Just define HAVE_REMOTE and then include pcap.h -#endif - -// Definition for Microsoft Visual Studio -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - \file remote-ext.h - - The goal of this file it to include most of the new definitions that should be - placed into the pcap.h file. - - It includes all new definitions (structures and functions like pcap_open(). - Some of the functions are not really a remote feature, but, right now, - they are placed here. -*/ - - - -// All this stuff is public -/*! \addtogroup remote_struct - \{ -*/ - - - - -/*! - \brief Defines the maximum buffer size in which address, port, interface names are kept. - - In case the adapter name or such is larger than this value, it is truncated. - This is not used by the user; however it must be aware that an hostname / interface - name longer than this value will be truncated. -*/ -#define PCAP_BUF_SIZE 1024 - - -/*! \addtogroup remote_source_ID - \{ -*/ - - -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a file, i.e. the user want to open a capture from a local file. -*/ -#define PCAP_SRC_FILE 2 -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a local interface, i.e. the user want to open a capture from - a local interface. This does not involve the RPCAP protocol. -*/ -#define PCAP_SRC_IFLOCAL 3 -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a remote interface, i.e. the user want to open a capture from - an interface on a remote host. This does involve the RPCAP protocol. -*/ -#define PCAP_SRC_IFREMOTE 4 - -/*! - \} -*/ - - - -/*! \addtogroup remote_source_string - - The formats allowed by the pcap_open() are the following: - - file://path_and_filename [opens a local file] - - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] - - rpcap://host/devicename [opens the selected device available on a remote host] - - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] - - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged] - - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged] - - The formats allowed by the pcap_findalldevs_ex() are the following: - - file://folder/ [lists all the files in the given folder] - - rpcap:// [lists all local adapters] - - rpcap://host:port/ [lists the devices available on a remote host] - - Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since - IPv6 is fully supported, these are the allowed formats: - - - host (literal): e.g. host.foo.bar - - host (numeric IPv4): e.g. 10.11.12.13 - - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] - - host (numeric IPv6): e.g. [1:2:3::4] - - port: can be either numeric (e.g. '80') or literal (e.g. 'http') - - Here you find some allowed examples: - - rpcap://host.foo.bar/devicename [everything literal, no port number] - - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] - - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] - - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] - - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] - - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] - - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] - - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] - - \{ -*/ - - -/*! - \brief String that will be used to determine the type of source in use (file, - remote/local interface). - - This string will be prepended to the interface name in order to create a string - that contains all the information required to open the source. - - This string indicates that the user wants to open a capture from a local file. -*/ -#define PCAP_SRC_FILE_STRING "file://" -/*! - \brief String that will be used to determine the type of source in use (file, - remote/local interface). - - This string will be prepended to the interface name in order to create a string - that contains all the information required to open the source. - - This string indicates that the user wants to open a capture from a network interface. - This string does not necessarily involve the use of the RPCAP protocol. If the - interface required resides on the local host, the RPCAP protocol is not involved - and the local functions are used. -*/ -#define PCAP_SRC_IF_STRING "rpcap://" - -/*! - \} -*/ - - - - - -/*! - \addtogroup remote_open_flags - \{ -*/ - -/*! - \brief Defines if the adapter has to go in promiscuous mode. - - It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. - Note that even if this parameter is false, the interface could well be in promiscuous - mode for some other reason (for example because another capture process with - promiscuous mode enabled is currently using that interface). - On on Linux systems with 2.2 or later kernels (that have the "any" device), this - flag does not work on the "any" device; if an argument of "any" is supplied, - the 'promisc' flag is ignored. -*/ -#define PCAP_OPENFLAG_PROMISCUOUS 1 - -/*! - \brief Defines if the data trasfer (in case of a remote - capture) has to be done with UDP protocol. - - If it is '1' if you want a UDP data connection, '0' if you want - a TCP data connection; control connection is always TCP-based. - A UDP connection is much lighter, but it does not guarantee that all - the captured packets arrive to the client workstation. Moreover, - it could be harmful in case of network congestion. - This flag is meaningless if the source is not a remote interface. - In that case, it is simply ignored. -*/ -#define PCAP_OPENFLAG_DATATX_UDP 2 - - -/*! - \brief Defines if the remote probe will capture its own generated traffic. - - In case the remote probe uses the same interface to capture traffic and to send - data back to the caller, the captured traffic includes the RPCAP traffic as well. - If this flag is turned on, the RPCAP traffic is excluded from the capture, so that - the trace returned back to the collector is does not include this traffic. -*/ -#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 - -/*! - \brief Defines if the local adapter will capture its own generated traffic. - - This flag tells the underlying capture driver to drop the packets that were sent by itself. - This is usefult when building applications like bridges, that should ignore the traffic - they just sent. -*/ -#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8 - -/*! - \brief This flag configures the adapter for maximum responsiveness. - - In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before - copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, - i.e. better performance, which is good for applications like sniffers. If the user sets the - PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application - is ready to receive them. This is suggested for real time applications (like, for example, a bridge) - that need the best responsiveness.*/ -#define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16 - -/*! - \} -*/ - - -/*! - \addtogroup remote_samp_methods - \{ -*/ - -/*! - \brief No sampling has to be done on the current capture. - - In this case, no sampling algorithms are applied to the current capture. -*/ -#define PCAP_SAMP_NOSAMP 0 - -/*! - \brief It defines that only 1 out of N packets must be returned to the user. - - In this case, the 'value' field of the 'pcap_samp' structure indicates the - number of packets (minus 1) that must be discarded before one packet got accepted. - In other words, if 'value = 10', the first packet is returned to the caller, while - the following 9 are discarded. -*/ -#define PCAP_SAMP_1_EVERY_N 1 - -/*! - \brief It defines that we have to return 1 packet every N milliseconds. - - In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting - time' in milliseconds before one packet got accepted. - In other words, if 'value = 10', the first packet is returned to the caller; the next - returned one will be the first packet that arrives when 10ms have elapsed. -*/ -#define PCAP_SAMP_FIRST_AFTER_N_MS 2 - -/*! - \} -*/ - - -/*! - \addtogroup remote_auth_methods - \{ -*/ - -/*! - \brief It defines the NULL authentication. - - This value has to be used within the 'type' member of the pcap_rmtauth structure. - The 'NULL' authentication has to be equal to 'zero', so that old applications - can just put every field of struct pcap_rmtauth to zero, and it does work. -*/ -#define RPCAP_RMTAUTH_NULL 0 -/*! - \brief It defines the username/password authentication. - - With this type of authentication, the RPCAP protocol will use the username/ - password provided to authenticate the user on the remote machine. If the - authentication is successful (and the user has the right to open network devices) - the RPCAP connection will continue; otherwise it will be dropped. - - This value has to be used within the 'type' member of the pcap_rmtauth structure. -*/ -#define RPCAP_RMTAUTH_PWD 1 - -/*! - \} -*/ - - - - -/*! - - \brief This structure keeps the information needed to autheticate - the user on a remote machine. - - The remote machine can either grant or refuse the access according - to the information provided. - In case the NULL authentication is required, both 'username' and - 'password' can be NULL pointers. - - This structure is meaningless if the source is not a remote interface; - in that case, the functions which requires such a structure can accept - a NULL pointer as well. -*/ -struct pcap_rmtauth -{ - /*! - \brief Type of the authentication required. - - In order to provide maximum flexibility, we can support different types - of authentication based on the value of this 'type' variable. The currently - supported authentication methods are defined into the - \link remote_auth_methods Remote Authentication Methods Section\endlink. - - */ - int type; - /*! - \brief Zero-terminated string containing the username that has to be - used on the remote machine for authentication. - - This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication - and it can be NULL. - */ - char *username; - /*! - \brief Zero-terminated string containing the password that has to be - used on the remote machine for authentication. - - This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication - and it can be NULL. - */ - char *password; -}; - - -/*! - \brief This structure defines the information related to sampling. - - In case the sampling is requested, the capturing device should read - only a subset of the packets coming from the source. The returned packets depend - on the sampling parameters. - - \warning The sampling process is applied after the filtering process. - In other words, packets are filtered first, then the sampling process selects a - subset of the 'filtered' packets and it returns them to the caller. -*/ -struct pcap_samp -{ - /*! - Method used for sampling. Currently, the supported methods are listed in the - \link remote_samp_methods Sampling Methods Section\endlink. - */ - int method; - - /*! - This value depends on the sampling method defined. For its meaning, please check - at the \link remote_samp_methods Sampling Methods Section\endlink. - */ - int value; -}; - - - - -//! Maximum lenght of an host name (needed for the RPCAP active mode) -#define RPCAP_HOSTLIST_SIZE 1024 - - -/*! - \} -*/ // end of public documentation - - -// Exported functions - - - -/** \name New WinPcap functions - - This section lists the new functions that are able to help considerably in writing - WinPcap programs because of their easiness of use. - */ -//\{ -pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf); -int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf); -int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf); -int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf); -struct pcap_samp *pcap_setsampling(pcap_t *p); - -//\} -// End of new winpcap functions - - - -/** \name Remote Capture functions - */ -//\{ -SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf); -int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf); -int pcap_remoteact_close(const char *host, char *errbuf); -void pcap_remoteact_cleanup(); -//\} -// End of remote capture functions - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/vs10/lib/Packet.lib b/vs10/lib/Packet.lib deleted file mode 100644 index c19383fd9028881f4a2c1e11d1fb34a0b2111e77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8450 zcmcIp&2JM|5TAVT(Lh5&zQ0XCKrb`|8-j$Qd{Qi&5ZR{XW;XVwEVaF^v!O*j^v0>; z#EE+)#EAo!-Z*ih5|!wsw@Um8IdCeS*|+&F@ zKGNt1Mq^t5M19kYhBpC-`a2noPNE)C-xEd?j{u1J5sPT_F{5$BBN}_hC~+2mXlOJb zY%_#3c#YB2O8}zDe;7@z;5X918%C4&k&iU^oKXVti6({_jXy&?q+uK@(ZnvJ{`c6g z_k}`wZR1upUszeqEoajk`CHjS%_{z2dr&B>-_B&Ba`=@gFme9I?e&|5mBs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HS<0eDKxxl0O9*!I1k8==cdG$USM)O9M4D?tMKYlV~o(nwB4jez$A1UP) RKN;rPttuG^a%47!{s$#mim(6x diff --git a/vs10/lib/libwpcap.a b/vs10/lib/libwpcap.a deleted file mode 100644 index f69509891bd78494ef9708d6cbe58a46cd0bce0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53028 zcmeHQYp5hg6|S9ZvT zwGF3x`qb&3I#pkvsyg+$>To*htlqlyz>Im!%`Y^Yt;OcSxtW0O(WMZEblG1S?b$&H(#+$G_P#_2((DOF`%V&q zbnQMy*FQ}N(v2@NI`9@DNOS*U)Y?x7(&8$kC5RK!P5)+e%dLbU-S#r0JN`%r(%qXG z-Fq(~NcTfH(u03u^vLCeAUy`pB0T}`M|$!&qfh*q5Ts9TXY}-)gdlyY%jlWc2tj)G zJw}~vgdk-PGdfZbf|S3(=;%KPK`J0^kcM|N8XY49sr(J2^;3i(y)e({v(FKN^f`zZ z(ih{sL2toQG#2@KL-)8ia{}6)o`s0k=_&gyDnQDz>`TV^XDaEK7-9U0 zqWkH!Y%NR5QCf`q3a1l;tpNJ8rGt1U53`==W`OyDoqggN8EQS1_5eT={)dOjCx&U~ zXl7?t(G_eeH_G~hGD|yU(#yxDtQ};@cY1@dnYQWy9#(lGON+Ik5qtd^9%?<6b~@Q` zQp`jke8K7i)`MN`p zag|gTET-|#^mU9Yr78kkJ06{6RCx)DCl6rn;Vkj_Yeq)AMg&p$B0E;vMpyDQiE=d? zWrdkhOiqSKX+sYb;(GM+VlYb9v(Y#on6|?Tp>OJ^&rOmxL#T9bFfgIV7$WTG+OV)b z77!3zO{$x%8_{P{l*^S)MldeM(C=wnWV!{?=t@ zO7?P%PbKqlGJZZC4z0-QY$~^EB3uKG6+)$tWTh(CG+Bc$B(rrJIv~cGQf6d+nka!R z5uT*^i2hzpi*C>Srk851|2713zX1!ijjI%Yl-r9K8A;;L79F2vR z`|Mw=xK)c1DyEkr$f*3E&@Uek)3Rg5M>1J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IG~mEFg!n_N7N#j;G+6_Zy7U`RIAHNSwshkug_52hU0* z`-+MomSMd;{WtBP(IZ?7#G$OM^62_GiL(OU9G|YAmstE*m|J68n6X{H6W|4jC7!D- zAI;~(ylBzPLpTf6@yhGF5q`lUsW)~OhC>;9&)1$A7o}TIa~tbLe#=V&DSFb)4OzyF SYO|}NyRXZHWZxVLl>Y&<75+{D diff --git a/vs10/lib/x64/Packet.lib b/vs10/lib/x64/Packet.lib deleted file mode 100644 index b3bd00e4336d1fd911024eb89fd5aa1bd970cb54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8290 zcmcIp&2JM|5FZl08VDqDzCR75f?jA6Y(Au_a=s`ACs?*=Z<|pt-YZ|Jyha= z5aNW?KcNyrh%>!$;#R3bRN~S@{{w^&CnP#=-@eaXZyh$VG}_&ndGmW8GjHZSAN$H^ zRyMxw`7){g<`>S)&85LX3w@o4~`NTY~FXzDtp zK^)g$tz6Eo<*yb><(1Xqav_^9T`iOyqw<64Lb<$tEtd<*;a93a#idKv)~}RT7E6ne z_uA#Gn@yv6`&+Zwvg`(0vFc7aR79EIm~NP^#O8V{P3xA~Y@@9TX`8E#*;uR^j%zlR zj>vqfSu`6}`lcvKY+bL_MzQ73!{X+qT`^oU#HuEu8rg>BhUiLcD!te=!)!`ys#h>8 zCQes~NmW7>mN)H|88%glfa(@a_tH-ntxbJaWj@u!Mf7d18+B8iF;48g8K5l&R{h{;YI}HAObp zTQ}X(ZO7F07@PO4U>enuRX6P|bsDgLvWV-i*;UmjDtbJwvA$LRu4%d20-%}@$i2)q zYIblu*iT=;?XFpklD%v@x0NvwcrM^}N!M3znGJPJI8Q?0+jVV+#Hq@5?dQ7%p6^Zoz}sHTTzvrfet@T=02?C!uLm)Ui~-azv%Exl zj2Yq;^6w=89w2`lpKm4s-r@5Dem|N3$RORH0eCo!JfvqssE6N6m?fVeUB>TMQvkCl zdyo7(*nR*hgP7NmUqehxzR&|l;4t*T3D^%4FalFB1jDco4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#nqXWELO3Suc zJbRY%2O(|uk;E}gCrBwacn3q`AtVczRU;CjRALVAG#LKbl7(nrE7Desev9TETXlk# z(to=QnmiG6AU3rG{Wrid+~s`>v55Xl@UcXcY|uyJ8;iDA_Ow-L$l#dMKz;J$nq^a2 z`!K}=AC98Qqd|+{rdL+16rB)v6J>-cvU#>>Sus-9q7jaPduI68Gh6*4^dSXl)I$=N zmpVd98Kd1Ek~!sd&9bSi{g+~Y#|#!fKehmi=)siT-?+t6N7D|*rn0suMeFt$lnym} zB%vkUSR3{_jL3g!*p@iu$k?Wlgtce`@bvv7eh%}PYj}sh;Ux{#V?T=fErcActncEhfAf~kN zP%EOk$k7R2f_Epp*2ArM_Kt{yw5cT+!zqX8-#)P*i&!U9*8d|M&qS4-R=QNiw&haR z|DznsT$$;lT`5?{IF`AM^9Nx)&9TfypH8q6=A76m9%oqc4pApKDLar845ww2*!C)t zOVPlS49Q(bb + @@ -156,6 +157,7 @@ + diff --git a/vs10/masscan.vcxproj.filters b/vs10/masscan.vcxproj.filters index fa37d0be..59268a90 100644 --- a/vs10/masscan.vcxproj.filters +++ b/vs10/masscan.vcxproj.filters @@ -282,6 +282,9 @@ Source Files\scripts + + Source Files\rawsock + @@ -482,6 +485,9 @@ Source Files\output + + Source Files\rawsock + From d4f8115f6d228135a866dd2bb069b44eeb77bf00 Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Tue, 30 May 2017 05:06:50 -0400 Subject: [PATCH 3/7] remove libpcap dependency for openbsd --- src/rawsock-pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rawsock-pcap.c b/src/rawsock-pcap.c index ae03c8a3..520d56a0 100644 --- a/src/rawsock-pcap.c +++ b/src/rawsock-pcap.c @@ -221,7 +221,7 @@ static unsigned null_CAN_TRANSMIT(const char *devicename) return result; #elif defined(__linux__) return 1; -#elif defined(__APPLE__) || defined(__FreeBSD__) +#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) return 1; #else #error unknown os From 8a720302353f8613fe6bd15a020d9425e01b076d Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Wed, 31 May 2017 00:20:05 -0400 Subject: [PATCH 4/7] warnings --- src/in-report.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/in-report.c b/src/in-report.c index 815a088a..db0c1317 100644 --- a/src/in-report.c +++ b/src/in-report.c @@ -70,6 +70,7 @@ cndb_add(unsigned ip, const unsigned char *name, size_t name_length) /*************************************************************************** ***************************************************************************/ +#if 0 static void cndb_add_cn(unsigned ip, const unsigned char *data, size_t length) { @@ -106,9 +107,11 @@ cndb_add_cn(unsigned ip, const unsigned char *data, size_t length) /* now insert into database */ cndb_add(ip, data+name_offset, name_length); } +#endif /*************************************************************************** ***************************************************************************/ +#if 0 static unsigned found(const char *str, size_t str_len, const unsigned char *p, size_t length) { @@ -123,6 +126,7 @@ found(const char *str, size_t str_len, const unsigned char *p, size_t length) } return 0; } +#endif enum { XUnknown, From 3f15e9b162768a36beaa4ad4bb1b1741cc49d8f8 Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Wed, 31 May 2017 00:27:40 -0400 Subject: [PATCH 5/7] libpcap error if library not found --- src/rawsock-pcap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rawsock-pcap.c b/src/rawsock-pcap.c index 520d56a0..ff5b95fd 100644 --- a/src/rawsock-pcap.c +++ b/src/rawsock-pcap.c @@ -387,8 +387,10 @@ if (pl->datalink == NULL) pl->func_err=1, pl->datalink = null_##PCAP_DATALINK; } } - if (hLibpcap == NULL) - fprintf(stderr, "pcap: failed to load libpcap\n"); + if (hLibpcap == NULL) { + fprintf(stderr, "pcap: failed to load libpcap shared library\n"); + fprintf(stderr, " HINT: you must install libpcap or WinPcap\n"); + } } #define DOLINK(PCAP_DATALINK, datalink) \ From a15af18969ad8f8bfa87ef07471dde58c63f2608 Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Mon, 5 Jun 2017 03:54:30 -0400 Subject: [PATCH 6/7] libpcap statics --- src/rawsock-pcap.c | 51 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/src/rawsock-pcap.c b/src/rawsock-pcap.c index ff5b95fd..cf66f3b8 100644 --- a/src/rawsock-pcap.c +++ b/src/rawsock-pcap.c @@ -3,20 +3,28 @@ * Programer(s): Robert David Graham [rdg] */ /* - PCAPLIVE + LIBPCAP INTERFACE - This code links the 'libpcap' module at RUNTIME rather than LOADTIME. - This allows us to: - (a) run this program on capture files without needing libpcap installed. - (b) give more user friendly diagnostic to the users who don't realize - that they need to install libpcap separately. + This VERY MESSY code is a hack to load the 'libpcap' library + at runtime rather than compile time. - On Windows, this uses the LoadLibrary/GetProcAddress functions to - load the library. + This reason for this mess is that it gets rid of a dependency + when compiling this project. Otherwise, developers would have + to download the 'libpcap-dev' dependency in order to build + this project. - On Linux, this uses the dlopen/dlsym functions to do essentially - the same thing. - */ + Almost every platform these days (OpenBSD, FreeBSD, macOS, + Debian, RedHat) comes with a "libpcap.so" library already + installed by default with a known BINARY interface. Thus, + we can include the data structures definitions directly + in this project, then load the library dynamically. + + For those systems without libpcap.so already installed, the + user can either install those on the system, or compile + this project in "STATIC" mode, which will link to the + static libpcap.a library. + +*/ #include "logger.h" #if _MSC_VER==1200 @@ -241,31 +249,50 @@ static void *my_null(int x, ...) } static pcap_t *null_PCAP_OPEN_OFFLINE(const char *fname, char *errbuf) { +#ifdef STATICPCAP + return pcap_open_offline(fname, errbuf); +#endif return my_null(2, fname, errbuf); } static int null_PCAP_SENDPACKET(pcap_t *p, const unsigned char *buf, int size) { +#ifdef STATICPCAP + return pcap_sendpacket(p, buf, size); +#endif my_null(3, p, buf, size); return 0; } static const unsigned char *null_PCAP_NEXT(pcap_t *p, struct pcap_pkthdr *h) { - my_null(3, p, h); +#ifdef STATICPCAP + return pcap_next(p, h); +#endif + my_null(3, p, h); return 0; } static int null_PCAP_SETDIRECTION(pcap_t *p, pcap_direction_t d) { +#ifdef STATICPCAP + return pcap_setdirection(p, d); +#endif my_null(2, p, d); return 0; } static const char *null_PCAP_DATALINK_VAL_TO_NAME(int dlt) { +#ifdef STATICPCAP + return pcap_datalink_val_toName(dlt); +#endif my_null(1, dlt); return 0; } static void null_PCAP_PERROR(pcap_t *p, char *prefix) { +#ifdef STATICPCAP + pcap_perror(p, prefix); + return; +#endif UNUSEDPARM(p); fprintf(stderr, "%s\n", prefix); perror("pcap"); From 78728764ad9744293bf0015861750e95c447cfaa Mon Sep 17 00:00:00 2001 From: Robert David Graham Date: Mon, 5 Jun 2017 23:58:07 -0400 Subject: [PATCH 7/7] bumped version --- src/masscan-version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/masscan-version.h b/src/masscan-version.h index e48c25c5..ee9bf800 100644 --- a/src/masscan-version.h +++ b/src/masscan-version.h @@ -1,6 +1,6 @@ #ifndef MASSCAN_VERSION -#define MASSCAN_VERSION "1.0.3" +#define MASSCAN_VERSION "1.0.4" #endif