pcap-int.h revision 214518
117683Spst/* 217683Spst * Copyright (c) 1994, 1995, 1996 317683Spst * The Regents of the University of California. All rights reserved. 417683Spst * 517683Spst * Redistribution and use in source and binary forms, with or without 617683Spst * modification, are permitted provided that the following conditions 717683Spst * are met: 817683Spst * 1. Redistributions of source code must retain the above copyright 917683Spst * notice, this list of conditions and the following disclaimer. 1017683Spst * 2. Redistributions in binary form must reproduce the above copyright 1117683Spst * notice, this list of conditions and the following disclaimer in the 1217683Spst * documentation and/or other materials provided with the distribution. 1317683Spst * 3. All advertising materials mentioning features or use of this software 1417683Spst * must display the following acknowledgement: 1517683Spst * This product includes software developed by the Computer Systems 1617683Spst * Engineering Group at Lawrence Berkeley Laboratory. 1717683Spst * 4. Neither the name of the University nor of the Laboratory may be used 1817683Spst * to endorse or promote products derived from this software without 1917683Spst * specific prior written permission. 2017683Spst * 2117683Spst * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2217683Spst * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2317683Spst * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2417683Spst * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2517683Spst * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2617683Spst * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2717683Spst * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2817683Spst * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2917683Spst * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3017683Spst * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3117683Spst * SUCH DAMAGE. 3217683Spst * 33214518Srpaulo * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL) 3417683Spst */ 3517683Spst 3617683Spst#ifndef pcap_int_h 37190225Srpaulo#define pcap_int_h 3817683Spst 39190225Srpaulo#include <pcap/pcap.h> 40190225Srpaulo 4138151Sphk#ifdef __cplusplus 4238151Sphkextern "C" { 4338151Sphk#endif 4438151Sphk 45190225Srpaulo#ifdef HAVE_LIBDLPI 46190225Srpaulo#include <libdlpi.h> 47190225Srpaulo#endif 4817683Spst 49127667Sbms#ifdef WIN32 50172680Smlaier#include <Packet32.h> 51214518Srpauloextern CRITICAL_SECTION g_PcapCompileCriticalSection; 52127667Sbms#endif /* WIN32 */ 53127667Sbms 54146771Ssam#ifdef MSDOS 55146771Ssam#include <fcntl.h> 56146771Ssam#include <io.h> 57146771Ssam#endif 58146771Ssam 59214518Srpaulo#ifdef HAVE_SNF_API 60214518Srpaulo#include <snf.h> 61214518Srpaulo#endif 62214518Srpaulo 63190225Srpaulo#if (defined(_MSC_VER) && (_MSC_VER <= 1200)) /* we are compiling with Visual Studio 6, that doesn't support the LL suffix*/ 64190225Srpaulo 6517683Spst/* 66172680Smlaier * Swap byte ordering of unsigned long long timestamp on a big endian 67172680Smlaier * machine. 68172680Smlaier */ 69190225Srpaulo#define SWAPLL(ull) ((ull & 0xff00000000000000) >> 56) | \ 70190225Srpaulo ((ull & 0x00ff000000000000) >> 40) | \ 71190225Srpaulo ((ull & 0x0000ff0000000000) >> 24) | \ 72190225Srpaulo ((ull & 0x000000ff00000000) >> 8) | \ 73190225Srpaulo ((ull & 0x00000000ff000000) << 8) | \ 74190225Srpaulo ((ull & 0x0000000000ff0000) << 24) | \ 75190225Srpaulo ((ull & 0x000000000000ff00) << 40) | \ 76190225Srpaulo ((ull & 0x00000000000000ff) << 56) 77190225Srpaulo 78190225Srpaulo#else /* A recent Visual studio compiler or not VC */ 79190225Srpaulo 80190225Srpaulo/* 81190225Srpaulo * Swap byte ordering of unsigned long long timestamp on a big endian 82190225Srpaulo * machine. 83190225Srpaulo */ 84172680Smlaier#define SWAPLL(ull) ((ull & 0xff00000000000000LL) >> 56) | \ 85172680Smlaier ((ull & 0x00ff000000000000LL) >> 40) | \ 86172680Smlaier ((ull & 0x0000ff0000000000LL) >> 24) | \ 87172680Smlaier ((ull & 0x000000ff00000000LL) >> 8) | \ 88172680Smlaier ((ull & 0x00000000ff000000LL) << 8) | \ 89172680Smlaier ((ull & 0x0000000000ff0000LL) << 24) | \ 90172680Smlaier ((ull & 0x000000000000ff00LL) << 40) | \ 91172680Smlaier ((ull & 0x00000000000000ffLL) << 56) 92172680Smlaier 93190225Srpaulo#endif /* _MSC_VER */ 94190225Srpaulo 95172680Smlaier/* 9617683Spst * Savefile 9717683Spst */ 98127667Sbmstypedef enum { 99127667Sbms NOT_SWAPPED, 100127667Sbms SWAPPED, 101127667Sbms MAYBE_SWAPPED 102127667Sbms} swapped_type_t; 103127667Sbms 104190225Srpaulo/* 105190225Srpaulo * Used when reading a savefile. 106190225Srpaulo */ 10717683Spststruct pcap_sf { 10817683Spst FILE *rfile; 109214518Srpaulo int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **); 11017683Spst int swapped; 111190225Srpaulo size_t hdrsize; 112127667Sbms swapped_type_t lengths_swapped; 11317683Spst int version_major; 11417683Spst int version_minor; 115214518Srpaulo bpf_u_int32 ifcount; /* number of interfaces seen in this capture */ 116214518Srpaulo u_int tsresol; /* time stamp resolution */ 117214518Srpaulo u_int tsscale; /* scaling factor for resolution -> microseconds */ 118214518Srpaulo u_int64_t tsoffset; /* time stamp offset */ 11917683Spst}; 12017683Spst 121190225Srpaulo/* 122190225Srpaulo * Used when doing a live capture. 123190225Srpaulo */ 12417683Spststruct pcap_md { 12517683Spst struct pcap_stat stat; 12617683Spst /*XXX*/ 12775110Sfenner int use_bpf; /* using kernel filter */ 12817683Spst u_long TotPkts; /* can't oflow for 79 hrs on ether */ 12917683Spst u_long TotAccepted; /* count accepted by filter */ 13017683Spst u_long TotDrops; /* count of dropped packets */ 13117683Spst long TotMissed; /* missed by i/f during this run */ 13217683Spst long OrigMissed; /* missed by i/f before this run */ 133146771Ssam char *device; /* device name */ 134190225Srpaulo int timeout; /* timeout for buffering */ 135214518Srpaulo int must_do_on_close; /* stuff we must do when we close */ 136190225Srpaulo struct pcap *next; /* list of open pcaps that need stuff cleared on close */ 13726175Sfenner#ifdef linux 13875110Sfenner int sock_packet; /* using Linux 2.0 compatible interface */ 13975110Sfenner int cooked; /* using SOCK_DGRAM rather than SOCK_RAW */ 140146771Ssam int ifindex; /* interface index of device we're bound to */ 14175110Sfenner int lo_ifindex; /* interface index of the loopback device */ 142172680Smlaier u_int packets_read; /* count of packets read with recvfrom() */ 143190225Srpaulo bpf_u_int32 oldmode; /* mode to restore when turning monitor mode off */ 144214518Srpaulo char *mondevice; /* mac80211 monitor device we created */ 145214518Srpaulo u_char *mmapbuf; /* memory-mapped region pointer */ 146214518Srpaulo size_t mmapbuflen; /* size of region */ 147190225Srpaulo u_int tp_version; /* version of tpacket_hdr for mmaped ring */ 148190225Srpaulo u_int tp_hdrlen; /* hdrlen of tpacket_hdr for mmaped ring */ 149214518Srpaulo u_char *oneshot_buffer; /* buffer for copy of packet */ 150214518Srpaulo long proc_dropped; /* packets reported dropped by /proc/net/dev */ 151190225Srpaulo#endif /* linux */ 152127667Sbms 153127667Sbms#ifdef HAVE_DAG_API 154162015Ssam#ifdef HAVE_DAG_STREAMS_API 155162015Ssam u_char *dag_mem_bottom; /* DAG card current memory bottom pointer */ 156162015Ssam u_char *dag_mem_top; /* DAG card current memory top pointer */ 157190225Srpaulo#else /* HAVE_DAG_STREAMS_API */ 158127667Sbms void *dag_mem_base; /* DAG card memory base address */ 159162015Ssam u_int dag_mem_bottom; /* DAG card current memory bottom offset */ 160162015Ssam u_int dag_mem_top; /* DAG card current memory top offset */ 161162015Ssam#endif /* HAVE_DAG_STREAMS_API */ 162127667Sbms int dag_fcs_bits; /* Number of checksum bits from link layer */ 163146771Ssam int dag_offset_flags; /* Flags to pass to dag_offset(). */ 164162015Ssam int dag_stream; /* DAG stream number */ 165162015Ssam int dag_timeout; /* timeout specified to pcap_open_live. 166162015Ssam * Same as in linux above, introduce 167162015Ssam * generally? */ 168162015Ssam#endif /* HAVE_DAG_API */ 169214518Srpaulo#ifdef HAVE_SNF_API 170214518Srpaulo snf_handle_t snf_handle; /* opaque device handle */ 171214518Srpaulo snf_ring_t snf_ring; /* opaque device ring handle */ 172214518Srpaulo int snf_timeout; 173214518Srpaulo int snf_boardnum; 174214518Srpaulo#endif /*HAVE_SNF_API*/ 175214518Srpaulo 176190225Srpaulo#ifdef HAVE_ZEROCOPY_BPF 177190225Srpaulo /* 178190225Srpaulo * Zero-copy read buffer -- for zero-copy BPF. 'buffer' above will 179190225Srpaulo * alternative between these two actual mmap'd buffers as required. 180190225Srpaulo * As there is a header on the front size of the mmap'd buffer, only 181190225Srpaulo * some of the buffer is exposed to libpcap as a whole via bufsize; 182190225Srpaulo * zbufsize is the true size. zbuffer tracks the current zbuf 183190225Srpaulo * assocated with buffer so that it can be used to decide which the 184190225Srpaulo * next buffer to read will be. 185190225Srpaulo */ 186190225Srpaulo u_char *zbuf1, *zbuf2, *zbuffer; 187190225Srpaulo u_int zbufsize; 188190225Srpaulo u_int zerocopy; 189190225Srpaulo u_int interrupted; 190190225Srpaulo struct timespec firstsel; 191190225Srpaulo /* 192190225Srpaulo * If there's currently a buffer being actively processed, then it is 193190225Srpaulo * referenced here; 'buffer' is also pointed at it, but offset by the 194190225Srpaulo * size of the header. 195190225Srpaulo */ 196190225Srpaulo struct bpf_zbuf_header *bzh; 197190225Srpaulo#endif /* HAVE_ZEROCOPY_BPF */ 19817683Spst}; 19917683Spst 200147897Ssam/* 201214518Srpaulo * Stuff to do when we close. 202190225Srpaulo */ 203214518Srpaulo#define MUST_CLEAR_PROMISC 0x00000001 /* clear promiscuous mode */ 204214518Srpaulo#define MUST_CLEAR_RFMON 0x00000002 /* clear rfmon (monitor) mode */ 205214518Srpaulo#define MUST_DELETE_MONIF 0x00000004 /* delete monitor-mode interface */ 206190225Srpaulo 207190225Srpaulostruct pcap_opt { 208190225Srpaulo int buffer_size; 209190225Srpaulo char *source; 210190225Srpaulo int promisc; 211190225Srpaulo int rfmon; 212190225Srpaulo}; 213190225Srpaulo 214190225Srpaulo/* 215147897Ssam * Ultrix, DEC OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H 216172680Smlaier * Tru64 UNIX, and some versions of NetBSD pad FDDI packets to make everything 217172680Smlaier * line up on a nice boundary. 218147897Ssam */ 219172680Smlaier#ifdef __NetBSD__ 220172680Smlaier#include <sys/param.h> /* needed to declare __NetBSD_Version__ */ 221172680Smlaier#endif 222172680Smlaier 223147897Ssam#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000) 224147897Ssam#define PCAP_FDDIPAD 3 225147897Ssam#endif 226147897Ssam 227190225Srpaulotypedef int (*activate_op_t)(pcap_t *); 228190225Srpaulotypedef int (*can_set_rfmon_op_t)(pcap_t *); 229190225Srpaulotypedef int (*read_op_t)(pcap_t *, int cnt, pcap_handler, u_char *); 230190225Srpaulotypedef int (*inject_op_t)(pcap_t *, const void *, size_t); 231190225Srpaulotypedef int (*setfilter_op_t)(pcap_t *, struct bpf_program *); 232190225Srpaulotypedef int (*setdirection_op_t)(pcap_t *, pcap_direction_t); 233190225Srpaulotypedef int (*set_datalink_op_t)(pcap_t *, int); 234190225Srpaulotypedef int (*getnonblock_op_t)(pcap_t *, char *); 235190225Srpaulotypedef int (*setnonblock_op_t)(pcap_t *, int, char *); 236190225Srpaulotypedef int (*stats_op_t)(pcap_t *, struct pcap_stat *); 237190225Srpaulo#ifdef WIN32 238190225Srpaulotypedef int (*setbuff_op_t)(pcap_t *, int); 239190225Srpaulotypedef int (*setmode_op_t)(pcap_t *, int); 240190225Srpaulotypedef int (*setmintocopy_op_t)(pcap_t *, int); 241190225Srpaulo#endif 242190225Srpaulotypedef void (*cleanup_op_t)(pcap_t *); 243190225Srpaulo 24417683Spststruct pcap { 245127667Sbms#ifdef WIN32 246127667Sbms ADAPTER *adapter; 247127667Sbms LPPACKET Packet; 248127667Sbms int nonblock; 249127667Sbms#else 25017683Spst int fd; 251127667Sbms int selectable_fd; 252146771Ssam int send_fd; 253127667Sbms#endif /* WIN32 */ 254190225Srpaulo 255190225Srpaulo#ifdef HAVE_LIBDLPI 256190225Srpaulo dlpi_handle_t dlpi_hd; 257190225Srpaulo#endif 25817683Spst int snapshot; 259190225Srpaulo int linktype; /* Network linktype */ 260190225Srpaulo int linktype_ext; /* Extended information stored in the linktype field of a file */ 26117683Spst int tzoff; /* timezone offset */ 26217683Spst int offset; /* offset for proper alignment */ 263190225Srpaulo int activated; /* true if the capture is really started */ 264190225Srpaulo int oldstyle; /* if we're opening with pcap_open_live() */ 26517683Spst 266127667Sbms int break_loop; /* flag set to force break from packet-reading loop */ 267127667Sbms 268146771Ssam#ifdef PCAP_FDDIPAD 269146771Ssam int fddipad; 270146771Ssam#endif 271146771Ssam 272146771Ssam#ifdef MSDOS 273146771Ssam void (*wait_proc)(void); /* call proc while waiting */ 274146771Ssam#endif 275146771Ssam 27617683Spst struct pcap_sf sf; 27717683Spst struct pcap_md md; 278190225Srpaulo struct pcap_opt opt; 27917683Spst 28017683Spst /* 281214518Srpaulo * Read buffer. 28217683Spst */ 28317683Spst int bufsize; 28417683Spst u_char *buffer; 28517683Spst u_char *bp; 28617683Spst int cc; 28717683Spst 28817683Spst /* 28917683Spst * Place holder for pcap_next(). 29017683Spst */ 29117683Spst u_char *pkt; 29217683Spst 293147897Ssam /* We're accepting only packets in this direction/these directions. */ 294162015Ssam pcap_direction_t direction; 295147897Ssam 29617683Spst /* 297127667Sbms * Methods. 298127667Sbms */ 299190225Srpaulo activate_op_t activate_op; 300190225Srpaulo can_set_rfmon_op_t can_set_rfmon_op; 301190225Srpaulo read_op_t read_op; 302190225Srpaulo inject_op_t inject_op; 303190225Srpaulo setfilter_op_t setfilter_op; 304190225Srpaulo setdirection_op_t setdirection_op; 305190225Srpaulo set_datalink_op_t set_datalink_op; 306190225Srpaulo getnonblock_op_t getnonblock_op; 307190225Srpaulo setnonblock_op_t setnonblock_op; 308190225Srpaulo stats_op_t stats_op; 309127667Sbms 310214518Srpaulo /* 311214518Srpaulo * Routine to use as callback for pcap_next()/pcap_next_ex(). 312214518Srpaulo */ 313214518Srpaulo pcap_handler oneshot_callback; 314214518Srpaulo 315190225Srpaulo#ifdef WIN32 316127667Sbms /* 317190225Srpaulo * These are, at least currently, specific to the Win32 NPF 318190225Srpaulo * driver. 319190225Srpaulo */ 320190225Srpaulo setbuff_op_t setbuff_op; 321190225Srpaulo setmode_op_t setmode_op; 322190225Srpaulo setmintocopy_op_t setmintocopy_op; 323190225Srpaulo#endif 324190225Srpaulo cleanup_op_t cleanup_op; 325190225Srpaulo 326190225Srpaulo /* 32717683Spst * Placeholder for filter code if bpf not in kernel. 32817683Spst */ 32917683Spst struct bpf_program fcode; 33017683Spst 331127667Sbms char errbuf[PCAP_ERRBUF_SIZE + 1]; 332109841Sfenner int dlt_count; 333146771Ssam u_int *dlt_list; 334127667Sbms 335127667Sbms struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ 33617683Spst}; 33717683Spst 33856891Sfenner/* 339172680Smlaier * This is a timeval as stored in a savefile. 34056891Sfenner * It has to use the same types everywhere, independent of the actual 341172680Smlaier * `struct timeval'; `struct timeval' has 32-bit tv_sec values on some 342172680Smlaier * platforms and 64-bit tv_sec values on other platforms, and writing 343172680Smlaier * out native `struct timeval' values would mean files could only be 344172680Smlaier * read on systems with the same tv_sec size as the system on which 345172680Smlaier * the file was written. 34656891Sfenner */ 34756891Sfenner 34856891Sfennerstruct pcap_timeval { 34956891Sfenner bpf_int32 tv_sec; /* seconds */ 35056891Sfenner bpf_int32 tv_usec; /* microseconds */ 35156891Sfenner}; 35256891Sfenner 35356891Sfenner/* 354172680Smlaier * This is a `pcap_pkthdr' as actually stored in a savefile. 35575110Sfenner * 35675110Sfenner * Do not change the format of this structure, in any way (this includes 35775110Sfenner * changes that only affect the length of fields in this structure), 35875110Sfenner * and do not make the time stamp anything other than seconds and 35975110Sfenner * microseconds (e.g., seconds and nanoseconds). Instead: 36075110Sfenner * 36175110Sfenner * introduce a new structure for the new format; 36275110Sfenner * 363190225Srpaulo * send mail to "tcpdump-workers@lists.tcpdump.org", requesting 364190225Srpaulo * a new magic number for your new capture file format, and, when 36575110Sfenner * you get the new magic number, put it in "savefile.c"; 36675110Sfenner * 36775110Sfenner * use that magic number for save files with the changed record 36875110Sfenner * header; 36975110Sfenner * 37075110Sfenner * make the code in "savefile.c" capable of reading files with 37175110Sfenner * the old record header as well as files with the new record header 37275110Sfenner * (using the magic number to determine the header format). 37375110Sfenner * 374190225Srpaulo * Then supply the changes as a patch at 375190225Srpaulo * 376190225Srpaulo * http://sourceforge.net/projects/libpcap/ 377190225Srpaulo * 378190225Srpaulo * so that future versions of libpcap and programs that use it (such as 379190225Srpaulo * tcpdump) will be able to read your new capture file format. 38056891Sfenner */ 38156891Sfenner 38256891Sfennerstruct pcap_sf_pkthdr { 38356891Sfenner struct pcap_timeval ts; /* time stamp */ 38456891Sfenner bpf_u_int32 caplen; /* length of portion present */ 38556891Sfenner bpf_u_int32 len; /* length this packet (off wire) */ 38656891Sfenner}; 38756891Sfenner 38875110Sfenner/* 389172680Smlaier * How a `pcap_pkthdr' is actually stored in savefiles written 39075110Sfenner * by some patched versions of libpcap (e.g. the ones in Red 39175110Sfenner * Hat Linux 6.1 and 6.2). 39275110Sfenner * 39375110Sfenner * Do not change the format of this structure, in any way (this includes 39475110Sfenner * changes that only affect the length of fields in this structure). 39575110Sfenner * Instead, introduce a new structure, as per the above. 39675110Sfenner */ 39775110Sfenner 39875110Sfennerstruct pcap_sf_patched_pkthdr { 39975110Sfenner struct pcap_timeval ts; /* time stamp */ 40075110Sfenner bpf_u_int32 caplen; /* length of portion present */ 40175110Sfenner bpf_u_int32 len; /* length this packet (off wire) */ 40275110Sfenner int index; 40375110Sfenner unsigned short protocol; 40475110Sfenner unsigned char pkt_type; 40575110Sfenner}; 40675110Sfenner 407214518Srpaulo/* 408214518Srpaulo * User data structure for the one-shot callback used for pcap_next() 409214518Srpaulo * and pcap_next_ex(). 410214518Srpaulo */ 411214518Srpaulostruct oneshot_userdata { 412214518Srpaulo struct pcap_pkthdr *hdr; 413214518Srpaulo const u_char **pkt; 414214518Srpaulo pcap_t *pd; 415214518Srpaulo}; 416214518Srpaulo 41717683Spstint yylex(void); 41817683Spst 41917683Spst#ifndef min 42017683Spst#define min(a, b) ((a) > (b) ? (b) : (a)) 42117683Spst#endif 42217683Spst 42317683Spst/* XXX should these be in pcap.h? */ 42417683Spstint pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); 42517683Spstint pcap_read(pcap_t *, int cnt, pcap_handler, u_char *); 42617683Spst 427147897Ssam#ifndef HAVE_STRLCPY 428147897Ssam#define strlcpy(x, y, z) \ 429147897Ssam (strncpy((x), (y), (z)), \ 430147897Ssam ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ 431147897Ssam strlen((y))) 43217683Spst#endif 43317683Spst 434127667Sbms#include <stdarg.h> 435127667Sbms 436214518Srpaulo#if !defined(HAVE_SNPRINTF) 437214518Srpaulo#define snprintf pcap_snprintf 438214518Srpauloextern int snprintf (char *, size_t, const char *, ...); 439214518Srpaulo#endif 440214518Srpaulo 441214518Srpaulo#if !defined(HAVE_VSNPRINTF) 442214518Srpaulo#define vsnprintf pcap_vsnprintf 443214518Srpauloextern int vsnprintf (char *, size_t, const char *, va_list ap); 444214518Srpaulo#endif 445214518Srpaulo 446127667Sbms/* 447127667Sbms * Routines that most pcap implementations can use for non-blocking mode. 448127667Sbms */ 449146771Ssam#if !defined(WIN32) && !defined(MSDOS) 450127667Sbmsint pcap_getnonblock_fd(pcap_t *, char *); 451127667Sbmsint pcap_setnonblock_fd(pcap_t *p, int, char *); 452127667Sbms#endif 453127667Sbms 454190225Srpaulopcap_t *pcap_create_common(const char *, char *); 455190225Srpauloint pcap_do_addexit(pcap_t *); 456190225Srpaulovoid pcap_add_to_pcaps_to_close(pcap_t *); 457190225Srpaulovoid pcap_remove_from_pcaps_to_close(pcap_t *); 458190225Srpaulovoid pcap_cleanup_live_common(pcap_t *); 459190225Srpauloint pcap_not_initialized(pcap_t *); 460190225Srpauloint pcap_check_activated(pcap_t *); 461146771Ssam 462127667Sbms/* 463127667Sbms * Internal interfaces for "pcap_findalldevs()". 464127667Sbms * 465127667Sbms * "pcap_platform_finddevs()" is a platform-dependent routine to 466127667Sbms * add devices not found by the "standard" mechanisms (SIOCGIFCONF, 467127667Sbms * "getifaddrs()", etc.. 468127667Sbms * 469127667Sbms * "pcap_add_if()" adds an interface to the list of interfaces. 470127667Sbms */ 471127667Sbmsint pcap_platform_finddevs(pcap_if_t **, char *); 472146771Ssamint add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *, 473127667Sbms size_t, struct sockaddr *, size_t, struct sockaddr *, size_t, 474127667Sbms struct sockaddr *, size_t, char *); 475146771Ssamint pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *); 476127667Sbmsstruct sockaddr *dup_sockaddr(struct sockaddr *, size_t); 477127667Sbmsint add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int, 478127667Sbms const char *, char *); 479127667Sbms 480127667Sbms#ifdef WIN32 481127667Sbmschar *pcap_win32strerror(void); 482127667Sbms#endif 483127667Sbms 48475110Sfennerint install_bpf_program(pcap_t *, struct bpf_program *); 48575110Sfenner 486127667Sbmsint pcap_strcasecmp(const char *, const char *); 487127667Sbms 48838151Sphk#ifdef __cplusplus 48938151Sphk} 49017683Spst#endif 49138151Sphk 49238151Sphk#endif 493