
#ifndef DEFS_H_
#define DEFS_H_
#include "config.h"
/*XXX*/
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <errno.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#include <signal.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_H_IOCTL_H
#include <h/ioctl.h>
#else
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#endif
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>

#ifndef __P
#ifdef __STDC__
#define __P(x)	x
#else
#define __P(x)	()
#endif
#endif



/*
 * Miscellaneous constants and macros.
 */
#define FALSE		0
#define TRUE		1

#define EQUAL(s1, s2)	(strcmp((s1), (s2)) == 0)

#define TIMER_INTERVAL	ROUTE_MAX_REPORT_DELAY



/* obnoxious gcc gives an extraneous warning about this constant... */
#if defined(__STDC__) || defined(__GNUC__)
#define JAN_1970	2208988800UL	/* 1970 - 1900 in seconds */
#else
#define JAN_1970	2208988800L	/* 1970 - 1900 in seconds */
#define const		/**/
#endif

#ifndef HAVE_BCOPY
#define bcopy(a, b, c)	memcpy(b, a, c)
#endif
#ifndef HAVE_BCMP
#define bcmp(a, b, c)	memcmp(a, b, c)
#endif
#ifndef HAVE_BZERO
#define bzero(s, n) 	memset((s), 0, (n))
#endif
#ifndef HAVE_SETLINEBUF
#define setlinebuf(s)	setvbuf(s, NULL, _IOLBF, 0)
#endif
#ifdef HAVE_SIGNAL_SYSV
#define signal(s,f)	sigset(s,f)
#endif


#if !(defined(BSD) && (BSD >= 199103))
extern int		errno;
#endif

#ifndef int32
#define int32 long
#endif
typedef unsigned int32 u_int32;
typedef int boolean;
typedef unsigned char byte;

#ifndef FD_SET

typedef int32   fd_mask;
#define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */

#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p)      bzero((char *)(p), sizeof(*(p)))
#endif

#endif
