diff options
Diffstat (limited to 'pcap-int.h')
-rw-r--r-- | pcap-int.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/pcap-int.h b/pcap-int.h index 080470e937a34..c3afbade52b38 100644 --- a/pcap-int.h +++ b/pcap-int.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.85.2.9 2008-09-16 00:21:08 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL) */ #ifndef pcap_int_h @@ -48,6 +48,7 @@ extern "C" { #ifdef WIN32 #include <Packet32.h> +extern CRITICAL_SECTION g_PcapCompileCriticalSection; #endif /* WIN32 */ #ifdef MSDOS @@ -55,6 +56,10 @@ extern "C" { #include <io.h> #endif +#ifdef HAVE_SNF_API +#include <snf.h> +#endif + #if (defined(_MSC_VER) && (_MSC_VER <= 1200)) /* we are compiling with Visual Studio 6, that doesn't support the LL suffix*/ /* @@ -101,12 +106,16 @@ typedef enum { */ struct pcap_sf { FILE *rfile; + int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **); int swapped; size_t hdrsize; swapped_type_t lengths_swapped; int version_major; int version_minor; - u_char *base; + bpf_u_int32 ifcount; /* number of interfaces seen in this capture */ + u_int tsresol; /* time stamp resolution */ + u_int tsscale; /* scaling factor for resolution -> microseconds */ + u_int64_t tsoffset; /* time stamp offset */ }; /* @@ -123,7 +132,7 @@ struct pcap_md { long OrigMissed; /* missed by i/f before this run */ char *device; /* device name */ int timeout; /* timeout for buffering */ - int must_clear; /* stuff we must clear when we close */ + int must_do_on_close; /* stuff we must do when we close */ struct pcap *next; /* list of open pcaps that need stuff cleared on close */ #ifdef linux int sock_packet; /* using Linux 2.0 compatible interface */ @@ -132,8 +141,13 @@ struct pcap_md { int lo_ifindex; /* interface index of the loopback device */ u_int packets_read; /* count of packets read with recvfrom() */ bpf_u_int32 oldmode; /* mode to restore when turning monitor mode off */ + char *mondevice; /* mac80211 monitor device we created */ + u_char *mmapbuf; /* memory-mapped region pointer */ + size_t mmapbuflen; /* size of region */ u_int tp_version; /* version of tpacket_hdr for mmaped ring */ u_int tp_hdrlen; /* hdrlen of tpacket_hdr for mmaped ring */ + u_char *oneshot_buffer; /* buffer for copy of packet */ + long proc_dropped; /* packets reported dropped by /proc/net/dev */ #endif /* linux */ #ifdef HAVE_DAG_API @@ -152,6 +166,13 @@ struct pcap_md { * Same as in linux above, introduce * generally? */ #endif /* HAVE_DAG_API */ +#ifdef HAVE_SNF_API + snf_handle_t snf_handle; /* opaque device handle */ + snf_ring_t snf_ring; /* opaque device ring handle */ + int snf_timeout; + int snf_boardnum; +#endif /*HAVE_SNF_API*/ + #ifdef HAVE_ZEROCOPY_BPF /* * Zero-copy read buffer -- for zero-copy BPF. 'buffer' above will @@ -177,10 +198,11 @@ struct pcap_md { }; /* - * Stuff to clear when we close. + * Stuff to do when we close. */ -#define MUST_CLEAR_PROMISC 0x00000001 /* promiscuous mode */ -#define MUST_CLEAR_RFMON 0x00000002 /* rfmon (monitor) mode */ +#define MUST_CLEAR_PROMISC 0x00000001 /* clear promiscuous mode */ +#define MUST_CLEAR_RFMON 0x00000002 /* clear rfmon (monitor) mode */ +#define MUST_DELETE_MONIF 0x00000004 /* delete monitor-mode interface */ struct pcap_opt { int buffer_size; @@ -285,6 +307,11 @@ struct pcap { setnonblock_op_t setnonblock_op; stats_op_t stats_op; + /* + * Routine to use as callback for pcap_next()/pcap_next_ex(). + */ + pcap_handler oneshot_callback; + #ifdef WIN32 /* * These are, at least currently, specific to the Win32 NPF @@ -377,6 +404,16 @@ struct pcap_sf_patched_pkthdr { unsigned char pkt_type; }; +/* + * User data structure for the one-shot callback used for pcap_next() + * and pcap_next_ex(). + */ +struct oneshot_userdata { + struct pcap_pkthdr *hdr; + const u_char **pkt; + pcap_t *pd; +}; + int yylex(void); #ifndef min |