#
# Try to have the compiler default to hiding symbols, so that only
-# symbols explicitly exported with PCAP_EXPORTED_C_FUNC or
-# PCAP_EXPORTED_DATA will be visible outside (shared) libraries.
+# symbols explicitly exported with PCAP_API will be visible outside
+# (shared) libraries.
#
# Not necessary with MSVC, as that's the default.
#
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden)
else
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden)
;;
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
AC_LBL_CHECK_COMPILER_OPT($1, -xldscope=hidden)
;;
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
#
# Try to have the compiler default to hiding symbols,
# so that only symbols explicitly exported with
- # PCAP_EXPORTED_C_FUNC or PCAP_EXPORTED_DATA will
- # be visible outside (shared) libraries.
+ # PCAP_API will be visible outside (shared) libraries.
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -xldscope=hidden option" >&5
#ifndef dlpisubs_h
#define dlpisubs_h
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Private data for capturing on DLPI devices.
*/
/*
* Functions defined by dlpisubs.c.
*/
-PCAP_UNEXPORTED_C_FUNC int pcap_stats_dlpi(pcap_t *, struct pcap_stat *);
-PCAP_UNEXPORTED_C_FUNC int pcap_process_pkts(pcap_t *, pcap_handler, u_char *, int,
- u_char *, int);
-PCAP_UNEXPORTED_C_FUNC int pcap_process_mactype(pcap_t *, u_int);
+int pcap_stats_dlpi(pcap_t *, struct pcap_stat *);
+int pcap_process_pkts(pcap_t *, pcap_handler, u_char *, int, u_char *, int);
+int pcap_process_mactype(pcap_t *, u_int);
#ifdef HAVE_SYS_BUFMOD_H
-PCAP_UNEXPORTED_C_FUNC int pcap_conf_bufmod(pcap_t *, int);
+int pcap_conf_bufmod(pcap_t *, int);
+#endif
+int pcap_alloc_databuf(pcap_t *);
+int strioctl(int, int, int, char *);
+
+#ifdef __cplusplus
+}
#endif
-PCAP_UNEXPORTED_C_FUNC int pcap_alloc_databuf(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC int strioctl(int, int, int, char *);
#endif
#include "pcap/funcattrs.h"
-PCAP_UNEXPORTED_C_FUNC void pcap_fmt_set_encoding(unsigned int);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void pcap_fmt_set_encoding(unsigned int);
-PCAP_UNEXPORTED_C_FUNC void pcap_fmt_errmsg_for_errno(char *, size_t, int,
+void pcap_fmt_errmsg_for_errno(char *, size_t, int,
PCAP_FORMAT_STRING(const char *), ...) PCAP_PRINTFLIKE(4, 5);
#ifdef _WIN32
-PCAP_UNEXPORTED_C_FUNC void pcap_fmt_errmsg_for_win32_err(char *, size_t, DWORD,
+void pcap_fmt_errmsg_for_win32_err(char *, size_t, DWORD,
PCAP_FORMAT_STRING(const char *), ...) PCAP_PRINTFLIKE(4, 5);
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif
* warnings we might get from compilers about the lack of a
* declaration.
*/
-PCAP_EXPORTED_DATA struct eproto eproto_db[];
-PCAP_EXPORTED_DATA_DEF struct eproto eproto_db[] = {
+PCAP_API struct eproto eproto_db[];
+PCAP_API_DEF struct eproto eproto_db[] = {
{ "aarp", ETHERTYPE_AARP },
{ "arp", ETHERTYPE_ARP },
{ "atalk", ETHERTYPE_ATALK },
* SUCH DAMAGE.
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Routines used for name-or-address-string-to-address resolution
* that are *not* exported to code using libpcap.
*/
-PCAP_UNEXPORTED_C_FUNC int __pcap_atodn(const char *, bpf_u_int32 *);
-PCAP_UNEXPORTED_C_FUNC int __pcap_atoin(const char *, bpf_u_int32 *);
-PCAP_UNEXPORTED_C_FUNC int __pcap_nametodnaddr(const char *, u_short *);
+int __pcap_atodn(const char *, bpf_u_int32 *);
+int __pcap_atoin(const char *, bpf_u_int32 *);
+int __pcap_nametodnaddr(const char *, u_short *);
+
+#ifdef __cplusplus
+}
+#endif
* it's not declared in any header file, and won't be declared in any
* header file provided by libpcap.
*/
-PCAP_EXPORTED_C_FUNC void pcap_set_optimizer_debug(int value);
+PCAP_API void pcap_set_optimizer_debug(int value);
PCAP_API_DEF void
pcap_set_optimizer_debug(int value)
* it's not declared in any header file, and won't be declared in any
* header file provided by libpcap.
*/
-PCAP_EXPORTED_C_FUNC void pcap_set_print_dot_graph(int value);
+PCAP_API void pcap_set_print_dot_graph(int value);
PCAP_API_DEF void
pcap_set_print_dot_graph(int value)
*/
#define PCAP_VERSION_STRING "libpcap version " PACKAGE_VERSION
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* If pcap_new_api is set, we disable pcap_lookupdev(), because:
*
#define min(a, b) ((a) > (b) ? (b) : (a))
#endif
-PCAP_UNEXPORTED_C_FUNC int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *);
+int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *);
#include <stdarg.h>
* Routines that most pcap implementations can use for non-blocking mode.
*/
#if !defined(_WIN32) && !defined(MSDOS)
-PCAP_UNEXPORTED_C_FUNC int pcap_getnonblock_fd(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC int pcap_setnonblock_fd(pcap_t *p, int);
+int pcap_getnonblock_fd(pcap_t *);
+int pcap_setnonblock_fd(pcap_t *p, int);
#endif
/*
* "pcap_create_common()" allocates and fills in a pcap_t, for use
* by pcap_create routines.
*/
-PCAP_UNEXPORTED_C_FUNC pcap_t *pcap_create_interface(const char *, char *);
+pcap_t *pcap_create_interface(const char *, char *);
/*
* This wrapper takes an error buffer pointer and a type to use for the
pcap_create_common(ebuf, \
sizeof (struct { pcap_t __common; type __private; }), \
offsetof (struct { pcap_t __common; type __private; }, __private))
-PCAP_UNEXPORTED_C_FUNC pcap_t *pcap_create_common(char *, size_t, size_t);
-PCAP_UNEXPORTED_C_FUNC int pcap_do_addexit(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC void pcap_add_to_pcaps_to_close(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC void pcap_remove_from_pcaps_to_close(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC void pcap_cleanup_live_common(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC int pcap_check_activated(pcap_t *);
-PCAP_UNEXPORTED_C_FUNC void pcap_breakloop_common(pcap_t *);
+pcap_t *pcap_create_common(char *, size_t, size_t);
+int pcap_do_addexit(pcap_t *);
+void pcap_add_to_pcaps_to_close(pcap_t *);
+void pcap_remove_from_pcaps_to_close(pcap_t *);
+void pcap_cleanup_live_common(pcap_t *);
+int pcap_check_activated(pcap_t *);
+void pcap_breakloop_common(pcap_t *);
/*
* Internal interfaces for "pcap_findalldevs()".
struct pcap_if_list;
typedef struct pcap_if_list pcap_if_list_t;
typedef int (*get_if_flags_func)(const char *, bpf_u_int32 *, char *);
-PCAP_UNEXPORTED_C_FUNC int pcap_platform_finddevs(pcap_if_list_t *, char *);
+int pcap_platform_finddevs(pcap_if_list_t *, char *);
#if !defined(_WIN32) && !defined(MSDOS)
-PCAP_UNEXPORTED_C_FUNC int pcap_findalldevs_interfaces(pcap_if_list_t *, char *,
+int pcap_findalldevs_interfaces(pcap_if_list_t *, char *,
int (*)(const char *), get_if_flags_func);
#endif
-PCAP_UNEXPORTED_C_FUNC pcap_if_t *find_or_add_dev(pcap_if_list_t *, const char *,
- bpf_u_int32, get_if_flags_func, const char *, char *);
-PCAP_UNEXPORTED_C_FUNC pcap_if_t *find_dev(pcap_if_list_t *, const char *);
-PCAP_UNEXPORTED_C_FUNC pcap_if_t *add_dev(pcap_if_list_t *, const char *, bpf_u_int32,
- const char *, char *);
-PCAP_UNEXPORTED_C_FUNC int add_addr_to_dev(pcap_if_t *, struct sockaddr *, size_t,
+pcap_if_t *find_or_add_dev(pcap_if_list_t *, const char *, bpf_u_int32,
+ get_if_flags_func, const char *, char *);
+pcap_if_t *find_dev(pcap_if_list_t *, const char *);
+pcap_if_t *add_dev(pcap_if_list_t *, const char *, bpf_u_int32, const char *,
+ char *);
+int add_addr_to_dev(pcap_if_t *, struct sockaddr *, size_t,
struct sockaddr *, size_t, struct sockaddr *, size_t,
struct sockaddr *dstaddr, size_t, char *errbuf);
#ifndef _WIN32
-PCAP_UNEXPORTED_C_FUNC pcap_if_t *find_or_add_if(pcap_if_list_t *, const char *,
- bpf_u_int32, get_if_flags_func, char *);
-PCAP_UNEXPORTED_C_FUNC int add_addr_to_if(pcap_if_list_t *, const char *, bpf_u_int32,
+pcap_if_t *find_or_add_if(pcap_if_list_t *, const char *, bpf_u_int32,
+ get_if_flags_func, char *);
+int add_addr_to_if(pcap_if_list_t *, const char *, bpf_u_int32,
get_if_flags_func,
struct sockaddr *, size_t, struct sockaddr *, size_t,
struct sockaddr *, size_t, struct sockaddr *, size_t, char *);
pcap_open_offline_common(ebuf, \
sizeof (struct { pcap_t __common; type __private; }), \
offsetof (struct { pcap_t __common; type __private; }, __private))
-PCAP_UNEXPORTED_C_FUNC pcap_t *pcap_open_offline_common(char *ebuf, size_t total_size,
+pcap_t *pcap_open_offline_common(char *ebuf, size_t total_size,
size_t private_data);
-PCAP_UNEXPORTED_C_FUNC bpf_u_int32 pcap_adjust_snapshot(bpf_u_int32 linktype,
- bpf_u_int32 snaplen);
-PCAP_UNEXPORTED_C_FUNC void sf_cleanup(pcap_t *p);
+bpf_u_int32 pcap_adjust_snapshot(bpf_u_int32 linktype, bpf_u_int32 snaplen);
+void sf_cleanup(pcap_t *p);
#ifdef _WIN32
-PCAP_UNEXPORTED_C_FUNC FILE *charset_fopen(const char *path, const char *mode);
+FILE *charset_fopen(const char *path, const char *mode);
#else
/*
* On other OSes, just use Boring Old fopen().
#define pcap_code_handle_t HMODULE
#define pcap_funcptr_t FARPROC
-PCAP_UNEXPORTED_C_FUNC pcap_code_handle_t pcap_load_code(const char *);
-PCAP_UNEXPORTED_C_FUNC pcap_funcptr_t pcap_find_function(pcap_code_handle_t,
- const char *);
+pcap_code_handle_t pcap_load_code(const char *);
+pcap_funcptr_t pcap_find_function(pcap_code_handle_t, const char *);
#endif
/*
* Filtering routine that takes the auxiliary data as an additional
* argument.
*/
-PCAP_UNEXPORTED_C_FUNC u_int pcap_filter_with_aux_data(const struct bpf_insn *,
+u_int pcap_filter_with_aux_data(const struct bpf_insn *,
const u_char *, u_int, u_int, const struct pcap_bpf_aux_data *);
/*
* Filtering routine that doesn't.
*/
-PCAP_UNEXPORTED_C_FUNC u_int pcap_filter(const struct bpf_insn *, const u_char *,
- u_int, u_int);
+u_int pcap_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
/*
* Routine to validate a BPF program.
*/
-PCAP_UNEXPORTED_C_FUNC int pcap_validate_filter(const struct bpf_insn *, int);
+int pcap_validate_filter(const struct bpf_insn *, int);
/*
* Internal interfaces for both "pcap_create()" and routines that
* "pcap_oneshot()" is the standard one-shot callback for "pcap_next()"
* and "pcap_next_ex()".
*/
-PCAP_UNEXPORTED_C_FUNC void pcap_oneshot(u_char *, const struct pcap_pkthdr *,
- const u_char *);
+void pcap_oneshot(u_char *, const struct pcap_pkthdr *, const u_char *);
-PCAP_UNEXPORTED_C_FUNC int install_bpf_program(pcap_t *, struct bpf_program *);
+int install_bpf_program(pcap_t *, struct bpf_program *);
-PCAP_UNEXPORTED_C_FUNC int pcap_strcasecmp(const char *, const char *);
+int pcap_strcasecmp(const char *, const char *);
/*
* Internal interfaces for pcap_createsrcstr and pcap_parsesrcstr with
* the additional bit of information regarding SSL support (rpcap:// vs.
* rpcaps://).
*/
-PCAP_UNEXPORTED_C_FUNC int pcap_createsrcstr_ex(char *, int, const char *, const char *,
+int pcap_createsrcstr_ex(char *, int, const char *, const char *,
const char *, unsigned char, char *);
-PCAP_UNEXPORTED_C_FUNC int pcap_parsesrcstr_ex(const char *, int *, char *, char *,
+int pcap_parsesrcstr_ex(const char *, int *, char *, char *,
char *, unsigned char *, char *);
#ifdef YYDEBUG
extern int pcap_debug;
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif
/*
* String containing the library version.
* Not explicitly exported via a header file - the right API to use
- * is pcap_lib_version() - but some programs referred to it, so we
+ * is pcap_lib_version() - but some programs included it, so we
* provide it.
*
* We declare it here, right before defining it, to squelch any
* warnings we might get from compilers about the lack of a
* declaration.
*/
-PCAP_EXPORTED_DATA char pcap_version[];
-PCAP_EXPORTED_DATA_DEF char pcap_version[] = PACKAGE_VERSION;
+PCAP_API char pcap_version[];
+PCAP_API_DEF char pcap_version[] = PACKAGE_VERSION;
static void
pcap_set_not_initialized_message(pcap_t *pcap)
* it's not declared in any header file, and won't be declared in any
* header file provided by libpcap.
*/
-PCAP_EXPORTED_C_FUNC void pcap_set_parser_debug(int value);
+PCAP_API void pcap_set_parser_debug(int value);
PCAP_API_DEF void
pcap_set_parser_debug(int value)
#include <pcap/funcattrs.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* BSD style release date */
#define BPF_RELEASE 199606
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
+PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
PCAP_AVAILABLE_0_6
-PCAP_EXPORTED_C_FUNC int bpf_validate(const struct bpf_insn *f, int len);
+PCAP_API int bpf_validate(const struct bpf_insn *f, int len);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC char *bpf_image(const struct bpf_insn *, int);
+PCAP_API char *bpf_image(const struct bpf_insn *, int);
PCAP_AVAILABLE_0_6
-PCAP_EXPORTED_C_FUNC void bpf_dump(const struct bpf_program *, int);
+PCAP_API void bpf_dump(const struct bpf_program *, int);
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
+#ifdef __cplusplus
+}
+#endif
+
#endif /* !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) */
*/
/*
- * PCAP_EXPORTED_DATA_DEF must be used when defining *data* exported from
- * libpcap. It should not be used in data declarations in headers.
+ * PCAP_API_DEF must be used when defining *data* exported from
+ * libpcap. It can be used when defining *functions* exported
+ * from libpcap, but it doesn't have to be used there. It
+ * should not be used in declarations in headers.
*
- * PCAP_EXPORTED_C_FUNC must be used when *declaring* functions exported from
- * libpcap; PCAP_API_DEF won't work on all platforms.
- *
- * PCAP_EXPORTED_DATA must be used when *declaring* data exported from
- * libpcap; PCAP_EXPORTED_DATA_DEF won't work on all platforms.
+ * PCAP_API must be used when *declaring* data or functions
+ * exported from libpcap; PCAP_API_DEF won't work on all platforms.
*/
#if defined(_WIN32)
*
* So:
*
- * if pcap_EXPORTS is defined, we define PCAP_EXPORTED as
+ * if pcap_EXPORTS is defined, we define PCAP_API_DEF as
* __declspec(dllexport);
*
- * if PCAP_DLL is defined, we define PCAP_EXPORTED as
+ * if PCAP_DLL is defined, we define PCAP_API_DEF as
* __declspec(dllimport);
*
- * otherwise, we define PCAP_EXPORTED as nothing.
+ * otherwise, we define PCAP_API_DEF as nothing.
*/
#if defined(pcap_EXPORTS)
/*
* We're compiling libpcap as a DLL, so we should export functions
* in our API.
*/
- #define PCAP_EXPORTED __declspec(dllexport)
+ #define PCAP_API_DEF __declspec(dllexport)
#elif defined(PCAP_DLL)
/*
* We're using libpcap as a DLL, so the calls will be a little more
* efficient if we explicitly import the functions.
*/
- #define PCAP_EXPORTED __declspec(dllimport)
+ #define PCAP_API_DEF __declspec(dllimport)
#else
/*
* Either we're building libpcap as a static library, or we're using
* using it as a dynamic library, so neither import nor export the
* functions explicitly.
*/
- #define PCAP_EXPORTED
+ #define PCAP_API_DEF
#endif
#elif defined(MSDOS)
/* XXX - does this need special treatment? */
- #define PCAP_EXPORTED
+ #define PCAP_API_DEF
#else /* UN*X */
#ifdef pcap_EXPORTS
/*
* GCC 3.4 or later, or XL C 13.0 or later, so we have
* __attribute__((visibility()).
*/
- #define PCAP_EXPORTED __attribute__((visibility("default")))
+ #define PCAP_API_DEF __attribute__((visibility("default")))
#elif PCAP_IS_AT_LEAST_SUNC_VERSION(5,5)
/*
* Sun C 5.5 or later, so we have __global.
* (Sun C 5.9 and later also have __attribute__((visibility()),
* but there's no reason to prefer it with Sun C.)
*/
- #define PCAP_EXPORTED __global
+ #define PCAP_API_DEF __global
#else
/*
* We don't have anything to say.
*/
- #define PCAP_EXPORTED
+ #define PCAP_API_DEF
#endif
#else
/*
* We're not building libpcap.
*/
- #define PCAP_EXPORTED
+ #define PCAP_API_DEF
#endif
#endif /* _WIN32/MSDOS/UN*X */
-/*
- * If we're compiling C++ code, flag a function as having C linkage.
- */
-#ifdef __cplusplus
-#define PCAP_C_LINKAGE "C"
-#else
-#define PCAP_C_LINKAGE
-#endif
-
-/*
- * Declare a C function used internally in libpcap but *not* exported
- * from libpcap.
- */
-#define PCAP_UNEXPORTED_C_FUNC extern PCAP_C_LINKAGE
-
-/*
- * Declare a C function exported from libpcap.
- */
-#define PCAP_EXPORTED_C_FUNC PCAP_EXPORTED extern PCAP_C_LINKAGE
-
-/*
- * Declare a variable exported from libpcap.
- */
-#define PCAP_EXPORTED_DATA PCAP_EXPORTED extern
-
-/*
- * Define a variable exported from libpcap.
- *
- * No definition macro is needed for functions exported from libpcap.
- */
-#define PCAP_EXPORTED_DATA_DEF PCAP_EXPORTED
+#define PCAP_API PCAP_API_DEF extern
/*
* Definitions to 1) indicate what version of libpcap first had a given
#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
#ifndef PCAP_ETHERS_FILE
#define PCAP_ETHERS_FILE "/etc/ethers"
#endif
-PCAP_EXPORTED_C_FUNC struct pcap_etherent *pcap_next_etherent(FILE *);
-PCAP_EXPORTED_C_FUNC u_char *pcap_ether_hostton(const char*);
-PCAP_EXPORTED_C_FUNC u_char *pcap_ether_aton(const char *);
+PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *);
+PCAP_API u_char *pcap_ether_hostton(const char*);
+PCAP_API u_char *pcap_ether_aton(const char *);
-PCAP_EXPORTED_C_FUNC bpf_u_int32 **pcap_nametoaddr(const char *)
+PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *)
PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead");
-PCAP_EXPORTED_C_FUNC struct addrinfo *pcap_nametoaddrinfo(const char *);
-PCAP_EXPORTED_C_FUNC bpf_u_int32 pcap_nametonetaddr(const char *);
+PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
+PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
-PCAP_EXPORTED_C_FUNC int pcap_nametoport(const char *, int *, int *);
-PCAP_EXPORTED_C_FUNC int pcap_nametoportrange(const char *, int *, int *, int *);
-PCAP_EXPORTED_C_FUNC int pcap_nametoproto(const char *);
-PCAP_EXPORTED_C_FUNC int pcap_nametoeproto(const char *);
-PCAP_EXPORTED_C_FUNC int pcap_nametollc(const char *);
+PCAP_API int pcap_nametoport(const char *, int *, int *);
+PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *);
+PCAP_API int pcap_nametoproto(const char *);
+PCAP_API int pcap_nametoeproto(const char *);
+PCAP_API 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.
*/
#define PROTO_UNDEF -1
+#ifdef __cplusplus
+}
+#endif
+
#endif
#include <stdio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Version number of the current version of the pcap file format.
*
#define PCAP_CHAR_ENC_UTF_8 0x00000001U /* strings are in UTF-8 */
PCAP_AVAILABLE_1_10
-PCAP_EXPORTED_C_FUNC int pcap_init(unsigned int, char *);
+PCAP_API int pcap_init(unsigned int, char *);
/*
* We're deprecating pcap_lookupdev() for various reasons (not
* should use pcap_findalldevs() and use the first device.
*/
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC char *pcap_lookupdev(char *)
+PCAP_API char *pcap_lookupdev(char *)
PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
+PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_create(const char *, char *);
+PCAP_API pcap_t *pcap_create(const char *, char *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_set_snaplen(pcap_t *, int);
+PCAP_API int pcap_set_snaplen(pcap_t *, int);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_set_promisc(pcap_t *, int);
+PCAP_API int pcap_set_promisc(pcap_t *, int);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_can_set_rfmon(pcap_t *);
+PCAP_API int pcap_can_set_rfmon(pcap_t *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_set_rfmon(pcap_t *, int);
+PCAP_API int pcap_set_rfmon(pcap_t *, int);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_set_timeout(pcap_t *, int);
+PCAP_API int pcap_set_timeout(pcap_t *, int);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC int pcap_set_tstamp_type(pcap_t *, int);
+PCAP_API int pcap_set_tstamp_type(pcap_t *, int);
PCAP_AVAILABLE_1_5
-PCAP_EXPORTED_C_FUNC int pcap_set_immediate_mode(pcap_t *, int);
+PCAP_API int pcap_set_immediate_mode(pcap_t *, int);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_set_buffer_size(pcap_t *, int);
+PCAP_API int pcap_set_buffer_size(pcap_t *, int);
PCAP_AVAILABLE_1_5
-PCAP_EXPORTED_C_FUNC int pcap_set_tstamp_precision(pcap_t *, int);
+PCAP_API int pcap_set_tstamp_precision(pcap_t *, int);
PCAP_AVAILABLE_1_5
-PCAP_EXPORTED_C_FUNC int pcap_get_tstamp_precision(pcap_t *);
+PCAP_API int pcap_get_tstamp_precision(pcap_t *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_activate(pcap_t *);
+PCAP_API int pcap_activate(pcap_t *);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC int pcap_list_tstamp_types(pcap_t *, int **);
+PCAP_API int pcap_list_tstamp_types(pcap_t *, int **);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC void pcap_free_tstamp_types(int *);
+PCAP_API void pcap_free_tstamp_types(int *);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC int pcap_tstamp_type_name_to_val(const char *);
+PCAP_API int pcap_tstamp_type_name_to_val(const char *);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC const char *pcap_tstamp_type_val_to_name(int);
+PCAP_API const char *pcap_tstamp_type_val_to_name(int);
PCAP_AVAILABLE_1_2
-PCAP_EXPORTED_C_FUNC const char *pcap_tstamp_type_val_to_description(int);
+PCAP_API const char *pcap_tstamp_type_val_to_description(int);
#ifdef __linux__
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC int pcap_set_protocol_linux(pcap_t *, int);
+PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
#endif
/*
#define PCAP_TSTAMP_PRECISION_NANO 1 /* use timestamps with nanosecond precision */
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open_live(const char *, int, int, int, char *);
+PCAP_API pcap_t *pcap_open_live(const char *, int, int, int, char *);
PCAP_AVAILABLE_0_6
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open_dead(int, int);
+PCAP_API pcap_t *pcap_open_dead(int, int);
PCAP_AVAILABLE_1_5
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
+PCAP_API pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
PCAP_AVAILABLE_1_5
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
+PCAP_API pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open_offline(const char *, char *);
+PCAP_API pcap_t *pcap_open_offline(const char *, char *);
#ifdef _WIN32
PCAP_AVAILABLE_1_5
- PCAP_EXPORTED_C_FUNC pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
+ PCAP_API pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
- PCAP_EXPORTED_C_FUNC pcap_t *pcap_hopen_offline(intptr_t, char *);
+ PCAP_API pcap_t *pcap_hopen_offline(intptr_t, char *);
/*
* If we're building libpcap, these are internal routines in savefile.c,
* so we must not define them as macros.
#endif
#else /*_WIN32*/
PCAP_AVAILABLE_1_5
- PCAP_EXPORTED_C_FUNC pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
+ PCAP_API pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
PCAP_AVAILABLE_0_9
- PCAP_EXPORTED_C_FUNC pcap_t *pcap_fopen_offline(FILE *, char *);
+ PCAP_API pcap_t *pcap_fopen_offline(FILE *, char *);
#endif /*_WIN32*/
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC void pcap_close(pcap_t *);
+PCAP_API void pcap_close(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
+PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
+PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *);
+PCAP_API const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
+PCAP_API int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC void pcap_breakloop(pcap_t *);
+PCAP_API void pcap_breakloop(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_stats(pcap_t *, struct pcap_stat *);
+PCAP_API int pcap_stats(pcap_t *, struct pcap_stat *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_setfilter(pcap_t *, struct bpf_program *);
+PCAP_API int pcap_setfilter(pcap_t *, struct bpf_program *);
PCAP_AVAILABLE_0_9
-PCAP_EXPORTED_C_FUNC int pcap_setdirection(pcap_t *, pcap_direction_t);
+PCAP_API int pcap_setdirection(pcap_t *, pcap_direction_t);
PCAP_AVAILABLE_0_7
-PCAP_EXPORTED_C_FUNC int pcap_getnonblock(pcap_t *, char *);
+PCAP_API int pcap_getnonblock(pcap_t *, char *);
PCAP_AVAILABLE_0_7
-PCAP_EXPORTED_C_FUNC int pcap_setnonblock(pcap_t *, int, char *);
+PCAP_API int pcap_setnonblock(pcap_t *, int, char *);
PCAP_AVAILABLE_0_9
-PCAP_EXPORTED_C_FUNC int pcap_inject(pcap_t *, const void *, size_t);
+PCAP_API int pcap_inject(pcap_t *, const void *, size_t);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_sendpacket(pcap_t *, const u_char *, int);
+PCAP_API int pcap_sendpacket(pcap_t *, const u_char *, int);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC const char *pcap_statustostr(int);
+PCAP_API const char *pcap_statustostr(int);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC const char *pcap_strerror(int);
+PCAP_API const char *pcap_strerror(int);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC char *pcap_geterr(pcap_t *);
+PCAP_API char *pcap_geterr(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC void pcap_perror(pcap_t *, const char *);
+PCAP_API void pcap_perror(pcap_t *, const char *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
+PCAP_API int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
bpf_u_int32);
PCAP_AVAILABLE_0_5
-PCAP_EXPORTED_C_FUNC int pcap_compile_nopcap(int, int, struct bpf_program *,
+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_EXPORTED_C_FUNC void pcap_freecode(struct bpf_program *);
+PCAP_API void pcap_freecode(struct bpf_program *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_offline_filter(const struct bpf_program *,
+PCAP_API int pcap_offline_filter(const struct bpf_program *,
const struct pcap_pkthdr *, const u_char *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_datalink(pcap_t *);
+PCAP_API int pcap_datalink(pcap_t *);
PCAP_AVAILABLE_1_0
-PCAP_EXPORTED_C_FUNC int pcap_datalink_ext(pcap_t *);
+PCAP_API int pcap_datalink_ext(pcap_t *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_list_datalinks(pcap_t *, int **);
+PCAP_API int pcap_list_datalinks(pcap_t *, int **);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_set_datalink(pcap_t *, int);
+PCAP_API int pcap_set_datalink(pcap_t *, int);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC void pcap_free_datalinks(int *);
+PCAP_API void pcap_free_datalinks(int *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_datalink_name_to_val(const char *);
+PCAP_API int pcap_datalink_name_to_val(const char *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC const char *pcap_datalink_val_to_name(int);
+PCAP_API const char *pcap_datalink_val_to_name(int);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC const char *pcap_datalink_val_to_description(int);
+PCAP_API const char *pcap_datalink_val_to_description(int);
PCAP_AVAILABLE_1_10
-PCAP_EXPORTED_C_FUNC const char *pcap_datalink_val_to_description_or_dlt(int);
+PCAP_API const char *pcap_datalink_val_to_description_or_dlt(int);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_snapshot(pcap_t *);
+PCAP_API int pcap_snapshot(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_is_swapped(pcap_t *);
+PCAP_API int pcap_is_swapped(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_major_version(pcap_t *);
+PCAP_API int pcap_major_version(pcap_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_minor_version(pcap_t *);
+PCAP_API int pcap_minor_version(pcap_t *);
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC int pcap_bufsize(pcap_t *);
+PCAP_API int pcap_bufsize(pcap_t *);
/* XXX */
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC FILE *pcap_file(pcap_t *);
+PCAP_API FILE *pcap_file(pcap_t *);
#ifdef _WIN32
/*
* a Windows-only pcap_handle() API that returns the HANDLE.
*/
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_fileno(pcap_t *)
+PCAP_API int pcap_fileno(pcap_t *)
PCAP_DEPRECATED(pcap_fileno, "use 'pcap_handle'");
#else /* _WIN32 */
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC int pcap_fileno(pcap_t *);
+PCAP_API int pcap_fileno(pcap_t *);
#endif /* _WIN32 */
#ifdef _WIN32
- PCAP_EXPORTED_C_FUNC int pcap_wsockinit(void);
+ PCAP_API int pcap_wsockinit(void);
#endif
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
+PCAP_API pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
#ifdef _WIN32
PCAP_AVAILABLE_0_9
- PCAP_EXPORTED_C_FUNC pcap_dumper_t *pcap_dump_hopen(pcap_t *, intptr_t);
+ 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
#endif
#else /*_WIN32*/
PCAP_AVAILABLE_0_9
- PCAP_EXPORTED_C_FUNC pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
+ PCAP_API pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
#endif /*_WIN32*/
PCAP_AVAILABLE_1_7
-PCAP_EXPORTED_C_FUNC pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
+PCAP_API pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC FILE *pcap_dump_file(pcap_dumper_t *);
+PCAP_API FILE *pcap_dump_file(pcap_dumper_t *);
PCAP_AVAILABLE_0_9
-PCAP_EXPORTED_C_FUNC long pcap_dump_ftell(pcap_dumper_t *);
+PCAP_API long pcap_dump_ftell(pcap_dumper_t *);
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC int64_t pcap_dump_ftell64(pcap_dumper_t *);
+PCAP_API int64_t pcap_dump_ftell64(pcap_dumper_t *);
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC int pcap_dump_flush(pcap_dumper_t *);
+PCAP_API int pcap_dump_flush(pcap_dumper_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC void pcap_dump_close(pcap_dumper_t *);
+PCAP_API void pcap_dump_close(pcap_dumper_t *);
PCAP_AVAILABLE_0_4
-PCAP_EXPORTED_C_FUNC void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
+PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
PCAP_AVAILABLE_0_7
-PCAP_EXPORTED_C_FUNC int pcap_findalldevs(pcap_if_t **, char *);
+PCAP_API int pcap_findalldevs(pcap_if_t **, char *);
PCAP_AVAILABLE_0_7
-PCAP_EXPORTED_C_FUNC void pcap_freealldevs(pcap_if_t *);
+PCAP_API void pcap_freealldevs(pcap_if_t *);
/*
* We return a pointer to the version string, rather than exporting the
* On Windows, the string is constructed at run time.
*/
PCAP_AVAILABLE_0_8
-PCAP_EXPORTED_C_FUNC const char *pcap_lib_version(void);
+PCAP_API const char *pcap_lib_version(void);
#if defined(_WIN32)
typedef struct _AirpcapHandle *PAirpcapHandle;
#endif
- PCAP_EXPORTED_C_FUNC int pcap_setbuff(pcap_t *p, int dim);
- PCAP_EXPORTED_C_FUNC int pcap_setmode(pcap_t *p, int mode);
- PCAP_EXPORTED_C_FUNC int pcap_setmintocopy(pcap_t *p, int size);
+ PCAP_API int pcap_setbuff(pcap_t *p, int dim);
+ PCAP_API int pcap_setmode(pcap_t *p, int mode);
+ PCAP_API int pcap_setmintocopy(pcap_t *p, int size);
- PCAP_EXPORTED_C_FUNC HANDLE pcap_getevent(pcap_t *p);
+ PCAP_API HANDLE pcap_getevent(pcap_t *p);
PCAP_AVAILABLE_1_8
- PCAP_EXPORTED_C_FUNC int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *);
+ PCAP_API int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *);
PCAP_AVAILABLE_1_8
- PCAP_EXPORTED_C_FUNC int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *);
+ PCAP_API int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *);
- PCAP_EXPORTED_C_FUNC pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
+ PCAP_API pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
- PCAP_EXPORTED_C_FUNC void pcap_sendqueue_destroy(pcap_send_queue* queue);
+ PCAP_API void pcap_sendqueue_destroy(pcap_send_queue* queue);
- PCAP_EXPORTED_C_FUNC int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
+ PCAP_API int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
- PCAP_EXPORTED_C_FUNC u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
+ PCAP_API u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
- PCAP_EXPORTED_C_FUNC struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
+ PCAP_API struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
- PCAP_EXPORTED_C_FUNC int pcap_setuserbuffer(pcap_t *p, int size);
+ PCAP_API int pcap_setuserbuffer(pcap_t *p, int size);
- PCAP_EXPORTED_C_FUNC int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
+ PCAP_API int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
- PCAP_EXPORTED_C_FUNC int pcap_live_dump_ended(pcap_t *p, int sync);
+ PCAP_API int pcap_live_dump_ended(pcap_t *p, int sync);
- PCAP_EXPORTED_C_FUNC int pcap_start_oem(char* err_str, int flags);
+ PCAP_API int pcap_start_oem(char* err_str, int flags);
- PCAP_EXPORTED_C_FUNC PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
+ PCAP_API PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
#define MODE_CAPT 0
#define MODE_STAT 1
* MS-DOS definitions
*/
- PCAP_EXPORTED_C_FUNC int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);
- PCAP_EXPORTED_C_FUNC void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);
- PCAP_EXPORTED_C_FUNC u_long pcap_mac_packets (void);
+ PCAP_API int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);
+ PCAP_API void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);
+ PCAP_API u_long pcap_mac_packets (void);
#else /* UN*X */
*/
PCAP_AVAILABLE_0_8
- PCAP_EXPORTED_C_FUNC int pcap_get_selectable_fd(pcap_t *);
+ PCAP_API int pcap_get_selectable_fd(pcap_t *);
PCAP_AVAILABLE_1_9
- PCAP_EXPORTED_C_FUNC const struct timeval *pcap_get_required_select_timeout(pcap_t *);
+ PCAP_API const struct timeval *pcap_get_required_select_timeout(pcap_t *);
#endif /* _WIN32/MSDOS/UN*X */
* API available.
*/
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC pcap_t *pcap_open(const char *source, int snaplen, int flags,
+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_EXPORTED_C_FUNC int pcap_createsrcstr(char *source, int type, const char *host,
+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_EXPORTED_C_FUNC int pcap_parsesrcstr(const char *source, int *type, char *host,
+PCAP_API int pcap_parsesrcstr(const char *source, int *type, char *host,
char *port, char *name, char *errbuf);
/*
* the only API available.
*/
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC int pcap_findalldevs_ex(const char *source,
+PCAP_API int pcap_findalldevs_ex(const char *source,
struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
/*
* New functions.
*/
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC struct pcap_samp *pcap_setsampling(pcap_t *p);
+PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
/*
* RPCAP active mode.
#define RPCAP_HOSTLIST_SIZE 1024
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC SOCKET pcap_remoteact_accept(const char *address, const char *port,
+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_EXPORTED_C_FUNC SOCKET pcap_remoteact_accept_ex(const char *address, const char *port,
+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_EXPORTED_C_FUNC int pcap_remoteact_list(char *hostlist, char sep, int size,
+PCAP_API int pcap_remoteact_list(char *hostlist, char sep, int size,
char *errbuf);
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC int pcap_remoteact_close(const char *host, char *errbuf);
+PCAP_API int pcap_remoteact_close(const char *host, char *errbuf);
PCAP_AVAILABLE_1_9
-PCAP_EXPORTED_C_FUNC void pcap_remoteact_cleanup(void);
+PCAP_API void pcap_remoteact_cleanup(void);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* lib_pcap_pcap_h */
#include "pcap/funcattrs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef HAVE_STRLCAT
#define pcap_strlcat strlcat
#else
/*
* Define it ourselves.
*/
- PCAP_UNEXPORTED_C_FUNC size_t pcap_strlcat(char * restrict dst, const char * restrict src, size_t dstsize);
+ extern size_t pcap_strlcat(char * restrict dst, const char * restrict src, size_t dstsize);
#endif
#endif
/*
* Define it ourselves.
*/
- PCAP_UNEXPORTED_C_FUNC size_t pcap_strlcpy(char * restrict dst, const char * restrict src, size_t dstsize);
+ extern size_t pcap_strlcpy(char * restrict dst, const char * restrict src, size_t dstsize);
#endif
#endif
#ifdef HAVE_ASPRINTF
#define pcap_asprintf asprintf
#else
-PCAP_UNEXPORTED_C_FUNC int pcap_asprintf(char **, PCAP_FORMAT_STRING(const char *), ...)
+extern int pcap_asprintf(char **, PCAP_FORMAT_STRING(const char *), ...)
PCAP_PRINTFLIKE(2, 3);
#endif
#ifdef HAVE_VASPRINTF
#define pcap_vasprintf vasprintf
#else
-PCAP_UNEXPORTED_C_FUNC int pcap_vasprintf(char **, const char *, va_list ap);
+extern int pcap_vasprintf(char **, const char *, va_list ap);
#endif
#ifdef HAVE_STRTOK_R
/*
* Define it ourselves.
*/
- PCAP_UNEXPORTED_C_FUNC char *pcap_strtok_r(char *, const char *, char **);
+ extern char *pcap_strtok_r(char *, const char *, char **);
#endif
#endif /* HAVE_STRTOK_R */
#endif
#endif /* _WIN32 */
+#ifdef __cplusplus
+}
+#endif
+
#endif
#endif
#include "pcap/socket.h"
-#include "pcap/funcattrs.h"
#ifndef _WIN32
/* UN*X */
* MSDN states that this function is available for most versions on Windows.
*/
#if ((defined(__MINGW32__)) && (_WIN32_WINNT < 0x0501))
-PCAP_UNEXPORTED_C_FUNC int WSAAPI getnameinfo(const struct sockaddr*, socklen_t, char*,
- DWORD, char*, DWORD, int);
+int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
+ char*,DWORD,int);
#endif
/*
* \}
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* \defgroup ExportedFunc Exported Functions
*/
* \{
*/
-PCAP_UNEXPORTED_C_FUNC int sock_init(char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC void sock_cleanup(void);
-PCAP_UNEXPORTED_C_FUNC void sock_fmterror(const char *caller, int errcode, char *errbuf,
- int errbuflen);
-PCAP_UNEXPORTED_C_FUNC void sock_geterror(const char *caller, char *errbuf,
- int errbufsize);
-PCAP_UNEXPORTED_C_FUNC int sock_initaddress(const char *address, const char *port,
+int sock_init(char *errbuf, int errbuflen);
+void sock_cleanup(void);
+void sock_fmterror(const char *caller, int errcode, char *errbuf, int errbuflen);
+void sock_geterror(const char *caller, char *errbuf, int errbufsize);
+int sock_initaddress(const char *address, const char *port,
struct addrinfo *hints, struct addrinfo **addrinfo,
char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_recv(SOCKET sock, SSL *, void *buffer, size_t size,
- int receiveall, char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_recv_dgram(SOCKET sock, SSL *, void *buffer, size_t size,
+int sock_recv(SOCKET sock, SSL *, void *buffer, size_t size, int receiveall,
char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC SOCKET sock_open(struct addrinfo *addrinfo, int server,
- int nconn, char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_close(SOCKET sock, char *errbuf, int errbuflen);
-
-PCAP_UNEXPORTED_C_FUNC int sock_send(SOCKET sock, SSL *, const char *buffer, size_t size,
+int sock_recv_dgram(SOCKET sock, SSL *, void *buffer, size_t size,
char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_bufferize(const char *buffer, int size, char *tempbuf,
- int *offset, int totsize, int checkonly, char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_discard(SOCKET sock, SSL *, int size, char *errbuf,
- int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_check_hostlist(char *hostlist, const char *sep,
- struct sockaddr_storage *from, char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_cmpaddr(struct sockaddr_storage *first,
- struct sockaddr_storage *second);
-
-PCAP_UNEXPORTED_C_FUNC int sock_getmyinfo(SOCKET sock, char *address, int addrlen,
- char *port, int portlen, int flags, char *errbuf, int errbuflen);
-
-PCAP_UNEXPORTED_C_FUNC int sock_getascii_addrport(const struct sockaddr_storage *sockaddr,
- char *address, int addrlen, char *port, int portlen, int flags,
+SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen);
+int sock_close(SOCKET sock, char *errbuf, int errbuflen);
+
+int sock_send(SOCKET sock, SSL *, const char *buffer, size_t size,
char *errbuf, int errbuflen);
-PCAP_UNEXPORTED_C_FUNC int sock_present2network(const char *address,
- struct sockaddr_storage *sockaddr, int addr_family, char *errbuf,
- int errbuflen);
+int sock_bufferize(const char *buffer, int size, char *tempbuf, int *offset, int totsize, int checkonly, char *errbuf, int errbuflen);
+int sock_discard(SOCKET sock, SSL *, int size, char *errbuf, int errbuflen);
+int sock_check_hostlist(char *hostlist, const char *sep, struct sockaddr_storage *from, char *errbuf, int errbuflen);
+int sock_cmpaddr(struct sockaddr_storage *first, struct sockaddr_storage *second);
+
+int sock_getmyinfo(SOCKET sock, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, int errbuflen);
+
+int sock_getascii_addrport(const struct sockaddr_storage *sockaddr, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, int errbuflen);
+int sock_present2network(const char *address, struct sockaddr_storage *sockaddr, int addr_family, char *errbuf, int errbuflen);
+
+#ifdef __cplusplus
+}
+#endif
/*
* \}
* to include them, and only intended for use by libpcap developers trying
* to debug the optimizer for filter expressions).
*/
-PCAP_EXPORTED_C_FUNC void pcap_set_optimizer_debug(int);
-PCAP_EXPORTED_C_FUNC void pcap_set_print_dot_graph(int);
+PCAP_API void pcap_set_optimizer_debug(int);
+PCAP_API void pcap_set_print_dot_graph(int);
#endif
static char *program_name;