#ifndef NTP_MACHINE_H
#define NTP_MACHINE_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include "ntp_proto.h"
#if !defined(HAVE_NTP_ADJTIME) && defined(HAVE___ADJTIMEX)
# define ntp_adjtime __adjtimex
#endif
#if 0
#if defined(SYS_IRIX4)||defined(SYS_IRIX5)
# define ADJTIME_IS_ACCURATE
# define LOCK_PROCESS
#endif
#if defined(SYS_ULTRIX)
# define S_CHAR_DEFINED
# define NTP_SYSCALLS_STD
# define HAVE_MODEM_CONTROL
#endif
#if defined(SYS_AUX2) || defined(SYS_AUX3)
# define NO_SIGNED_CHAR_DECL
# define LOCK_PROCESS
# define NTP_POSIX_SOURCE
# define LOG_NTP LOG_LOCAL1
#endif
#if defined(SYS_HPUX)
# define getdtablesize() sysconf(_SC_OPEN_MAX)
# define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0)
# define NO_SIGNED_CHAR_DECL
# define LOCK_PROCESS
#endif
#if defined(SYS_BSDI)
# define USE_FSETOWNCTTY
#endif
#ifdef SYS_FREEBSD
# define KERNEL_PLL
#endif
#if defined(SYS_LINUX)
# define ntp_adjtime __adjtimex
#endif
#if defined(SYS_PTX)
# define LOCK_PROCESS
struct timezone { int __0; };
typedef unsigned int u_int;
# ifndef _NETINET_IN_SYSTM_INCLUDED
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
# endif
#endif
#if defined(SYS_SVR4)
# define STREAM
# define LOCK_PROCESS
# define SIZE_RETURNED_IN_BUFFER
#endif
#if defined(SYS_UNIXWARE1)
# define STREAM
# define STREAMS
# undef STEP_SLEW
# define LOCK_PROCESS
# define SIZE_RETURNED_IN_BUFFER
# include <sys/sockio.h>
# include <sys/types.h>
# include <netinet/in_systm.h>
#endif
#if defined(SYS_DOMAINOS)
# define NTP_SYSCALLS_STD
# ifndef IN_CLASSD
# define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
# define IN_CLASSD_NET 0xf0000000
# define IN_CLASSD_NSHIFT 28
# define IN_CLASSD_HOST 0xfffffff
# define IN_MULTICAST(i) IN_CLASSD(i)
# endif
#endif
#if defined(SYS_UXPV)
# define LOCK_PROCESS
# define SIZE_RETURNED_IN_BUFFER
#endif
#endif
#ifndef SYS_WINNT
typedef int SOCKET;
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
# define closesocket(fd) close(fd)
#endif
int ntp_set_tod (struct timeval *tvp, void *tzp);
#if defined (SYS_CYGWIN32)
#include <windows.h>
#define __int64 long long
#endif
#ifdef SYS_VXWORKS
#define NO_MAIN_ALLOWED 1
#define NO_NETDB 1
#define NO_RENAME 1
#define USE_FIONBIO 1
#define TIMEOFDAY 0x0
#define HAVE_GETCLOCK 1
#define HAVE_NO_NICE 1
#define HAVE_RANDOM 1
#define HAVE_SRANDOM 1
#define NODETACH 1
#include "vxWorks.h"
#include "ioLib.h"
#include "taskLib.h"
#include "time.h"
extern int sysClkRateGet ();
extern void sleep (int seconds);
extern void alarm (int seconds);
#define getpid taskIdSelf
#define getclock clock_gettime
#define fcntl ioctl
#define _getch getchar
#define openlog(x,y)
#undef min
#undef max
#endif
#ifdef NO_NETDB
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
#define h_addr h_addr_list[0]
};
struct servent {
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
extern int h_errno;
#define TRY_AGAIN 2
struct hostent *gethostbyname (char * netnum);
struct hostent *gethostbyaddr (char * netnum, int size, int addr_type);
struct servent *getservbyname (char *name, char *type);
#endif
#ifdef NO_MAIN_ALLOWED
#define CALL(callname, progname, callmain) \
extern int callmain (int,char**); \
void callname (a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
char *a0; \
char *a1; \
char *a2; \
char *a3; \
char *a4; \
char *a5; \
char *a6; \
char *a7; \
char *a8; \
char *a9; \
char *a10; \
{ \
char *x[11]; \
int argc; \
char *argv[] = {progname,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; \
int i; \
for (i=0;i<11;i++) \
x[i] = NULL; \
x[0] = a0; \
x[1] = a1; \
x[2] = a2; \
x[3] = a3; \
x[4] = a4; \
x[5] = a5; \
x[6] = a6; \
x[7] = a7; \
x[8] = a8; \
x[9] = a9; \
x[10] = a10; \
argc=1; \
for (i=0; i<11;i++) \
if (x[i]) \
{ \
argv[argc++] = x[i]; \
} \
callmain(argc,argv); \
}
#endif
#ifdef HAVE_SYS_STROPTS_H
# ifdef HAVE_SYS_STREAM_H
# define STREAM
# endif
#endif
#ifndef RETSIGTYPE
# if defined(NTP_POSIX_SOURCE)
# define RETSIGTYPE void
# else
# define RETSIGTYPE int
# endif
#endif
#ifdef NTP_SYSCALLS_STD
# ifndef NTP_SYSCALL_GET
# define NTP_SYSCALL_GET 235
# endif
# ifndef NTP_SYSCALL_ADJ
# define NTP_SYSCALL_ADJ 236
# endif
#endif
#ifdef MPE
# include <sys/types.h>
# include <netinet/in.h>
# include <stdio.h>
# include <time.h>
# define _getch getchar
# define bind __ntp_mpe_bind
# define fcntl __ntp_mpe_fcntl
# define IN_CLASSD(i) ((((long)(i))&0xf0000000)==0xe0000000)
# define IN_MULTICAST IN_CLASSD
# define ITIMER_REAL 0
# define MAXHOSTNAMELEN 64
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
extern int __filbuf(FILE *);
extern int __flsbuf(int, FILE *);
extern int gethostname(char *, int);
extern unsigned long inet_addr(char *);
extern char *strdup(const char *);
# define HAVE_NO_NICE
#endif
#ifdef HAVE_RTPRIO
# define HAVE_NO_NICE
#else
# ifdef HAVE_SETPRIORITY
# define HAVE_BSD_NICE
# else
# ifdef HAVE_NICE
# define HAVE_ATT_NICE
# endif
# endif
#endif
#if !defined(HAVE_ATT_NICE) \
&& !defined(HAVE_BSD_NICE) \
&& !defined(HAVE_NO_NICE)
#include "ERROR: You must define one of the HAVE_xx_NICE defines!"
#endif
#ifdef HAVE_TERMIOS_H
# define HAVE_TERMIOS
#else
# ifdef HAVE_TERMIO_H
# define HAVE_SYSV_TTYS
# else
# ifdef HAVE_SGTTY_H
# define HAVE_BSD_TTYS
# endif
# endif
#endif
#ifdef HAVE_TERMIOS
# undef HAVE_BSD_TTYS
# undef HAVE_SYSV_TTYS
#endif
#ifndef HAVE_TIMEGM
extern time_t timegm (struct tm *);
#endif
#ifdef HAVE_SYSV_TTYS
# undef HAVE_BSD_TTYS
#endif
#if !defined(SYS_WINNT) && !defined(VMS) && !defined(SYS_VXWORKS)
# if !defined(HAVE_SYSV_TTYS) \
&& !defined(HAVE_BSD_TTYS) \
&& !defined(HAVE_TERMIOS)
#include "ERROR: no tty type defined!"
# endif
#endif
#ifdef WORDS_BIGENDIAN
# define XNTP_BIG_ENDIAN 1
#else
# define XNTP_LITTLE_ENDIAN 1
#endif
#if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN)
BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION
#endif
#if defined(XNTP_BIG_ENDIAN) && defined(XNTP_LITTLE_ENDIAN)
BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION
#endif
#endif