That lets us use any of them in public declarations, if we ever need to.
ethertype.h \
extract.h \
ftmacros.h \
- funcattrs.h \
gencode.h \
ieee80211.h \
llc.h \
+++ /dev/null
-/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996, 1997
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Computer Systems
- * Engineering Group at Lawrence Berkeley Laboratory.
- * 4. Neither the name of the University nor of the Laboratory may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lib_funcattrs_h
-#define lib_funcattrs_h
-
-/*
- * Attributes to apply to functions and their arguments, using various
- * compiler-specific extensions.
- */
-
-/*
- * This was introduced by Clang:
- *
- * http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
- *
- * in some version (which version?); it has been picked up by GCC 5.0.
- */
-#ifndef __has_attribute
- /*
- * It's a macro, so you can check whether it's defined to check
- * whether it's supported.
- *
- * If it's not, define it to always return 0, so that we move on to
- * the fallback checks.
- */
- #define __has_attribute(x) 0
-#endif
-
-/*
- * PCAP_NORETURN, before a function declaration, means "this function
- * never returns". (It must go before the function declaration, e.g.
- * "extern PCAP_NORETURN func(...)" rather than after the function
- * declaration, as the MSVC version has to go before the declaration.)
- */
-#if __has_attribute(noreturn) \
- || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
- || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) \
- || (defined(__xlC__) && __xlC__ >= 0x0A01) \
- || (defined(__HP_aCC) && __HP_aCC >= 61000)
- /*
- * Compiler with support for __attribute((noreturn)), or GCC 2.5 and
- * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
- * and later (do any earlier versions of XL C support this?), or
- * HP aCC A.06.10 and later.
- */
- #define PCAP_NORETURN __attribute((noreturn))
-#elif defined(_MSC_VER)
- /*
- * MSVC.
- */
- #define PCAP_NORETURN __declspec(noreturn)
-#else
- #define PCAP_NORETURN
-#endif
-
-/*
- * PCAP_PRINTFLIKE(x,y), after a function declaration, means "this function
- * does printf-style formatting, with the xth argument being the format
- * string and the yth argument being the first argument for the format
- * string".
- */
-#if __has_attribute(__format__) \
- || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)) \
- || (defined(__xlC__) && __xlC__ >= 0x0A01) \
- || (defined(__HP_aCC) && __HP_aCC >= 61000)
- /*
- * Compiler with support for it, or GCC 2.3 and later, or IBM XL C 10.1
- * and later (do any earlier versions of XL C support this?),
- * or HP aCC A.06.10 and later.
- */
- #define PCAP_PRINTFLIKE(x,y) __attribute__((__format__(__printf__,x,y)))
-#else
- #define PCAP_PRINTFLIKE(x,y)
-#endif
-
-/*
- * For flagging arguments as format strings in MSVC.
- */
-#if _MSC_VER >= 1400
- #include <sal.h>
- #if _MSC_VER > 1400
- #define PCAP_FORMAT_STRING(p) _Printf_format_string_ p
- #else
- #define PCAP_FORMAT_STRING(p) __format_string p
- #endif
-#else
- #define PCAP_FORMAT_STRING(p) p
-#endif
-
-#endif /* lib_funcattrs_h */
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include "funcattrs.h"
+#include "pcap/funcattrs.h"
/*
* ATM support:
#ifndef lib_pcap_funcattrs_h
#define lib_pcap_funcattrs_h
+/*
+ * Attributes to apply to functions and their arguments, using various
+ * compiler-specific extensions.
+ */
+
/*
* PCAP_API_DEF must be used when defining *data* exported from
* libpcap. It can be used when defining *functions* exported
* exported from libpcap; PCAP_API_DEF won't work on all platforms.
*/
+/*
+ * This was introduced by Clang:
+ *
+ * http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
+ *
+ * in some version (which version?); it has been picked up by GCC 5.0.
+ */
+#ifndef __has_attribute
+ /*
+ * It's a macro, so you can check whether it's defined to check
+ * whether it's supported.
+ *
+ * If it's not, define it to always return 0, so that we move on to
+ * the fallback checks.
+ */
+ #define __has_attribute(x) 0
+#endif
+
/*
* Check whether this is GCC major.minor or a later release, or some
* compiler that claims to be "just like GCC" of that version or a
* shared library by default, so we might have to explicitly mark
* functions as exported.
*/
- #if IS_AT_LEAST_GNUC_VERSION(3, 4)
+ #if IS_AT_LEAST_GNUC_VERSION(3, 4) \
+ || (defined(__xlC__) && __xlC__ >= 0x0C00)
/*
* GCC 3.4 or later, or some compiler asserting compatibility with
- * GCC 3.4 or later, so we have __attribute__((visibility()).
+ * GCC 3.4 or later, or XL C 13.0 or later, so we have
+ * __attribute__((visibility()).
*/
#define PCAP_API_DEF __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define PCAP_API PCAP_API_DEF extern
+/*
+ * PCAP_NORETURN, before a function declaration, means "this function
+ * never returns". (It must go before the function declaration, e.g.
+ * "extern PCAP_NORETURN func(...)" rather than after the function
+ * declaration, as the MSVC version has to go before the declaration.)
+ */
+#if __has_attribute(noreturn) \
+ || IS_AT_LEAST_GNUC_VERSION(2, 5) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) \
+ || (defined(__xlC__) && __xlC__ >= 0x0A01) \
+ || (defined(__HP_aCC) && __HP_aCC >= 61000)
+ /*
+ * Compiler with support for __attribute((noreturn)), or GCC 2.5 and
+ * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
+ * and later (do any earlier versions of XL C support this?), or
+ * HP aCC A.06.10 and later.
+ */
+ #define PCAP_NORETURN __attribute((noreturn))
+#elif defined(_MSC_VER)
+ /*
+ * MSVC.
+ */
+ #define PCAP_NORETURN __declspec(noreturn)
+#else
+ #define PCAP_NORETURN
+#endif
+
+/*
+ * PCAP_PRINTFLIKE(x,y), after a function declaration, means "this function
+ * does printf-style formatting, with the xth argument being the format
+ * string and the yth argument being the first argument for the format
+ * string".
+ */
+#if __has_attribute(__format__) \
+ || IS_AT_LEAST_GNUC_VERSION(2, 3) \
+ || (defined(__xlC__) && __xlC__ >= 0x0A01) \
+ || (defined(__HP_aCC) && __HP_aCC >= 61000)
+ /*
+ * Compiler with support for it, or GCC 2.3 and later, or IBM XL C 10.1
+ * and later (do any earlier versions of XL C support this?),
+ * or HP aCC A.06.10 and later.
+ */
+ #define PCAP_PRINTFLIKE(x,y) __attribute__((__format__(__printf__,x,y)))
+#else
+ #define PCAP_PRINTFLIKE(x,y)
+#endif
+
+/*
+ * For flagging arguments as format strings in MSVC.
+ */
+#if _MSC_VER >= 1400
+ #include <sal.h>
+ #if _MSC_VER > 1400
+ #define PCAP_FORMAT_STRING(p) _Printf_format_string_ p
+ #else
+ #define PCAP_FORMAT_STRING(p) __format_string p
+ #endif
+#else
+ #define PCAP_FORMAT_STRING(p) p
+#endif
+
#endif /* lib_pcap_funcattrs_h */
* flavors of UN*X.
*/
-#include "funcattrs.h"
+#include "pcap/funcattrs.h"
#ifdef __cplusplus
extern "C" {
#include <pcap.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
static const char *program_name;
#include <pcap.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
static char *program_name;
#include <sys/types.h>
#include <sys/stat.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
static char *program_name;
#include <pcap.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
static int ifprint(pcap_if_t *d);
static char *iptos(bpf_u_int32 in);
#endif
#include <errno.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
#define MAXIMUM_SNAPLEN 65535
#include <string.h>
#include <stdarg.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
/* Forwards */
static void error(const char *, ...);
#endif
#include <poll.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
char *program_name;
#include <sys/types.h>
#include <sys/stat.h>
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
/* BSD-flavored OS - use BPF */