/*
** Copyright (C) 2001-2008 by Carnegie Mellon University.
**
** @OPENSOURCE_HEADER_START@
**
** Use of the SILK system and related source code is subject to the terms
** of the following licenses:
**
** GNU Public License (GPL) Rights pursuant to Version 2, June 1991
** Government Purpose License Rights (GPLR) pursuant to DFARS 252.225-7013
**
** NO WARRANTY
**
** ANY INFORMATION, MATERIALS, SERVICES, INTELLECTUAL PROPERTY OR OTHER
** PROPERTY OR RIGHTS GRANTED OR PROVIDED BY CARNEGIE MELLON UNIVERSITY
** PURSUANT TO THIS LICENSE (HEREINAFTER THE "DELIVERABLES") ARE ON AN
** "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
** KIND, EITHER EXPRESS OR IMPLIED AS TO ANY MATTER INCLUDING, BUT NOT
** LIMITED TO, WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE,
** MERCHANTABILITY, INFORMATIONAL CONTENT, NONINFRINGEMENT, OR ERROR-FREE
** OPERATION. CARNEGIE MELLON UNIVERSITY SHALL NOT BE LIABLE FOR INDIRECT,
** SPECIAL OR CONSEQUENTIAL DAMAGES, SUCH AS LOSS OF PROFITS OR INABILITY
** TO USE SAID INTELLECTUAL PROPERTY, UNDER THIS LICENSE, REGARDLESS OF
** WHETHER SUCH PARTY WAS AWARE OF THE POSSIBILITY OF SUCH DAMAGES.
** LICENSEE AGREES THAT IT WILL NOT MAKE ANY WARRANTY ON BEHALF OF
** CARNEGIE MELLON UNIVERSITY, EXPRESS OR IMPLIED, TO ANY PERSON
** CONCERNING THE APPLICATION OF OR THE RESULTS TO BE OBTAINED WITH THE
** DELIVERABLES UNDER THIS LICENSE.
**
** Licensee hereby agrees to defend, indemnify, and hold harmless Carnegie
** Mellon University, its trustees, officers, employees, and agents from
** all claims or demands made against them (and any related losses,
** expenses, or attorney's fees) arising out of, or relating to Licensee's
** and/or its sub licensees' negligent use or willful misuse of or
** negligent conduct or willful misconduct regarding the Software,
** facilities, or other rights or assistance granted by Carnegie Mellon
** University under this License, including, but not limited to, any
** claims of product liability, personal injury, death, damage to
** property, or violation of any laws or regulations.
**
** Carnegie Mellon University Software Engineering Institute authored
** documents are sponsored by the U.S. Department of Defense under
** Contract F19628-00-C-0003. Carnegie Mellon University retains
** copyrights in all material produced under this contract. The U.S.
** Government retains a non-exclusive, royalty-free license to publish or
** reproduce these documents, or allow others to do so, for U.S.
** Government purposes only pursuant to the copyright license under the
** contract clause at 252.227.7013.
**
** @OPENSOURCE_HEADER_END@
*/
#if defined(_SILK_CONFIG_H) || !defined(_SILK_H)
#error "Never include silk_config.h directly, include silk.h instead."
#endif
#define _SILK_CONFIG_H

/* we have a bunch of these because not all versions of autoconf
 * support substitutions with embedded newlines */
#include <stdio.h>
#include <sys/types.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <pthread.h>
#include <netinet/in.h>
#include <assert.h>
#include <zlib.h>
#include <lzo1x.h>















/* Path to root directory of packed data files */
#define SILK_DATA_ROOTDIR "/data"


/* Define to 1 build with support for GnuTLS.  Requires the
 * <gnutls/gnutls.h> header file. */
#define SK_ENABLE_GNUTLS 0

/* Define to 1 to build with support for IPFIX.  Requires libfixbuf
 * support and the <fixbuf/public.h> header file. */
#define SK_ENABLE_IPFIX 0

/* Define to 1 to build with support for NetFlow v9.  Requires
 * libfixbuf-0.8.0 support and the <fixbuf/public.h> header file. */
#define SK_ENABLE_NETFLOW9 0

/* Define to 1 to build with support for IPV6 (experimental). */
#define SK_ENABLE_IPV6 0

/* Define to 1 to use the local timezone for command input and
 * printing records; otherwise use UTC. */
#define SK_ENABLE_LOCALTIME 0

/* Define to 1 to build with support for LZO compression.  Requires
 * the <lzo1x.h> header file. */
#define SK_ENABLE_LZO 1

/* Define to 1 build with support for zlib compression.  Requires the
 * <zlib.h> header file. */
#define SK_ENABLE_ZLIB 1


/* Endian macros */
#define IS_LITTLE_ENDIAN 0
#define IS_BIG_ENDIAN 1


/* Name of header with getopt_long_only() */
#define SILK_GETOPT_HEADER_NAME <getopt.h>


#ifdef SILK_CONFIG_H
/* set all the things we only need to set when building */
#include "config.h"

/* Set to an integer describing this version of SiLK */
#define SILK_VERSION_NUMBER 1001001

/* Define to 1 to build with support for IPA. Requires the <ipa/ipa.h>
 * header file. */
#define SK_ENABLE_IPA 0

#if !defined(SK_ENABLE_MPI_CLUSTER)
#  define SK_ENABLE_MPI_CLUSTER 0
#endif


/* Define to the compression method to use by default for binary SiLK
   output files (see silk_files.h for valid methods). */
#define SK_ENABLE_OUTPUT_COMPRESSION SK_COMPMETHOD_NONE


#if	HAVE_SYS_TYPES_H
#  include <sys/types.h>
#endif
#if	HAVE_SYS_STAT_H
#  include <sys/stat.h>
#endif
#if	STDC_HEADERS
#  include <stdlib.h>
#  include <stddef.h>
#else
#  if	HAVE_STDLIB_H
#    include <stdlib.h>
#  endif
#  if	HAVE_MALLOC_H
#    include <malloc.h>
#  endif
#endif
#if	HAVE_STRING_H
#  if	!STDC_HEADERS && HAVE_MEMORY_H
#    include <memory.h>
#  endif
#  include <string.h>
#endif
#if	HAVE_STRINGS_H
#  include <strings.h>
#endif
#if	HAVE_INTTYPES_H
#  include <inttypes.h>
#else
#  if	HAVE_STDINT_H
#    include <stdint.h>
#  endif
#endif
#if	HAVE_UNISTD_H
#  include <unistd.h>
#endif

#if	HAVE_ASSERT_H
#  include <assert.h>
#endif
#if	HAVE_CTYPE_H
#  include <ctype.h>
#endif
#if	HAVE_ERRNO_H
#  include <errno.h>
#endif
#if	HAVE_FCNTL_H
#  include <fcntl.h>
#endif
#if	HAVE_FLOAT_H
#  include <float.h>
#endif
#if	HAVE_LIMITS_H
#  include <limits.h>
#endif
#if	HAVE_MATH_H
#  include <math.h>
#endif
#if	HAVE_NETDB_H
#  include <netdb.h>
#endif
#if	HAVE_PTHREAD_H
#  include <pthread.h>
#endif
#if     HAVE_REGEX_H
#  include <regex.h>
#endif
#if	HAVE_SIGNAL_H
#  include <signal.h>
#endif
#if	HAVE_STDARG_H
#  include <stdarg.h>
#endif
#if	HAVE_SYS_SELECT_H
#  include <sys/select.h>
#endif
#if	HAVE_SYS_SOCKET_H
#  include <sys/socket.h>
#endif
#if	HAVE_NETINET_IN_H
#  include <netinet/in.h>
#endif
#if	HAVE_NETINET_TCP_H
#  include <netinet/tcp.h>
#endif
#if	HAVE_ARPA_INET_H
#  include <arpa/inet.h>
#endif

#if	TIME_WITH_SYS_TIME
#  include <sys/time.h>
#  include <time.h>
#else
#  if	HAVE_SYS_TIME_H
#    include <sys/time.h>
#  else
#    include <time.h>
#  endif
#endif

#if	HAVE_DIRENT_H
#  include <dirent.h>
#else
#  define dirent direct
#  if	HAVE_SYS_NDIR_H
#    include <sys/ndir.h>
#  endif
#  if	HAVE_SYS_DIR_H
#    include <sys/dir.h>
#  endif
#  if	HAVE_NDIR_H
#    include <ndir.h>
#  endif
#endif

#if	HAVE_SYS_MMAN_H
#  include <sys/mman.h>
#endif
#if	HAVE_SYS_RESOURCE_H
#  include <sys/resource.h>
#endif
#if	HAVE_SYS_WAIT_H
#  include <sys/wait.h>
#endif
#if	HAVE_SYS_UIO_H
#  include <sys/uio.h>
#endif

/* Maxima */
#if !defined(INT8_MAX)
#  define  INT8_MAX          127
#endif
#if !defined(UINT8_MAX)
#  define UINT8_MAX          255U
#endif
#if !defined(INT16_MAX)
#  define  INT16_MAX       32767
#endif
#if !defined(UINT16_MAX)
#  define UINT16_MAX       65535U
#endif
#if !defined(INT32_MAX)
#  define  INT32_MAX   2147483647
#endif
#if !defined(UINT32_MAX)
#  define UINT32_MAX   4294967295U
#endif
#if !defined(INT64_MAX)
#  if (SIZEOF_UNSIGNED_LONG_LONG >= 8)
#    define  INT64_MAX     9223372036854775807LL
#  else
#    if (SIZEOF_LONG >= 8)
#      define  INT64_MAX   9223372036854775807L
#    endif
#  endif
#endif
#if !defined(UINT64_MAX)
#  if (SIZEOF_UNSIGNED_LONG_LONG >= 8)
#    define UINT64_MAX    18446744073709551615ULL
#  else
#    if (SIZEOF_LONG >= 8)
#      define UINT64_MAX  18446744073709551615UL
#    endif
#  endif
#endif

#if !defined(ULLONG_MAX)
#  if (SIZEOF_UNSIGNED_LONG_LONG == 8)
#    define ULLONG_MAX UINT64_MAX
#  endif
#endif

/* PRI* macros for printing */
#if !defined(PRIu32)
/* Assume we either get them all or get none of them. */
#  define PRId32 "d"
#  define PRIi32 "i"
#  define PRIo32 "o"
#  define PRIu32 "u"
#  define PRIx32 "x"
#  define PRIX32 "X"

#  define PRId16 PRId32
#  define PRIi16 PRIi32
#  define PRIo16 PRIo32
#  define PRIu16 PRIu32
#  define PRIx16 PRIx32
#  define PRIX16 PRIX32

#  define PRId8  PRId32
#  define PRIi8  PRIi32
#  define PRIo8  PRIo32
#  define PRIu8  PRIu32
#  define PRIx8  PRIx32
#  define PRIX8  PRIX32
#endif /* !defined(PRIU32) */
#if !defined(PRIu64)
#  if (SIZEOF_LONG >= 8)
#    define PRId64 "l" PRId32
#    define PRIi64 "l" PRIi32
#    define PRIo64 "l" PRIo32
#    define PRIu64 "l" PRIu32
#    define PRIx64 "l" PRIx32
#    define PRIX64 "l" PRIX32
#  else
#    define PRId64 "ll" PRId32
#    define PRIi64 "ll" PRIi32
#    define PRIo64 "ll" PRIo32
#    define PRIu64 "ll" PRIu32
#    define PRIx64 "ll" PRIx32
#    define PRIX64 "ll" PRIX32
#  endif
#endif /* !defined(PRIu64) */


/* Functions and types from C99 that we require */
#ifndef HAVE_INTMAX_T
typedef int64_t intmax_t;
#endif
#ifndef HAVE_IMAXDIV_T
typedef struct imaxdiv_st {
    intmax_t quot; /* Quotient  */
    intmax_t rem;  /* Remainder */
} imaxdiv_t;
#endif

#ifndef HAVE_IMAXDIV
#  define imaxdiv sk_imaxdiv
#endif
#ifndef HAVE_MEMCCPY
#  define memccpy sk_memccpy
#endif
#ifndef HAVE_STRSEP
#  define strsep sk_strsep
#endif
#ifndef HAVE_TIMEGM
#  define timegm sk_timegm
#endif


/* various IP protocols */
#ifndef IPPROTO_ICMP
#  define IPPROTO_ICMP    1
#endif
#ifndef IPPROTO_TCP
#  define IPPROTO_TCP     6
#endif
#ifndef IPPROTO_UDP
#  define IPPROTO_UDP    17
#endif


#endif /* SILK_CONFIG_H */


/* Wrap UNUSED() around unused parameters to silence gcc -W */
#ifdef __GNUC__
#define UNUSED(var) /*@unused@*/ var __attribute__((__unused__))
#define SK_CHECK_PRINTF(fmt_pos, argv1_pos)                        \
    __attribute__((format (printf, fmt_pos, argv1_pos)))
#else
#define UNUSED(var) /*@unused@*/ var
#define SK_CHECK_PRINTF(fmt_pos, argv1)
#endif

/*
 *  Create a variable for magic RCS variables: Define 'var' to be the
 *  string in 'id'.  Can be used in header, keep 'var's unique.  Use:
 *  RCSIDENTVAR(myheader, "$Magic RCS Var$");
 */
#ifndef HAVE_COMP_ATTRIBUTE_USED
#define RCSIDENTVAR(var, id) \
    static const char /*@observer@*/ UNUSED(* var) = (id)
#else
/*
 *  Have RCSIDENTVAR() mark the variables as "used" so GCC doesn't
 *  strip them.
 */
#define RCSIDENTVAR(var, id) \
    static const char /*@observer@*/ /*@unused@*/ * var __attribute__((__used__)) = (id)
#endif /* HAVE_COMP_ATTRIBUTE_USED */

/*
 *  As above, except for C files since 'var' can be fixed.
 */
#define RCSIDENT(id) RCSIDENTVAR(_rcsID, (id))


RCSIDENTVAR(rcsID_SILK_CONFIG_H, "$SiLK: silk_config.h.in 12149 2008-08-01 22:05:15Z mthomas $");


/*
** Local Variables:
** mode:c
** indent-tabs-mode:nil
** c-basic-offset:4
** End:
*/
