mirror of
https://github.com/nmap/nmap.git
synced 2026-01-07 06:59:03 +00:00
Update included libpcap to 1.10.1
This commit is contained in:
@@ -69,6 +69,49 @@
|
||||
#ifndef lib_pcap_pcap_h
|
||||
#define lib_pcap_pcap_h
|
||||
|
||||
/*
|
||||
* Some software that uses libpcap/WinPcap/Npcap defines _MSC_VER before
|
||||
* includeing pcap.h if it's not defined - and it defines it to 1500.
|
||||
* (I'm looking at *you*, lwIP!)
|
||||
*
|
||||
* Attempt to detect this, and undefine _MSC_VER so that we can *reliably*
|
||||
* use it to know what compiler is being used and, if it's Visual Studio,
|
||||
* what version is being used.
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
/*
|
||||
* We assume here that software such as that doesn't define _MSC_FULL_VER
|
||||
* as well and that it defines _MSC_VER with a value > 1200.
|
||||
*
|
||||
* DO NOT BREAK THESE ASSUMPTIONS. IF YOU FEEL YOU MUST DEFINE _MSC_VER
|
||||
* WITH A COMPILER THAT'S NOT MICROSOFT'S C COMPILER, PLEASE CONTACT
|
||||
* US SO THAT WE CAN MAKE IT SO THAT YOU DON'T HAVE TO DO THAT. THANK
|
||||
* YOU.
|
||||
*
|
||||
* OK, is _MSC_FULL_VER defined?
|
||||
*/
|
||||
#if !defined(_MSC_FULL_VER)
|
||||
/*
|
||||
* According to
|
||||
*
|
||||
* https://sourceforge.net/p/predef/wiki/Compilers/
|
||||
*
|
||||
* with "Visual C++ 6.0 Processor Pack"/Visual C++ 6.0 SP6 and
|
||||
* later, _MSC_FULL_VER is defined, so either this is an older
|
||||
* version of Visual C++ or it's not Visual C++ at all.
|
||||
*
|
||||
* For Visual C++ 6.0, _MSC_VER is defined as 1200.
|
||||
*/
|
||||
#if _MSC_VER > 1200
|
||||
/*
|
||||
* If this is Visual C++, _MSC_FULL_VER should be defined, so we
|
||||
* assume this isn't Visual C++, and undo the lie that it is.
|
||||
*/
|
||||
#undef _MSC_VER
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <pcap/funcattrs.h>
|
||||
|
||||
#include <pcap/pcap-inttypes.h>
|
||||
@@ -127,6 +170,7 @@ typedef struct pcap_addr pcap_addr_t;
|
||||
* 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.
|
||||
* Documentation: https://www.tcpdump.org/manpages/pcap-savefile.5.txt.
|
||||
*
|
||||
* Do not change the layout of this structure, in any way (this includes
|
||||
* changes that only affect the length of fields in this structure).
|
||||
@@ -154,7 +198,7 @@ typedef struct pcap_addr pcap_addr_t;
|
||||
*
|
||||
* Then supply the changes by forking the branch at
|
||||
*
|
||||
* https://github.com/the-tcpdump-group/libpcap/issues
|
||||
* https://github.com/the-tcpdump-group/libpcap/tree/master
|
||||
*
|
||||
* and issuing a pull request, so that future versions of libpcap and
|
||||
* programs that use it (such as tcpdump) will be able to read your new
|
||||
@@ -164,8 +208,8 @@ 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_int32 thiszone; /* gmt to local correction; this is always 0 */
|
||||
bpf_u_int32 sigfigs; /* accuracy of timestamps; this is always 0 */
|
||||
bpf_u_int32 snaplen; /* max length saved portion of each pkt */
|
||||
bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */
|
||||
};
|
||||
@@ -201,7 +245,7 @@ typedef enum {
|
||||
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) */
|
||||
bpf_u_int32 len; /* length of this packet (off wire) */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -320,36 +364,92 @@ typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
|
||||
*/
|
||||
#define PCAP_NETMASK_UNKNOWN 0xffffffff
|
||||
|
||||
/*
|
||||
* Initialize pcap. If this isn't called, pcap is initialized to
|
||||
* a mode source-compatible and binary-compatible with older versions
|
||||
* that lack this routine.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization options.
|
||||
* All bits not listed here are reserved for expansion.
|
||||
*
|
||||
* On UNIX-like systems, the local character encoding is assumed to be
|
||||
* UTF-8, so no character encoding transformations are done.
|
||||
*
|
||||
* On Windows, the local character encoding is the local ANSI code page.
|
||||
*/
|
||||
#define PCAP_CHAR_ENC_LOCAL 0x00000000U /* strings are in the local character encoding */
|
||||
#define PCAP_CHAR_ENC_UTF_8 0x00000001U /* strings are in UTF-8 */
|
||||
|
||||
PCAP_AVAILABLE_1_10
|
||||
PCAP_API int pcap_init(unsigned int, char *);
|
||||
|
||||
/*
|
||||
* We're deprecating pcap_lookupdev() for various reasons (not
|
||||
* thread-safe, can behave weirdly with WinPcap). Callers
|
||||
* should use pcap_findalldevs() and use the first device.
|
||||
*/
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API char *pcap_lookupdev(char *)
|
||||
PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API pcap_t *pcap_create(const char *, char *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_set_snaplen(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_set_promisc(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_can_set_rfmon(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_set_rfmon(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_set_timeout(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API int pcap_set_tstamp_type(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API int pcap_set_immediate_mode(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_set_buffer_size(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API int pcap_set_tstamp_precision(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API int pcap_get_tstamp_precision(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_activate(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API int pcap_list_tstamp_types(pcap_t *, int **);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API void pcap_free_tstamp_types(int *);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API int pcap_tstamp_type_name_to_val(const char *);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API const char *pcap_tstamp_type_val_to_name(int);
|
||||
|
||||
PCAP_AVAILABLE_1_2
|
||||
PCAP_API const char *pcap_tstamp_type_val_to_description(int);
|
||||
|
||||
#ifdef __linux__
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
|
||||
#endif
|
||||
|
||||
@@ -359,8 +459,7 @@ PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
|
||||
*
|
||||
* A system that supports PCAP_TSTAMP_HOST is offering time stamps
|
||||
* provided by the host machine, rather than by the capture device,
|
||||
* but not committing to any characteristics of the time stamp;
|
||||
* it will not offer any of the PCAP_TSTAMP_HOST_ subtypes.
|
||||
* but not committing to any characteristics of the time stamp.
|
||||
*
|
||||
* PCAP_TSTAMP_HOST_LOWPREC is a time stamp, provided by the host machine,
|
||||
* that's low-precision but relatively cheap to fetch; it's normally done
|
||||
@@ -368,10 +467,15 @@ PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
|
||||
* fetch from system calls.
|
||||
*
|
||||
* PCAP_TSTAMP_HOST_HIPREC is a time stamp, provided by the host machine,
|
||||
* that's high-precision; it might be more expensive to fetch. It might
|
||||
* or might not be synchronized with the system clock, and might have
|
||||
* that's high-precision; it might be more expensive to fetch. It is
|
||||
* synchronized with the system clock.
|
||||
*
|
||||
* PCAP_TSTAMP_HOST_HIPREC_UNSYNCED is a time stamp, provided by the host
|
||||
* machine, that's high-precision; it might be more expensive to fetch.
|
||||
* It is not synchronized with the system clock, and might have
|
||||
* problems with time stamps for packets received on different CPUs,
|
||||
* depending on the platform.
|
||||
* depending on the platform. It might be more likely to be strictly
|
||||
* monotonic than PCAP_TSTAMP_HOST_HIPREC.
|
||||
*
|
||||
* PCAP_TSTAMP_ADAPTER is a high-precision time stamp supplied by the
|
||||
* capture device; it's synchronized with the system clock.
|
||||
@@ -391,11 +495,12 @@ PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
|
||||
* the packet is received by the network adapter, due to batching
|
||||
* of interrupts for packet arrival, queueing delays, etc..
|
||||
*/
|
||||
#define PCAP_TSTAMP_HOST 0 /* host-provided, unknown characteristics */
|
||||
#define PCAP_TSTAMP_HOST_LOWPREC 1 /* host-provided, low precision */
|
||||
#define PCAP_TSTAMP_HOST_HIPREC 2 /* host-provided, high precision */
|
||||
#define PCAP_TSTAMP_ADAPTER 3 /* device-provided, synced with the system clock */
|
||||
#define PCAP_TSTAMP_ADAPTER_UNSYNCED 4 /* device-provided, not synced with the system clock */
|
||||
#define PCAP_TSTAMP_HOST 0 /* host-provided, unknown characteristics */
|
||||
#define PCAP_TSTAMP_HOST_LOWPREC 1 /* host-provided, low precision, synced with the system clock */
|
||||
#define PCAP_TSTAMP_HOST_HIPREC 2 /* host-provided, high precision, synced with the system clock */
|
||||
#define PCAP_TSTAMP_ADAPTER 3 /* device-provided, synced with the system clock */
|
||||
#define PCAP_TSTAMP_ADAPTER_UNSYNCED 4 /* device-provided, not synced with the system clock */
|
||||
#define PCAP_TSTAMP_HOST_HIPREC_UNSYNCED 5 /* host-provided, high precision, not synced with the system clock */
|
||||
|
||||
/*
|
||||
* Time stamp resolution types.
|
||||
@@ -406,13 +511,25 @@ PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
|
||||
#define PCAP_TSTAMP_PRECISION_MICRO 0 /* use timestamps with microsecond precision, default */
|
||||
#define PCAP_TSTAMP_PRECISION_NANO 1 /* use timestamps with nanosecond precision */
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API pcap_t *pcap_open_live(const char *, int, int, int, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_6
|
||||
PCAP_API pcap_t *pcap_open_dead(int, int);
|
||||
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
|
||||
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API pcap_t *pcap_open_offline(const char *, char *);
|
||||
|
||||
#ifdef _WIN32
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
|
||||
|
||||
PCAP_API pcap_t *pcap_hopen_offline(intptr_t, char *);
|
||||
/*
|
||||
* If we're building libpcap, these are internal routines in savefile.c,
|
||||
@@ -434,60 +551,153 @@ PCAP_API pcap_t *pcap_open_offline(const char *, char *);
|
||||
pcap_hopen_offline(_get_osfhandle(_fileno(f)), b)
|
||||
#endif
|
||||
#else /*_WIN32*/
|
||||
PCAP_AVAILABLE_1_5
|
||||
PCAP_API pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API pcap_t *pcap_fopen_offline(FILE *, char *);
|
||||
#endif /*_WIN32*/
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API void pcap_close(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API void pcap_breakloop(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_stats(pcap_t *, struct pcap_stat *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_setfilter(pcap_t *, struct bpf_program *);
|
||||
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API int pcap_setdirection(pcap_t *, pcap_direction_t);
|
||||
|
||||
PCAP_AVAILABLE_0_7
|
||||
PCAP_API int pcap_getnonblock(pcap_t *, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_7
|
||||
PCAP_API int pcap_setnonblock(pcap_t *, int, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API int pcap_inject(pcap_t *, const void *, size_t);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_sendpacket(pcap_t *, const u_char *, int);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API const char *pcap_statustostr(int);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API const char *pcap_strerror(int);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API char *pcap_geterr(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API void pcap_perror(pcap_t *, const char *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
|
||||
bpf_u_int32);
|
||||
|
||||
PCAP_AVAILABLE_0_5
|
||||
PCAP_API int pcap_compile_nopcap(int, int, struct bpf_program *,
|
||||
const char *, int, bpf_u_int32);
|
||||
|
||||
/* XXX - this took two arguments in 0.4 and 0.5 */
|
||||
PCAP_AVAILABLE_0_6
|
||||
PCAP_API void pcap_freecode(struct bpf_program *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_offline_filter(const struct bpf_program *,
|
||||
const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_datalink(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_0
|
||||
PCAP_API int pcap_datalink_ext(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_list_datalinks(pcap_t *, int **);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_set_datalink(pcap_t *, int);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API void pcap_free_datalinks(int *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_datalink_name_to_val(const char *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API const char *pcap_datalink_val_to_name(int);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API const char *pcap_datalink_val_to_description(int);
|
||||
|
||||
PCAP_AVAILABLE_1_10
|
||||
PCAP_API const char *pcap_datalink_val_to_description_or_dlt(int);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_snapshot(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_is_swapped(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_major_version(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_minor_version(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_bufsize(pcap_t *);
|
||||
|
||||
/* XXX */
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API FILE *pcap_file(pcap_t *);
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* This probably shouldn't have been kept in WinPcap; most if not all
|
||||
* UN*X code that used it won't work on Windows. We deprecate it; if
|
||||
* anybody really needs access to whatever HANDLE may be associated
|
||||
* with a pcap_t (there's no guarantee that there is one), we can add
|
||||
* a Windows-only pcap_handle() API that returns the HANDLE.
|
||||
*/
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_fileno(pcap_t *)
|
||||
PCAP_DEPRECATED(pcap_fileno, "use 'pcap_handle'");
|
||||
#else /* _WIN32 */
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API int pcap_fileno(pcap_t *);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _WIN32
|
||||
PCAP_API int pcap_wsockinit(void);
|
||||
#endif
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
|
||||
|
||||
#ifdef _WIN32
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API pcap_dumper_t *pcap_dump_hopen(pcap_t *, intptr_t);
|
||||
|
||||
/*
|
||||
* If we're building libpcap, this is an internal routine in sf-pcap.c, so
|
||||
* we must not define it as a macro.
|
||||
@@ -506,17 +716,35 @@ PCAP_API pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
|
||||
pcap_dump_hopen(p, _get_osfhandle(_fileno(f)))
|
||||
#endif
|
||||
#else /*_WIN32*/
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
|
||||
#endif /*_WIN32*/
|
||||
|
||||
PCAP_AVAILABLE_1_7
|
||||
PCAP_API pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API FILE *pcap_dump_file(pcap_dumper_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_9
|
||||
PCAP_API long pcap_dump_ftell(pcap_dumper_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int64_t pcap_dump_ftell64(pcap_dumper_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_dump_flush(pcap_dumper_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API void pcap_dump_close(pcap_dumper_t *);
|
||||
|
||||
PCAP_AVAILABLE_0_4
|
||||
PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
PCAP_AVAILABLE_0_7
|
||||
PCAP_API int pcap_findalldevs(pcap_if_t **, char *);
|
||||
|
||||
PCAP_AVAILABLE_0_7
|
||||
PCAP_API void pcap_freealldevs(pcap_if_t *);
|
||||
|
||||
/*
|
||||
@@ -524,7 +752,7 @@ PCAP_API void pcap_freealldevs(pcap_if_t *);
|
||||
* version string directly.
|
||||
*
|
||||
* On at least some UNIXes, if you import data from a shared library into
|
||||
* an program, the data is bound into the program binary, so if the string
|
||||
* a program, the data is bound into the program binary, so if the string
|
||||
* in the version of the library with which the program was linked isn't
|
||||
* the same as the string in the version of the library with which the
|
||||
* program is being run, various undesirable things may happen (warnings,
|
||||
@@ -534,22 +762,9 @@ PCAP_API void pcap_freealldevs(pcap_if_t *);
|
||||
*
|
||||
* On Windows, the string is constructed at run time.
|
||||
*/
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API const char *pcap_lib_version(void);
|
||||
|
||||
/*
|
||||
* On at least some versions of NetBSD and QNX, we don't want to declare
|
||||
* bpf_filter() here, as it's also be declared in <net/bpf.h>, with a
|
||||
* different signature, but, on other BSD-flavored UN*Xes, it's not
|
||||
* declared in <net/bpf.h>, so we *do* want to declare it here, so it's
|
||||
* declared when we build pcap-bpf.c.
|
||||
*/
|
||||
#if !defined(__NetBSD__) && !defined(__QNX__)
|
||||
PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
|
||||
#endif
|
||||
PCAP_API int bpf_validate(const struct bpf_insn *f, int len);
|
||||
PCAP_API char *bpf_image(const struct bpf_insn *, int);
|
||||
PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
/*
|
||||
@@ -583,7 +798,10 @@ PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
|
||||
PCAP_API HANDLE pcap_getevent(pcap_t *p);
|
||||
|
||||
PCAP_AVAILABLE_1_8
|
||||
PCAP_API int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_8
|
||||
PCAP_API int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *);
|
||||
|
||||
PCAP_API pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
|
||||
@@ -626,8 +844,11 @@ PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
* UN*X definitions
|
||||
*/
|
||||
|
||||
PCAP_AVAILABLE_0_8
|
||||
PCAP_API int pcap_get_selectable_fd(pcap_t *);
|
||||
PCAP_API struct timeval *pcap_get_required_select_timeout(pcap_t *);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API const struct timeval *pcap_get_required_select_timeout(pcap_t *);
|
||||
|
||||
#endif /* _WIN32/MSDOS/UN*X */
|
||||
|
||||
@@ -660,14 +881,17 @@ PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
* - 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]
|
||||
* - adaptername [to open a local adapter; kept for compatibility, but it is strongly discouraged]
|
||||
* - (NULL) [to open the first local adapter; kept for compatibility, 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]
|
||||
*
|
||||
* In all the above, "rpcaps://" can be substituted for "rpcap://" to enable
|
||||
* SSL (if it has been compiled in).
|
||||
*
|
||||
* Referring to the 'host' and 'port' parameters, they can be either numeric or literal. Since
|
||||
* IPv6 is fully supported, these are the allowed formats:
|
||||
*
|
||||
@@ -728,7 +952,7 @@ PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
#define PCAP_OPENFLAG_DATATX_UDP 0x00000002
|
||||
|
||||
/*
|
||||
* Specifies wheether the remote probe will capture its own generated
|
||||
* Specifies whether the remote probe will capture its own generated
|
||||
* traffic.
|
||||
*
|
||||
* In case the remote probe uses the same interface to capture traffic
|
||||
@@ -797,7 +1021,7 @@ PCAP_API void bpf_dump(const struct bpf_program *, int);
|
||||
#define RPCAP_RMTAUTH_PWD 1
|
||||
|
||||
/*
|
||||
* This structure keeps the information needed to autheticate the user
|
||||
* This structure keeps the information needed to authenticate the user
|
||||
* on a remote machine.
|
||||
*
|
||||
* The remote machine can either grant or refuse the access according
|
||||
@@ -856,10 +1080,15 @@ struct pcap_rmtauth
|
||||
* For opening a remote capture, pcap_open() is currently the only
|
||||
* API available.
|
||||
*/
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
|
||||
int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_createsrcstr(char *source, int type, const char *host,
|
||||
const char *port, const char *name, char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_parsesrcstr(const char *source, int *type, char *host,
|
||||
char *port, char *name, char *errbuf);
|
||||
|
||||
@@ -882,6 +1111,7 @@ PCAP_API int pcap_parsesrcstr(const char *source, int *type, char *host,
|
||||
* For listing remote capture devices, pcap_findalldevs_ex() is currently
|
||||
* the only API available.
|
||||
*/
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_findalldevs_ex(const char *source,
|
||||
struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
|
||||
|
||||
@@ -952,6 +1182,7 @@ struct pcap_samp
|
||||
/*
|
||||
* New functions.
|
||||
*/
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
|
||||
|
||||
/*
|
||||
@@ -961,12 +1192,24 @@ PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
|
||||
/* Maximum length of an host name (needed for the RPCAP active mode) */
|
||||
#define RPCAP_HOSTLIST_SIZE 1024
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API SOCKET pcap_remoteact_accept(const char *address, const char *port,
|
||||
const char *hostlist, char *connectinghost,
|
||||
struct pcap_rmtauth *auth, char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_10
|
||||
PCAP_API SOCKET pcap_remoteact_accept_ex(const char *address, const char *port,
|
||||
const char *hostlist, char *connectinghost,
|
||||
struct pcap_rmtauth *auth, int uses_ssl, char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_remoteact_list(char *hostlist, char sep, int size,
|
||||
char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API int pcap_remoteact_close(const char *host, char *errbuf);
|
||||
|
||||
PCAP_AVAILABLE_1_9
|
||||
PCAP_API void pcap_remoteact_cleanup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user