154 lines
5.2 KiB
C
Raw Normal View History

Update libpcap to 1.1.1. Changes: Thu. April 1, 2010. guy@alum.mit.edu. Summary for 1.1.1 libpcap release Update CHANGES to reflect more of the changes in 1.1.0. Fix build on RHEL5. Fix shared library build on AIX. Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. Summary for 1.1.0 libpcap release Add SocketCAN capture support Add Myricom SNF API support Update Endace DAG and ERF support Add support for shared libraries on Solaris, HP-UX, and AIX Build, install, and un-install shared libraries by default; don't build/install shared libraries on platforms we don't support Fix building from a directory other than the source directory Fix compiler warnings and builds on some platforms Update config.guess and config.sub Support monitor mode on mac80211 devices on Linux Fix USB memory-mapped capturing on Linux; it requires a new DLT_ value On Linux, scan /sys/class/net for devices if we have it; scan it, or /proc/net/dev if we don't have /sys/class/net, even if we have getifaddrs(), as it'll find interfaces with no addresses Add limited support for reading pcap-ng files Fix BPF driver-loading error handling on AIX Support getting the full-length interface description on FreeBSD In the lexical analyzer, free up any addrinfo structure we got back from getaddrinfo(). Add support for BPF and libdlpi in OpenSolaris (and SXCE) Hyphenate "link-layer" everywhere Add /sys/kernel/debug/usb/usbmon to the list of usbmon locations In pcap_read_linux_mmap(), if there are no frames available, call poll() even if we're in non-blocking mode, so we pick up errors, and check for the errors in question. Note that poll() works on BPF devices is Snow Leopard If an ENXIO or ENETDOWN is received, it may mean the device has gone away. Deal with it. For BPF, raise the default capture buffer size to from 32k to 512k Support ps_ifdrop on Linux Added a bunch of #ifdef directives to make wpcap.dll (WinPcap) compile under cygwin. Changes to Linux mmapped captures. Fix bug where create_ring would fail for particular snaplen and buffer size combinations Update pcap-config so that it handles libpcap requiring additional libraries Add workaround for threadsafeness on Windows Add missing mapping for DLT_ENC <-> LINKTYPE_ENC DLT: Add DLT_CAN_SOCKETCAN DLT: Add Solaris ipnet Don't check for DLT_IPNET if it's not defined Add link-layer types for Fibre Channel FC-2 Add link-layer types for Wireless HART Add link-layer types for AOS Add link-layer types for DECT Autoconf fixes (AIX, HP-UX, OSF/1, Tru64 cleanups) Install headers unconditionally, and include vlan.h/bluetooth.h if enabled Autoconf fixes+cleanup Support enabling/disabling bluetooth (--{en,dis}able-bluetooth) Support disabling SITA support (--without-sita) Return -1 on failure to create packet ring (if supported but creation failed) Fix handling of 'any' device, so that it can be opened, and no longer attempt to open it in Monitor mode Add support for snapshot length for USB Memory-Mapped Interface Fix configure and build on recent Linux kernels Fix memory-mapped Linux capture to support pcap_next() and pcap_next_ex() Fixes for Linux USB capture DLT: Add DLT_LINUX_EVDEV DLT: Add DLT_GSMTAP_UM DLT: Add DLT_GSMTAP_ABIS
2010-10-28 16:22:13 +00:00
#ifndef __PKTDRVR_H
#define __PKTDRVR_H
#define PUBLIC
#define LOCAL static
#define RX_BUF_SIZE ETH_MTU /* buffer size variables. NB !! */
#define TX_BUF_SIZE ETH_MTU /* must be same as in pkt_rx*.* */
#ifdef __HIGHC__
#pragma Off(Align_members)
#else
#pragma pack(1)
#endif
typedef enum { /* Packet-driver classes */
PD_ETHER = 1,
PD_PRONET10 = 2,
PD_IEEE8025 = 3,
PD_OMNINET = 4,
PD_APPLETALK = 5,
PD_SLIP = 6,
PD_STARTLAN = 7,
PD_ARCNET = 8,
PD_AX25 = 9,
PD_KISS = 10,
PD_IEEE8023_2 = 11,
PD_FDDI8022 = 12,
PD_X25 = 13,
PD_LANstar = 14,
PD_PPP = 18
} PKT_CLASS;
typedef enum { /* Packet-driver receive modes */
PDRX_OFF = 1, /* turn off receiver */
PDRX_DIRECT, /* receive only to this interface */
PDRX_BROADCAST, /* DIRECT + broadcast packets */
PDRX_MULTICAST1, /* BROADCAST + limited multicast */
PDRX_MULTICAST2, /* BROADCAST + all multicast */
PDRX_ALL_PACKETS, /* receive all packets on network */
} PKT_RX_MODE;
typedef struct {
char type[8];
char len;
} PKT_FRAME;
typedef struct {
BYTE class; /* = 1 for DEC/Interl/Xerox Ethernet */
BYTE number; /* = 0 for single LAN adapter */
WORD type; /* = 13 for 3C523 */
BYTE funcs; /* Basic/Extended/HiPerf functions */
WORD intr; /* user interrupt vector number */
WORD handle; /* Handle associated with session */
BYTE name [15]; /* Name of adapter interface,ie.3C523*/
BOOL quiet; /* (don't) print errors to stdout */
const char *error; /* address of error string */
BYTE majVer; /* Major driver implementation ver. */
BYTE minVer; /* Minor driver implementation ver. */
BYTE dummyLen; /* length of following data */
WORD MAClength; /* HiPerformance data, N/A */
WORD MTU; /* HiPerformance data, N/A */
WORD multicast; /* HiPerformance data, N/A */
WORD rcvrBuffers; /* valid for */
WORD UMTbufs; /* High Performance drivers only */
WORD postEOIintr; /* Usage ?? */
} PKT_INFO;
#define PKT_PARAM_SIZE 14 /* members majVer - postEOIintr */
typedef struct {
DWORD inPackets; /* # of packets received */
DWORD outPackets; /* # of packets transmitted */
DWORD inBytes; /* # of bytes received */
DWORD outBytes; /* # of bytes transmitted */
DWORD inErrors; /* # of reception errors */
DWORD outErrors; /* # of transmission errors */
DWORD lost; /* # of packets lost (RX) */
} PKT_STAT;
2017-02-12 07:04:44 +00:00
Update libpcap to 1.1.1. Changes: Thu. April 1, 2010. guy@alum.mit.edu. Summary for 1.1.1 libpcap release Update CHANGES to reflect more of the changes in 1.1.0. Fix build on RHEL5. Fix shared library build on AIX. Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. Summary for 1.1.0 libpcap release Add SocketCAN capture support Add Myricom SNF API support Update Endace DAG and ERF support Add support for shared libraries on Solaris, HP-UX, and AIX Build, install, and un-install shared libraries by default; don't build/install shared libraries on platforms we don't support Fix building from a directory other than the source directory Fix compiler warnings and builds on some platforms Update config.guess and config.sub Support monitor mode on mac80211 devices on Linux Fix USB memory-mapped capturing on Linux; it requires a new DLT_ value On Linux, scan /sys/class/net for devices if we have it; scan it, or /proc/net/dev if we don't have /sys/class/net, even if we have getifaddrs(), as it'll find interfaces with no addresses Add limited support for reading pcap-ng files Fix BPF driver-loading error handling on AIX Support getting the full-length interface description on FreeBSD In the lexical analyzer, free up any addrinfo structure we got back from getaddrinfo(). Add support for BPF and libdlpi in OpenSolaris (and SXCE) Hyphenate "link-layer" everywhere Add /sys/kernel/debug/usb/usbmon to the list of usbmon locations In pcap_read_linux_mmap(), if there are no frames available, call poll() even if we're in non-blocking mode, so we pick up errors, and check for the errors in question. Note that poll() works on BPF devices is Snow Leopard If an ENXIO or ENETDOWN is received, it may mean the device has gone away. Deal with it. For BPF, raise the default capture buffer size to from 32k to 512k Support ps_ifdrop on Linux Added a bunch of #ifdef directives to make wpcap.dll (WinPcap) compile under cygwin. Changes to Linux mmapped captures. Fix bug where create_ring would fail for particular snaplen and buffer size combinations Update pcap-config so that it handles libpcap requiring additional libraries Add workaround for threadsafeness on Windows Add missing mapping for DLT_ENC <-> LINKTYPE_ENC DLT: Add DLT_CAN_SOCKETCAN DLT: Add Solaris ipnet Don't check for DLT_IPNET if it's not defined Add link-layer types for Fibre Channel FC-2 Add link-layer types for Wireless HART Add link-layer types for AOS Add link-layer types for DECT Autoconf fixes (AIX, HP-UX, OSF/1, Tru64 cleanups) Install headers unconditionally, and include vlan.h/bluetooth.h if enabled Autoconf fixes+cleanup Support enabling/disabling bluetooth (--{en,dis}able-bluetooth) Support disabling SITA support (--without-sita) Return -1 on failure to create packet ring (if supported but creation failed) Fix handling of 'any' device, so that it can be opened, and no longer attempt to open it in Monitor mode Add support for snapshot length for USB Memory-Mapped Interface Fix configure and build on recent Linux kernels Fix memory-mapped Linux capture to support pcap_next() and pcap_next_ex() Fixes for Linux USB capture DLT: Add DLT_LINUX_EVDEV DLT: Add DLT_GSMTAP_UM DLT: Add DLT_GSMTAP_ABIS
2010-10-28 16:22:13 +00:00
typedef struct {
ETHER destin;
ETHER source;
WORD proto;
BYTE data [TX_BUF_SIZE];
} TX_ELEMENT;
typedef struct {
WORD firstCount; /* # of bytes on 1st */
WORD secondCount; /* and 2nd upcall */
WORD handle; /* instance that upcalled */
ETHER destin; /* E-net destination address */
ETHER source; /* E-net source address */
WORD proto; /* protocol number */
BYTE data [RX_BUF_SIZE];
} RX_ELEMENT;
#ifdef __HIGHC__
#pragma pop(Align_members)
#else
#pragma pack()
#endif
/*
* Prototypes for publics
*/
#ifdef __cplusplus
extern "C" {
#endif
extern PKT_STAT pktStat; /* statistics for packets */
extern PKT_INFO pktInfo; /* packet-driver information */
extern PKT_RX_MODE receiveMode;
extern ETHER myAddress, ethBroadcast;
extern BOOL PktInitDriver (PKT_RX_MODE mode);
extern BOOL PktExitDriver (void);
extern const char *PktGetErrorStr (int errNum);
extern const char *PktGetClassName (WORD class);
extern const char *PktRXmodeStr (PKT_RX_MODE mode);
extern BOOL PktSearchDriver (void);
extern int PktReceive (BYTE *buf, int max);
extern BOOL PktTransmit (const void *eth, int len);
extern DWORD PktRxDropped (void);
extern BOOL PktReleaseHandle (WORD handle);
extern BOOL PktTerminHandle (WORD handle);
extern BOOL PktResetInterface (WORD handle);
extern BOOL PktSetReceiverMode(PKT_RX_MODE mode);
extern BOOL PktGetReceiverMode(PKT_RX_MODE *mode);
extern BOOL PktGetStatistics (WORD handle);
extern BOOL PktSessStatistics (WORD handle);
extern BOOL PktResetStatistics(WORD handle);
extern BOOL PktGetAddress (ETHER *addr);
extern BOOL PktSetAddress (const ETHER *addr);
extern BOOL PktGetDriverInfo (void);
extern BOOL PktGetDriverParam (void);
extern void PktQueueBusy (BOOL busy);
extern WORD PktBuffersUsed (void);
#ifdef __cplusplus
}
#endif
#endif /* __PKTDRVR_H */