/*===========================================================================*
 * @(#) $Name: arts++-1-1-a12 $ $Id: caida_t.h.in,v 1.1.1.1 2002/11/16 00:46:41 rkoga Exp $
 *===========================================================================*
 *  This header file is basically the equivalent of the fixed-width types in
 *  <inttypes.h> in the new ISO C working draft (Working Draft 1997-11-21,
 *  WG14/N794 J11/97-158), but for today's compilers (February 1998) and
 *  generated by autoconf so I can ship it around to various platforms.
 *  I've also added ipv4addr_t here, since CAIDA frequently needs to deal
 *  with IPv4 addresses.  It's worth noting that an ipv4addr_t value should
 *  always be in network byte order, regardless of a platform's endianness,
 *  which makes it distinct from an uint32_t.
 *
 *  Daniel McRobb <dwm@caida.org>
 *===========================================================================*/

/*===========================================================================*
 *  Copyright Notice
 *
 *  By accessing this software, arts++, you are duly informed
 *  of and agree to be bound by the conditions described below in this
 *  notice:
 *
 *  This software product, arts++, is developed by Daniel W. McRobb, and
 *  copyrighted(C) 1998 by the University of California, San Diego
 *  (UCSD), with all rights reserved.  UCSD administers the CAIDA grant,
 *  NCR-9711092, under which part of this code was developed.
 *
 *  There is no charge for arts++ software.  You can redistribute it
 *  and/or modify it under the terms of the GNU Lesser General Public
 *  License, Version 2.1, February 1999, which is incorporated by
 *  reference herein.
 *
 *  arts++ is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF
 *  MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use
 *  of it will not infringe on any third party's intellectual
 *  property rights.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with arts++.  Copies can also be obtained from:
 *
 *    http://www.gnu.org/copyleft/lesser.html
 *
 *  or by writing to:
 *
 *  Free Software Foundation, Inc.
 *  59 Temple Place, Suite 330
 *  Boston, MA 02111-1307
 *  USA
 *
 *  Or contact:
 *
 *    info@caida.org
 *===========================================================================*/

#ifndef _CAIDA_T_H_
#define _CAIDA_T_H_

#include <sys/types.h>

#undef HAVE_SYS_FILIO_H

#define HAVE_MACHINE_TYPES_H  0
#define HAVE_INTTYPES_H       0

#define HAVE_INT8_T    0
#define HAVE_INT16_T   0
#define HAVE_INT32_T   0
#define HAVE_INT64_T   0
#define HAVE_UINT8_T   0
#define HAVE_UINT16_T  0
#define HAVE_UINT32_T  0
#define HAVE_UINT64_T  0

#if (HAVE_INTTYPES_H == 1)
  #include <inttypes.h>
#endif

#if (HAVE_MACHINE_TYPES_H == 1)
  #include <machine/types.h>
#endif

#define SIZEOF_UNSIGNED_SHORT       0
#define SIZEOF_UNSIGNED_INT         0
#define SIZEOF_UNSIGNED_LONG        0
#define SIZEOF_UNSIGNED_LONG_LONG   0

#define SIZEOF_SHORT           0
#define SIZEOF_INT             0
#define SIZEOF_LONG            0
#define SIZEOF_LONG_LONG       0

#if (HAVE_UINT8_T == 0)
  typedef unsigned char   uint8_t;
#endif

#if (HAVE_INT8_T == 0)
  typedef char            int8_t;
#endif

#if (HAVE_UINT16_T == 0)
  #if (SIZEOF_UNSIGNED_SHORT == 2)
    typedef unsigned short  uint16_t;
  #endif
#endif

#if (HAVE_INT16_T == 0)
  #if (SIZEOF_SHORT == 2)
    typedef short           int16_t;
  #endif
#endif

#if (HAVE_UINT32_T == 0)
  #if (SIZEOF_UNSIGNED_INT == 4)
    typedef unsigned int    uint32_t;
  #elif (SIZEOF_UNSIGNED_LONG == 4)
    typedef unsigned long   uint32_t;
  #endif
#endif

typedef uint32_t  ipv4addr_t;

#if (HAVE_INT32_T == 0)
  #if (SIZEOF_INT == 4)
    typedef int             int32_t;
  #elif (SIZEOF_LONG == 4)
    typedef long            int32_t;
  #endif
#endif

#if (HAVE_UINT64_T == 0)
  #if (SIZEOF_UNSIGNED_LONG_LONG == 8)
    typedef unsigned long long  uint64_t;
  #endif
#endif

#if (HAVE_INT64_T == 0)
  #if (SIZEOF_LONG_LONG == 8)
    typedef long long       int64_t;
  #endif
#endif

#endif  /* _CAIDA_T_H_  */
