diff options
author | roberto <roberto@FreeBSD.org> | 1999-12-22 15:24:45 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 1999-12-22 15:24:45 +0000 |
commit | 07fa87617ade0f00e9d60fa4b1079cac165d6059 (patch) | |
tree | daf1c2e9a599e9dfc97305d8b5252e8630bea9b9 /usr.sbin/xntpd/include | |
parent | 5960602b89278a9a46eb40f3716de826681c1072 (diff) | |
download | FreeBSD-src-07fa87617ade0f00e9d60fa4b1079cac165d6059.zip FreeBSD-src-07fa87617ade0f00e9d60fa4b1079cac165d6059.tar.gz |
Bye bye xntpd.
Diffstat (limited to 'usr.sbin/xntpd/include')
35 files changed, 0 insertions, 6129 deletions
diff --git a/usr.sbin/xntpd/include/README b/usr.sbin/xntpd/include/README deleted file mode 100644 index 73d0620..0000000 --- a/usr.sbin/xntpd/include/README +++ /dev/null @@ -1,21 +0,0 @@ -README file for directory ./include of the NTP Version 3 distribution - -This directory contains the include files used by most programs in this -distribution. The ./sys directory in this directory contains system -header files used by the clock discipline and STREAMS modules in the -../kernel directory. - -Note that multicast support (MCAST define) requires the header file -/usr/include/netinet/in.h for the particular architecture to be in place. -This file is constructed during the installation process in older systems; -it is already in place for those machines that support multicast ex box. -The file in.h included in this distribution is for Suns; the files for -other systems can be found in the multicast distribtutions for each -architecture separately. - -If the precision-time kernel (KERNEL_PLL define) is configured, the -installation process requires the header file /usr/include/sys/timex.h -for the particular architecture to be in place. The file timex.h included -in this distribution is for Suns; the files for other systems can be -found in the kernel distributions available from the manufacturer's -representatives. diff --git a/usr.sbin/xntpd/include/in.h b/usr.sbin/xntpd/include/in.h deleted file mode 100644 index c18d569..0000000 --- a/usr.sbin/xntpd/include/in.h +++ /dev/null @@ -1,256 +0,0 @@ -/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* - * Constants and structures defined by the internet system, - * Per RFC 790, September 1981. - */ - -#ifndef _netinet_in_h -#define _netinet_in_h - -/* - * Protocols - */ -#define IPPROTO_IP 0 /* dummy for IP */ -#define IPPROTO_ICMP 1 /* control message protocol */ -#define IPPROTO_IGMP 2 /* group control protocol */ -#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ -#define IPPROTO_ST 5 /* st */ -#define IPPROTO_TCP 6 /* tcp */ -#define IPPROTO_EGP 8 /* exterior gateway protocol */ -#define IPPROTO_PUP 12 /* pup */ -#define IPPROTO_UDP 17 /* user datagram protocol */ -#define IPPROTO_IDP 22 /* xns idp */ -#define IPPROTO_HELLO 63 /* "hello" routing protocol */ -#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ -#define IPPROTO_OSPF 89 /* Open SPF IGP */ - -#define IPPROTO_RAW 255 /* raw IP packet */ -#define IPPROTO_MAX 256 - -/* - * Port/socket numbers: network standard functions - */ -#define IPPORT_ECHO 7 -#define IPPORT_DISCARD 9 -#define IPPORT_SYSTAT 11 -#define IPPORT_DAYTIME 13 -#define IPPORT_NETSTAT 15 -#define IPPORT_FTP 21 -#define IPPORT_TELNET 23 -#define IPPORT_SMTP 25 -#define IPPORT_TIMESERVER 37 -#define IPPORT_NAMESERVER 42 -#define IPPORT_WHOIS 43 -#define IPPORT_MTP 57 - -/* - * Port/socket numbers: host specific functions - */ -#define IPPORT_TFTP 69 -#define IPPORT_RJE 77 -#define IPPORT_FINGER 79 -#define IPPORT_TTYLINK 87 -#define IPPORT_SUPDUP 95 - -/* - * UNIX TCP sockets - */ -#define IPPORT_EXECSERVER 512 -#define IPPORT_LOGINSERVER 513 -#define IPPORT_CMDSERVER 514 -#define IPPORT_EFSSERVER 520 - -/* - * UNIX UDP sockets - */ -#define IPPORT_BIFFUDP 512 -#define IPPORT_WHOSERVER 513 -#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ - -/* - * Ports < IPPORT_RESERVED are reserved for - * privileged processes (e.g. root). - * Ports > IPPORT_USERRESERVED are reserved - * for servers, not necessarily privileged. - */ -#define IPPORT_RESERVED 1024 -#define IPPORT_USERRESERVED 5000 - -/* - * Link numbers - */ -#define IMPLINK_IP 155 -#define IMPLINK_LOWEXPER 156 -#define IMPLINK_HIGHEXPER 158 - -/* - * Internet address - * This definition contains obsolete fields for compatibility - * with SunOS 3.x and 4.2bsd. The presence of subnets renders - * divisions into fixed fields misleading at best. New code - * should use only the s_addr field. - */ -struct in_addr { - union { - struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; - struct { u_short s_w1,s_w2; } S_un_w; - u_long S_addr; - } S_un; -#define s_addr S_un.S_addr /* should be used for all code */ -#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ -#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ -#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ -#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ -#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ -}; - -/* - * Definitions of bits in internet address integers. - * On subnets, the decomposition of addresses to host and net parts - * is done according to subnet mask, not the masks here. - */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ -#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ -#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) - -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_LOOPBACK (u_long)0x7F000001 -#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ - -#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ -#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ - -#define IN_LOOPBACKNET 127 /* official! */ - -/* - * Define a macro to stuff the loopback address into an Internet address - */ -#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ - (a)->sin_family = AF_INET;} - -/* - * Socket address, internet style. - */ -struct sockaddr_in { - short sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; - -/* - * Options for use with [gs]etsockopt at the IP level. - */ -#define IP_OPTIONS 1 /* set/get IP per-packet options */ -#define IP_MULTICAST_IF 2 /* set/get IP multicast interface */ -#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive */ -#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */ -#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */ -#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */ - -#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ -#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ -#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ - -/* - * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. - */ -struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; - -#if !defined(vax) && !defined(ntohl) && !defined(i386) -/* - * Macros for number representation conversion. - */ -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) -#endif - -#if !defined(ntohl) && (defined(vax) || defined(i386)) -u_short ntohs(), htons(); -u_long ntohl(), htonl(); -#endif - -#ifdef KERNEL -extern struct domain inetdomain; -extern struct protosw inetsw[]; -struct in_addr in_makeaddr(); -u_long in_netof(), in_lnaof(); -#endif - -#ifndef BYTE_ORDER -/* - * Definitions for byte order, - * according to byte significance from low address to high. - */ -#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ -#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ - -#if defined(vax) || defined(i386) -#define BYTE_ORDER LITTLE_ENDIAN -#else -#define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ -#endif -#endif BYTE_ORDER - -/* - * Macros for number representation conversion. - */ -#if BYTE_ORDER==LITTLE_ENDIAN -#define NTOHL(d) ((d) = ntohl((d))) -#define NTOHS(d) ((d) = ntohs((d))) -#define HTONL(d) ((d) = htonl((d))) -#define HTONS(d) ((d) = htons((d))) -#else -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) -#define NTOHL(d) -#define NTOHS(d) -#define HTONL(d) -#define HTONS(d) -#endif - -#endif /*!_netinet_in_h*/ diff --git a/usr.sbin/xntpd/include/l_stdlib.h b/usr.sbin/xntpd/include/l_stdlib.h deleted file mode 100644 index 221682e..0000000 --- a/usr.sbin/xntpd/include/l_stdlib.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Proto types for machines that are not ANSI and POSIX compliant. - * This is optionaly - */ - -#ifndef _l_stdlib_h -#define _l_stdlib_h - -#if defined(NTP_POSIX_SOURCE) -#include <stdlib.h> -#endif - -#ifndef P -#if defined(__STDC__) || defined(USE_PROTOTYPES) -#define P(x) x -#else -#define P(x) () -#if !defined(const) -#define const -#endif -#endif -#endif - -/* - * Unprottyped library functions for SunOS 4.x.x - */ -#ifdef SYS_SUNOS4 -extern void closelog P((void)); -extern void openlog P((char *, int, int)); -extern void syslog P((int, char *, ...)); -extern int setlogmask P((int)); - -extern char * getpass P((char *)); - -extern int setpriority P((int ,int ,int)); - -extern long strtol P((char *, char **, int)); - -#if !defined(NTP_POSIX_SOURCE) -extern int atoi P((char *)); -extern int dup2 P((int, int)); -extern int execve P((char *, char **,char **)); -extern int fork P((void)); -extern int getdtablesize P((void)); -extern int qsort P((void *, int , int, - int (*compar)(void *, void *))); -extern int rand P((void)); -extern int setpgrp P((int, int)); -extern void srand P((unsigned int)); -extern void bcopy P((char *, char *, int)); -#endif - -#ifndef bzero /* XXX macro prototyping clash */ -extern void bzero P((char *, int)); -extern int bcmp P((char *, char *, int)); -extern void bcopy P((char *, char *, int)); -#endif -extern char *mktemp P((char *)); - -extern int tolower P((int)); - -extern int isatty P((int)); - -extern unsigned sleep P((unsigned )); -extern unsigned int alarm P((unsigned int)); -extern int pause P((void)); - -extern int getpid P((void)); -extern int getppid P((void)); - -extern int close P((int)); -extern int ioctl P((int, int, char *)); -extern int read P((int, void *, unsigned)); -extern int rename P((char *, char *)); -extern int write P((int, const void *, unsigned)); -extern int unlink P((const char *)); -extern int link P((const char *, const char *)); - -#ifdef FILE -extern int fclose P((FILE *)); -extern int fflush P((FILE *)); -extern int fprintf P((FILE *, char *, ...)); -extern int fscanf P((FILE *, char *, ...)); -extern int fputs P((char *, FILE *)); -extern int fputc P((char, FILE *)); -extern int fread P((char *, int, int, FILE *)); -extern int printf P((char *, ...)); -extern int setbuf P((FILE *, char *)); -extern int setvbuf P((FILE *, char *, int, int)); -extern int scanf P((char *, ...)); -extern int sscanf P((char *, char *, ...)); -extern int vsprintf P((char *, char *, ...)); -extern int _flsbuf P((int, FILE *)); -extern int _filbuf P((FILE *)); -extern void perror P((char *)); -#ifndef NTP_POSIX_SOURCE -extern int setlinebuf P((FILE *)); -#endif -#endif - -#ifdef _ntp_string_h -#ifdef NTP_POSIX_SOURCE /* these are builtins */ -#ifndef NTP_NEED_BOPS /* but may be emulated by bops */ -extern char *memcpy(); -extern char *memset(); -extern int memcmp(); -#endif -#endif -#endif - -#ifdef _sys_socket_h -extern int bind P((int, struct sockaddr *, int)); -extern int connect P((int, struct sockaddr *, int)); -extern int sendto P((int, char *, int, int, struct sockaddr *, int)); -extern int setsockopt P((int, int, int, char *, int)); -extern int socket P((int, int, int)); -extern int recvfrom P((int, char *, int, int, struct sockaddr *, int *)); -#endif /* _sys_socket_h */ - -#ifdef _ntp_select_h -extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); -#endif - -#ifdef _sys_time_h -extern int adjtime P((struct timeval *, struct timeval *)); -extern int setitimer P((int , struct itimerval *, struct itimerval *)); -#ifdef SYSV_TIMEOFDAY -extern int gettimeofday P((struct timeval *)); -extern int settimeofday P((struct timeval *)); -#else /* ! SYSV_TIMEOFDAY */ -extern int gettimeofday P((struct timeval *, struct timezone *)); -extern int settimeofday P((struct timeval *, struct timezone *)); -#endif /* SYSV_TIMEOFDAY */ -#endif /* _sys_time_h */ - -#ifdef __time_h -extern time_t time P((time_t *)); -#endif - -#ifdef __setjmp_h -extern int setjmp P((jmp_buf)); -extern void longjmp P((jmp_buf, int)); -#endif - -#ifdef _sys_resource_h -extern int getrusage P((int, struct rusage *)); -#endif - -#ifdef _nlist_h -extern int nlist P((char *, struct nlist *)); -#endif - -#endif /* SYS_SUNOS4 */ - -/* - * Unprototyped library functions for DEC OSF/1 - */ -#ifdef SYS_DECOSF1 -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ -extern u_short htons P((u_short)); -extern u_short ntohs P((u_short)); -extern U_LONG htonl P((U_LONG)); -extern U_LONG ntohl P((U_LONG)); -#endif /* _MACHINE_ENDIAN_H_ */ - -/* -extern char * getpass P((char *)); -*/ -extern char * mktemp P((char *)); -#ifndef SYS_IX86OSF1 -extern int ioctl P((int, u_long, char *)); -extern void bzero P((char *, int)); -#endif - -#ifdef SOCK_DGRAM -extern int bind P((int, const struct sockaddr *, int)); -extern int connect P((int, const struct sockaddr *, int)); -extern int socket P((int, int, int)); -extern int sendto P((int, const void *, int, int, const struct sockaddr *, int)); -extern int setsockopt P((int, int, int, const void *, int)); -extern int recvfrom P((int, void *, int, int, struct sockaddr *, int *)); -#endif /* SOCK_STREAM */ - -#ifdef _ntp_select_h -extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); -#endif - -#endif /* DECOSF1 */ - -/* - * Unprototyped library functions for Ultrix - */ -#ifdef SYS_ULTRIX -extern int close P((int)); -extern char * getpass P((char *)); -extern int getpid P((void)); -extern int ioctl P((int, int, char *)); -extern char *mktemp P((char *)); -extern int unlink P((const char *)); -extern int link P((const char *, const char *)); - -extern void closelog P((void)); -extern void syslog P((int, char *, ...)); -#ifndef LOG_DAEMON -extern void openlog P((char *, int)); -#else -extern void openlog P((char *, int, int)); -#endif - -extern int setpriority P((int ,int ,int )); - -#ifdef SOCK_DGRAM -extern int bind P((int, struct sockaddr *, int)); -extern int connect P((int, struct sockaddr *, int)); -extern int socket P((int, int, int)); -extern int sendto P((int, char *, int, int, struct sockaddr *, int)); -extern int setsockopt P((int, int, int, char *, int)); -extern int recvfrom P((int, char *, int, int, struct sockaddr *, int *)); -#endif /* SOCK_STREAM */ - -#ifdef _TIME_H_ -extern int gettimeofday P((struct timeval *, struct timezone *)); -extern int settimeofday P((struct timeval *, struct timezone *)); -extern int adjtime P((struct timeval *, struct timeval *)); -extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); -extern int setitimer P((int , struct itimerval *, struct itimerval *)); -#endif /* _TIME_H_ */ - -#ifdef N_UNDF -extern int nlist P((char *, struct nlist *)); -#endif - -#ifndef bzero /* XXX macro prototyping clash */ -extern void bzero P((char *, int)); -extern int bcmp P((char *, char *, int)); -extern void bcopy P((char *, char *, int)); -#endif - -#ifndef NTP_POSIX_SOURCE -extern int atoi P((char *)); -extern void bzero P((char *, int)); -extern int bcmp P((char *, char *, int)); -extern void bcopy P((char *, char *, int)); -extern int execve P((char *, char **,char **)); -extern int fork P((void)); -extern int getdtablesize P((void)); -extern int ran P((void)); -extern int rand P((void)); -extern void srand P((unsigned int)); -#ifdef _TIME_H_ -extern int gettimeofday P((struct timeval *, struct timezone *)); -extern int settimeofday P((struct timeval *, struct timezone *)); -#endif -#endif - -#ifdef _RESOURCE_H_ -extern int getrusage P((int, struct rusage *)); -#endif - -#endif /* SYS_ULTRIX */ - -#if defined(__convex__) -extern char * getpass P((char *)); -#endif - -#ifdef SYS_IRIX4 -extern char * getpass P((char *)); -#endif /* IRIX4 */ - -#ifdef SYS_VAX -extern char * getpass P((char *)); -#endif /* VAX */ - -#ifdef SYS_DOMAINOS -extern char * getpass P((char *)); -#endif /* SYS_DOMAINOS */ - -#ifdef SYS_BSD -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#endif - -#endif /* l_stdlib_h */ - diff --git a/usr.sbin/xntpd/include/md5.h b/usr.sbin/xntpd/include/md5.h deleted file mode 100644 index 82b43e1..0000000 --- a/usr.sbin/xntpd/include/md5.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - *********************************************************************** - ** md5.h -- header file for implementation of MD5 ** - ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** - ** Revised (for MD5): RLR 4/27/91 ** - *********************************************************************** - */ - -/* - *********************************************************************** - ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** - ** ** - ** License to copy and use this software is granted provided that ** - ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** - ** Digest Algorithm" in all material mentioning or referencing this ** - ** software or this function. ** - ** ** - ** License is also granted to make and use derivative works ** - ** provided that such works are identified as "derived from the RSA ** - ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** - ** material mentioning or referencing the derived work. ** - ** ** - ** RSA Data Security, Inc. makes no representations concerning ** - ** either the merchantability of this software or the suitability ** - ** of this software for any particular purpose. It is provided "as ** - ** is" without express or implied warranty of any kind. ** - ** ** - ** These notices must be retained in any copies of any part of this ** - ** documentation and/or software. ** - *********************************************************************** - */ - -#include "ntp_types.h" - -/* typedef a 32-bit type */ -typedef unsigned LONG UINT4; - -/* Data structure for MD5 (Message-Digest) computation */ -typedef struct { - UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ - UINT4 buf[4]; /* scratch buffer */ - unsigned char in[64]; /* input buffer */ - unsigned char digest[16]; /* actual digest after MD5Final call */ -} MD5_CTX; - -void MD5Init (); -void MD5Update (); -void MD5Final (); - -/* - *********************************************************************** - ** End of md5.h ** - ******************************** (cut) ******************************** - */ diff --git a/usr.sbin/xntpd/include/mx4200.h b/usr.sbin/xntpd/include/mx4200.h deleted file mode 100644 index 13058de..0000000 --- a/usr.sbin/xntpd/include/mx4200.h +++ /dev/null @@ -1,40 +0,0 @@ - -/* records transmitted from extern CDU to MX 4200 */ -#define PMVXG_S_INITMODEA 0 /* initialization/mode part A */ -#define PMVXG_S_INITMODEB 1 /* initialization/mode part B*/ -#define PMVXG_S_SATHEALTH 2 /* satellite health control */ -#define PMVXG_S_DIFFNAV 3 /* differential navigation control */ -#define PMVXG_S_PORTCONF 7 /* control port configuration */ -#define PMVXG_S_GETSELFTEST 3 /* self test (request results) */ -#define PMVXG_S_RTCMCONF 16 /* RTCM port configuration */ -#define PMVXG_S_PASSTHRU 17 /* equipment port pass-thru config */ -#define PMVXG_S_RESTART 18 /* restart control */ -#define PMVXG_S_OSCPARAM 19 /* oscillator parameter */ -#define PMVXG_S_DOSELFTEST 20 /* self test (activate a test) */ -#define PMVXG_S_TRECOVCONF 23 /* time recovery configuration */ -#define PMVXG_S_RAWDATASEL 24 /* raw data port data selection */ -#define PMVXG_S_EQUIPCONF 26 /* equipment port configuration */ -#define PMVXG_S_RAWDATACONF 27 /* raw data port configuration */ - -/* records transmitted from MX 4200 to external CDU */ -#define PMVXG_D_STATUS 0 /* status */ -#define PMVXG_D_POSITION 1 /* position */ -#define PMVXG_D_OPDOPS 3 /* (optimum) DOPs */ -#define PMVXG_D_MODEDATA 4 /* mode data */ -#define PMVXG_D_SATPRED 5 /* satellite predictions */ -#define PMVXG_D_SATHEALTH 6 /* satellite health status */ -#define PMVXG_D_UNRECOG 7 /* unrecognized request response */ -#define PMVXG_D_SIGSTRLOC 8 /* sig strength & location (sats 1-4) */ -#define PMVXG_D_SPEEDHEAD 11 /* speed/heading data */ -#define PMVXG_D_OSELFTEST 12 /* (old) self-test results */ -#define PMVXG_D_SIGSTRLOC2 18 /* sig strength & location (sats 5-8) */ -#define PMVXG_D_OSCPARAM 19 /* oscillator parameter */ -#define PMVXG_D_SELFTEST 20 /* self test results */ -#define PMVXG_D_PHV 21 /* position, height & velocity */ -#define PMVXG_D_DOPS 22 /* DOPs */ -#define PMVXG_D_SOFTCONF 30 /* software configuration */ -#define PMVXG_D_DIFFGPSMODE 503 /* differential gps moding */ -#define PMVXG_D_TRECOVUSEAGE 523 /* time recovery usage */ -#define PMVXG_D_RAWDATAOUT 524 /* raw data port data output */ -#define PMVXG_D_TRECOVRESULT 828 /* time recovery results */ -#define PMVXG_D_TRECOVOUT 830 /* time recovery output message */ diff --git a/usr.sbin/xntpd/include/ntp.h b/usr.sbin/xntpd/include/ntp.h deleted file mode 100644 index 5eca0e8..0000000 --- a/usr.sbin/xntpd/include/ntp.h +++ /dev/null @@ -1,706 +0,0 @@ -/* - * ntp.h - NTP definitions for the masses - */ - -#include "ntp_types.h" - -/* - * How to get signed characters. On machines where signed char works, - * use it. On machines where signed char doesn't work, char had better - * be signed. - */ -#if !defined(S_CHAR_DEFINED) -#if defined(NO_SIGNED_CHAR_DECL) -typedef char s_char; -#else -typedef signed char s_char; -#endif -#ifdef sequent -#undef SO_RCVBUF -#undef SO_SNDBUF -#endif -#endif - -/* - * NTP protocol parameters. See section 3.2.6 of the specification. - */ -#define NTP_VERSION ((u_char)3) /* current version number */ -#define NTP_OLDVERSION ((u_char)1) /* oldest credible version */ -#define NTP_PORT 123 /* included for sake of non-unix machines */ -#define NTP_MAXSTRATUM ((u_char)15) /* max stratum, infinity a la Bellman-Ford */ -#define NTP_MAXAGE 86400 /* one day in seconds */ -#define NTP_MAXSKEW 1 /* 1 sec, skew after NTP_MAXAGE w/o updates */ -#define NTP_SKEWINC 49170 /* skew increment for clock updates (l_f) */ -#define NTP_SKEWFACTOR 16 /* approximation of factor for peer calcs */ -#define NTP_MAXDISTANCE (1 * FP_SECOND) /* max. rootdelay for synchr. */ -#define NTP_MINDPOLL 6 /* log2 default min poll interval (64 s) */ -#define NTP_MAXDPOLL 10 /* log2 default max poll interval (~17 m) */ -#define NTP_MINPOLL 4 /* log2 min poll interval (16 s) */ -#define NTP_MAXPOLL 14 /* log2 max poll interval (~4.5 h) */ -#define NTP_MINCLOCK 3 /* minimum for outlyer detection */ -#define NTP_MAXCLOCK 10 /* maximum select list size */ -#define NTP_MINDISPERSE (FP_SECOND / 100) /* min dispersion (u_fp 10 ms) */ -#define NTP_MAXDISPERSE (FP_SECOND * 16) /* max dispersion (u_fp 16 s) */ -#define NTP_DISPFACTOR 20 /* MAXDISPERSE as a shift (u_fp 16 s) */ -#define NTP_WINDOW 8 /* reachability register size */ -#define NTP_SHIFT 8 /* 8 suitable for crystal time base */ -#define NTP_MAXKEY 65535 /* maximum authentication key number */ -#define NTP_MAXD 3 /* log2 estimated error averaging factor */ - -/* - * Loop filter parameters. See section 5.1 of the specification. - * - * Note that these are appropriate for a crystal time base. If your - * system clock is line frequency controlled you should read the - * specification for appropriate modifications. Note that the - * loop filter code will have to change if you change CLOCK_MAX - * to be greater than or equal to 500 ms. - * - * Note these parameters have been rescaled for a time constant range from - * 0 through 10, with 2 corresoponding to the old time constant of 0. - */ -#define CLOCK_MINSTEP 900 /* step timeout (sec) */ -#define CLOCK_ADJ 0 /* log2 adjustment interval (1 sec) */ -#define CLOCK_DSCALE 20 /* skew reg. scale: unit is 2**-20 ~= 1 ppm */ -#define CLOCK_FREQ 16 /* log2 frequency weight (65536) */ -#define CLOCK_PHASE 6 /* log2 phase weight (64) */ -#define CLOCK_LIMIT 30 /* time constant adjust threshold */ -#define CLOCK_G 2 /* log2 frequency averaging factor */ -#define CLOCK_MAXSEC 800 /* max update interval for pll */ - -#define CLOCK_MAX_FP 0x000020c5 /* max clock offset (s_fp 128 ms) */ -#define CLOCK_MAX_F 0x20c49ba6 /* max clock offset (l_fp 128 ms) */ -#define CLOCK_MAX_I 0x00000000 /* both fractional and integral parts */ - -#define CLOCK_WAYTOOBIG 1000 /* if clock 1000 sec off, forget it */ - -/* - * Event timers are actually implemented as a sorted queue of expiry - * times. The queue is slotted, with each slot holding timers which - * expire in a 2**(NTP_MINPOLL-1) (8) second period. The timers in - * each slot are sorted by increasing expiry time. The number of - * slots is 2**(NTP_MAXPOLL-(NTP_MINPOLL-1)), or 512, to cover a time - * period of 2**NTP_MAXPOLL (16384) seconds into the future before - * wrapping. - */ -#define EVENT_TIMEOUT CLOCK_ADJ - -struct event { - struct event *next; /* next in chain */ - struct event *prev; /* previous in chain */ - struct peer *peer; /* peer this counter belongs to */ - void (*event_handler)(); /* routine to call to handle event */ - u_long event_time; /* expiry time of counter */ -}; - -#define TIMER_SLOTTIME (1<<(NTP_MINPOLL-1)) -#define TIMER_NSLOTS (1<<(NTP_MAXPOLL-(NTP_MINPOLL-1))) -#define TIMER_SLOT(t) (((t) >> (NTP_MINPOLL-1)) & (TIMER_NSLOTS-1)) - -/* - * TIMER_ENQUEUE() puts stuff on the timer queue. It takes as - * arguments (ea), an array of event slots, and (iev), the event - * to be inserted. This one searches the hash bucket from the - * end, and is about optimum for the timing requirements of - * NTP peers. - */ -#define TIMER_ENQUEUE(ea, iev) \ - do { \ - register struct event *ev; \ - \ - ev = (ea)[TIMER_SLOT((iev)->event_time)].prev; \ - while (ev->event_time > (iev)->event_time) \ - ev = ev->prev; \ - (iev)->prev = ev; \ - (iev)->next = ev->next; \ - (ev)->next->prev = (iev); \ - (ev)->next = (iev); \ - } while(0) - -/* - * TIMER_INSERT() also puts stuff on the timer queue, but searches the - * bucket from the top. This is better for things that do very short - * time outs, like clock support. - */ -#define TIMER_INSERT(ea, iev) \ - do { \ - register struct event *ev; \ - \ - ev = (ea)[TIMER_SLOT((iev)->event_time)].next; \ - while (ev->event_time != 0 && \ - ev->event_time < (iev)->event_time) \ - ev = ev->next; \ - (iev)->next = ev; \ - (iev)->prev = ev->prev; \ - (ev)->prev->next = (iev); \ - (ev)->prev = (iev); \ - } while(0) - -/* - * Remove an event from the queue. - */ -#define TIMER_DEQUEUE(ev) \ - do { \ - if ((ev)->next != 0) { \ - (ev)->next->prev = (ev)->prev; \ - (ev)->prev->next = (ev)->next; \ - (ev)->next = (ev)->prev = 0; \ - } \ - } while (0) - -/* - * The interface structure is used to hold the addresses and socket - * numbers of each of the interfaces we are using. - */ -struct interface { - int fd; /* socket this is opened on */ - int bfd; /* socket for receiving broadcasts */ - struct sockaddr_in sin; /* interface address */ - struct sockaddr_in bcast; /* broadcast address */ - struct sockaddr_in mask; /* interface mask */ - char name[8]; /* name of interface */ - int flags; /* interface flags */ - int last_ttl; /* last TTL specified */ - long received; /* number of incoming packets */ - long sent; /* number of outgoing packets */ - long notsent; /* number of send failures */ -}; - -/* - * Flags for interfaces - */ -#define INT_BROADCAST 1 /* can broadcast out this interface */ -#define INT_BCASTOPEN 2 /* broadcast socket is open */ -#define INT_LOOPBACK 4 /* the loopback interface */ -#define INT_MULTICAST 8 /* multicasting enabled */ - -/* - * Define flasher bits (tests 1 through 8 in packet procedure) - * These reveal the state at the last grumble from the peer and are - * most handy for diagnosing problems, even if not strictly a state - * variable in the spec. These are recorded in the peer structure. - */ -#define TEST1 0x01 /* duplicate packet received */ -#define TEST2 0x02 /* bogus packet received */ -#define TEST3 0x04 /* protocol unsynchronized */ -#define TEST4 0x08 /* peer delay/dispersion bounds check */ -#define TEST5 0x10 /* peer authentication failed */ -#define TEST6 0x20 /* peer clock unsynchronized */ -#define TEST7 0x40 /* peer stratum out of bounds */ -#define TEST8 0x80 /* root delay/dispersion bounds check */ - -/* - * The peer structure. Holds state information relating to the guys - * we are peering with. Most of this stuff is from section 3.2 of the - * spec. - */ -struct peer { - struct peer *next; - struct peer *ass_next; /* link pointer in associd hash */ - struct sockaddr_in srcadr; /* address of remote host */ - struct interface *dstadr; /* pointer to address on local host */ - struct refclockproc *procptr; /* pointer to reference clock sutuff */ - u_char leap; /* leap indicator */ - u_char hmode; /* association mode with this peer */ - u_char pmode; /* peer's association mode */ - u_char stratum; /* stratum of remote peer */ - s_char precision; /* peer's clock precision */ - u_char ppoll; /* peer poll interval */ - u_char hpoll; /* local host poll interval */ - u_char minpoll; /* min local host poll interval */ - u_char maxpoll; /* max local host poll interval */ - u_char version; /* version number */ - u_char flags; /* peer flags */ - u_char cast_flags; /* flags MDF_?CAST */ - u_char flash; /* peer flashers (for maint) */ - u_char refclktype; /* reference clock type */ - u_char refclkunit; /* reference clock unit number */ - u_char sstclktype; /* clock type for system status word */ - s_fp rootdelay; /* distance from primary clock */ - u_fp rootdispersion; /* peer clock dispersion */ - U_LONG refid; /* peer reference ID */ - l_fp reftime; /* time of peer's last update */ - struct event event_timer; /* event queue entry */ - U_LONG keyid; /* encription key ID */ - U_LONG pkeyid; /* keyid used to encrypt last message */ - u_short associd; /* association ID, a unique integer */ - u_char ttl; /* time to live (multicast) */ -/* **Start of clear-to-zero area.*** */ -/* Everything that is cleared to zero goes below here */ - u_char valid; /* valid counter */ -#define clear_to_zero valid - u_char reach; /* reachability, NTP_WINDOW bits */ - u_char unreach; /* unreachable count */ - u_short filter_nextpt; /* index into filter shift register */ - s_fp filter_delay[NTP_SHIFT]; /* delay part of shift register */ - l_fp filter_offset[NTP_SHIFT]; /* offset part of shift register */ - s_fp filter_soffset[NTP_SHIFT]; /* offset in s_fp format, for disp */ - l_fp org; /* originate time stamp */ - l_fp rec; /* receive time stamp */ - l_fp xmt; /* transmit time stamp */ -/* ***End of clear-to-zero area.*** */ -/* Everything that is cleared to zero goes above here */ - u_char filter_order[NTP_SHIFT]; /* we keep the filter sorted here */ -#define end_clear_to_zero filter_order[0] - u_fp filter_error[NTP_SHIFT]; /* error part of shift register */ - long update; /* base sys_clock for skew calc.s */ - s_fp delay; /* filter estimated delay */ - u_fp dispersion; /* filter estimated dispersion */ - l_fp offset; /* filter estimated clock offset */ - s_fp soffset; /* fp version of above */ - s_fp synch; /* synch distance from above */ - u_fp selectdisp; /* select dispersion */ - s_fp estbdelay; /* broadcast offset */ - - /* - * statistic counters - */ - u_long timereset; /* time stat counters were reset */ - u_long sent; /* number of updates sent */ - u_long received; /* number of frames received */ - u_long timereceived; /* last time a frame received */ - u_long timereachable; /* last reachable/unreachable event */ - u_long processed; /* processed by the protocol */ - u_long badauth; /* bad credentials detected */ - u_long bogusorg; /* rejected due to bogus origin */ - u_long oldpkt; /* rejected as duplicate packet */ - u_long seldisptoolarge; /* too much dispersion for selection */ - u_long selbroken; /* broken NTP detected in selection */ - u_long seltooold; /* too long since sync in selection */ - u_char candidate; /* position after candidate selection */ - u_char select; /* position at end of falseticker sel */ - u_char was_sane; /* set to 1 if it passed sanity check */ - u_char correct; /* set to 1 if it passed correctness check */ - u_char last_event; /* set to code for last peer error */ - u_char num_events; /* num. of events which have occurred */ -}; - -/* - * Values for peer.leap, sys_leap - */ -#define LEAP_NOWARNING 0x0 /* normal, no leap second warning */ -#define LEAP_ADDSECOND 0x1 /* last minute of day has 61 seconds */ -#define LEAP_DELSECOND 0x2 /* last minute of day has 59 seconds */ -#define LEAP_NOTINSYNC 0x3 /* overload, clock is free running */ - -/* - * Values for peer.mode - */ -#define MODE_UNSPEC 0 /* unspecified (probably old NTP version) */ -#define MODE_ACTIVE 1 /* symmetric active */ -#define MODE_PASSIVE 2 /* symmetric passive */ -#define MODE_CLIENT 3 /* client mode */ -#define MODE_SERVER 4 /* server mode */ -#define MODE_BROADCAST 5 /* broadcast mode */ -#define MODE_CONTROL 6 /* control mode packet */ -#define MODE_PRIVATE 7 /* implementation defined function */ - -#define MODE_BCLIENT 8 /* a pseudo mode, used internally */ -#define MODE_MCLIENT 9 /* multicast mode, used internally */ - -/* - * Values for peer.stratum, sys_stratum - */ -#define STRATUM_REFCLOCK ((u_char)0) /* stratum claimed by primary clock */ -#define STRATUM_PRIMARY ((u_char)1) /* host has a primary clock */ -#define STRATUM_INFIN ((u_char)NTP_MAXSTRATUM) /* infinity a la Bellman-Ford */ -/* A stratum of 0 in the packet is mapped to 16 internally */ -#define STRATUM_PKT_UNSPEC ((u_char)0) /* unspecified in packet */ -#define STRATUM_UNSPEC ((u_char)(NTP_MAXSTRATUM+(u_char)1)) /* unspecified */ - -/* - * Values for peer.flags - */ -#define FLAG_CONFIG 0x1 /* association was configured */ -#define FLAG_AUTHENABLE 0x2 /* this guy needs authentication */ -#define FLAG_MCAST1 0x4 /* multicast client/server mode */ -#define FLAG_MCAST2 0x8 /* multicast client mode */ -#define FLAG_AUTHENTIC 0x10 /* last message was authentic */ -#define FLAG_REFCLOCK 0x20 /* this is actually a reference clock */ -#define FLAG_SYSPEER 0x40 /* this is one of the selected peers */ -#define FLAG_PREFER 0x80 /* this is the preferred peer */ - -/* - * Definitions for the clear() routine. We use memset() to clear - * the parts of the peer structure which go to zero. These are - * used to calculate the start address and length of the area. - */ -#define CLEAR_TO_ZERO(p) ((char *)&((p)->clear_to_zero)) -#define END_CLEAR_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero)) -#define LEN_CLEAR_TO_ZERO (END_CLEAR_TO_ZERO((struct peer *)0) \ - - CLEAR_TO_ZERO((struct peer *)0)) -/* - * Reference clock identifiers (for pps signal) - */ -#define PPSREFID (U_LONG)"PPS " /* used when pps controls stratum > 1 */ - -/* - * Reference clock types. Added as necessary. - */ -#define REFCLK_NONE 0 /* unknown or missing */ -#define REFCLK_LOCALCLOCK 1 /* external (e.g., lockclock) */ -#define REFCLK_GPS_TRAK 2 /* TRAK 8810 GPS Receiver */ -#define REFCLK_WWV_PST 3 /* PST/Traconex 1020 WWV/H */ -#define REFCLK_WWVB_SPECTRACOM 4 /* Spectracom 8170/Netclock WWVB */ -#define REFCLK_GOES_TRUETIME 5 /* TrueTime 468-DC GOES */ -#define REFCLK_IRIG_AUDIO 6 /* IRIG-B audio decoder */ -#define REFCLK_CHU 7 /* scratchbuilt CHU (Canada) */ -#define REFCLK_PARSE 8 /* generic driver (usually DCF77,GPS) */ -#define REFCLK_GPS_MX4200 9 /* Magnavox MX4200 GPS */ -#define REFCLK_GPS_AS2201 10 /* Austron 2201A GPS */ -#define REFCLK_OMEGA_TRUETIME 11 /* TrueTime OM-DC OMEGA */ -#define REFCLK_IRIG_TPRO 12 /* KSI/Odetics TPRO-S IRIG */ -#define REFCLK_ATOM_LEITCH 13 /* Leitch CSD 5300 Master Clock */ -#define REFCLK_MSF_EES 14 /* EES M201 MSF Receiver */ -#define REFCLK_GPSTM_TRUETIME 15 /* TrueTime GPS/TM-TMD Receiver */ -#define REFCLK_IRIG_BANCOMM 16 /* Bancomm GPS/IRIG Interface */ -#define REFCLK_GPS_DATUM 17 /* Datum Programmable Time System */ -#define REFCLK_NIST_ACTS 18 /* NIST Auto Computer Time Service */ -#define REFCLK_WWV_HEATH 19 /* Heath GC1000 WWV/WWVH Receiver */ -#define REFCLK_GPS_NMEA 20 /* NMEA based GPS clock */ -#define REFCLK_GPS_MOTO 21 /* Motorola GPS clock */ -#define REFCLK_ATOM_PPS 22 /* 1-PPS Clock Discipline */ -#define REFCLK_MAX 24 /* maximum index (room to expand) */ - -/* - * We tell reference clocks from real peers by giving the reference - * clocks an address of the form 127.127.t.u, where t is the type and - * u is the unit number. We define some of this here since we will need - * some sanity checks to make sure this address isn't interpretted as - * that of a normal peer. - */ -#define REFCLOCK_ADDR 0x7f7f0000 /* 127.127.0.0 */ -#define REFCLOCK_MASK 0xffff0000 /* 255.255.0.0 */ - -#define ISREFCLOCKADR(srcadr) ((SRCADR(srcadr) & REFCLOCK_MASK) \ - == REFCLOCK_ADDR) - -/* - * Macro for checking for invalid addresses. This is really, really - * gross, but is needed so no one configures a host on net 127 now that - * we're encouraging it the the configuration file. - */ -#define LOOPBACKADR 0x7f000001 -#define LOOPNETMASK 0xff000000 - -#define ISBADADR(srcadr) (((SRCADR(srcadr) & LOOPNETMASK) \ - == (LOOPBACKADR & LOOPNETMASK)) \ - && (SRCADR(srcadr) != LOOPBACKADR)) - -/* - * Utilities for manipulating addresses and port numbers - */ -#define NSRCADR(src) ((src)->sin_addr.s_addr) /* address in net byte order */ -#define NSRCPORT(src) ((src)->sin_port) /* port in net byte order */ -#define SRCADR(src) (ntohl(NSRCADR((src)))) /* address in host byte order */ -#define SRCPORT(src) (ntohs(NSRCPORT((src)))) /* host port */ - -/* - * NTP packet format. The mac field is optional. It isn't really - * an l_fp either, but for now declaring it that way is convenient. - * See Appendix A in the specification. - * - * Note that all u_fp and l_fp values arrive in network byte order - * and must be converted (except the mac, which isn't, really). - */ -struct pkt { - u_char li_vn_mode; /* contains leap indicator, version and mode */ - u_char stratum; /* peer's stratum */ - u_char ppoll; /* the peer polling interval */ - s_char precision; /* peer clock precision */ - s_fp rootdelay; /* distance to primary clock */ - u_fp rootdispersion; /* clock dispersion */ - U_LONG refid; /* reference clock ID */ - l_fp reftime; /* time peer clock was last updated */ - l_fp org; /* originate time stamp */ - l_fp rec; /* receive time stamp */ - l_fp xmt; /* transmit time stamp */ - -#define MIN_MAC_LEN (sizeof(U_LONG) + 8) /* DES */ -#define MAX_MAC_LEN (sizeof(U_LONG) + 16) /* MD5 */ - - U_LONG keyid; /* key identification */ - u_char mac[MAX_MAC_LEN-sizeof(U_LONG)];/* message-authentication code */ - /*l_fp mac;*/ -}; - -/* - * Packets can come in two flavours, one with a mac and one without. - */ -#define LEN_PKT_NOMAC (sizeof(struct pkt) - MAX_MAC_LEN) - -/* - * Minimum size of packet with a MAC: has to include at least a key number. - */ -#define LEN_PKT_MAC (LEN_PKT_NOMAC + sizeof(U_LONG)) - -/* - * Stuff for extracting things from li_vn_mode - */ -#define PKT_MODE(li_vn_mode) ((u_char)((li_vn_mode) & 0x7)) -#define PKT_VERSION(li_vn_mode) ((u_char)(((li_vn_mode) >> 3) & 0x7)) -#define PKT_LEAP(li_vn_mode) ((u_char)(((li_vn_mode) >> 6) & 0x3)) - -/* - * Stuff for putting things back into li_vn_mode - */ -#define PKT_LI_VN_MODE(li, vn, md) \ - ((u_char)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7))) - - -/* - * Dealing with stratum. 0 gets mapped to 16 incoming, and back to 0 - * on output. - */ -#define PKT_TO_STRATUM(s) ((u_char)(((s) == (STRATUM_PKT_UNSPEC)) ?\ - (STRATUM_UNSPEC) : (s))) - -#define STRATUM_TO_PKT(s) ((u_char)(((s) == (STRATUM_UNSPEC)) ?\ - (STRATUM_PKT_UNSPEC) : (s))) - -/* - * Format of a recvbuf. These are used by the asynchronous receive - * routine to store incoming packets and related information. - */ - -/* - * the maximum length NTP packet is a full length NTP control message with - * the maximum length message authenticator. I hate to hard-code 468 and 12, - * but only a few modules include ntp_control.h... - */ -#define RX_BUFF_SIZE (468+12+MAX_MAC_LEN) - -struct recvbuf { - struct recvbuf *next; /* next buffer in chain */ - union { - struct sockaddr_in X_recv_srcadr; - caddr_t X_recv_srcclock; - } X_from_where; -#define recv_srcadr X_from_where.X_recv_srcadr -#define recv_srcclock X_from_where.X_recv_srcclock - struct sockaddr_in srcadr; /* where packet came from */ - struct interface *dstadr; /* interface datagram arrived thru */ - int fd; /* fd on which it was received */ - l_fp recv_time; /* time of arrival */ - void (*receiver)(); /* routine to receive buffer */ - int recv_length; /* number of octets received */ - union { - struct pkt X_recv_pkt; - char X_recv_buffer[RX_BUFF_SIZE]; - } recv_space; -#define recv_pkt recv_space.X_recv_pkt -#define recv_buffer recv_space.X_recv_buffer -}; - - -/* - * Event codes. Used for reporting errors/events to the control module - */ -#define PEER_EVENT 0x80 /* this is a peer event */ - -#define EVNT_UNSPEC 0 -#define EVNT_SYSRESTART 1 -#define EVNT_SYSFAULT 2 -#define EVNT_SYNCCHG 3 -#define EVNT_PEERSTCHG 4 -#define EVNT_CLOCKRESET 5 -#define EVNT_BADDATETIM 6 -#define EVNT_CLOCKEXCPT 7 - -#define EVNT_PEERIPERR (1|PEER_EVENT) -#define EVNT_PEERAUTH (2|PEER_EVENT) -#define EVNT_UNREACH (3|PEER_EVENT) -#define EVNT_REACH (4|PEER_EVENT) -#define EVNT_PEERCLOCK (5|PEER_EVENT) - -/* - * Clock event codes - */ -#define CEVNT_NOMINAL 0 -#define CEVNT_TIMEOUT 1 -#define CEVNT_BADREPLY 2 -#define CEVNT_FAULT 3 -#define CEVNT_PROP 4 -#define CEVNT_BADDATE 5 -#define CEVNT_BADTIME 6 -#define CEVNT_MAX CEVNT_BADTIME - -/* - * Very misplaced value. Default port through which we send traps. - */ -#define TRAPPORT 18447 - - -/* - * To speed lookups, peers are hashed by the low order bits of the remote - * IP address. These definitions relate to that. - */ -#define HASH_SIZE 32 -#define HASH_MASK (HASH_SIZE-1) -#define HASH_ADDR(src) ((SRCADR((src))^(SRCADR((src))>>8)) & HASH_MASK) - - -/* - * The poll update procedure takes an extra argument which controls - * how a random perturbation is applied to peer.timer. The choice is - * to not randomize at all, to randomize only if we're going to update - * peer.timer, and to randomize no matter what (almost, the algorithm - * is that we apply the random value if it is less than the current - * timer count). - */ -#define POLL_NOTRANDOM 0 /* don't randomize */ -#define POLL_RANDOMCHANGE 1 /* if you change, change randomly */ -#define POLL_MAKERANDOM 2 /* randomize next interval */ - - -/* - * How we randomize polls. The poll interval is a power of two. - * We chose a random value which is between 1/4 and 3/4 of the - * poll interval we would normally use and which is an even multiple - * of the EVENT_TIMEOUT. The random number routine, given an argument - * spread value of n, returns an integer between 0 and (1<<n)-1. This - * is shifted by EVENT_TIMEOUT and added to the base value. - */ -#define RANDOM_SPREAD(poll) ((poll) - (EVENT_TIMEOUT+1)) -#define RANDOM_POLL(poll, rval) ((((rval)+1)<<EVENT_TIMEOUT) + (1<<((poll)-2))) - -/* - * min, min3 and max. Makes it easier to transliterate the spec without - * thinking about it. - */ -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min3(a,b,c) min(min((a),(b)), (c)) - - -/* - * Configuration items. These are for the protocol module (proto_config()) - */ -#define PROTO_BROADCLIENT 1 -#define PROTO_PRECISION 2 -#define PROTO_AUTHENTICATE 3 -#define PROTO_BROADDELAY 4 -#define PROTO_AUTHDELAY 5 -#define PROTO_MULTICAST_ADD 6 -#define PROTO_MULTICAST_DEL 7 -#define PROTO_PLL 8 -#define PROTO_PPS 9 -#define PROTO_MONITOR 10 -#define PROTO_FILEGEN 11 - -/* - * Configuration items for the loop filter - */ -#define LOOP_DRIFTCOMP 1 /* set frequency offset */ -#define LOOP_PPSDELAY 2 /* set pps delay */ -#define LOOP_PPSBAUD 3 /* set pps baud rate */ - -/* - * Configuration items for the stats printer - */ -#define STATS_FREQ_FILE 1 /* configure drift file */ -#define STATS_STATSDIR 2 /* directory prefix for stats files */ -#define STATS_PID_FILE 3 /* configure xntpd PID file */ - -#define MJD_1970 40587 /* MJD for 1 Jan 1970 */ - -/* - * Default parameters. We use these in the absense of something better. - */ -#define DEFPRECISION (-7) /* default precision (~10 ms) */ -#define DEFBROADDELAY 0x00000100 /* default broadcast offset */ - /* (~4 ms as s_fp) */ -#define DEFAUTHDELAY 0x00080000 /* default authentcation delay */ - /* (~100 us as l_fp.u_f) */ -#define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 */ -/* - * Structure used optionally for monitoring when this is turned on. - */ -struct mon_data { - struct mon_data *hash_next; /* next structure in hash list */ - struct mon_data *mru_next; /* next structure in MRU list */ - struct mon_data *mru_prev; /* previous structure in MRU list */ - struct mon_data *fifo_next; /* next structure in FIFO list */ - struct mon_data *fifo_prev; /* previous structure in FIFO list */ - u_long lastdrop; /* last time dropped due to RES_LIMIT*/ - u_long lasttime; /* last time data updated */ - u_long firsttime; /* time structure initialized */ - u_long count; /* count we have seen */ - U_LONG rmtadr; /* address of remote host */ - struct interface *interface; /* interface on which this arrived */ - u_short rmtport; /* remote port last came from */ - u_char mode; /* mode of incoming packet */ - u_char version; /* version of incoming packet */ - u_char cast_flags; /* flags MDF_?CAST */ -}; - -#define MDF_UCAST 1 /* unicast packet */ -#define MDF_MCAST 2 /* multicast packet */ -#define MDF_BCAST 4 /* broadcast packet */ -#define MDF_LCAST 8 /* local packet */ - -/* - * Values used with mon_enabled to indicate reason for enabling monitoring - */ -#define MON_OFF 0x00 /* no monitoring */ -#define MON_ON 0x01 /* monitoring explicitly enabled */ -#define MON_RES 0x02 /* implicit monitoring for RES_LIMITED */ -/* - * Structure used for restrictlist entries - */ -struct restrictlist { - struct restrictlist *next; /* link to next entry */ - U_LONG addr; /* host address (host byte order) */ - U_LONG mask; /* mask for address (host byte order) */ - u_long count; /* number of packets matched */ - u_short flags; /* accesslist flags */ - u_short mflags; /* match flags */ -}; - -/* - * Access flags - */ -#define RES_IGNORE 0x1 /* ignore if matched */ -#define RES_DONTSERVE 0x2 /* don't give him any time */ -#define RES_DONTTRUST 0x4 /* don't trust if matched */ -#define RES_NOQUERY 0x8 /* don't allow queries if matched */ -#define RES_NOMODIFY 0x10 /* don't allow him to modify server */ -#define RES_NOPEER 0x20 /* don't allocate memory resources */ -#define RES_NOTRAP 0x40 /* don't allow him to set traps */ -#define RES_LPTRAP 0x80 /* traps set by him are low priority */ -#define RES_LIMITED 0x100 /* limit per net number of clients */ - -#define RES_ALLFLAGS \ - (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ - |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) - -/* - * Match flags - */ -#define RESM_INTERFACE 0x1 /* this is an interface */ -#define RESM_NTPONLY 0x2 /* match ntp port only */ - -/* - * Restriction configuration ops - */ -#define RESTRICT_FLAGS 1 /* add flags to restrict entry */ -#define RESTRICT_UNFLAG 2 /* remove flags from restrict entry */ -#define RESTRICT_REMOVE 3 /* remove a restrict entry */ - - -/* - * Experimental alternate selection algorithm identifiers - */ -#define SELECT_1 1 -#define SELECT_2 2 -#define SELECT_3 3 -#define SELECT_4 4 -#define SELECT_5 5 - -/* - * Endpoint structure for the select algorithm - */ -struct endpoint { - s_fp val; /* offset of endpoint */ - int type; /* interval entry/exit */ -}; diff --git a/usr.sbin/xntpd/include/ntp_calendar.h b/usr.sbin/xntpd/include/ntp_calendar.h deleted file mode 100644 index 461aee4..0000000 --- a/usr.sbin/xntpd/include/ntp_calendar.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ntp_calendar.h - definitions for the calendar time-of-day routine - */ - -#include "ntp_types.h" - -struct calendar { - u_short year; /* year (A.D.) */ - u_short yearday; /* day of year, 1 = January 1 */ - u_char month; /* month, 1 = January */ - u_char monthday; /* day of month */ - u_char hour; /* hour of day, midnight = 0 */ - u_char minute; /* minute of hour */ - u_char second; /* second of minute */ -}; - -/* - * Days in each month. 30 days hath September... - */ -#define JAN 31 -#define FEB 28 -#define FEBLEAP 29 -#define MAR 31 -#define APR 30 -#define MAY 31 -#define JUN 30 -#define JUL 31 -#define AUG 31 -#define SEP 30 -#define OCT 31 -#define NOV 30 -#define DEC 31 - -/* - * We deal in a 4 year cycle starting at March 1, 1900. We assume - * we will only want to deal with dates since then, and not to exceed - * the rollover day in 2036. - */ -#define SECSPERMIN (60) /* seconds per minute */ -#define MINSPERHR (60) /* minutes per hour */ -#define HRSPERDAY (24) /* hours per day */ -#define DAYSPERYEAR (365) /* days per year */ - -#define SECSPERDAY (SECSPERMIN*MINSPERHR*HRSPERDAY) -#define SECSPERYEAR (365 * SECSPERDAY) /* regular year */ -#define SECSPERLEAPYEAR (366 * SECSPERDAY) /* leap year */ - -#define MAR1900 ((JAN+FEB) * SECSPERDAY) /* no leap year in 1900 */ -#define DAYSPERCYCLE (365+365+365+366) /* 3 normal years plus leap */ -#define SECSPERCYCLE (DAYSPERCYCLE*SECSPERDAY) -#define YEARSPERCYCLE 4 - -/* - * Gross hacks. I have illicit knowlege that there won't be overflows - * here, the compiler often can't tell this. - */ -#define TIMES60(val) ((((val)<<4) - (val))<<2) /* *(16 - 1) * 4 */ -#define TIMES24(val) (((val)<<4) + ((val)<<3)) /* *16 + *8 */ -#define TIMES7(val) (((val)<<3) - (val)) /* *8 - *1 */ -#define TIMESDPERC(val) (((val)<<10) + ((val)<<8) \ - + ((val)<<7) + ((val)<<5) \ - + ((val)<<4) + ((val)<<2) + (val)) /* *big* hack */ - -/* - * Another big hack. Cycle 22 started on March 1, 1988. This is - * STARTCYCLE22 seconds after the start of cycle 0. - */ -#define CYCLE22 (22) -#define STARTCYCLE22 (u_long)(0xa586b500) /* 2777068800 */ -#define MAR1988 (u_long)(STARTCYCLE22 + (u_long)MAR1900) - -/* - * The length of January + February in leap and non-leap years. - */ -#define JANFEBNOLEAP ((JAN+FEB) * SECSPERDAY) -#define JANFEBLEAP ((JAN+FEBLEAP) * SECSPERDAY) - -extern void caljulian P((u_long, struct calendar *)); -extern u_long caltontp P((const struct calendar *)); - diff --git a/usr.sbin/xntpd/include/ntp_control.h b/usr.sbin/xntpd/include/ntp_control.h deleted file mode 100644 index 1124bb0..0000000 --- a/usr.sbin/xntpd/include/ntp_control.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * ntp_control.h - definitions related to NTP mode 6 control messages - */ - -#include "ntp_types.h" - -struct ntp_control { - u_char li_vn_mode; /* leap, version, mode */ - u_char r_m_e_op; /* response, more, error, opcode */ - u_short sequence; /* sequence number of request */ - u_short status; /* status word for association */ - u_short associd; /* association ID */ - u_short offset; /* offset of this batch of data */ - u_short count; /* count of data in this packet */ - u_char data[(480 + MAX_MAC_LEN)]; /* data + auth */ -}; - -/* - * Length of the control header, in octets - */ -#define CTL_HEADER_LEN 12 -#define CTL_MAX_DATA_LEN 468 - - -/* - * Limits and things - */ -#define CTL_MAXTRAPS 3 /* maximum number of traps we allow */ -#define CTL_TRAPTIME (60*60) /* time out traps in 1 hour */ -#define CTL_MAXAUTHSIZE 64 /* maximum size of an authen'ed req */ - -/* - * Decoding for the r_m_e_op field - */ -#define CTL_RESPONSE 0x80 -#define CTL_ERROR 0x40 -#define CTL_MORE 0x20 -#define CTL_OP_MASK 0x1f - -#define CTL_ISRESPONSE(r_m_e_op) (((r_m_e_op) & 0x80) != 0) -#define CTL_ISMORE(r_m_e_op) (((r_m_e_op) & 0x20) != 0) -#define CTL_ISERROR(r_m_e_op) (((r_m_e_op) & 0x40) != 0) -#define CTL_OP(r_m_e_op) ((r_m_e_op) & CTL_OP_MASK) - -/* - * Opcodes - */ -#define CTL_OP_UNSPEC 0 -#define CTL_OP_READSTAT 1 -#define CTL_OP_READVAR 2 -#define CTL_OP_WRITEVAR 3 -#define CTL_OP_READCLOCK 4 -#define CTL_OP_WRITECLOCK 5 -#define CTL_OP_SETTRAP 6 -#define CTL_OP_ASYNCMSG 7 -#define CTL_OP_UNSETTRAP 31 - -/* - * {En,De}coding of the system status word - */ -#define CTL_SST_TS_UNSPEC 0 /* time source unspecified */ -#define CTL_SST_TS_ATOM 1 /* time source calibrated atomic */ -#define CTL_SST_TS_LF 2 /* time source VLF or LF radio */ -#define CTL_SST_TS_HF 3 /* time source HF radio */ -#define CTL_SST_TS_UHF 4 /* time source UHF radio */ -#define CTL_SST_TS_LOCAL 5 /* time source LOCAL */ -#define CTL_SST_TS_NTP 6 /* time source NTP */ -#define CTL_SST_TS_UDPTIME 7 /* time source UDP/TIME */ -#define CTL_SST_TS_WRSTWTCH 8 /* time source is wristwatch */ -#define CTL_SST_TS_TELEPHONE 9 /* time source is telephone modem */ -#define CTL_SST_TS_PPS 0x20 /* time source is PPS signal */ - -#define CTL_SYS_MAXEVENTS 15 - -#define CTL_SYS_STATUS(li, source, nevnt, evnt) \ - (((((unsigned short)(li))<< 14)&0xc000) | \ - (((source)<<8)&0x3f00) | \ - (((nevnt)<<4)&0x00f0) | \ - ((evnt)&0x000f)) - -#define CTL_SYS_LI(status) (((status)>>14) & 0x3) -#define CTL_SYS_SOURCE(status) (((status)>>8) & 0x3f) -#define CTL_SYS_NEVNT(status) (((status)>>4) & 0xf) -#define CTL_SYS_EVENT(status) ((status) & 0xf) - -/* - * {En,De}coding of the peer status word - */ -#define CTL_PST_CONFIG 0x80 -#define CTL_PST_AUTHENABLE 0x40 -#define CTL_PST_AUTHENTIC 0x20 -#define CTL_PST_REACH 0x10 -#define CTL_PST_UNSPEC 0x08 - -#define CTL_PST_SEL_REJECT 0 /* rejected */ -#define CTL_PST_SEL_SANE 1 /* passed sanity checks */ -#define CTL_PST_SEL_CORRECT 2 /* passed correctness checks */ -#define CTL_PST_SEL_SELCAND 3 /* passed candidate checks */ -#define CTL_PST_SEL_SYNCCAND 4 /* passed outlyer checks */ -#define CTL_PST_SEL_DISTSYSPEER 5 /* selected, distance exceeded */ -#define CTL_PST_SEL_SYSPEER 6 /* selected */ -#define CTL_PST_SEL_PPS 7 /* selected, pps signal override */ - -#define CTL_PEER_MAXEVENTS 15 - -#define CTL_PEER_STATUS(status, nevnt, evnt) \ - ((((status)<<8) & 0xff00) | \ - (((nevnt)<<4) & 0x00f0) | \ - ((evnt) & 0x000f)) - -#define CTL_PEER_STATVAL(status)(((status)>>8) & 0xff) -#define CTL_PEER_NEVNT(status) (((status)>>4) & 0xf) -#define CTL_PEER_EVENT(status) ((status) & 0xf) - -/* - * {En,De}coding of the clock status word - */ -#define CTL_CLK_OKAY 0 -#define CTL_CLK_NOREPLY 1 -#define CTL_CLK_BADFORMAT 2 -#define CTL_CLK_FAULT 3 -#define CTL_CLK_PROPAGATION 4 -#define CTL_CLK_BADDATE 5 -#define CTL_CLK_BADTIME 6 - -#define CTL_CLK_STATUS(status, event) \ - ((((status)<<8) & 0xff00) | \ - ((event) & 0x00ff)) - -/* - * Error code responses returned when the E bit is set. - */ -#define CERR_UNSPEC 0 -#define CERR_PERMISSION 1 -#define CERR_BADFMT 2 -#define CERR_BADOP 3 -#define CERR_BADASSOC 4 -#define CERR_UNKNOWNVAR 5 -#define CERR_BADVALUE 6 -#define CERR_RESTRICT 7 - -#define CERR_NORESOURCE CERR_PERMISSION /* wish there was a different code */ - - -/* - * System variables we understand - */ -#define CS_LEAP 1 -#define CS_STRATUM 2 -#define CS_PRECISION 3 -#define CS_ROOTDELAY 4 -#define CS_ROOTDISPERSION 5 -#define CS_REFID 6 -#define CS_REFTIME 7 -#define CS_POLL 8 -#define CS_PEERID 9 -#define CS_OFFSET 10 -#define CS_DRIFT 11 -#define CS_COMPLIANCE 12 -#define CS_CLOCK 13 -#define CS_LEAPIND 14 -#define CS_LEAPWARNING 15 -#define CS_PROCESSOR 16 -#define CS_SYSTEM 17 -#define CS_KEYID 18 -#define CS_REFSKEW 19 -#define CS_VARLIST 20 - -#define CS_MAXCODE CS_VARLIST - -/* - * Peer variables we understand - */ -#define CP_CONFIG 1 -#define CP_AUTHENABLE 2 -#define CP_AUTHENTIC 3 -#define CP_SRCADR 4 -#define CP_SRCPORT 5 -#define CP_DSTADR 6 -#define CP_DSTPORT 7 -#define CP_LEAP 8 -#define CP_HMODE 9 -#define CP_STRATUM 10 -#define CP_PPOLL 11 -#define CP_HPOLL 12 -#define CP_PRECISION 13 -#define CP_ROOTDELAY 14 -#define CP_ROOTDISPERSION 15 -#define CP_REFID 16 -#define CP_REFTIME 17 -#define CP_ORG 18 -#define CP_REC 19 -#define CP_XMT 20 -#define CP_REACH 21 -#define CP_VALID 22 -#define CP_TIMER 23 -#define CP_DELAY 24 -#define CP_OFFSET 25 -#define CP_DISPERSION 26 -#define CP_KEYID 27 -#define CP_FILTDELAY 28 -#define CP_FILTOFFSET 29 -#define CP_PMODE 30 -#define CP_RECEIVED 31 -#define CP_SENT 32 -#define CP_FILTERROR 33 -#define CP_FLASH 34 -#define CP_DISP 35 -#define CP_VARLIST 36 - -#define CP_MAXCODE CP_VARLIST - -/* - * Clock variables we understand - */ -#define CC_TYPE 1 -#define CC_TIMECODE 2 -#define CC_POLL 3 -#define CC_NOREPLY 4 -#define CC_BADFORMAT 5 -#define CC_BADDATA 6 -#define CC_FUDGETIME1 7 -#define CC_FUDGETIME2 8 -#define CC_FUDGEVAL1 9 -#define CC_FUDGEVAL2 10 -#define CC_FLAGS 11 -#define CC_DEVICE 12 -#define CC_VARLIST 13 - -#define CC_MAXCODE CC_VARLIST - -/* - * Definition of the structure used internally to hold trap information. - * ntp_request.c wants to see this. - */ -struct ctl_trap { - struct sockaddr_in tr_addr; /* address of trap recipient */ - struct interface *tr_localaddr; /* interface to send this through */ - u_long tr_settime; /* time trap was set */ - u_long tr_count; /* async messages sent to this guy */ - u_long tr_origtime; /* time trap was originally set */ - u_long tr_resets; /* count of resets for this trap */ - u_short tr_sequence; /* trap sequence id */ - u_char tr_flags; /* trap flags */ - u_char tr_version; /* version number of trapper */ -}; - -/* - * Flag bits - */ -#define TRAP_INUSE 0x1 /* this trap is active */ -#define TRAP_NONPRIO 0x2 /* this trap is non-priority */ -#define TRAP_CONFIGURED 0x4 /* this trap was configured */ diff --git a/usr.sbin/xntpd/include/ntp_datum.h b/usr.sbin/xntpd/include/ntp_datum.h deleted file mode 100644 index 2aa2cb7..0000000 --- a/usr.sbin/xntpd/include/ntp_datum.h +++ /dev/null @@ -1,30 +0,0 @@ -struct btfp_time /* Structure for reading 5 time words */ - /* in one ioctl(2) operation. */ -{ - unsigned short btfp_time[5]; /* Time words 0,1,2,3, and 4. (16bit)*/ -}; - -/***** Simple ioctl commands *****/ - -#define RUNLOCK _IO('X',19) /* Release Capture Lockout */ -#define RCR0 _IOR('X',22,unsigned int) /* Read control register */ -#define WCR0 _IOW('X',23,unsigned int) /* Write control register */ - -/***** Compound ioctl commands *****/ - -/* Read all 5 time words in one call. */ -#define READTIME _IOR('X',32,struct btfp_time) -#define VMEFD "/dev/btfp0" - - struct vmedate { /* structure returned by get_vmetime.c */ - unsigned short year; - unsigned short doy; - unsigned short hr; - unsigned short mn; - unsigned short sec; - unsigned long frac; - unsigned short status; - }; - -#define PRIO 120 /* set the realtime priority */ -#define NREGS 7 /* number of registers we will use */ diff --git a/usr.sbin/xntpd/include/ntp_filegen.h b/usr.sbin/xntpd/include/ntp_filegen.h deleted file mode 100644 index 9e75bc6..0000000 --- a/usr.sbin/xntpd/include/ntp_filegen.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ntp_filegen.h,v 3.8 1994/05/30 09:48:53 kardel Exp - * - * definitions for NTP file generations support - * - * - * Copyright (c) 1992 - * Rainer Pruy Friedrich-Alexander Unuiversitaet Erlangen-Nuernberg - * - * This code may be modified and used freely - * provided the credits remain intact. - */ - -#include "ntp_types.h" - -/* - * supported file generation types - */ - -#define FILEGEN_NONE 255 /* no generations - use plain file name */ -#define FILEGEN_PID 1 /* one filegen per process incarnation */ -#define FILEGEN_DAY 2 /* one filegen per day */ -#define FILEGEN_WEEK 3 /* one filegen per week */ -#define FILEGEN_MONTH 4 /* one filegen per month */ -#define FILEGEN_YEAR 5 /* one filegen per year */ -#define FILEGEN_AGE 6 /* change filegen each FG_AGE_SECS */ - -/* - * supported file generation flags - */ - -#define FGEN_FLAG_LINK 0x01 /* make a link to base name */ - -#define FGEN_FLAG_ENABLED 0x80 /* set this to really create files */ - /* without this, open is suppressed */ - -typedef struct FILEGEN - { - FILE *fp; /* file referring to current generation */ - char *prefix; /* filename prefix and basename to be used*/ - char *basename; /* for constructing filename of generation file */ - /* WARNING: must be malloced !!! will be fed to free()*/ - u_long id; /* id of current generation */ - u_char type; /* type of file generation */ - u_char flag; /* flags modifying processing of file generation */ - } FILEGEN; - -extern void filegen_setup P((FILEGEN *, u_long)); -extern void filegen_config P((FILEGEN *, char *, u_int, u_int)); -extern FILEGEN *filegen_get P((char *)); -extern void filegen_register P((char *, FILEGEN *)); diff --git a/usr.sbin/xntpd/include/ntp_fp.h b/usr.sbin/xntpd/include/ntp_fp.h deleted file mode 100644 index ec657f7..0000000 --- a/usr.sbin/xntpd/include/ntp_fp.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * ntp_fp.h - definitions for NTP fixed point arithmetic - */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -#include "ntp_types.h" - -/* - * NTP uses two fixed point formats. The first (l_fp) is the "long" format - * and is 64 bits long with the decimal between bits 31 and 32. This - * is used for time stamps in the NTP packet header (in network byte - * order) and for internal computations of offsets (in local host byte - * order). We use the same structure for both signed and unsigned values, - * which is a big hack but saves rewriting all the operators twice. Just - * to confuse this, we also sometimes just carry the fractional part in - * calculations, in both signed and unsigned forms. Anyway, an l_fp looks - * like: - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Integral Part | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Fractional Part | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ -typedef struct { - union { - U_LONG Xl_ui; - LONG Xl_i; - } Ul_i; - union { - U_LONG Xl_uf; - LONG Xl_f; - } Ul_f; -} l_fp; - -#define l_ui Ul_i.Xl_ui /* unsigned integral part */ -#define l_i Ul_i.Xl_i /* signed integral part */ -#define l_uf Ul_f.Xl_uf /* unsigned fractional part */ -#define l_f Ul_f.Xl_f /* signed fractional part */ - -/* - * Fractional precision (of an l_fp) is actually the number of - * bits in a long. - */ -#define FRACTION_PREC (32) - - -/* - * The second fixed point format is 32 bits, with the decimal between - * bits 15 and 16. There is a signed version (s_fp) and an unsigned - * version (u_fp). This is used to represent synchronizing distance - * and synchronizing dispersion in the NTP packet header (again, in - * network byte order) and internally to hold both distance and - * dispersion values (in local byte order). In network byte order - * it looks like: - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Integer Part | Fraction Part | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ -typedef LONG s_fp; -typedef U_LONG u_fp; - -/* - * A unit second in fp format. Actually 2**(half_the_bits_in_a_long) - */ -#define FP_SECOND (0x10000) - -/* - * Byte order conversions - */ -#define HTONS_FP(x) (htonl(x)) -#define HTONL_FP(h, n) do { (n)->l_ui = htonl((h)->l_ui); \ - (n)->l_uf = htonl((h)->l_uf); } while (0) -#define NTOHS_FP(x) (ntohl(x)) -#define NTOHL_FP(n, h) do { (h)->l_ui = ntohl((n)->l_ui); \ - (h)->l_uf = ntohl((n)->l_uf); } while (0) -#define NTOHL_MFP(ni, nf, hi, hf) \ - do { (hi) = ntohl(ni); (hf) = ntohl(nf); } while (0) -#define HTONL_MFP(hi, hf, ni, nf) \ - do { (ni) = ntohl(hi); (nf) = ntohl(hf); } while (0) - -/* funny ones. Converts ts fractions to net order ts */ -#define HTONL_UF(uf, nts) \ - do { (nts)->l_ui = 0; (nts)->l_uf = htonl(uf); } while (0) -#define HTONL_F(f, nts) do { (nts)->l_uf = htonl(f); \ - if ((f) & 0x80000000) \ - (nts)->l_i = -1; \ - else \ - (nts)->l_i = 0; \ - } while (0) - -/* - * Conversions between the two fixed point types - */ -#define MFPTOFP(x_i, x_f) (((x_i)<<16) | (((x_f)>>16)&0xffff)) -#define LFPTOFP(v) MFPTOFP((v)->l_i, (v)->l_f) - -#define UFPTOLFP(x, v) ((v)->l_ui = (u_fp)(x)>>16, (v)->l_uf = (x)<<16) -#define FPTOLFP(x, v) (UFPTOLFP((x), (v)), (x) < 0 ? (v)->l_ui -= 0x10000 : 0) - -/* - * Primitive operations on long fixed point values. If these are - * reminiscent of assembler op codes it's only because some may - * be replaced by inline assembler for particular machines someday. - * These are the (kind of inefficient) run-anywhere versions. - */ -#define M_NEG(v_i, v_f) /* v = -v */ \ - do { \ - if ((v_f) == 0) \ - (v_i) = -(v_i); \ - else { \ - (v_f) = -(v_f); \ - (v_i) = ~(v_i); \ - } \ - } while(0) - -#define M_NEGM(r_i, r_f, a_i, a_f) /* r = -a */ \ - do { \ - if ((a_f) == 0) { \ - (r_f) = 0; \ - (r_i) = -(a_i); \ - } else { \ - (r_f) = -(a_f); \ - (r_i) = ~(a_i); \ - } \ - } while(0) - -#define M_ADD(r_i, r_f, a_i, a_f) /* r += a */ \ - do { \ - register U_LONG lo_tmp; \ - register U_LONG hi_tmp; \ - \ - lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \ - hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \ - if (lo_tmp & 0x10000) \ - hi_tmp++; \ - (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \ - \ - (r_i) += (a_i); \ - if (hi_tmp & 0x10000) \ - (r_i)++; \ - } while (0) - -#define M_ADD3(r_ovr, r_i, r_f, a_ovr, a_i, a_f) /* r += a, three word */ \ - do { \ - register U_LONG lo_tmp; \ - register U_LONG hi_tmp; \ - \ - lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \ - hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \ - if (lo_tmp & 0x10000) \ - hi_tmp++; \ - (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \ - \ - lo_tmp = ((r_i) & 0xffff) + ((a_i) & 0xffff); \ - if (hi_tmp & 0x10000) \ - lo_tmp++; \ - hi_tmp = (((r_i) >> 16) & 0xffff) + (((a_i) >> 16) & 0xffff); \ - if (lo_tmp & 0x10000) \ - hi_tmp++; \ - (r_i) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \ - \ - (r_ovr) += (a_ovr); \ - if (hi_tmp & 0x10000) \ - (r_ovr)++; \ - } while (0) - -#define M_SUB(r_i, r_f, a_i, a_f) /* r -= a */ \ - do { \ - register U_LONG lo_tmp; \ - register U_LONG hi_tmp; \ - \ - if ((a_f) == 0) { \ - (r_i) -= (a_i); \ - } else { \ - lo_tmp = ((r_f) & 0xffff) + ((-(a_f)) & 0xffff); \ - hi_tmp = (((r_f) >> 16) & 0xffff) \ - + (((-(a_f)) >> 16) & 0xffff); \ - if (lo_tmp & 0x10000) \ - hi_tmp++; \ - (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \ - \ - (r_i) += ~(a_i); \ - if (hi_tmp & 0x10000) \ - (r_i)++; \ - } \ - } while (0) - -#define M_RSHIFTU(v_i, v_f) /* v >>= 1, v is unsigned */ \ - do { \ - (v_f) = (U_LONG)(v_f) >> 1; \ - if ((v_i) & 01) \ - (v_f) |= 0x80000000; \ - (v_i) = (U_LONG)(v_i) >> 1; \ - } while (0) - -#define M_RSHIFT(v_i, v_f) /* v >>= 1, v is signed */ \ - do { \ - (v_f) = (U_LONG)(v_f) >> 1; \ - if ((v_i) & 01) \ - (v_f) |= 0x80000000; \ - if ((v_i) & 0x80000000) \ - (v_i) = ((v_i) >> 1) | 0x80000000; \ - else \ - (v_i) = (v_i) >> 1; \ - } while (0) - -#define M_LSHIFT(v_i, v_f) /* v <<= 1 */ \ - do { \ - (v_i) <<= 1; \ - if ((v_f) & 0x80000000) \ - (v_i) |= 0x1; \ - (v_f) <<= 1; \ - } while (0) - -#define M_LSHIFT3(v_ovr, v_i, v_f) /* v <<= 1, with overflow */ \ - do { \ - (v_ovr) <<= 1; \ - if ((v_i) & 0x80000000) \ - (v_ovr) |= 0x1; \ - (v_i) <<= 1; \ - if ((v_f) & 0x80000000) \ - (v_i) |= 0x1; \ - (v_f) <<= 1; \ - } while (0) - -#define M_ADDUF(r_i, r_f, uf) /* r += uf, uf is U_LONG fraction */ \ - M_ADD((r_i), (r_f), 0, (uf)) /* let optimizer worry about it */ - -#define M_SUBUF(r_i, r_f, uf) /* r -= uf, uf is U_LONG fraction */ \ - M_SUB((r_i), (r_f), 0, (uf)) /* let optimizer worry about it */ - -#define M_ADDF(r_i, r_f, f) /* r += f, f is a LONG fraction */ \ - do { \ - if ((f) > 0) \ - M_ADD((r_i), (r_f), 0, (f)); \ - else if ((f) < 0) \ - M_ADD((r_i), (r_f), (-1), (f));\ - } while(0) - -#define M_ISNEG(v_i, v_f) /* v < 0 */ \ - (((v_i) & 0x80000000) != 0) - -#define M_ISHIS(a_i, a_f, b_i, b_f) /* a >= b unsigned */ \ - (((U_LONG)(a_i)) > ((U_LONG)(b_i)) || \ - ((a_i) == (b_i) && ((U_LONG)(a_f)) >= ((U_LONG)(b_f)))) - -#define M_ISGEQ(a_i, a_f, b_i, b_f) /* a >= b signed */ \ - (((LONG)(a_i)) > ((LONG)(b_i)) || \ - ((a_i) == (b_i) && ((U_LONG)(a_f)) >= ((U_LONG)(b_f)))) - -#define M_ISEQU(a_i, a_f, b_i, b_f) /* a == b unsigned */ \ - ((a_i) == (b_i) && (a_f) == (b_f)) - -/* - * Operations on the long fp format - */ -#define L_ADD(r, a) M_ADD((r)->l_ui, (r)->l_uf, (a)->l_ui, (a)->l_uf) -#define L_SUB(r, a) M_SUB((r)->l_ui, (r)->l_uf, (a)->l_ui, (a)->l_uf) -#define L_NEG(v) M_NEG((v)->l_ui, (v)->l_uf) -#define L_ADDUF(r, uf) M_ADDUF((r)->l_ui, (r)->l_uf, (uf)) -#define L_SUBUF(r, uf) M_SUBUF((r)->l_ui, (r)->l_uf, (uf)) -#define L_ADDF(r, f) M_ADDF((r)->l_ui, (r)->l_uf, (f)) -#define L_RSHIFT(v) M_RSHIFT((v)->l_i, (v)->l_uf) -#define L_RSHIFTU(v) M_RSHIFT((v)->l_ui, (v)->l_uf) -#define L_LSHIFT(v) M_LSHIFT((v)->l_ui, (v)->l_uf) -#define L_CLR(v) ((v)->l_ui = (v)->l_uf = 0) - -#define L_ISNEG(v) (((v)->l_ui & 0x80000000) != 0) -#define L_ISZERO(v) ((v)->l_ui == 0 && (v)->l_uf == 0) -#define L_ISHIS(a, b) ((a)->l_ui > (b)->l_ui || \ - ((a)->l_ui == (b)->l_ui && (a)->l_uf >= (b)->l_uf)) -#define L_ISGEQ(a, b) ((a)->l_i > (b)->l_i || \ - ((a)->l_i == (b)->l_i && (a)->l_uf >= (b)->l_uf)) -#define L_ISEQU(a, b) M_ISEQU((a)->l_ui, (a)->l_uf, (b)->l_ui, (b)->l_uf) - -extern char * dofptoa P((u_fp, int, int, int)); -extern char * dolfptoa P((u_long, u_long, int, int, int)); - -extern int atolfp P((const char *, l_fp *)); -extern int buftvtots P((const char *, l_fp *)); -extern void gettstamp P((l_fp *)); -extern char * fptoa P((s_fp, int)); -extern char * fptoms P((s_fp, int)); -extern char * fptoms P((s_fp, int)); -extern int hextolfp P((const char *, l_fp *)); -extern int mstolfp P((const char *, l_fp *)); -extern char * prettydate P((l_fp *)); -extern char * uglydate P((l_fp *)); - -extern void get_systime P((l_fp *)); -extern int step_systime P((l_fp *)); -extern int step_systime_real P((l_fp *)); -extern int adj_systime P((l_fp *)); - -#define lfptoa(_fpv, _ndec) mfptoa((_fpv)->l_ui, (_fpv)->l_uf, (_ndec)) -#define lfptoms(_fpv, _ndec) mfptoms((_fpv)->l_ui, (_fpv)->l_uf, (_ndec)) - -#define ntoa(_sin) numtoa((_sin)->sin_addr.s_addr) -#define ntohost(_sin) numtohost((_sin)->sin_addr.s_addr) - -#define ufptoa(_fpv, _ndec) dofptoa((_fpv), 0, (_ndec), 0) -#define ufptoms(_fpv, _ndec) dofptoa((_fpv), 0, (_ndec), 1) -#define ulfptoa(_fpv, _ndec) dolfptoa((_fpv)->l_ui, (_fpv)->l_uf, 0, (_ndec), 0) -#define ulfptoms(_fpv, _ndec) dolfptoa((_fpv)->l_ui, (_fpv)->l_uf, 0, (_ndec), 1) -#define umfptoa(_fpi, _fpf, _ndec) dolfptoa((_fpi), (_fpf), 0, (_ndec), 0) diff --git a/usr.sbin/xntpd/include/ntp_if.h b/usr.sbin/xntpd/include/ntp_if.h deleted file mode 100644 index 340481a..0000000 --- a/usr.sbin/xntpd/include/ntp_if.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Sockets are not standard. - * So hide uglyness in include file. - */ -#if defined(SYS_CONVEXOS9) -#include "/sys/sync/queue.h" -#include "/sys/sync/sema.h" -#endif - -#if defined(SYS_AIX) -#include <sys/time.h> -#include <time.h> -#endif - -#if (defined(SOLARIS) && !defined(bsd)) || defined(SYS_SUNOS4) -#include <sys/sockio.h> -#endif - -#if defined(SYS_UNIXWARE1) -#include <sys/sockio.h> -#endif - -#if defined(SYS_PTX) || defined(SYS_SINIXM) -#include <sys/stream.h> -#include <sys/stropts.h> -#endif - -#if defined(SYS_SVR4) -#if !defined(USE_STREAMS_DEVICE_FOR_IF_CONFIG) -#include <sys/sockio.h> -#else /* USE_STREAMS_DEVICE_FOR_IF_CONFIG */ -#include <netinet/ip.h> -#undef SIOCGIFCONF -#undef SIOCGIFFLAGS -#undef SIOCGIFADDR -#undef SIOCGIFBRDADDR -#undef SIOCGIFNETMASK -#define SIOCGIFCONF IPIOC_GETIFCONF -#define SIOCGIFFLAGS IPIOC_GETIFFLAGS -#define SIOCGIFADDR IPIOC_GETIFADDR -#define SIOCGIFBRDADDR IPIOC_GETIFBRDADDR -#define SIOCGIFNETMASK IPIOC_GETIFNETMASK -#endif /* USE_STREAMS_DEVICE_FOR_IF_CONFIG */ - -#endif /* SYS_SVR4 */ - -#if defined(SYS_FREEBSD) -#include <sys/time.h> -#endif - -#include <net/if.h> diff --git a/usr.sbin/xntpd/include/ntp_in.h b/usr.sbin/xntpd/include/ntp_in.h deleted file mode 100755 index 494051f..0000000 --- a/usr.sbin/xntpd/include/ntp_in.h +++ /dev/null @@ -1,259 +0,0 @@ -/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* - * Constants and structures defined by the internet system, - * Per RFC 790, September 1981. - */ - -#ifndef _netinet_in_h -#define _netinet_in_h -#define _NETINET_IN_H_ -#define _SYS_IN_INCLUDED -#define __IN_HEADER - -/* - * Protocols - */ -#define IPPROTO_IP 0 /* dummy for IP */ -#define IPPROTO_ICMP 1 /* control message protocol */ -#define IPPROTO_IGMP 2 /* group control protocol */ -#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ -#define IPPROTO_ST 5 /* st */ -#define IPPROTO_TCP 6 /* tcp */ -#define IPPROTO_EGP 8 /* exterior gateway protocol */ -#define IPPROTO_PUP 12 /* pup */ -#define IPPROTO_UDP 17 /* user datagram protocol */ -#define IPPROTO_IDP 22 /* xns idp */ -#define IPPROTO_HELLO 63 /* "hello" routing protocol */ -#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ -#define IPPROTO_OSPF 89 /* Open SPF IGP */ - -#define IPPROTO_RAW 255 /* raw IP packet */ -#define IPPROTO_MAX 256 - -/* - * Port/socket numbers: network standard functions - */ -#define IPPORT_ECHO 7 -#define IPPORT_DISCARD 9 -#define IPPORT_SYSTAT 11 -#define IPPORT_DAYTIME 13 -#define IPPORT_NETSTAT 15 -#define IPPORT_FTP 21 -#define IPPORT_TELNET 23 -#define IPPORT_SMTP 25 -#define IPPORT_TIMESERVER 37 -#define IPPORT_NAMESERVER 42 -#define IPPORT_WHOIS 43 -#define IPPORT_MTP 57 - -/* - * Port/socket numbers: host specific functions - */ -#define IPPORT_TFTP 69 -#define IPPORT_RJE 77 -#define IPPORT_FINGER 79 -#define IPPORT_TTYLINK 87 -#define IPPORT_SUPDUP 95 - -/* - * UNIX TCP sockets - */ -#define IPPORT_EXECSERVER 512 -#define IPPORT_LOGINSERVER 513 -#define IPPORT_CMDSERVER 514 -#define IPPORT_EFSSERVER 520 - -/* - * UNIX UDP sockets - */ -#define IPPORT_BIFFUDP 512 -#define IPPORT_WHOSERVER 513 -#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ - -/* - * Ports < IPPORT_RESERVED are reserved for - * privileged processes (e.g. root). - * Ports > IPPORT_USERRESERVED are reserved - * for servers, not necessarily privileged. - */ -#define IPPORT_RESERVED 1024 -#define IPPORT_USERRESERVED 5000 - -/* - * Link numbers - */ -#define IMPLINK_IP 155 -#define IMPLINK_LOWEXPER 156 -#define IMPLINK_HIGHEXPER 158 - -/* - * Internet address - * This definition contains obsolete fields for compatibility - * with SunOS 3.x and 4.2bsd. The presence of subnets renders - * divisions into fixed fields misleading at best. New code - * should use only the s_addr field. - */ -struct in_addr { - union { - struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; - struct { u_short s_w1,s_w2; } S_un_w; - u_long S_addr; - } S_un; -#define s_addr S_un.S_addr /* should be used for all code */ -#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ -#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ -#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ -#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ -#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ -}; - -/* - * Definitions of bits in internet address integers. - * On subnets, the decomposition of addresses to host and net parts - * is done according to subnet mask, not the masks here. - */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ -#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ -#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) - -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_LOOPBACK (u_long)0x7F000001 -#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ - -#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ -#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ - -#define IN_LOOPBACKNET 127 /* official! */ - -/* - * Define a macro to stuff the loopback address into an Internet address - */ -#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ - (a)->sin_family = AF_INET;} - -/* - * Socket address, internet style. - */ -struct sockaddr_in { - short sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; - -/* - * Options for use with [gs]etsockopt at the IP level. - */ -#define IP_OPTIONS 1 /* set/get IP per-packet options */ -#define IP_MULTICAST_IF 2 /* set/get IP multicast interface */ -#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive */ -#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */ -#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */ -#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */ - -#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ -#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ -#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ - -/* - * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. - */ -struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; - -#if !defined(vax) && !defined(ntohl) && !defined(i386) -/* - * Macros for number representation conversion. - */ -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) -#endif - -#if !defined(ntohl) && (defined(vax) || defined(i386)) -u_short ntohs(), htons(); -u_long ntohl(), htonl(); -#endif - -#ifdef KERNEL -extern struct domain inetdomain; -extern struct protosw inetsw[]; -struct in_addr in_makeaddr(); -u_long in_netof(), in_lnaof(); -#endif - -#ifndef BYTE_ORDER -/* - * Definitions for byte order, - * according to byte significance from low address to high. - */ -#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ -#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ - -#if defined(vax) || defined(i386) -#define BYTE_ORDER LITTLE_ENDIAN -#else -#define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ -#endif -#endif BYTE_ORDER - -/* - * Macros for number representation conversion. - */ -#if BYTE_ORDER==LITTLE_ENDIAN -#define NTOHL(d) ((d) = ntohl((d))) -#define NTOHS(d) ((d) = ntohs((d))) -#define HTONL(d) ((d) = htonl((d))) -#define HTONS(d) ((d) = htons((d))) -#else -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) -#define NTOHL(d) -#define NTOHS(d) -#define HTONL(d) -#define HTONS(d) -#endif - -#endif /*!_netinet_in_h*/ diff --git a/usr.sbin/xntpd/include/ntp_io.h b/usr.sbin/xntpd/include/ntp_io.h deleted file mode 100644 index ebe20b4..0000000 --- a/usr.sbin/xntpd/include/ntp_io.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * POSIX says use <fnct.h> to get O_* symbols and - * SEEK_SET symbol form <untisd.h>. - */ -#if defined(NTP_POSIX_SOURCE) - -/* - * POSIX way - */ -#include <stdio.h> -#if defined(HAVE_SIGNALED_IO) && (defined(SYS_AUX2) || defined(SYS_AUX3) || defined(SYS_PTX)) -#include <sys/file.h> -#endif -#include <unistd.h> -#include <fcntl.h> -#else -/* - * BSD way - */ -#include <sys/file.h> -#include <fcntl.h> -#if !defined(SEEK_SET) && defined(L_SET) -#define SEEK_SET L_SET -#endif -#endif diff --git a/usr.sbin/xntpd/include/ntp_machine.h b/usr.sbin/xntpd/include/ntp_machine.h deleted file mode 100644 index 0d4267c..0000000 --- a/usr.sbin/xntpd/include/ntp_machine.h +++ /dev/null @@ -1,742 +0,0 @@ -/* - * Collect all machine dependent idiosyncrasies in one place. - */ - -#ifndef __ntp_machine -#define __ntp_machine - -/* - Various options. - They can defined with the DEFS directive in the Config file if they - are not defined here. - -WHICH NICE - - HAVE_ATT_NICE - Use att nice(priority_change) - HAVE_BSD_NICE - Use bsd setprioirty(which, who, priority) - HAVE_NO_NICE - Don't have (or use) either - -KERNEL MUCKING - If you porting to a new system see xntpd/ntp_unixclock.c and - util/tickadj.c to see what these do. This is very system - dependent stuff!!! - - HAVE_LIBKVM - Use libkvm to read kernal memory - HAVE_READKMEM - Use read to read kernal memory - NOKMEM - Don't read kmem - HAVE_N_UN - Have u_nn nlist struct. - -WHICH SETPGRP TO USE - Not needed if NTP_POSIX_SOURCE is defined since you - better of setsid! - - HAVE_ATT_SETPGRP - setpgrp(void) instead of setpgrp(int, int) - - -Signaled IO - Signled IO defines. - - HAVE_SIGNALED_IO - Enable signaled io. Assumes you are going to use SIGIO - for tty and udp io. - USE_UDP_SIGPOLL - Use SIGPOLL on socket io. This assumes that the - sockets routines are defined on top of streams. - USE_TTY_SIGPOLL - Use SIGPOLL on tty io. This assumes streams. - UDP_BACKWARDS_SETOWN - SunOS 3.5 or Ultirx 2.0 system. - - -WHICH TERMINAL MODEL TO USE - I would assume HAVE_TERMIOS if - NTP_POSIX_SOURCE was set but can't. The - posix tty driver is too restrictive on most systems. - It is defined if you define STREAMS. - - We do not put these defines in the ntp_machine.h as some systems - offer multiple interfaces and refclock configuration likes to - peek into the configuration defines for tty model restrictions. - Thus all tty definitions should be in the files in the machines directory. - - HAVE_TERMIOS - Use POSIX termios.h - HAVE_SYSV_TTYS - Use SYSV termio.h - HAVE_BSD_TTYS - Use BSD stty.h - -THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about - kernel mucking. - - NTP_POSIX_SOURCE - Use POSIX functions over bsd functions and att functions. - This is NOT the same as _POSIX_SOURCE. - It is much weaker! - - -STEP SLEW OR TWO STEP - The Default is to step. - - SLEWALWAYS - setttimeofday can not be used to set the time of day at - all. - STEP_SLEW - setttimeofday can not set the seconds part of time - time use setttimeofday to set the seconds part of the - time and the slew the seconds. - FORCE_NTPDATE_STEP - even if SLEWALWAYS is defined, force a step of - of the systemtime (via settimeofday()). Only takes - affect if STEP_SLEW isn't defined. - -WHICH TIMEOFDAY() - - SYSV_TIMEOFDAY - [sg]ettimeofday(struct timeval *) as opposed to BSD - [sg]ettimeofday(struct timeval *, struct timezone *) - -INFO ON NEW KERNEL PLL SYS CALLS - - NTP_SYSCALLS_STD - use the "normal" ones - NTP_SYSCALL_GET - SYS_ntp_gettime id - NTP_SYSCALL_ADJ - SYS_ntp_adjtime id - NTP_SYSCALLS_LIBC - ntp_adjtime() and ntp_gettime() are in libc. - -HOW TO GET IP INTERFACE INFORMATION - - Some UNIX V.4 machines implement a sockets library on top of - streams. For these systems, you must use send the SIOCGIFCONF down - the stream in an I_STR ioctl. This ususally also implies - USE_STREAMS_DEVICE FOR IF_CONFIG. Dell UNIX is a notable exception. - - STREAMS_TLI - use ioctl(I_STR) to implement ioctl(SIOCGIFCONF) - -WHAT DOES IOCTL(SIOCGIFCONF) RETURN IN THE BUFFER - - UNIX V.4 machines implement a sockets library on top of streams. - When requesting the IP interface configuration with an ioctl(2) calll, - an array of ifreq structures are placed in the provided buffer. Some - implementations also place the length of the buffer information in - the first integer position of the buffer. - - SIZE_RETURNED_IN_BUFFER - size integer is in the buffer - -WILL IOCTL(SIOCGIFCONF) WORK ON A SOCKET - - Some UNIX V.4 machines do not appear to support ioctl() requests for the - IP interface configuration on a socket. They appear to require the use - of the streams device instead. - - USE_STREAMS_DEVICE_FOR_IF_CONFIG - use the /dev/ip device for configuration - -MISC - - USE_PROTOTYPES - Prototype functions - DOSYNCTODR - Resync TODR clock every hour. - RETSIGTYPE - Define signal function type. - NO_SIGNED_CHAR_DECL - No "signed char" see include/ntp.h - LOCK_PROCESS - Have plock. - UDP_WILDCARD_DELIVERY - - these systems deliver broadcast packets to the wildcard - port instead to a port bound to the interface bound - to the correct broadcast address - are these - implementations broken or did the spec change ? - -DEFINITIONS FOR SYSTEM && PROCESSOR - STR_SYSTEM - value of system variable - STR_PROCESSOR - value of processor variable - -You could just put the defines on the DEFS line in machines/<os> file. -I don't since there are lots of different types of compilers that a system might -have, some that can do proto typing and others that cannot on the same system. -I get a chance to twiddle some of the configuration parameters at compile -time based on compiler/machine combinations by using this include file. -See convex, aix and sun configurations see how complex it get. - -Note that it _is_ considered reasonable to add some system-specific defines -to the machine/<os> file if it would be too inconvenient to puzzle them out -in this file. - -*/ - - -/* - * RS6000 running AIX. - */ -#if defined(SYS_AIX) -#define HAVE_SIGNALED_IO -#ifndef _BSD -#define NTP_STDC -#define NTP_POSIX_SOURCE -/* - * Keep USE_PROTOTYPES and _NO_PROTO in step. - */ -#if defined(_NO_PROTO) && defined(USE_PROTOTYPES) -#undef USE_PROTOTYPES -#endif -#if !defined(_NO_PROTO) && !defined(USE_PROTOTYPES) -#define USE_PROTOTYPES -#endif -#endif /*_BSD */ -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/AIX" -#endif -#endif /* RS6000 */ - -/* - * SunOS 4.X.X - * Note: posix version has NTP_POSIX_SOURCE and HAVE_SIGNALED_IO - */ -#if defined(SYS_SUNOS4) -#define NTP_NEED_BOPS -#define NO_SIGNED_CHAR_DECL -#define HAVE_LIBKVM -#define HAVE_MALLOC_H -#define HAVE_BSD_NICE -#define RETSIGTYPE void -#define NTP_SYSCALL_GET 132 -#define NTP_SYSCALL_ADJ 147 -#define HAVE_MODEM_CONTROL -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/SunOS 4.x" -#endif -#endif - -/* - * Sinix-M - */ -#if defined(SYS_SINIXM) -#undef HAVE_SIGNALED_IO -#undef USE_TTY_SIGPOLL -#undef USE_UDP_SIGPOLL -#define STREAMS_TLI -#define NO_SIGNED_CHAR_DECL -#define STEP_SLEW /* TWO step */ -#define RETSIGTYPE void -#define NTP_POSIX_SOURCE -#define HAVE_ATT_SETPGRP -#define HAVE_ATT_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/SINIX-M" -#endif -#endif - -/* - * SunOS 5.1 or SunOS 5.2 or Solaris 2.1 or Solaris 2.2 - */ -#if defined(SYS_SOLARIS) -#define HAVE_SIGNALED_IO -#define USE_TTY_SIGPOLL -#define USE_UDP_SIGPOLL -#define NO_SIGNED_CHAR_DECL -#define STEP_SLEW /* TWO step */ -#define RETSIGTYPE void -#define NTP_POSIX_SOURCE -#define HAVE_ATT_SETPGRP -#define HAVE_ATT_NICE -#define UDP_WILDCARD_DELIVERY -#define HAVE_MODEM_CONTROL -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Solaris 2.x" -#endif -#endif - -/* - * Convex - */ -#if defined(SYS_CONVEXOS10) || defined(SYS_CONVEXOS9) -#define HAVE_SIGNALED_IO -#define HAVE_N_UN -#define HAVE_READKMEM -#define HAVE_BSD_NICE -#if defined(convex) -#define RETSIGTYPE int -#define NO_SIGNED_CHAR_DECL -#else -#if defined(__stdc__) && !defined(USE_PROTOTYPES) -#define USE_PROTOTYPES -#endif -#if !defined(__stdc__) && defined(USE_PROTOTYPES) -#undef USE_PROTOTYPES -#endif -#define NTP_POSIX_SOURCE -#define HAVE_ATT_SETPGRP -#endif -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/ConvexOS" -#endif -#endif - -/* - * IRIX 4.X and IRIX 5.x - */ -#if defined(SYS_IRIX4)||defined(SYS_IRIX5) -#define HAVE_SIGNALED_IO -#define USE_TTY_SIGPOLL -#define ADJTIME_IS_ACCURATE -#define LOCK_PROCESS -#define USE_PROTOTYPES -#define HAVE_ATT_SETPGRP -#define HAVE_BSD_NICE -#define NTP_POSIX_SOURCE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/IRIX" -#endif -#endif - -/* - * Ultrix - * Note: posix version has NTP_POSIX_SOURCE and HAVE_SIGNALED_IO - */ -#if defined(SYS_ULTRIX) -#define S_CHAR_DEFINED -#define HAVE_READKMEM -#define HAVE_BSD_NICE -#define RETSIGTYPE void -#define NTP_SYSCALLS_STD -#define HAVE_MODEM_CONTROL -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Ultrix" -#endif -#endif - -/* - * AUX - */ -#if defined(SYS_AUX2) || defined(SYS_AUX3) -#define NO_SIGNED_CHAR_DECL -#define HAVE_READKMEM -#define HAVE_ATT_NICE -#define LOCK_PROCESS -#define NTP_POSIX_SOURCE -/* - * This requires that _POSIX_SOURCE be forced on the - * compiler command flag. We can't do it here since this - * file is included _after_ the system header files and we - * need to let _them_ know we're POSIX. We do this in - * compilers/aux3.gcc... - */ -#define SLEWALWAYS -#define FORCE_NTPDATE_STEP -#define RETSIGTYPE void -#define HAVE_ATT_SETPGRP -#define LOG_NTP LOG_LOCAL1 -#define HAVE_SIGNALED_IO -#define NTP_NEED_BOPS -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/AUX" -#endif -#endif - -/* - * Next - */ -#if defined(SYS_NEXT) -#define RETSIGTYPE void -#define DOSYNCTODR -#define HAVE_READKMEM -#define HAVE_BSD_NICE -#define HAVE_N_UN -#undef NTP_POSIX_SOURCE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Next" -#endif -#endif - -/* - * HPUX - */ -#if defined(SYS_HPUX) -#define NTP_POSIX_SOURCE -#define HAVE_SIGNALED_IO -#define getdtablesize() sysconf(_SC_OPEN_MAX) -#define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) -#define NO_SIGNED_CHAR_DECL -#define LOCK_PROCESS -#define RETSIGTYPE void -#if (SYS_HPUX < 9) -#define HAVE_NO_NICE /* HPUX uses rtprio instead */ -#else -#define HAVE_BSD_NICE /* new at 9.X */ -#endif -#if (SYS_HPUX < 10) -#define NOKMEM -#else -#define HAVE_READKMEM -#endif -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/HPUX" -#endif -#endif - -/* - * bsdi - */ -#if defined(SYS_BSDI) -#define HAVE_SIGNALED_IO -#define HAVE_LIBKVM -#define NTP_POSIX_SOURCE -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/BSDI" -#endif -#endif - -/* - * 4.4 bsd - */ -#if defined(SYS_44BSD) -#define HAVE_SIGNALED_IO -#define HAVE_LIBKVM -#define HAVE_SYSCTL -#define NTP_POSIX_SOURCE -#define HAVE_BSD_NICE -#define USE_PROTOTYPES -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/4.4BSD" -#endif -#define MCAST -#ifdef SYS_FREEBSD -#ifdef HAVE_SIGNALED_IO -#undef HAVE_SIGNALED_IO -#endif -#define HAVE_TERMIOS -#define HAVE_UNAME -#define HAVE_SYS_TIMEX_H -#define HAVE_GETBOOTFILE -#define NTP_SYSCALLS_LIBC -#define KERNEL_PLL -#endif -#endif - -/* - * Linux - */ -#if defined(SYS_LINUX) -#undef HAVE_SIGNALED_IO -#define RETSIGTYPE void -#define NTP_POSIX_SOURCE -#define ADJTIME_IS_ACCURATE -#define HAVE_SYS_TIMEX_H -/* hope there will be a standard interface - * along with a standard name one day ! */ -#define ntp_adjtime __adjtimex -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Linux" -#endif -#endif - -/* - * 386BSD and any variants 8-) - should really have only ONE define - * for this bunch. - */ -#if defined(SYS_386BSD) || defined(SYS_NETBSD) -#define HAVE_SIGNALED_IO -#define HAVE_READKMEM -#define NTP_POSIX_SOURCE -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/\052BSD" -#endif -#ifdef SYS_FREEBSD -#define HAVE_TERMIOS -#define HAVE_UNAME -#define HAVE_SYS_TIMEX_H -#define NTP_SYSCALLS_LIBC -#define KERNEL_PLL -#endif -#endif - -/* - * DEC AXP OSF/1 - */ -#if defined(SYS_DECOSF1) -#define HAVE_SIGNALED_IO -#define HAVE_READKMEM -#define NTP_POSIX_SOURCE -#define NTP_SYSCALLS_STD -#define HAVE_BSD_NICE -#define HAVE_MODEM_CONTROL -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/DECOSF1" -#endif -#endif - -/* - * Intel x86 OSF/1 - */ -#if defined(SYS_IX86OSF1) -#define HAVE_SIGNALED_IO -#define HAVE_READKMEM -#define NTP_POSIX_SOURCE -#define NTP_SYSCALLS_STD -#define HAVE_BSD_NICE -#define HAVE_MODEM_CONTROL -#define SYS_DECOSF1 -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/IX86OSF1" -#endif -#endif - -/* - * ISI - */ -#if defined(SYS_BSD) -#define NO_SIGNED_CHAR_DECL -#define HAVE_BSD_NICE -#define HAVE_BSD_TTYS -#define HAVE_READKMEM -#define HAVE_SIGNALED_IO -#define NEED_VSPRINTF -#undef NTP_POSIX_SOURCE -#endif - -/* - * I386 - * XXX - what OS? - */ -#if defined(SYS_I386) -#define HAVE_READKMEM -#define S_CHAR_DEFINED -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/I386" -#endif -#endif - -/* - * Mips - */ -#if defined(SYS_MIPS) -#define NOKMEM -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Mips" -#endif -#endif - -/* - * SEQUENT - */ -#if defined(SYS_SEQUENT) -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Sequent Dynix 3" -#endif -#endif - -/* - * PTX - */ -#if defined(SYS_PTX) -#define NO_SIGNED_CHAR_DECL -#define STREAMS_TLI -#define HAVE_ATT_SETPGRP -#define HAVE_SIGNALED_IO -#define USE_UDP_SIGPOLL -#define USE_TTY_SIGPOLL -#undef ADJTIME_IS_ACCURATE /* not checked yet */ -#define LOCK_PROCESS -#define HAVE_ATT_SETPGRP -#define HAVE_ATT_NICE -#define STEP_SLEW /* TWO step */ -#define SYSV_GETTIMEOFDAY -#define HAVE_READKMEM -#define UDP_WILDCARD_DELIVERY -#define NTP_POSIX_SOURCE -#define memmove(x, y, z) memcpy(x, y, z) -struct timezone { int __0; }; /* unused placebo */ -/* - * no comment !@! - */ -typedef unsigned int u_int; -#ifndef _NETINET_IN_SYSTM_INCLUDED /* i am about to comment... */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned long u_long; -#endif -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Sequent PTX" -#endif -#endif - - -/* - * Sony NEWS - */ -#if defined(SYS_SONY) -#define NO_SIGNED_CHAR_DECL -#define HAVE_READKMEM -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Sony" -#endif -#endif - -/* - * VAX - * XXX - VMS? - */ -#if defined(SYS_VAX) -#define NO_SIGNED_CHAR_DECL -#define HAVE_READKMEM -#define HAVE_BSD_NICE -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/VAX" -#endif -#endif - -/* - * UNIX V.4 on and NCR 3000 - */ -#if defined(SYS_SVR4) -#define HAVE_ATT_SETPGRP -#define USE_PROTOTYPES -#define NTP_POSIX_SOURCE -#define HAVE_ATT_NICE -#define HAVE_READKMEM -#define USE_TTY_SIGPOLL -#define USE_UDP_SIGPOLL -#define STREAM -#define STEP_SLEW /* TWO step */ -#define LOCK_PROCESS -#define SYSV_TIMEOFDAY -#define SIZE_RETURNED_IN_BUFFER -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/SysVR4" -#endif -#endif - -/* - * (Univel/Novell) Unixware1 SVR4 on intel x86 processor - */ -#if defined(SYS_UNIXWARE1) -/* #define _POSIX_SOURCE */ -#undef HAVE_ATT_SETPGRP -#define USE_PROTOTYPES -#define NTP_POSIX_SOURCE -#define HAVE_ATT_NICE -#define HAVE_READKMEM -#define USE_TTY_SIGPOLL -#define USE_UDP_SIGPOLL -#define UDP_WILDCARD_DELIVERY -#undef HAVE_SIGNALED_IO -#define STREAM -#define STREAMS -#ifndef STREAMS_TLI -/*#define STREAMS_TLI*/ -#endif -/* #define USE_STREAMS_DEVICE_FOR_IF_CONFIG */ -#undef STEP_SLEW /* TWO step */ -#define LOCK_PROCESS -#define NO_SIGNED_CHAR_DECL -#undef SYSV_TIMEOFDAY -#define SIZE_RETURNED_IN_BUFFER -#define RETSIGTYPE void -#include <sys/sockio.h> -#include <sys/types.h> -#include <netinet/in_systm.h> -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/Unixware1" -#endif -#endif - -/* - * DomainOS - */ -#if defined(SYS_DOMAINOS) -#define HAVE_BSD_NICE -#define NOKMEM -#define HAVE_SIGNALED_IO -#define NTP_SYSCALLS_STD -#define USE_PROTOTYPES -#define UDP_WILDCARD_DELIVERY -#ifndef STR_SYSTEM -#define STR_SYSTEM "UNIX/DOMAINOS" -#endif -#endif - -#ifdef STREAM /* STREAM implies TERMIOS */ -#ifndef HAVE_TERMIOS -#define HAVE_TERMIOS -#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 /* NTP_SYSCALLS_STD */ - -#if !defined(HAVE_ATT_NICE) \ - && !defined(HAVE_BSD_NICE) \ - && !defined(HAVE_NO_NICE) - ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines -#endif - -/* - * use only one tty model - no use in initialising - * a tty in three ways - * HAVE_TERMIOS is preferred over HAVE_SYSV_TTYS over HAVE_BSD_TTYS - */ -#ifdef HAVE_TERMIOS -#undef HAVE_BSD_TTYS -#undef HAVE_SYSV_TTYS -#endif - -#ifdef HAVE_SYSV_TTYS -#undef HAVE_BSD_TTYS -#endif - -#if !defined(HAVE_SYSV_TTYS) \ - && !defined(HAVE_BSD_TTYS) \ - && !defined(HAVE_TERMIOS) - ERROR no_tty_type_defined -#endif - - -#if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) - -# if defined(XNTP_AUTO_ENDIAN) -# include <netinet/in.h> - -# if BYTE_ORDER == BIG_ENDIAN -# define XNTP_BIG_ENDIAN -# endif -# if BYTE_ORDER == LITTLE_ENDIAN -# define XNTP_LITTLE_ENDIAN -# endif - -# else /* AUTO */ - -# ifdef WORDS_BIGENDIAN -# define XNTP_BIG_ENDIAN 1 -# else -# define XNTP_LITTLE_ENDIAN 1 -# endif - -# endif /* AUTO */ - -#endif /* !BIG && !LITTLE */ - -/* - * Byte order woes. The DES code is sensitive to byte order. This - * used to be resolved by calling ntohl() and htonl() to swap things - * around, but this turned out to be quite costly on Vaxes where those - * things are actual functions. The code now straightens out byte - * order troubles on its own, with no performance penalty for little - * end first machines, but at great expense to cleanliness. - */ -#if !defined(XNTP_BIG_ENDIAN) && !defined(XNTP_LITTLE_ENDIAN) - /* - * Pick one or the other. - */ - BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION -#endif - -#if defined(XNTP_BIG_ENDIAN) && defined(XNTP_LITTLE_ENDIAN) - /* - * Pick one or the other. - */ - BYTE_ORDER_NOT_DEFINED_FOR_AUTHENTICATION -#endif - - -#endif /* __ntp_machine */ diff --git a/usr.sbin/xntpd/include/ntp_malloc.h b/usr.sbin/xntpd/include/ntp_malloc.h deleted file mode 100644 index 0079cb7..0000000 --- a/usr.sbin/xntpd/include/ntp_malloc.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Define malloc and friends. - */ -#ifndef _ntp_malloc_h - -#define _ntp_malloc_h -#ifdef NTP_POSIX_SOURCE -#include <stdlib.h> -#else /* NTP_POSIX_SOURCE */ -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif -#endif /* NTP_POSIX_SOURCE */ - -#endif /* _ntp_malloc_h */ diff --git a/usr.sbin/xntpd/include/ntp_refclock.h b/usr.sbin/xntpd/include/ntp_refclock.h deleted file mode 100644 index fcc1200..0000000 --- a/usr.sbin/xntpd/include/ntp_refclock.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * ntp_refclock.h - definitions for reference clock support - */ - -#include "ntp_types.h" - -#if defined(HAVE_BSD_TTYS) -#include <sgtty.h> -#endif /* HAVE_BSD_TTYS */ - -#if defined(HAVE_SYSV_TTYS) -#include <termio.h> -#endif /* HAVE_SYSV_TTYS */ - -#if defined(HAVE_TERMIOS) -#include <termios.h> -#endif - -#if defined(STREAM) -#include <stropts.h> -#if defined(CLK) -#include <sys/clkdefs.h> -#endif /* CLK */ -#endif /* STREAM */ - -#if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS) -#define BSD_TTYS -#endif /* SYSV_TTYS STREAM BSD_TTYS */ - -/* - * Macros to determine the clock type and unit numbers from a - * 127.127.t.u address - */ -#define REFCLOCKTYPE(srcadr) ((SRCADR(srcadr) >> 8) & 0xff) -#define REFCLOCKUNIT(srcadr) (SRCADR(srcadr) & 0xff) - -/* - * List of reference clock names and descriptions. These must agree with - * lib/clocktypes.c and xntpd/refclock_conf.c. - */ -struct clktype { - int code; /* driver "major" number */ - char *clocktype; /* long description */ - char *abbrev; /* short description */ -}; - -/* - * Configuration flag values - */ -#define CLK_HAVETIME1 0x1 -#define CLK_HAVETIME2 0x2 -#define CLK_HAVEVAL1 0x4 -#define CLK_HAVEVAL2 0x8 - -#define CLK_FLAG1 0x1 -#define CLK_FLAG2 0x2 -#define CLK_FLAG3 0x4 -#define CLK_FLAG4 0x8 - -#define CLK_HAVEFLAG1 0x10 -#define CLK_HAVEFLAG2 0x20 -#define CLK_HAVEFLAG3 0x40 -#define CLK_HAVEFLAG4 0x80 - -/* - * Structure for returning clock status - */ -struct refclockstat { - u_char type; /* clock type */ - u_char flags; /* clock flags */ - u_char haveflags; /* bit array of valid flags */ - u_char lencode; /* length of last timecode */ - char *lastcode; /* last timecode received */ - U_LONG polls; /* transmit polls */ - U_LONG noresponse; /* no response to poll */ - U_LONG badformat; /* bad format timecode received */ - U_LONG baddata; /* invalid data timecode received */ - U_LONG timereset; /* driver resets */ - char *clockdesc; /* ASCII description */ - l_fp fudgetime1; /* configure fudge time1 */ - l_fp fudgetime2; /* configure fudge time2 */ - LONG fudgeval1; /* configure fudge value1 */ - LONG fudgeval2; /* configure fudge value2 */ - u_char currentstatus; /* clock status */ - u_char lastevent; /* last exception event */ - u_char unused; /* spare */ - struct ctl_var *kv_list; /* additional variables */ -}; - -/* - * Reference clock I/O structure. Used to provide an interface between - * the reference clock drivers and the I/O module. - */ -struct refclockio { - struct refclockio *next; /* link to next structure */ - void (*clock_recv)();/* completion routine */ - caddr_t srcclock; /* pointer to clock structure */ - int datalen; /* lenth of data */ - int fd; /* file descriptor */ - u_long recvcount; /* count of receive completions */ -}; - -/* - * Structure for returning debugging info - */ -#define NCLKBUGVALUES 16 -#define NCLKBUGTIMES 32 - -struct refclockbug { - u_char nvalues; /* values following */ - u_char ntimes; /* times following */ - u_short svalues; /* values format sign array */ - U_LONG stimes; /* times format sign array */ - U_LONG values[NCLKBUGVALUES]; /* real values */ - l_fp times[NCLKBUGTIMES]; /* real times */ -}; - -/* - * Structure interface between the reference clock support - * ntp_refclock.c and the driver utility routines - */ -#define MAXSTAGE 64 /* max stages in shift register */ -#define BMAX 128 /* max timecode length */ -#define GMT 0 /* I hope nobody sees this */ -#define MAXDIAL 20 /* max length of modem dial strings */ - -/* - * Line discipline flags. These require line discipline or streams - * modules to be installed/loaded in the kernel. If specified, but not - * installed, the code runs as if unspecified. - */ -#define LDISC_STD 0x0 /* standard */ -#define LDISC_CLK 0x1 /* tty_clk \n intercept */ -#define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */ -#define LDISC_ACTS 0x4 /* tty_clk #* intercept */ -#define LDISC_CHU 0x8 /* tty_chu */ -#define LDISC_PPS 0x10 /* ppsclock */ - -struct refclockproc { - struct refclockio io; /* I/O handler structure */ - caddr_t unitptr; /* pointer to unit structure */ - u_long lasttime; /* last clock update time */ - u_char leap; /* leap/synchronization code */ - u_char currentstatus; /* clock status */ - u_char lastevent; /* last exception event */ - u_char type; /* clock type */ - char *clockdesc; /* clock description */ - char lastcode[BMAX]; /* last timecode received */ - u_char lencode; /* length of last timecode */ - - u_int year; /* year of eternity */ - u_int day; /* day of year */ - u_int hour; /* hour of day */ - u_int minute; /* minute of hour */ - u_int second; /* second of minute */ - u_int msec; /* millisecond of second */ - u_long usec; /* microsecond of second (alt) */ - u_int nstages; /* median filter stages */ - u_long yearstart; /* beginning of year */ - u_long coderecv; /* sample counter */ - l_fp lastref; /* last reference timestamp */ - l_fp lastrec; /* last local timestamp */ - l_fp offset; /* median offset */ - u_fp dispersion; /* sample dispersion */ - l_fp filter[MAXSTAGE]; /* median filter */ - - /* - * Configuration data - */ - l_fp fudgetime1; /* fudge time1 */ - l_fp fudgetime2; /* fudge time2 */ - u_long refid; /* reference identifier */ - u_long sloppyclockflag; /* fudge flags */ - - /* - * Status tallies - */ - u_long timestarted; /* time we started this */ - u_long polls; /* polls sent */ - u_long noreply; /* no replies to polls */ - u_long badformat; /* bad format reply */ - u_long baddata; /* bad data reply */ -}; - -/* - * Structure interface between the reference clock support - * ntp_refclock.c and particular clock drivers. This must agree with the - * structure defined in the driver. - */ -#define noentry 0 /* flag for null routine */ -#define NOFLAGS 0 /* flag for null flags */ - -struct refclock { - int (*clock_start) P((int, struct peer *)); - void (*clock_shutdown) P((int, struct peer *)); - void (*clock_poll) P((int, struct peer *)); - void (*clock_control) P((int, struct refclockstat *, - struct refclockstat *)); - void (*clock_init) P((void)); - void (*clock_buginfo) P((int, struct refclockbug *)); - u_long clock_flags; -}; - -/* - * Function prototypes - */ -extern int io_addclock_simple P((struct refclockio *)); -extern int io_addclock P((struct refclockio *)); -extern void io_closeclock P((struct refclockio *)); - -#ifdef REFCLOCK -extern void refclock_buginfo P((struct sockaddr_in *, - struct refclockbug *)); -extern void refclock_control P((struct sockaddr_in *, - struct refclockstat *, - struct refclockstat *)); -extern int refclock_open P((char *, int, int)); -extern void refclock_transmit P((struct peer *)); -extern int refclock_ioctl P((int, int)); -extern int refclock_process P((struct refclockproc *, int, int)); -extern void refclock_report P((struct peer *, u_char)); -extern int refclock_gtlin P((struct recvbuf *, char *, int, - l_fp *)); -#endif /* REFCLOCK */ diff --git a/usr.sbin/xntpd/include/ntp_request.h b/usr.sbin/xntpd/include/ntp_request.h deleted file mode 100644 index ea2d769..0000000 --- a/usr.sbin/xntpd/include/ntp_request.h +++ /dev/null @@ -1,808 +0,0 @@ -/* - * ntp_request.h - definitions for the xntpd remote query facility - */ - -#include "ntp_types.h" - -/* - * A mode 7 packet is used exchanging data between an NTP server - * and a client for purposes other than time synchronization, e.g. - * monitoring, statistics gathering and configuration. A mode 7 - * packet has the following format: - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * |R|M| VN | Mode|A| Sequence | Implementation| Req Code | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Err | Number of data items | MBZ | Size of data item | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Data (Minimum 0 octets, maximum 500 octets) | - * | | - * [...] - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Encryption Keyid (when A bit set) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Message Authentication Code (when A bit set) | - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * where the fields are (note that the client sends requests, the server - * responses): - * - * Response Bit: This packet is a response (if clear, packet is a request). - * - * More Bit: Set for all packets but the last in a response which - * requires more than one packet. - * - * Version Number: 2 for current version - * - * Mode: Always 7 - * - * Authenticated bit: If set, this packet is authenticated. - * - * Sequence number: For a multipacket response, contains the sequence - * number of this packet. 0 is the first in the sequence, - * 127 (or less) is the last. The More Bit must be set in - * all packets but the last. - * - * Implementation number: The number of the implementation this request code - * is defined by. An implementation number of zero is used - * for requst codes/data formats which all implementations - * agree on. Implementation number 255 is reserved (for - * extensions, in case we run out). - * - * Request code: An implementation-specific code which specifies the - * operation to be (which has been) performed and/or the - * format and semantics of the data included in the packet. - * - * Err: Must be 0 for a request. For a response, holds an error - * code relating to the request. If nonzero, the operation - * requested wasn't performed. - * - * 0 - no error - * 1 - incompatable implementation number - * 2 - unimplemented request code - * 3 - format error (wrong data items, data size, packet size etc.) - * 4 - no data available (e.g. request for details on unknown peer) - * 5-6 I don't know - * 7 - authentication failure (i.e. permission denied) - * - * Number of data items: number of data items in packet. 0 to 500 - * - * MBZ: A reserved data field, must be zero in requests and responses. - * - * Size of data item: size of each data item in packet. 0 to 500 - * - * Data: Variable sized area containing request/response data. For - * requests and responses the size in octets must be greater - * than or equal to the product of the number of data items - * and the size of a data item. For requests the data area - * must be exactly 40 octets in length. For responses the - * data area may be any length between 0 and 500 octets - * inclusive. - * - * Message Authentication Code: Same as NTP spec, in definition and function. - * May optionally be included in requests which require - * authentication, is never included in responses. - * - * The version number, mode and keyid have the same function and are - * in the same location as a standard NTP packet. The request packet - * is the same size as a standard NTP packet to ease receive buffer - * management, and to allow the same encryption procedure to be used - * both on mode 7 and standard NTP packets. The mac is included when - * it is required that a request be authenticated, the keyid should be - * zero in requests in which the mac is not included. - * - * The data format depends on the implementation number/request code pair - * and whether the packet is a request or a response. The only requirement - * is that data items start in the octet immediately following the size - * word and that data items be concatenated without padding between (i.e. - * if the data area is larger than data_items*size, all padding is at - * the end). Padding is ignored, other than for encryption purposes. - * Implementations using encryption might want to include a time stamp - * or other data in the request packet padding. The key used for requests - * is implementation defined, but key 15 is suggested as a default. - */ - -/* - * A request packet. These are almost a fixed length. - */ -struct req_pkt { - u_char rm_vn_mode; /* response, more, version, mode */ - u_char auth_seq; /* key, sequence number */ - u_char implementation; /* implementation number */ - u_char request; /* request number */ - u_short err_nitems; /* error code/number of data items */ - u_short mbz_itemsize; /* item size */ - char data[32]; /* data area */ - l_fp tstamp; /* time stamp, for authentication */ - U_LONG keyid; /* encryption key */ - char mac[MAX_MAC_LEN-sizeof(U_LONG)]; /* (optional) 8 byte auth code */ -}; - -/* - * Input packet lengths. One with the mac, one without. - */ -#define REQ_LEN_MAC (sizeof(struct req_pkt)) -#define REQ_LEN_NOMAC (sizeof(struct req_pkt) - MAX_MAC_LEN) - -/* - * A response packet. The length here is variable, this is a - * maximally sized one. Note that this implementation doesn't - * authenticate responses. - */ -#define RESP_HEADER_SIZE (8) -#define RESP_DATA_SIZE (500) - -struct resp_pkt { - u_char rm_vn_mode; /* response, more, version, mode */ - u_char auth_seq; /* key, sequence number */ - u_char implementation; /* implementation number */ - u_char request; /* request number */ - u_short err_nitems; /* error code/number of data items */ - u_short mbz_itemsize; /* item size */ - char data[RESP_DATA_SIZE]; /* data area */ -}; - - -/* - * Information error codes - */ -#define INFO_OKAY 0 -#define INFO_ERR_IMPL 1 /* incompatable implementation */ -#define INFO_ERR_REQ 2 /* unknown request code */ -#define INFO_ERR_FMT 3 /* format error */ -#define INFO_ERR_NODATA 4 /* no data for this request */ -#define INFO_ERR_AUTH 7 /* authentication failure */ - -/* - * Maximum sequence number. - */ -#define MAXSEQ 127 - - -/* - * Bit setting macros for multifield items. - */ -#define RESP_BIT 0x80 -#define MORE_BIT 0x40 - -#define ISRESPONSE(rm_vn_mode) (((rm_vn_mode)&RESP_BIT)!=0) -#define ISMORE(rm_vn_mode) (((rm_vn_mode)&MORE_BIT)!=0) -#define INFO_VERSION(rm_vn_mode) ((u_char)(((rm_vn_mode)>>3)&0x7)) -#define INFO_MODE(rm_vn_mode) ((rm_vn_mode)&0x7) - -#define RM_VN_MODE(resp, more) ((u_char)(((resp)?RESP_BIT:0)\ - |((more)?MORE_BIT:0)\ - |((NTP_VERSION)<<3)\ - |(MODE_PRIVATE))) - -#define INFO_IS_AUTH(auth_seq) (((auth_seq) & 0x80) != 0) -#define INFO_SEQ(auth_seq) ((auth_seq)&0x7f) -#define AUTH_SEQ(auth, seq) ((u_char)((((auth)!=0)?0x80:0)|((seq)&0x7f))) - -#define INFO_ERR(err_nitems) ((u_short)((ntohs(err_nitems)>>12)&0xf)) -#define INFO_NITEMS(err_nitems) ((u_short)(ntohs(err_nitems)&0xfff)) -#define ERR_NITEMS(err, nitems) (htons((((u_short)(err)<<12)&0xf000)\ - |((u_short)(nitems)&0xfff))) - -#define INFO_MBZ(mbz_itemsize) ((ntohs(mbz_itemsize)>>12)&0xf) -#define INFO_ITEMSIZE(mbz_itemsize) (ntohs(mbz_itemsize)&0xfff) -#define MBZ_ITEMSIZE(itemsize) (htons((u_short)(itemsize))) - - -/* - * Implementation numbers. One for universal use and one for xntpd. - */ -#define IMPL_UNIV 0 -#define IMPL_XNTPD 2 - -/* - * Some limits related to authentication. Frames which are - * authenticated must include a time stamp which differs from - * the receive time stamp by no more than 10 seconds. - */ -#define INFO_TS_MAXSKEW_UI 10 - -/* - * Universal request codes go here. There aren't any. - */ - -/* - * XNTPD request codes go here. - */ -#define REQ_PEER_LIST 0 /* return list of peers */ -#define REQ_PEER_LIST_SUM 1 /* return summary info for all peers */ -#define REQ_PEER_INFO 2 /* get standard information on peer */ -#define REQ_PEER_STATS 3 /* get statistics for peer */ -#define REQ_SYS_INFO 4 /* get system information */ -#define REQ_SYS_STATS 5 /* get system stats */ -#define REQ_IO_STATS 6 /* get I/O stats */ -#define REQ_MEM_STATS 7 /* stats related to peer list maint */ -#define REQ_LOOP_INFO 8 /* info from the loop filter */ -#define REQ_TIMER_STATS 9 /* get timer stats */ -#define REQ_CONFIG 10 /* configure a new peer */ -#define REQ_UNCONFIG 11 /* unconfigure an existing peer */ -#define REQ_SET_SYS_FLAG 12 /* set system flags */ -#define REQ_CLR_SYS_FLAG 13 /* clear system flags */ -#define REQ_MONITOR 14 /* monitor clients */ -#define REQ_NOMONITOR 15 /* stop monitoring clients */ -#define REQ_GET_RESTRICT 16 /* return restrict list */ -#define REQ_RESADDFLAGS 17 /* add flags to restrict list */ -#define REQ_RESSUBFLAGS 18 /* remove flags from restrict list */ -#define REQ_UNRESTRICT 19 /* remove entry from restrict list */ -#define REQ_MON_GETLIST 20 /* return data collected by monitor */ -#define REQ_RESET_STATS 21 /* reset stat counters */ -#define REQ_RESET_PEER 22 /* reset peer stat counters */ -#define REQ_REREAD_KEYS 23 /* reread the encryption key file */ -#define REQ_DO_DIRTY_HACK 24 /* historical interest */ -#define REQ_DONT_DIRTY_HACK 25 /* Ibid. */ -#define REQ_TRUSTKEY 26 /* add a trusted key */ -#define REQ_UNTRUSTKEY 27 /* remove a trusted key */ -#define REQ_AUTHINFO 28 /* return authentication info */ -#define REQ_TRAPS 29 /* return currently set traps */ -#define REQ_ADD_TRAP 30 /* add a trap */ -#define REQ_CLR_TRAP 31 /* clear a trap */ -#define REQ_REQUEST_KEY 32 /* define a new request keyid */ -#define REQ_CONTROL_KEY 33 /* define a new control keyid */ -#define REQ_GET_CTLSTATS 34 /* get stats from the control module */ -#define REQ_GET_LEAPINFO 35 /* get leap information */ -#define REQ_GET_CLOCKINFO 36 /* get clock information */ -#define REQ_SET_CLKFUDGE 37 /* set clock fudge factors */ -#define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ -#define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ -#define REQ_SET_PRECISION 41 /* set clock precision */ -#define REQ_MON_GETLIST_1 42 /* return data collected by monitor v1*/ - -/* - * Flags in the peer information returns - */ -#define INFO_FLAG_CONFIG 0x1 -#define INFO_FLAG_SYSPEER 0x2 -#define INFO_FLAG_UNUSED 0x4 -#define INFO_FLAG_REFCLOCK 0x8 -#define INFO_FLAG_PREFER 0x10 -#define INFO_FLAG_AUTHENABLE 0x20 -#define INFO_FLAG_SEL_CANDIDATE 0x40 -#define INFO_FLAG_SHORTLIST 0x80 - -/* - * Flags in the system information returns - */ -#define INFO_FLAG_BCLIENT 0x1 -#define INFO_FLAG_AUTHENTICATE 0x2 -#define INFO_FLAG_PLL 0x4 -#define INFO_FLAG_PPS 0x8 /* unused */ -#define INFO_FLAG_PLL_SYNC 0x10 -#define INFO_FLAG_PPS_SYNC 0x20 -#define INFO_FLAG_MONITOR 0x40 -#define INFO_FLAG_FILEGEN 0x80 - -/* - * Peer list structure. Used to return raw lists of peers. It goes - * without saying that everything returned is in network byte order. - */ -struct info_peer_list { - U_LONG address; /* address of peer */ - u_short port; /* port number of peer */ - u_char hmode; /* mode for this peer */ - u_char flags; /* flags (from above) */ -}; - - -/* - * Peer summary structure. Sort of the info that ntpdc returns by default. - */ -struct info_peer_summary { - U_LONG dstadr; /* local address (zero for undetermined) */ - U_LONG srcadr; /* source address */ - u_short srcport; /* source port */ - u_char stratum; /* stratum of peer */ - s_char hpoll; /* host polling interval */ - s_char ppoll; /* peer polling interval */ - u_char reach; /* reachability register */ - u_char flags; /* flags, from above */ - u_char hmode; /* peer mode */ - s_fp delay; /* peer.estdelay */ - l_fp offset; /* peer.estoffset */ - u_fp dispersion; /* peer.estdisp */ -}; - - -/* - * Peer information structure. - */ -struct info_peer { - U_LONG dstadr; /* local address */ - U_LONG srcadr; /* remote address */ - u_short srcport; /* remote port */ - u_char flags; /* peer flags */ - u_char leap; /* peer.leap */ - u_char hmode; /* peer.hmode */ - u_char pmode; /* peer.pmode */ - u_char stratum; /* peer.stratum */ - u_char ppoll; /* peer.ppoll */ - u_char hpoll; /* peer.hpoll */ - s_char precision; /* peer.precision */ - u_char version; /* peer.version */ - u_char valid; /* peer.valid */ - u_char reach; /* peer.reach */ - u_char unreach; /* peer.unreach */ - u_char flash; /* peer.flash */ - u_char ttl; /* peer.ttl */ - u_char unused8; /* (obsolete) */ - u_char unused9; - u_short associd; /* association ID */ - U_LONG keyid; /* auth key in use */ - U_LONG pkeyid; /* peer.pkeyid */ - U_LONG refid; /* peer.refid */ - U_LONG timer; /* peer.timer */ - s_fp rootdelay; /* peer.distance */ - u_fp rootdispersion; /* peer.dispersion */ - l_fp reftime; /* peer.reftime */ - l_fp org; /* peer.org */ - l_fp rec; /* peer.rec */ - l_fp xmt; /* peer.xmt */ - s_fp filtdelay[NTP_SHIFT]; /* delay shift register */ - l_fp filtoffset[NTP_SHIFT]; /* offset shift register */ - u_char order[NTP_SHIFT]; /* order of peers from last filter */ - s_fp delay; /* peer.estdelay */ - u_fp dispersion; /* peer.estdisp */ - l_fp offset; /* peer.estoffset */ - u_fp selectdisp; /* peer select dispersion */ - LONG unused1; /* (obsolete) */ - LONG unused2; - LONG unused3; - LONG unused4; - LONG unused5; - LONG unused6; - LONG unused7; - s_fp estbdelay; /* broadcast offset */ -}; - - -/* - * Peer statistics structure - */ -struct info_peer_stats { - U_LONG dstadr; /* local address */ - U_LONG srcadr; /* remote address */ - u_short srcport; /* remote port */ - u_short flags; /* peer flags */ - U_LONG timereset; /* time counters were reset */ - U_LONG timereceived; /* time since a packet received */ - U_LONG timetosend; /* time until a packet sent */ - U_LONG timereachable; /* time peer has been reachable */ - U_LONG sent; /* number sent */ - U_LONG unused1; /* (unused) */ - U_LONG processed; /* number processed */ - U_LONG unused2; /* (unused) */ - U_LONG badauth; /* bad authentication */ - U_LONG bogusorg; /* bogus origin */ - U_LONG oldpkt; /* duplicate */ - U_LONG unused3; /* (unused) */ - U_LONG unused4; /* (unused) */ - U_LONG seldisp; /* bad dispersion */ - U_LONG selbroken; /* bad reference time */ - U_LONG unused5; /* (unused) */ - u_char candidate; /* select order */ - u_char unused6; /* (unused) */ - u_char unused7; /* (unused) */ - u_char unused8; /* (unused) */ -}; - - -/* - * Loop filter variables - */ -struct info_loop { - l_fp last_offset; - l_fp drift_comp; - U_LONG compliance; - U_LONG watchdog_timer; -}; - - -/* - * System info. Mostly the sys.* variables, plus a few unique to - * the implementation. - */ -struct info_sys { - U_LONG peer; /* system peer address */ - u_char peer_mode; /* mode we are syncing to peer in */ - u_char leap; /* system leap bits */ - u_char stratum; /* our stratum */ - s_char precision; /* local clock precision */ - s_fp rootdelay; /* distance from sync source */ - u_fp rootdispersion; /* dispersion from sync source */ - U_LONG refid; /* reference ID of sync source */ - l_fp reftime; /* system reference time */ - U_LONG poll; /* system poll interval */ - u_char flags; /* system flags */ - u_char unused1; /* unused */ - u_char unused2; /* unused */ - u_char unused3; /* unused */ - s_fp bdelay; /* default broadcast offset */ - s_fp frequency; /* frequency residual (scaled ppm) */ - l_fp authdelay; /* default authentication delay */ - u_fp stability; /* clock stability (scaled ppm) */ -}; - - -/* - * System stats. These are collected in the protocol module - */ -struct info_sys_stats { - U_LONG timeup; /* time we have been up and running */ - U_LONG timereset; /* time since these were last cleared */ - U_LONG badstratum; /* packets claiming an invalid stratum */ - U_LONG oldversionpkt; /* old version packets received */ - U_LONG newversionpkt; /* new version packets received */ - U_LONG unknownversion; /* don't know version packets */ - U_LONG badlength; /* packets with bad length */ - U_LONG processed; /* packets processed */ - U_LONG badauth; /* packets dropped because of authorization */ - U_LONG wanderhold; /* (obsolete) */ - U_LONG limitrejected; /* rejected because of client limitation */ -}; - - -/* - * System stats - old version - */ -struct old_info_sys_stats { - U_LONG timeup; /* time we have been up and running */ - U_LONG timereset; /* time since these were last cleared */ - U_LONG badstratum; /* packets claiming an invalid stratum */ - U_LONG oldversionpkt; /* old version packets received */ - U_LONG newversionpkt; /* new version packets received */ - U_LONG unknownversion; /* don't know version packets */ - U_LONG badlength; /* packets with bad length */ - U_LONG processed; /* packets processed */ - U_LONG badauth; /* packets dropped because of authorization */ - U_LONG wanderhold; -}; - - -/* - * Peer memory statistics. Collected in the peer module. - */ -struct info_mem_stats { - U_LONG timereset; /* time since reset */ - u_short totalpeermem; - u_short freepeermem; - U_LONG findpeer_calls; - U_LONG allocations; - U_LONG demobilizations; - u_char hashcount[HASH_SIZE]; -}; - - -/* - * I/O statistics. Collected in the I/O module - */ -struct info_io_stats { - U_LONG timereset; /* time since reset */ - u_short totalrecvbufs; /* total receive bufs */ - u_short freerecvbufs; /* free buffers */ - u_short fullrecvbufs; /* full buffers */ - u_short lowwater; /* number of times we've added buffers */ - U_LONG dropped; /* dropped packets */ - U_LONG ignored; /* ignored packets */ - U_LONG received; /* received packets */ - U_LONG sent; /* packets sent */ - U_LONG notsent; /* packets not sent */ - U_LONG interrupts; /* interrupts we've handled */ - U_LONG int_received; /* received by interrupt handler */ -}; - - -/* - * Timer stats. Guess where from. - */ -struct info_timer_stats { - U_LONG timereset; /* time since reset */ - U_LONG alarms; /* alarms we've handled */ - U_LONG overflows; /* timer overflows */ - U_LONG xmtcalls; /* calls to xmit */ -}; - - -/* - * Structure for passing peer configuration information - */ -struct conf_peer { - U_LONG peeraddr; /* address to poll */ - u_char hmode; /* mode, either broadcast, active or client */ - u_char version; /* version number to poll with */ - u_char minpoll; /* min host poll interval */ - u_char maxpoll; /* max host poll interval */ - u_char flags; /* flags for this request */ - u_char ttl; /* time to live (multicast) */ - u_short unused; /* unused */ - U_LONG keyid; /* key to use for this association */ -}; - -#define CONF_FLAG_AUTHENABLE 0x1 -#define CONF_FLAG_PREFER 0x2 - -/* - * Structure for passing peer deletion information. Currently - * we only pass the address and delete all configured peers with - * this addess. - */ -struct conf_unpeer { - U_LONG peeraddr; /* address of peer */ -}; - -/* - * Structure for carrying system flags. - */ -struct conf_sys_flags { - U_LONG flags; -}; - -/* - * System flags we can set/clear - */ -#define SYS_FLAG_BCLIENT 0x1 -#define SYS_FLAG_AUTHENTICATE 0x2 -#define SYS_FLAG_PLL 0x4 -#define SYS_FLAG_PPS 0x8 -#define SYS_FLAG_MONITOR 0x10 -#define SYS_FLAG_FILEGEN 0x20 - -/* - * Structure used for returning restrict entries - */ -struct info_restrict { - U_LONG addr; /* match address */ - U_LONG mask; /* match mask */ - U_LONG count; /* number of packets matched */ - u_short flags; /* restrict flags */ - u_short mflags; /* match flags */ -}; - - -/* - * Structure used for specifying restrict entries - */ -struct conf_restrict { - U_LONG addr; /* match address */ - U_LONG mask; /* match mask */ - u_short flags; /* restrict flags */ - u_short mflags; /* match flags */ -}; - - -/* - * Structure used for returning monitor data - */ -struct info_monitor_1 { - U_LONG lasttime; /* last packet from this host */ - U_LONG firsttime; /* first time we received a packet */ - U_LONG lastdrop; /* last time we rejected a packet due to client limitation policy */ - U_LONG count; /* count of packets received */ - U_LONG addr; /* host address */ - U_LONG daddr; /* destination host address */ - U_LONG flags; /* flags about destination */ - u_short port; /* port number of last reception */ - u_char mode; /* mode of last packet */ - u_char version; /* version number of last packet */ -}; - - -/* - * Structure used for returning monitor data - */ -struct info_monitor { - U_LONG lasttime; /* last packet from this host */ - U_LONG firsttime; /* first time we received a packet */ - U_LONG lastdrop; /* last time we rejected a packet due to client limitation policy */ - U_LONG count; /* count of packets received */ - U_LONG addr; /* host address */ - u_short port; /* port number of last reception */ - u_char mode; /* mode of last packet */ - u_char version; /* version number of last packet */ -}; - -/* - * Structure used for returning monitor data (old format - */ -struct old_info_monitor { - U_LONG lasttime; /* last packet from this host */ - U_LONG firsttime; /* first time we received a packet */ - U_LONG count; /* count of packets received */ - U_LONG addr; /* host address */ - u_short port; /* port number of last reception */ - u_char mode; /* mode of last packet */ - u_char version; /* version number of last packet */ -}; - -/* - * Structure used for passing indication of flags to clear - */ -struct reset_flags { - U_LONG flags; -}; - -#define RESET_FLAG_ALLPEERS 0x01 -#define RESET_FLAG_IO 0x02 -#define RESET_FLAG_SYS 0x04 -#define RESET_FLAG_MEM 0x08 -#define RESET_FLAG_TIMER 0x10 -#define RESET_FLAG_AUTH 0x20 -#define RESET_FLAG_CTL 0x40 - -#define RESET_ALLFLAGS \ - (RESET_FLAG_ALLPEERS|RESET_FLAG_IO|RESET_FLAG_SYS \ - |RESET_FLAG_MEM|RESET_FLAG_TIMER|RESET_FLAG_AUTH|RESET_FLAG_CTL) - -/* - * Structure used to return information concerning the authentication - * module. - */ -struct info_auth { - U_LONG timereset; /* time counters were reset */ - U_LONG numkeys; /* number of keys we know */ - U_LONG numfreekeys; /* number of free keys */ - U_LONG keylookups; /* calls to authhavekey() */ - U_LONG keynotfound; /* requested key unknown */ - U_LONG encryptions; /* number of encryptions */ - U_LONG decryptions; /* number of decryptions */ - U_LONG unused; /* (unused) */ - U_LONG keyuncached; /* calls to encrypt/decrypt with uncached key */ -}; - - -/* - * Structure used to pass trap information to the client - */ -struct info_trap { - U_LONG local_address; /* local interface address */ - U_LONG trap_address; /* remote client's address */ - u_short trap_port; /* remote port number */ - u_short sequence; /* sequence number */ - U_LONG settime; /* time trap last set */ - U_LONG origtime; /* time trap originally set */ - U_LONG resets; /* number of resets on this trap */ - U_LONG flags; /* trap flags, as defined in ntp_control.h */ -}; - -/* - * Structure used to pass add/clear trap information to the client - */ -struct conf_trap { - U_LONG local_address; /* local interface address */ - U_LONG trap_address; /* remote client's address */ - u_short trap_port; /* remote client's port */ - u_short unused; -}; - - -/* - * Structure used to return statistics from the control module - */ -struct info_control { - U_LONG ctltimereset; - U_LONG numctlreq; /* number of requests we've received */ - U_LONG numctlbadpkts; /* number of bad control packets */ - U_LONG numctlresponses; /* # resp packets sent */ - U_LONG numctlfrags; /* # of fragments sent */ - U_LONG numctlerrors; /* number of error responses sent */ - U_LONG numctltooshort; /* number of too short input packets */ - U_LONG numctlinputresp; /* number of responses on input */ - U_LONG numctlinputfrag; /* number of fragments on input */ - U_LONG numctlinputerr; /* # input pkts with err bit set */ - U_LONG numctlbadoffset; /* # input pkts with nonzero offset */ - U_LONG numctlbadversion; /* # input pkts with unknown version */ - U_LONG numctldatatooshort; /* data too short for count */ - U_LONG numctlbadop; /* bad op code found in packet */ - U_LONG numasyncmsgs; /* # async messages we've sent */ -}; - - -/* - * Structure used to return leap information. - */ -struct info_leap { - u_char sys_leap; /* current sys_leap */ - u_char leap_indicator; /* current leap indicator */ - u_char leap_warning; /* current leap warning */ - u_char leap_bits; /* leap flags */ - U_LONG leap_timer; /* seconds to next interrupt */ - U_LONG leap_processcalls; /* calls to the leap process */ - U_LONG leap_notclose; /* found leap was not close */ - U_LONG leap_monthofleap; /* in month of leap */ - U_LONG leap_dayofleap; /* in day of leap */ - U_LONG leap_hoursfromleap; /* leap within two hours */ - U_LONG leap_happened; /* leap second happened */ -}; - -#define INFO_LEAP_MASK 0x3 /* flag for leap_bits */ -#define INFO_LEAP_SEENSTRATUM1 0x4 /* server has seen stratum 1 */ -#define INFO_LEAP_OVERRIDE 0x8 /* server will override the leap information */ - -/* - * Structure used to return clock information - */ -struct info_clock { - U_LONG clockadr; - u_char type; - u_char flags; - u_char lastevent; - u_char currentstatus; - U_LONG polls; - U_LONG noresponse; - U_LONG badformat; - U_LONG baddata; - U_LONG timestarted; - l_fp fudgetime1; - l_fp fudgetime2; - LONG fudgeval1; - LONG fudgeval2; -}; - - -/* - * Structure used for setting clock fudge factors - */ -struct conf_fudge { - U_LONG clockadr; - U_LONG which; - l_fp fudgetime; - LONG fudgeval_flags; -}; - -#define FUDGE_TIME1 1 -#define FUDGE_TIME2 2 -#define FUDGE_VAL1 3 -#define FUDGE_VAL2 4 -#define FUDGE_FLAGS 5 - - -/* - * Structure used for returning clock debugging info - */ -#define NUMCBUGVALUES 16 -#define NUMCBUGTIMES 32 - -struct info_clkbug { - U_LONG clockadr; - u_char nvalues; - u_char ntimes; - u_short svalues; - U_LONG stimes; - U_LONG values[NUMCBUGVALUES]; - l_fp times[NUMCBUGTIMES]; -}; - -/* - * Structure used for returning kernel pll/PPS information - */ -struct info_kernel { - LONG offset; - LONG freq; - LONG maxerror; - LONG esterror; - u_short status; - u_short shift; - LONG constant; - LONG precision; - LONG tolerance; - -/* - * Variables used only if PPS signal discipline is implemented - */ - LONG ppsfreq; - LONG jitter; - LONG stabil; - LONG jitcnt; - LONG calcnt; - LONG errcnt; - LONG stbcnt; -}; diff --git a/usr.sbin/xntpd/include/ntp_select.h b/usr.sbin/xntpd/include/ntp_select.h deleted file mode 100644 index 14e498d..0000000 --- a/usr.sbin/xntpd/include/ntp_select.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Not all machines define FD_SET in sys/types.h - */ -#ifndef _ntp_select_h -#define _ntp_select_h - -#if (defined(RS6000)||defined(SYS_PTX))&&!defined(_BSD) -#include <sys/select.h> -#endif - -#ifndef FD_SET -#define NFDBITS 32 -#define FD_SETSIZE 32 -#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) memset((char *)(p), 0, sizeof(*(p))) -#endif - -#endif /* _ntp_select_h */ diff --git a/usr.sbin/xntpd/include/ntp_stdlib.h b/usr.sbin/xntpd/include/ntp_stdlib.h deleted file mode 100644 index 19cdad8..0000000 --- a/usr.sbin/xntpd/include/ntp_stdlib.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * ntp_stdlib.h - Prototypes for XNTP lib. - */ -#include <sys/types.h> - -#include "ntp_types.h" -#include "ntp_string.h" -#include "l_stdlib.h" - -#ifndef P -#if defined(__STDC__) || defined(USE_PROTOTYPES) -#define P(x) x -#else -#define P(x) () -#if !defined(const) -#define const -#endif -#endif -#endif - -#if defined(__STDC__) -extern void msyslog P((int, char *, ...)); -#else -extern void msyslog P(()); -#endif - -extern void auth_des P((u_long *, u_char *)); -extern void auth_delkeys P((void)); -extern int auth_havekey P((u_long)); -extern int auth_parity P((u_long *)); -extern void auth_setkey P((u_long, u_long *)); -extern void auth_subkeys P((u_long *, u_char *, u_char *)); -extern int authistrusted P((u_long)); -extern int authusekey P((u_long, int, const char *)); - -extern void auth_delkeys P((void)); - -extern void auth1crypt P((u_long, U_LONG *, int)); -extern int auth2crypt P((u_long, U_LONG *, int)); -extern int authdecrypt P((u_long, U_LONG *, int)); -extern int authencrypt P((u_long, U_LONG *, int)); -extern int authhavekey P((u_long)); -extern int authreadkeys P((const char *)); -extern void authtrust P((u_long, int)); -extern void calleapwhen P((u_long, u_long *, u_long *)); -extern u_long calyearstart P((u_long)); -extern const char *clockname P((int)); -extern int clocktime P((int, int, int, int, int, u_long, u_long *, U_LONG *)); -extern char * emalloc P((u_int)); -extern int ntp_getopt P((int, char **, char *)); -extern void init_auth P((void)); -extern void init_lib P((void)); -extern void init_random P((void)); - -#ifdef DES -extern void DESauth1crypt P((u_long, U_LONG *, int)); -extern int DESauth2crypt P((u_long, U_LONG *, int)); -extern int DESauthdecrypt P((u_long, const U_LONG *, int)); -extern int DESauthencrypt P((u_long, U_LONG *, int)); -extern void DESauth_setkey P((u_long, const U_LONG *)); -extern void DESauth_subkeys P((const U_LONG *, u_char *, u_char *)); -extern void DESauth_des P((U_LONG *, u_char *)); -extern int DESauth_parity P((U_LONG *)); -#endif /* DES */ - -#ifdef MD5 -extern void MD5auth1crypt P((u_long, U_LONG *, int)); -extern int MD5auth2crypt P((u_long, U_LONG *, int)); -extern int MD5authdecrypt P((u_long, const U_LONG *, int)); -extern int MD5authencrypt P((u_long, U_LONG *, int)); -extern void MD5auth_setkey P((u_long, const U_LONG *)); -#endif /* MD5 */ - -extern int atoint P((const char *, long *)); -extern int atouint P((const char *, u_long *)); -extern int hextoint P((const char *, u_long *)); -extern char * humandate P((u_long)); -extern char * inttoa P((long)); -extern char * mfptoa P((u_long, u_long, int)); -extern char * mfptoms P((u_long, u_long, int)); -extern char * modetoa P((int)); -extern u_int32_t netof P((u_int32_t)); -extern char * numtoa P((u_int32_t)); -extern char * numtohost P((u_int32_t)); -extern int octtoint P((const char *, u_long *)); -extern u_long ranp2 P((int)); -extern char * refnumtoa P((u_long)); -extern int tsftomsu P((u_long, int)); -extern char * uinttoa P((u_long)); - -extern int decodenetnum P((const char *, u_long *)); - -extern RETSIGTYPE signal_no_reset P((int, RETSIGTYPE (*func)())); diff --git a/usr.sbin/xntpd/include/ntp_string.h b/usr.sbin/xntpd/include/ntp_string.h deleted file mode 100644 index 90a29da..0000000 --- a/usr.sbin/xntpd/include/ntp_string.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Define string ops: strchr strrchr memcmp memmove memset - */ - -#ifndef _ntp_string_h -#define _ntp_string_h - -#if defined(NTP_POSIX_SOURCE) - -# if defined(HAVE_MEMORY_H) -# include <memory.h> -# endif - -# include <string.h> - -#else - -# include <strings.h> -# define strchr(s,c) index(s,c) -# define strrchr(s,c) rindex(s,c) -# ifndef NTP_NEED_BOPS -# define NTP_NEED_BOPS -# endif -#endif /* NTP_POSIX_SOURCE */ - -#ifdef NTP_NEED_BOPS - -# define memcmp(a,b,c) bcmp(a,b,c) -# define memmove(t,f,c) bcopy(f,t,c) -# define memset(a,x,c) if (x == 0x00) bzero(a,c); else ntp_memset((char*)a,x,c) -void ntp_memset P((char *, int, int)); - -#endif /* NTP_NEED_BOPS */ - -#endif /* _ntp_string_h */ diff --git a/usr.sbin/xntpd/include/ntp_syslog.h b/usr.sbin/xntpd/include/ntp_syslog.h deleted file mode 100644 index 38b847b..0000000 --- a/usr.sbin/xntpd/include/ntp_syslog.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * A hack for platforms which require specially built syslog facilities - */ -#ifdef GIZMO -#include "gizmo_syslog.h" -#else /* !GIZMO */ -#include <syslog.h> -#ifdef SYSLOG_FILE -#include <stdio.h> -#endif -#endif /* GIZMO */ -#ifdef SYSLOG_FILE -extern FILE *syslog_file; -#define syslog msyslog -#endif diff --git a/usr.sbin/xntpd/include/ntp_timex.h b/usr.sbin/xntpd/include/ntp_timex.h deleted file mode 100644 index cb8396a..0000000 --- a/usr.sbin/xntpd/include/ntp_timex.h +++ /dev/null @@ -1,273 +0,0 @@ -/****************************************************************************** - * * - * Copyright (c) David L. Mills 1993, 1994 * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appears in all copies and that both the * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name University of Delaware not be used in * - * advertising or publicity pertaining to distribution of the software * - * without specific, written prior permission. The University of Delaware * - * makes no representations about the suitability this software for any * - * purpose. It is provided "as is" without express or implied warranty. * - * * - ******************************************************************************/ - -/* - * Modification history timex.h - * - * 19 Mar 94 David L. Mills - * Moved defines from kernel routines to header file and added new - * defines for PPS phase-lock loop. - * - * 20 Feb 94 David L. Mills - * Revised status codes and structures for external clock and PPS - * signal discipline. - * - * 28 Nov 93 David L. Mills - * Adjusted parameters to improve stability and increase poll - * interval. - * - * 17 Sep 93 David L. Mills - * Created file - */ -/* - * This header file defines the Network Time Protocol (NTP) interfaces - * for user and daemon application programs. These are implemented using - * private syscalls and data structures and require specific kernel - * support. - * - * NAME - * ntp_gettime - NTP user application interface - * - * SYNOPSIS - * #include <sys/timex.h> - * - * int syscall(SYS_ntp_gettime, tptr) - * - * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure - * - * NAME - * ntp_adjtime - NTP daemon application interface - * - * SYNOPSIS - * #include <sys/timex.h> - * - * int syscall(SYS_ntp_adjtime, mode, tptr) - * - * int SYS_ntp_adjtime defined in syscall.h header file - * struct timex *tptr pointer to timex structure - * - */ -#ifndef MSDOS /* Microsoft specific */ -#include <sys/syscall.h> -#endif /* MSDOS */ - -/* - * The following defines establish the engineering parameters of the - * phase-lock loop (PLL) model used in the kernel implementation. These - * parameters have been carefully chosen by analysis for good stability - * and wide dynamic range. - * - * The hz variable is defined in the kernel build environment. It - * establishes the timer interrupt frequency, 100 Hz for the SunOS - * kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the OSF/1 - * kernel. SHIFT_HZ expresses the same value as the nearest power of two - * in order to avoid hardware multiply operations. - * - * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen - * for a slightly underdamped convergence characteristic. - * - * MAXTC establishes the maximum time constant of the PLL. With the - * SHIFT_KG and SHIFT_KF values given and a time constant range from - * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, - * respectively. - */ -#define SHIFT_HZ 7 /* log2(hz) */ -#define SHIFT_KG 6 /* phase factor (shift) */ -#define SHIFT_KF 16 /* frequency factor (shift) */ -#define MAXTC 6 /* maximum time constant (shift) */ - -/* - * The following defines establish the scaling of the various variables - * used by the PLL. They are chosen to allow the greatest precision - * possible without overflow of a 32-bit word. - * - * SHIFT_SCALE defines the scaling (shift) of the time_phase variable, - * which serves as a an extension to the low-order bits of the system - * clock variable time.tv_usec. - * - * SHIFT_UPDATE defines the scaling (shift) of the time_offset variable, - * which represents the current time offset with respect to standard - * time. - * - * SHIFT_USEC defines the scaling (shift) of the time_freq and - * time_tolerance variables, which represent the current frequency - * offset and maximum frequency tolerance. - * - * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. - */ -#define SHIFT_SCALE 23 /* phase scale (shift) */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ -#define SHIFT_USEC 16 /* frequency offset scale (shift) */ -#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ - -/* - * The following defines establish the performance envelope of the PLL. - * They insure it operates within predefined limits, in order to satisfy - * correctness assertions. An excursion which exceeds these bounds is - * clamped to the bound and operation proceeds accordingly. In practice, - * this can occur only if something has failed or is operating out of - * tolerance, but otherwise the PLL continues to operate in a stable - * mode. - * - * MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), as - * defined in the NTP specification. CLOCK.MAX establishes the maximum - * time offset allowed before the system time is reset, rather than - * incrementally adjusted. Here, the maximum offset is clamped to - * MAXPHASE only in order to prevent overflow errors due to defective - * protocol implementations. - * - * MAXFREQ is the maximum frequency tolerance of the CPU clock - * oscillator plus the maximum slew rate allowed by the protocol. It - * should be set to at least the frequency tolerance of the oscillator - * plus 100 ppm for vernier frequency adjustments. If the kernel - * PPS discipline code is configured (PPS_SYNC), the oscillator time and - * frequency are disciplined to an external source, presumably with - * negligible time and frequency error relative to UTC, and MAXFREQ can - * be reduced. - * - * MAXTIME is the maximum jitter tolerance of the PPS signal if the - * kernel PPS discipline code is configured (PPS_SYNC). - * - * MINSEC and MAXSEC define the lower and upper bounds on the interval - * between protocol updates. - */ -#define MAXPHASE 128000L /* max phase error (us) */ -#ifdef PPS_SYNC -#define MAXFREQ (100L << SHIFT_USEC) /* max freq error (100 ppm) */ -#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ -#else -#define MAXFREQ (200L << SHIFT_USEC) /* max freq error (200 ppm) */ -#endif /* PPS_SYNC */ -#define MINSEC 16L /* min interval between updates (s) */ -#define MAXSEC 1200L /* max interval between updates (s) */ - -#ifdef PPS_SYNC -/* - * The following defines are used only if a pulse-per-second (PPS) - * signal is available and connected via a modem control lead, such as - * produced by the optional ppsclock feature incorporated in the Sun - * asynch driver. They establish the design parameters of the frequency- - * lock loop used to discipline the CPU clock oscillator to the PPS - * signal. - * - * PPS_AVG is the averaging factor for the frequency loop, as well as - * the time and frequency dispersion. - * - * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum - * calibration intervals, respectively, in seconds as a power of two. - * - * PPS_VALID is the maximum interval before the PPS signal is considered - * invalid and protocol updates used directly instead. - * - * MAXGLITCH is the maximum interval before a time offset of more than - * MAXTIME is believed. - */ -#define PPS_AVG 2 /* pps averaging constant (shift) */ -#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ -#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ -#define PPS_VALID 120 /* pps signal watchdog max (s) */ -#define MAXGLITCH 30 /* pps signal glitch max (s) */ -#endif /* PPS_SYNC */ - -/* - * The following defines and structures define the user interface for - * the ntp_gettime() and ntp_adjtime() system calls. - * - * Control mode codes (timex.modes) - */ -#define MOD_OFFSET 0x0001 /* set time offset */ -#define MOD_FREQUENCY 0x0002 /* set frequency offset */ -#define MOD_MAXERROR 0x0004 /* set maximum time error */ -#define MOD_ESTERROR 0x0008 /* set estimated time error */ -#define MOD_STATUS 0x0010 /* set clock status bits */ -#define MOD_TIMECONST 0x0020 /* set pll time constant */ -#define MOD_CLKB 0x4000 /* set clock B */ -#define MOD_CLKA 0x8000 /* set clock A */ - -/* - * Status codes (timex.status) - */ -#define STA_PLL 0x0001 /* enable PLL updates (rw) */ -#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ -#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ - -#define STA_INS 0x0010 /* insert leap (rw) */ -#define STA_DEL 0x0020 /* delete leap (rw) */ -#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ - -#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ -#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ -#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ -#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ - -#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ - -#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ - STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ - -/* - * Clock states (time_state) - */ -#define TIME_OK 0 /* no leap second warning */ -#define TIME_INS 1 /* insert leap second warning */ -#define TIME_DEL 2 /* delete leap second warning */ -#define TIME_OOP 3 /* leap second in progress */ -#define TIME_WAIT 4 /* leap second has occured */ -#define TIME_ERROR 5 /* clock not synchronized */ - -/* - * NTP user interface (ntp_gettime()) - used to read kernel clock values - * - * Note: maximum error = NTP synch distance = dispersion + delay / 2; - * estimated error = NTP dispersion. - */ -struct ntptimeval { - struct timeval time; /* current time (ro) */ - LONG maxerror; /* maximum error (us) (ro) */ - LONG esterror; /* estimated error (us) (ro) */ -}; - -/* - * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock - * oscillator - */ -struct timex { - unsigned int modes; /* clock mode bits (wo) */ - LONG offset; /* time offset (us) (rw) */ - LONG freq; /* frequency offset (scaled ppm) (rw) */ - LONG maxerror; /* maximum error (us) (rw) */ - LONG esterror; /* estimated error (us) (rw) */ - int status; /* clock status bits (rw) */ - LONG constant; /* pll time constant (rw) */ - LONG precision; /* clock precision (us) (ro) */ - LONG tolerance; /* clock frequency tolerance (scaled - * ppm) (ro) */ - /* - * The following read-only structure members are implemented - * only if the PPS signal discipline is configured in the - * kernel. - */ - LONG ppsfreq; /* pps frequency (scaled ppm) (ro) */ - LONG jitter; /* pps jitter (us) (ro) */ - int shift; /* interval duration (s) (shift) (ro) */ - LONG stabil; /* pps stability (scaled ppm) (ro) */ - LONG jitcnt; /* jitter limit exceeded (ro) */ - LONG calcnt; /* calibration intervals (ro) */ - LONG errcnt; /* calibration errors (ro) */ - LONG stbcnt; /* stability limit exceeded (ro) */ - -}; diff --git a/usr.sbin/xntpd/include/ntp_types.h b/usr.sbin/xntpd/include/ntp_types.h deleted file mode 100644 index bbcea1b..0000000 --- a/usr.sbin/xntpd/include/ntp_types.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ntp_types.h - defines how LONG and U_LONG are treated. For 64 bit systems - * like the DEC Alpha, they has to be defined as int and u_int. for 32 bit - * systems, define them as long and u_long - */ -#include "ntp_machine.h" - -#ifndef _NTP_TYPES_ -#define _NTP_TYPES_ - -/* - * This is another naming conflict. - * On NetBSD for MAC the macro "mac" is defined as 1 - * this is fun for a as a paket structure contains an - * optional "mac" member - severe confusion results 8-) - * As we hopefully do not have to rely on that macro we - * just undefine that. - */ -#ifdef mac -#undef mac -#endif - -/* - * Set up for prototyping - */ -#ifndef P -#if defined(__STDC__) || defined(USE_PROTOTYPES) -#define P(x) x -#else /* __STDC__ USE_PROTOTYPES */ -#define P(x) () -#if !defined(const) -#define const -#endif /* const */ -#endif /* __STDC__ USE_PROTOTYPES */ -#endif /* P */ - -/* - * DEC Alpha systems need LONG and U_LONG defined as int and u_int - */ -#ifdef __alpha -#ifndef LONG -#define LONG int -#endif /* LONG */ -#ifndef U_LONG -#define U_LONG u_int -#endif /* U_LONG */ -/* - * All other systems fall into this part - */ -#else /* __alpha */ -#ifndef LONG -#define LONG long -#endif /* LONG */ -#ifndef U_LONG -#define U_LONG u_long -#endif /* U_LONG */ -#endif /* __ alplha */ - -#endif /* _NTP_TYPES_ */ - diff --git a/usr.sbin/xntpd/include/ntp_unixtime.h b/usr.sbin/xntpd/include/ntp_unixtime.h deleted file mode 100644 index 8007a06..0000000 --- a/usr.sbin/xntpd/include/ntp_unixtime.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * ntp_unixtime.h - contains constants and macros for converting between - * NTP time stamps (l_fp) and Unix times (struct timeval) - */ - -#include "ntp_types.h" -#include <sys/time.h> - -/* gettimeofday() takes two args in BSD and only one in SYSV */ -#ifdef SYSV_TIMEOFDAY -# define GETTIMEOFDAY(a, b) (gettimeofday(a)) -# define SETTIMEOFDAY(a, b) (settimeofday(a)) -#else /* ! SYSV_TIMEOFDAY */ -# define GETTIMEOFDAY(a, b) (gettimeofday(a, b)) -# define SETTIMEOFDAY(a, b) (settimeofday(a, b)) -#endif /* SYSV_TIMEOFDAY */ - -/* - * Time of day conversion constant. Ntp's time scale starts in 1900, - * Unix in 1970. - */ -#define JAN_1970 0x83aa7e80 /* 2208988800 1970 - 1900 in seconds */ - -/* - * These constants are used to round the time stamps computed from - * a struct timeval to the microsecond (more or less). This keeps - * things neat. - */ -#define TS_MASK 0xfffff000 /* mask to usec, for time stamps */ -#define TS_ROUNDBIT 0x00000800 /* round at this bit */ - - -/* - * Convert usec to a time stamp fraction. If you use this the program - * must include the following declarations: - */ -extern u_long ustotslo[]; -extern u_long ustotsmid[]; -extern u_long ustotshi[]; - -#define TVUTOTSF(tvu, tsf) \ - (tsf) = ustotslo[(tvu) & 0xff] \ - + ustotsmid[((tvu) >> 8) & 0xff] \ - + ustotshi[((tvu) >> 16) & 0xf] - -/* - * Convert a struct timeval to a time stamp. - */ -#define TVTOTS(tv, ts) \ - do { \ - (ts)->l_ui = (u_long)(tv)->tv_sec; \ - TVUTOTSF((tv)->tv_usec, (ts)->l_uf); \ - } while(0) - -#define sTVTOTS(tv, ts) \ - do { \ - int isneg = 0; \ - long usec; \ - (ts)->l_ui = (tv)->tv_sec; \ - usec = (tv)->tv_usec; \ - if (((tv)->tv_sec < 0) || ((tv)->tv_usec < 0)) { \ - usec = -usec; \ - (ts)->l_ui = -(ts)->l_ui; \ - isneg = 1; \ - } \ - TVUTOTSF(usec, (ts)->l_uf); \ - if (isneg) { \ - L_NEG((ts)); \ - } \ - } while(0) - -/* - * TV_SHIFT is used to turn the table result into a usec value. To round, - * add in TV_ROUNDBIT before shifting - */ -#define TV_SHIFT 3 -#define TV_ROUNDBIT 0x4 - - -/* - * Convert a time stamp fraction to microseconds. The time stamp - * fraction is assumed to be unsigned. To use this in a program, declare: - */ -extern long tstouslo[]; -extern long tstousmid[]; -extern long tstoushi[]; - -#define TSFTOTVU(tsf, tvu) \ - (tvu) = (tstoushi[((tsf) >> 24) & 0xff] \ - + tstousmid[((tsf) >> 16) & 0xff] \ - + tstouslo[((tsf) >> 9) & 0x7f] \ - + TV_ROUNDBIT) >> TV_SHIFT -/* - * Convert a time stamp to a struct timeval. The time stamp - * has to be positive. - */ -#define TSTOTV(ts, tv) \ - do { \ - (tv)->tv_sec = (ts)->l_ui; \ - TSFTOTVU((ts)->l_uf, (tv)->tv_usec); \ - if ((tv)->tv_usec == 1000000) { \ - (tv)->tv_sec++; \ - (tv)->tv_usec = 0; \ - } \ - } while (0) - -/* - * Convert milliseconds to a time stamp fraction. This shouldn't be - * here, but it is convenient since the guys who use the definition will - * often be including this file anyway. - */ -extern u_long msutotsflo[]; -extern u_long msutotsfhi[]; - -#define MSUTOTSF(msu, tsf) \ - (tsf) = msutotsfhi[((msu) >> 5) & 0x1f] + msutotsflo[(msu) & 0x1f] - -extern char * tvtoa P((const struct timeval *)); -extern char * utvtoa P((const struct timeval *)); diff --git a/usr.sbin/xntpd/include/ntpd.h b/usr.sbin/xntpd/include/ntpd.h deleted file mode 100644 index 53e3a91..0000000 --- a/usr.sbin/xntpd/include/ntpd.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * ntpd.h - Prototypes for xntpd. - */ - -#include "ntp_syslog.h" -#include "ntp_fp.h" -#include "ntp.h" -#include "ntp_malloc.h" - -/* ntp_config.c */ -extern void getstartup P((int, char **)); -extern void getconfig P((int, char **)); - -/* ntp_config.c */ -extern void ctl_clr_stats P((void)); -extern int ctlclrtrap P((struct sockaddr_in *, struct interface *, int)); -extern u_short ctlpeerstatus P((struct peer *)); -extern int ctlsettrap P((struct sockaddr_in *, struct interface *, int, int)); -extern u_short ctlsysstatus P((void)); -extern void init_control P((void)); -extern void process_control P((struct recvbuf *, int)); -extern void report_event P((int, struct peer *)); - -/* ntp_control.c */ -/* - * Structure for translation tables between internal system - * variable indices and text format. - */ -struct ctl_var { - u_short code; - u_short flags; - char *text; -}; -/* - * Flag values - */ -#define CAN_READ 0x01 -#define CAN_WRITE 0x02 - -#define DEF 0x20 -#define PADDING 0x40 -#define EOV 0x80 - -#define RO (CAN_READ) -#define WO (CAN_WRITE) -#define RW (CAN_READ|CAN_WRITE) - -extern char * add_var P((struct ctl_var **, unsigned long, int)); -extern void free_varlist P((struct ctl_var *)); -extern void set_var P((struct ctl_var **, char *, unsigned long, int)); -extern void set_sys_var P((char *, unsigned long, int)); - -/* ntp_intres.c */ -extern void ntp_intres P((void)); - -/* ntp_io.c */ -extern struct interface *findbcastinter P((struct sockaddr_in *)); -extern struct interface *findinterface P((struct sockaddr_in *)); -extern void freerecvbuf P((struct recvbuf *)); -extern struct recvbuf *getrecvbufs P((void)); -extern void init_io P((void)); -extern void input_handler P((l_fp *)); -extern void io_clr_stats P((void)); -extern void io_setbclient P((void)); -extern void io_unsetbclient P((void)); -extern void io_multicast_add P((u_long)); -extern void io_multicast_del P((u_long)); - -extern void sendpkt P((struct sockaddr_in *, struct interface *, int, struct pkt *, int)); -#ifdef HAVE_SIGNALED_IO -extern void wait_for_signal P((void)); -extern void unblock_io_and_alarm P((void)); -extern void block_io_and_alarm P((void)); -#endif - -/* ntp_leap.c */ -extern void init_leap P((void)); -extern void leap_process P((void)); -extern int leap_setleap P((int, int)); -/* - * there seems to be a bug in the IRIX 4 compiler which prevents - * u_char from beeing used in prototyped functions. - * This is also true AIX compiler. - * So give up and define it to be int. WLJ - */ -extern int leap_actual P((int)); - -/* ntp_loopfilter.c */ -extern void init_loopfilter P((void)); -extern int local_clock P((l_fp *, struct peer *)); -extern void adj_frequency P((s_fp)); -extern void adj_host_clock P((void)); -extern void loop_config P((int, l_fp *, int)); -#if defined(PPS) || defined(PPSPPS) || defined(PPSCD) -extern int pps_sample P((l_fp *)); -#endif /* PPS || PPSDEV || PPSCD */ - -/* ntp_monitor.c */ -extern void init_mon P((void)); -extern void mon_start P((int)); -extern void mon_stop P((int)); -extern void monitor P((struct recvbuf *)); - -/* ntp_peer.c */ -extern void init_peer P((void)); -extern struct peer *findexistingpeer P((struct sockaddr_in *, struct peer *)); -extern struct peer *findpeer P((struct sockaddr_in *, struct interface *, int)); -extern struct peer *findpeerbyassoc P((int)); -extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, int, u_long)); -extern void peer_all_reset P((void)); -extern void peer_clr_stats P((void)); -extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, int, int, u_long)); -extern void peer_reset P((struct peer *)); -extern int peer_unconfig P((struct sockaddr_in *, struct interface *)); -extern void unpeer P((struct peer *)); - -/* ntp_proto.c */ -extern void transmit P((struct peer *)); -extern void receive P((struct recvbuf *)); -extern void peer_clear P((struct peer *)); -extern int process_packet P((struct peer *, struct pkt *, l_fp *, int, int)); -extern void clock_update P((struct peer *)); - -/* - * there seems to be a bug in the IRIX 4 compiler which prevents - * u_char from beeing used in prototyped functions. - * This is also true AIX compiler. - * So give up and define it to be int. WLJ - */ -extern void poll_update P((struct peer *, unsigned int, int)); - -extern void clear P((struct peer *)); -extern void clock_filter P((struct peer *, l_fp *, s_fp, u_fp)); -extern void clock_select P((void)); -extern void clock_combine P((struct peer **, int)); -extern void fast_xmit P((struct recvbuf *, int, int)); -extern void init_proto P((void)); -extern void proto_config P((int, u_long)); -extern void proto_clr_stats P((void)); - -#ifdef REFCLOCK -/* ntp_refclock.c */ -extern int refclock_newpeer P((struct peer *)); -extern void refclock_unpeer P((struct peer *)); -extern void refclock_receive P((struct peer *, l_fp *, s_fp, u_fp, l_fp *, l_fp *, int)); -extern void refclock_leap P((void)); -extern void init_refclock P((void)); -#endif /* REFCLOCK */ - -/* ntp_request.c */ -extern void init_request P((void)); -extern void process_private P((struct recvbuf *, int)); - -/* ntp_restrict.c */ -extern void init_restrict P((void)); -extern int restrictions P((struct sockaddr_in *)); -extern void restrict P((int, struct sockaddr_in *, struct sockaddr_in *, int, int)); - -/* ntp_timer.c */ -extern void init_timer P((void)); -extern void timer P((void)); -extern void timer_clr_stats P((void)); - -/* ntp_unixclock.c */ -extern void init_systime P((void)); - -/* ntp_util.c */ -extern void init_util P((void)); -extern void hourly_stats P((void)); -extern void stats_config P((int, char *)); -extern void record_peer_stats P((struct sockaddr_in *, int, l_fp *, s_fp, u_fp)); -extern void record_loop_stats P((l_fp *, s_fp, int)); -extern void record_clock_stats P((struct sockaddr_in *, char *)); -extern void getauthkeys P((char *)); -extern void rereadkeys P((void)); diff --git a/usr.sbin/xntpd/include/parse.h b/usr.sbin/xntpd/include/parse.h deleted file mode 100644 index 774cf5e..0000000 --- a/usr.sbin/xntpd/include/parse.h +++ /dev/null @@ -1,459 +0,0 @@ -/* - * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.21 1994/05/30 20:58:34 kardel Exp - * - * parse.h,v 3.21 1994/05/30 20:58:34 kardel Exp - * - * Copyright (c) 1989,1990,1991,1992,1993,1994 - * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#ifndef __PARSE_H__ -#define __PARSE_H__ -#if !(defined(lint) || defined(__GNUC__)) - static char parsehrcsid[]="parse.h,v 3.21 1994/05/30 20:58:34 kardel Exp"; -#endif - -#include "ntp_types.h" - -#include "parse_conf.h" - -/* - * we use the following datastructures in two modes - * either in the NTP itself where we use NTP time stamps at some places - * or in the kernel, where only struct timeval will be used. - */ -#undef PARSEKERNEL -#if defined(KERNEL) || defined(_KERNEL) -#ifndef PARSESTREAM -#define PARSESTREAM -#endif -#endif -#if defined(PARSESTREAM) && defined(STREAM) -#define PARSEKERNEL -#endif -#ifdef PARSEKERNEL -#ifndef _KERNEL -extern caddr_t kmem_alloc P((unsigned int)); -extern caddr_t kmem_free P((caddr_t, unsigned int)); -extern int splx(); -extern int splhigh(); -#define MALLOC(_X_) (char *)kmem_alloc(_X_) -#define FREE(_X_, _Y_) kmem_free((caddr_t)_X_, _Y_) -#else -#include <sys/kmem.h> -#define MALLOC(_X_) (char *)kmem_alloc(_X_, KM_SLEEP) -#define FREE(_X_, _Y_) kmem_free((caddr_t)_X_, _Y_) -#endif -#else -#define MALLOC(_X_) malloc(_X_) -#define FREE(_X_, _Y_) free(_X_) -#endif - -#if defined(PARSESTREAM) && defined(STREAM) -#include "sys/stream.h" -#include "sys/stropts.h" -#ifndef _KERNEL -extern int printf(); -#endif -#else /* STREAM */ -#include <stdio.h> -#include "ntp_syslog.h" -#ifdef DEBUG -extern int debug; -#define DD_PARSE 5 -#define DD_RAWDCF 4 -#define parseprintf(LEVEL, ARGS) if (debug > LEVEL) printf ARGS -#else /* DEBUG */ -#define parseprintf(LEVEL, ARGS) -#endif /* DEBUG */ -#endif /* PARSESTREAM */ - -#if defined(timercmp) && defined(__GNUC__) -#undef timercmp -#define timercmp(tvp, uvp, cmp) \ - ((tvp)->tv_sec cmp (uvp)->tv_sec || \ - ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)) -#endif - -#ifndef TIMES10 -#define TIMES10(_X_) (((_X_) << 3) + ((_X_) << 1)) -#endif - -/* - * state flags - */ -#define PARSEB_POWERUP 0x00000001 /* no synchronisation */ -#define PARSEB_NOSYNC 0x00000002 /* timecode currently not confirmed */ - -/* - * time zone information - */ -#define PARSEB_ANNOUNCE 0x00000010 /* switch time zone warning (DST switch) */ -#define PARSEB_DST 0x00000020 /* DST in effect */ -#define PARSEB_UTC 0x00000040 /* UTC time */ - -/* - * leap information - */ -#define PARSEB_LEAPDEL 0x00000100 /* LEAP deletion warning */ -#define PARSEB_LEAPADD 0x00000200 /* LEAP addition warning */ -#define PARSEB_LEAPS 0x00000300 /* LEAP warnings */ -#define PARSEB_LEAPSECOND 0x00000400 /* actual leap second */ -/* - * optional status information - */ -#define PARSEB_ALTERNATE 0x00001000 /* alternate antenna used */ -#define PARSEB_POSITION 0x00002000 /* position available */ - -/* - * feature information - */ -#define PARSEB_S_LEAP 0x00010000 /* supports LEAP */ -#define PARSEB_S_ANTENNA 0x00020000 /* supports antenna information */ -#define PARSEB_S_PPS 0x00040000 /* supports PPS time stamping */ -#define PARSEB_S_POSITION 0x00080000 /* supports position information (GPS) */ - -/* - * time stamp availality - */ -#define PARSEB_TIMECODE 0x10000000 /* valid time code sample */ -#define PARSEB_PPS 0x20000000 /* valid PPS sample */ - -#define PARSE_TCINFO (PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\ - PARSEB_UTC|PARSEB_LEAPS|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ - PARSEB_S_LOCATION|PARSEB_TIMECODE) - -#define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) -#define PARSE_NOSYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC) -#define PARSE_SYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0) -#define PARSE_ANNOUNCE(x) ((x) & PARSEB_ANNOUNCE) -#define PARSE_DST(x) ((x) & PARSEB_DST) -#define PARSE_UTC(x) ((x) & PARSEB_UTC) -#define PARSE_LEAPADD(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPADD)) -#define PARSE_LEAPDEL(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPDEL)) -#define PARSE_ALTERNATE(x) ((x) & PARSEB_ALTERNATE) -#define PARSE_LEAPSECOND(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND)) - -#define PARSE_S_LEAP(x) ((x) & PARSEB_S_LEAP) -#define PARSE_S_ANTENNA(x) ((x) & PARSEB_S_ANTENNA) -#define PARSE_S_PPS(x) ((x) & PARSEB_S_PPS) -#define PARSE_S_POSITION(x) ((x) & PARSEB_S_POSITION) - -#define PARSE_TIMECODE(x) ((x) & PARSEB_TIMECODE) -#define PARSE_PPS(x) ((x) & PARSEB_PPS) -#define PARSE_POSITION(x) ((x) & PARSEB_POSITION) - -/* - * operation flags - some are also fudge flags - */ -#define PARSE_STAT_FLAGS 0x03 /* interpreted by io module */ -#define PARSE_STAT_FILTER 0x01 /* filter incoming data */ -#define PARSE_STAT_AVG 0x02 /* 1:median average / 0: median point */ -#define PARSE_LEAP_DELETE 0x04 /* delete leap */ -#define PARSE_STATISTICS 0x08 /* enable statistics */ -#define PARSE_FIXED_FMT 0x10 /* fixed format */ -#define PARSE_PPSCLOCK 0x20 /* try to get PPS time stamp via ppsclock ioctl */ - -typedef union timestamp -{ - struct timeval tv; /* timeval - usually kernel view */ - l_fp fp; /* fixed point - xntp view */ -} timestamp_t; - -/* - * standard time stamp structure - */ -struct parsetime -{ - u_long parse_status; /* data status - CVT_OK, CVT_NONE, CVT_FAIL ... */ - timestamp_t parse_time; /* PARSE timestamp */ - timestamp_t parse_stime; /* telegram sample timestamp */ - timestamp_t parse_ptime; /* PPS time stamp */ - long parse_usecerror; /* sampled/filtered usec error */ - long parse_usecdisp; /* sampled usecdispersion */ - u_long parse_state; /* current receiver state */ - unsigned short parse_format; /* format code */ -}; - -typedef struct parsetime parsetime_t; - -/*---------- STREAMS interface ----------*/ - -#ifdef STREAM -/* - * ioctls - */ -#define PARSEIOC_ENABLE (('D'<<8) + 'E') -#define PARSEIOC_DISABLE (('D'<<8) + 'D') -#define PARSEIOC_SETSTAT (('D'<<8) + 'S') -#define PARSEIOC_GETSTAT (('D'<<8) + 'G') -#define PARSEIOC_SETFMT (('D'<<8) + 'f') -#define PARSEIOC_GETFMT (('D'<<8) + 'F') -#define PARSEIOC_SETCS (('D'<<8) + 'C') -#define PARSEIOC_TIMECODE (('D'<<8) + 'T') - -#endif - -/*------ IO handling flags (sorry) ------*/ - -#define PARSE_IO_CSIZE 0x00000003 -#define PARSE_IO_CS5 0x00000000 -#define PARSE_IO_CS6 0x00000001 -#define PARSE_IO_CS7 0x00000002 -#define PARSE_IO_CS8 0x00000003 - -/* - * sizes - */ -#define PARSE_TCMAX 128 - -/* - * ioctl structure - */ -union parsectl -{ - struct parsestatus - { - u_long flags; /* new/old flags */ - } parsestatus; - - struct parsegettc - { - u_long parse_state; /* last state */ - u_long parse_badformat; /* number of bad packets since last query */ - unsigned short parse_format;/* last decoded format */ - unsigned short parse_count; /* count of valid time code bytes */ - char parse_buffer[PARSE_TCMAX+1]; /* timecode buffer */ - } parsegettc; - - struct parseformat - { - unsigned short parse_format;/* number of examined format */ - unsigned short parse_count; /* count of valid string bytes */ - char parse_buffer[PARSE_TCMAX+1]; /* format code string */ - } parseformat; - - struct parsesetcs - { - u_long parse_cs; /* character size (needed for stripping) */ - } parsesetcs; -}; - -typedef union parsectl parsectl_t; - -/*------ for conversion routines --------*/ - -#define PARSE_DELTA 16 - -struct parse /* parse module local data */ -{ - int parse_flags; /* operation and current status flags */ - - int parse_ioflags; /* io handling flags (5-8 Bit control currently) */ - int parse_syncflags; /* possible sync events (START/END/character) */ - /* - * RS232 input parser information - */ - unsigned char parse_startsym[32]; /* possible start packet values */ - unsigned char parse_endsym[32]; /* possible end packet values */ - unsigned char parse_syncsym[32]; /* sync characters */ - struct timeval parse_timeout; /* max gap between characters (us) */ - - /* - * PPS 'input' buffer - */ - struct timeval parse_lastone; /* time stamp of last PPS 1 transition */ - struct timeval parse_lastzero; /* time stamp of last PPS 0 transition */ - - /* - * character input buffer - */ - timestamp_t parse_lastchar; /* time stamp of last received character */ - - /* - * private data - fixed format only - */ - unsigned short parse_plen; /* length of private data */ - void *parse_pdata; /* private data pointer */ - - /* - * time code input buffer (from RS232 or PPS) - */ - unsigned short parse_index; /* current buffer index */ - char *parse_data; /* data buffer */ - unsigned short parse_dsize; /* size of data buffer */ - unsigned short parse_lformat; /* last format used */ - u_long parse_lstate; /* last state code */ - char *parse_ldata; /* last data buffer */ - unsigned short parse_ldsize; /* last data buffer length */ - u_long parse_badformat; /* number of unparsable pakets */ - - /* - * time stamp filtering - */ - long parse_delta[PARSE_DELTA]; /* delta buffer */ - int parse_dindex; - - parsetime_t parse_dtime; /* external data prototype */ -}; - -typedef struct parse parse_t; - -struct clocktime /* clock time broken up from time code */ -{ - long day; - long month; - long year; - long hour; - long minute; - long second; - long usecond; - long utcoffset; /* in seconds */ - time_t utctime; /* the actual time - alternative to date/time */ - long flags; /* current clock status */ -}; - -typedef struct clocktime clocktime_t; - -/* - * clock formats specify routines to be called to - * convert the buffer into a struct clock. - * functions are called - * fn(buffer, data, clock) -> CVT_NONE, CVT_FAIL, CVT_OK - * - * the private data pointer can be used to - * distingush between different formats of a common - * base type - */ -#define F_START 0x00000001 /* start packet delimiter */ -#define F_END 0x00000002 /* end packet delimiter */ -#define SYNC_TIMEOUT 0x00000004 /* packet restart after timeout */ -#define SYNC_START 0x00000008 /* packet start is sync event */ -#define SYNC_END 0x00000010 /* packet end is sync event */ -#define SYNC_CHAR 0x00000020 /* special character is sync event */ -#define SYNC_ONE 0x00000040 /* PPS synchronize on 'ONE' transition */ -#define SYNC_ZERO 0x00000080 /* PPS synchronize on 'ZERO' transition */ -#define SYNC_SYNTHESIZE 0x00000100 /* generate intermediate time stamps */ -#define CVT_FIXEDONLY 0x00010000 /* convert only in fixed configuration */ - -/* - * parser related return/error codes - */ -#define CVT_MASK 0x0000000F /* conversion exit code */ -#define CVT_NONE 0x00000001 /* format not applicable */ -#define CVT_FAIL 0x00000002 /* conversion failed - error code returned */ -#define CVT_OK 0x00000004 /* conversion succeeded */ -#define CVT_SKIP 0x00000008 /* conversion succeeded */ -#define CVT_BADFMT 0x00000010 /* general format error - (unparsable) */ -#define CVT_BADDATE 0x00000020 /* date field incorrect */ -#define CVT_BADTIME 0x00000040 /* time field incorrect */ - -struct clockformat -{ - u_long (*input)(); /* special input protocol - implies fixed format */ - u_long (*convert)(); /* conversion routine */ - void (*syncevt)(); /* routine for handling RS232 sync events (time stamps) */ - u_long (*syncpps)(); /* PPS input routine */ - u_long (*synth)(); /* time code synthesizer */ - void *data; /* local parameters */ - char *name; /* clock format name */ - unsigned short length; /* maximum length of data packet */ - u_long flags; /* valid start symbols etc. */ - unsigned short plen; /* length of private data - implies fixed format */ - struct timeval timeout; /* buffer restart after timeout (us) */ - unsigned char startsym; /* start symbol */ - unsigned char endsym; /* end symbol */ - unsigned char syncsym; /* sync symbol */ -}; - -typedef struct clockformat clockformat_t; - -/* - * parse interface - */ -extern int parse_ioinit P((parse_t *)); -extern void parse_ioend P((parse_t *)); -extern int parse_ioread P((parse_t *, unsigned char, timestamp_t *)); -extern int parse_iopps P((parse_t *, int, timestamp_t *)); -extern void parse_iodone P((parse_t *)); - -extern int parse_getstat P((parsectl_t *, parse_t *)); -extern int parse_setstat P((parsectl_t *, parse_t *)); -extern int parse_timecode P((parsectl_t *, parse_t *)); -extern int parse_getfmt P((parsectl_t *, parse_t *)); -extern int parse_setfmt P((parsectl_t *, parse_t *)); -extern int parse_setcs P((parsectl_t *, parse_t *)); - -extern int Strok P((char *, char *)); -extern int Stoi P((char *, long *, int)); - -extern time_t parse_to_unixtime P((clocktime_t *, u_long *)); -extern u_long updatetimeinfo P((parse_t *, time_t, u_long, u_long)); -extern void syn_simple P((parse_t *, timestamp_t *, struct format *, u_long)); -extern u_long pps_simple P((parse_t *, int, timestamp_t *)); -#endif - -/* - * History: - * - * parse.h,v - * Revision 3.21 1994/05/30 20:58:34 kardel - * fix prototypes - * - * Revision 3.20 1994/05/30 10:19:44 kardel - * LONG cleanup - * - * Revision 3.19 1994/05/15 11:30:33 kardel - * documented flag4 as statistics enable flag - * - * Revision 3.18 1994/05/12 12:40:34 kardel - * shut up gcc about broken Sun/BSD code - * - * Revision 3.17 1994/03/03 09:27:20 kardel - * rcs ids fixed - * - * Revision 3.13 1994/01/25 19:04:21 kardel - * 94/01/23 reconcilation - * - * Revision 3.12 1994/01/23 17:23:05 kardel - * 1994 reconcilation - * - * Revision 3.11 1993/11/11 11:20:18 kardel - * declaration fixes - * - * Revision 3.10 1993/11/01 19:59:48 kardel - * parse Solaris support (initial version) - * - * Revision 3.9 1993/10/06 00:14:57 kardel - * include fixes - * - * Revision 3.8 1993/10/05 23:15:41 kardel - * more STREAM protection - * - * Revision 3.7 1993/10/05 22:56:10 kardel - * STREAM must be defined for PARSESTREAMS - * - * Revision 3.6 1993/10/03 19:10:28 kardel - * restructured I/O handling - * - * Revision 3.5 1993/09/26 23:41:13 kardel - * new parse driver logic - * - * Revision 3.4 1993/09/01 21:46:31 kardel - * conditional cleanup - * - * Revision 3.3 1993/08/27 00:29:29 kardel - * compilation cleanup - * - * Revision 3.2 1993/07/09 11:37:05 kardel - * Initial restructured version + GPS support - * - * Revision 3.1 1993/07/06 09:59:12 kardel - * DCF77 driver goes generic... - * - */ diff --git a/usr.sbin/xntpd/include/parse_conf.h b/usr.sbin/xntpd/include/parse_conf.h deleted file mode 100644 index 3c512aa..0000000 --- a/usr.sbin/xntpd/include/parse_conf.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * /src/NTP/REPOSITORY/v3/include/parse_conf.h,v 3.6 1994/05/30 10:19:49 kardel Exp - * - * parse_conf.h,v 3.6 1994/05/30 10:19:49 kardel Exp - * - * Copyright (c) 1993,1994 - * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#ifndef __PARSE_CONF_H__ -#define __PARSE_CONF_H__ -#if !(defined(lint) || defined(__GNUC__)) - static char dcfhrcsid[]="parse_conf.h,v 3.6 1994/05/30 10:19:49 kardel Exp FAU"; -#endif - -/* - * field location structure (Meinberg clocks/simple format) - */ -#define O_DAY 0 -#define O_MONTH 1 -#define O_YEAR 2 -#define O_HOUR 3 -#define O_MIN 4 -#define O_SEC 5 -#define O_WDAY 6 -#define O_FLAGS 7 -#define O_ZONE 8 -#define O_UTCHOFFSET 9 -#define O_UTCMOFFSET 10 -#define O_UTCSOFFSET 11 -#define O_COUNT (O_UTCSOFFSET+1) - -#define MBG_EXTENDED 0x00000001 - -/* - * see below for field offsets - */ - -struct format -{ - struct foff - { - char offset; /* offset into buffer */ - char length; /* length of field */ - } field_offsets[O_COUNT]; - char *fixed_string; /* string with must be chars (blanks = wildcards) */ - u_long flags; -}; -#endif diff --git a/usr.sbin/xntpd/include/sys/bsd_audioirig.h b/usr.sbin/xntpd/include/sys/bsd_audioirig.h deleted file mode 100644 index 0120282..0000000 --- a/usr.sbin/xntpd/include/sys/bsd_audioirig.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $FreeBSD$ - */ - -#ifndef _BSD_AUDIOIRIG_H_ -#define _BSD_AUDIOIRIG_H_ - -#include <sys/time.h> - -/********************************************************************/ -/* user interface */ - -/* - * irig ioctls - */ -#if defined(__STDC__) || !(defined(ibm032) && !defined(__GNUC)) -#define AUDIO_IRIG_OPEN _IO('A', 50) -#define AUDIO_IRIG_CLOSE _IO('A', 51) -#define AUDIO_IRIG_SETFORMAT _IOWR('A', 52, int) -#else -#define AUDIO_IRIG_OPEN _IO(A, 50) -#define AUDIO_IRIG_CLOSE _IO(A, 51) -#define AUDIO_IRIG_SETFORMAT _IOWR(A, 52, int) -#endif - -/* - * irig error codes - */ -#define AUDIO_IRIG_BADSIGNAL 0x01 -#define AUDIO_IRIG_BADDATA 0x02 -#define AUDIO_IRIG_BADSYNC 0x04 -#define AUDIO_IRIG_BADCLOCK 0x08 -#define AUDIO_IRIG_OLDDATA 0x10 - -/********************************************************************/ - -/* - * auib definitions - */ -#define AUIB_SIZE (0x0040) -#define AUIB_INC (0x0008) -#define AUIB_MOD(k) ((k) & 0x0038) -#define AUIB_INIT(ib) ((ib)->ib_head = (ib)->ib_tail = (ib)->ib_lock = \ - (ib)->phase = (ib)->shi = (ib)->slo = (ib)->high = \ - (ib)->level0 = (ib)->level1 = \ - (ib)->shift[0] = (ib)->shift[1] = (ib)->shift[2] = \ - (ib)->shift[3] = (ib)->sdata[0] = (ib)->sdata[1] = \ - (ib)->sdata[2] = (ib)->sdata[3] = (ib)->err = 0) -#define AUIB_EMPTY(ib) ((ib)->ib_head == (ib)->ib_tail) -#define AUIB_LEN(ib) (AUIB_MOD((ib)->ib_tail - (ib)->ib_head)) -#define AUIB_LEFT(ib) (AUIB_MOD((ib)->ib_head - (ib)->ib_tail - 1)) -#define IRIGDELAY 3 -#define IRIGLEVEL 1355 - -#ifndef LOCORE -/* - * irig_time holds IRIG data for one second - */ -struct irig_time { - struct timeval stamp; /* timestamp */ - u_char bits[13]; /* 100 irig data bits */ - u_char status; /* status byte */ - char time[14]; /* time string */ -}; - -/* - * auib's are used for IRIG data communication between the trap - * handler and the software interrupt. - */ -struct auib { - /* driver variables */ - u_short active; /* 0=inactive, else=active */ - u_short format; /* time output format */ - struct irig_time timestr; /* time structure */ - char buffer[14]; /* output formation buffer */ - - /* hardware interrupt variables */ - struct timeval tv1,tv2,tv3; /* time stamps (median filter) */ - int level0,level1; /* lo/hi input levels */ - int level; /* decision level */ - int high; /* recent largest sample */ - int sl0,sl1; /* recent sample levels */ - int lasts; /* last sample value */ - u_short scount; /* sample count */ - u_long eacc; /* 10-bit element accumulator */ - u_long ebit; /* current bit in element */ - u_char r_level,mmr1; /* recording level 0-255 */ - int shi,slo,phase; /* AGC variables */ - u_long err; /* error status bits */ - int ecount; /* count of elements this second */ - long shift[4]; /* shift register of pos ident */ - long sdata[4]; /* shift register of symbols */ - - int ib_head; /* queue head */ - int ib_tail; /* queue tail */ - u_short ib_lock; /* queue head lock */ - u_long ib_data[AUIB_SIZE]; /* data buffer */ -}; -#endif - -#endif /* _BSD_AUDIOIRIG_H_ */ diff --git a/usr.sbin/xntpd/include/sys/chudefs.h b/usr.sbin/xntpd/include/sys/chudefs.h deleted file mode 100644 index f5549f5..0000000 --- a/usr.sbin/xntpd/include/sys/chudefs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Definitions for the CHU line discipline v2.0 - */ - -/* - * The CHU time code consists of 10 BCD digits and is repeated - * twice for a total of 10 characters. A time is taken after - * the arrival of each character. The following structure is - * used to return this stuff. - */ -#define NCHUCHARS (10) - -struct chucode { - u_char codechars[NCHUCHARS]; /* code characters */ - u_char ncodechars; /* number of code characters */ - u_char chutype; /* packet type */ - struct timeval codetimes[NCHUCHARS]; /* arrival times */ -}; - -#define CHU_TIME 0 /* second half is equal to first half */ -#define CHU_YEAR 1 /* second half is one's complement */ - diff --git a/usr.sbin/xntpd/include/sys/clkdefs.h b/usr.sbin/xntpd/include/sys/clkdefs.h deleted file mode 100644 index afbc77a..0000000 --- a/usr.sbin/xntpd/include/sys/clkdefs.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Defines for the "clk" timestamping STREAMS module - */ - -#if defined(sun) -#include <sys/ioccom.h> -#else -#include <sys/ioctl.h> -#endif - -/* - * First, we need to define the maximum size of the set of - * characters to timestamp. 32 is MORE than enough. - */ - -#define CLK_MAXSTRSIZE 32 -struct clk_tstamp_charset { /* XXX to use _IOW not _IOWN */ - char val[CLK_MAXSTRSIZE]; -}; - -/* - * ioctl(fd, CLK_SETSTR, (char*)c ); - * - * will tell the driver that any char in the null-terminated - * string c should be timestamped. It is possible, though - * unlikely that this ioctl number could collide with an - * existing one on your system. If so, change the 'K' - * to some other letter. However, once you've compiled - * the kernel with this include file, you should NOT - * change this file. - */ - -#if defined(__STDC__) /* XXX avoid __STDC__=0 on SOLARIS */ -#define CLK_SETSTR _IOW('K', 01, struct clk_tstamp_charset) -#else -#define CLK_SETSTR _IOW(K, 01, struct clk_tstamp_charset) -#endif - diff --git a/usr.sbin/xntpd/include/sys/parsestreams.h b/usr.sbin/xntpd/include/sys/parsestreams.h deleted file mode 100644 index ac66f42..0000000 --- a/usr.sbin/xntpd/include/sys/parsestreams.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * /src/NTP/REPOSITORY/v3/include/sys/parsestreams.h,v 3.12 1994/06/01 08:21:08 kardel Exp - * - * parsestreams.h,v 3.12 1994/06/01 08:21:08 kardel Exp - * - * Copyright (c) 1989,1990,1991,1992,1993,1994 - * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#if !(defined(lint) || defined(__GNUC__)) - static char parse77hrcsid[]="parsestreams.h,v 3.12 1994/06/01 08:21:08 kardel Exp"; -#endif - -#undef PARSEKERNEL -#if defined(KERNEL) || defined(_KERNEL) -#ifndef PARSESTREAM -#define PARSESTREAM -#endif -#endif -#if defined(PARSESTREAM) && defined(STREAM) -#define PARSEKERNEL -#include <sys/ppsclock.h> - -struct parsestream /* parse module local data */ -{ - queue_t *parse_queue; /* read stream for this channel */ - queue_t *parse_dqueue; /* driver queue entry (PPS support) */ - unsigned long parse_status; /* operation flags */ - void *parse_data; /* local data space (PPS support) */ - parse_t parse_io; /* io structure */ - struct ppsclockev parse_ppsclockev; /* copy of last pps event */ -}; - -typedef struct parsestream parsestream_t; - -#define PARSE_ENABLE 0x0001 - -/*--------------- debugging support ---------------------------------*/ - -#ifdef DEBUG_PARSE - -extern int parsedebug; - -#define DD_OPEN 0x00000001 -#define DD_CLOSE 0x00000002 -#define DD_RPUT 0x00000004 -#define DD_WPUT 0x00000008 -#define DD_RSVC 0x00000010 -#define DD_PARSE 0x00000020 -#define DD_INSTALL 0x00000040 -#define DD_ISR 0x00000080 -#define DD_RAWDCF 0x00000100 - -#define parseprintf(X, Y) if ((X) & parsedebug) printf Y - -#else - -#define parseprintf(X, Y) - -#endif -#endif diff --git a/usr.sbin/xntpd/include/sys/ppsclock.h b/usr.sbin/xntpd/include/sys/ppsclock.h deleted file mode 100644 index edf28aa..0000000 --- a/usr.sbin/xntpd/include/sys/ppsclock.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66. - * - * Copyright (c) 1992 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 University of - * California, Lawrence Berkeley Laboratory. - * 4. The name of the University may not 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. - */ - -#define PPSCLOCKSTR "ppsclock" - -struct ppsclockev { - struct timeval tv; - u_int serial; -}; - -#if defined(__STDC__) || defined(SYS_HPUX) -#ifdef _IOR -#define CIOGETEV _IOR('C', 0, struct ppsclockev) /* get last pps event */ -#else /* XXX SOLARIS is different */ -#define CIO ('C'<<8) -#define CIOGETEV (CIO|0) /* get last pps event */ -#endif /* _IOR */ -#else /* __STDC__ */ -#ifdef _IOR -#define CIOGETEV _IOR(C, 0, struct ppsclockev) /* get last pps event */ -#else /* XXX SOLARIS is different */ -#define CIO ('C'<<8) -#define CIOGETEV (CIO|0) /* get last pps event */ -#endif /* _IOR */ -#endif /* __STDC__ */ diff --git a/usr.sbin/xntpd/include/sys/timex.h b/usr.sbin/xntpd/include/sys/timex.h deleted file mode 100644 index bc2d634..0000000 --- a/usr.sbin/xntpd/include/sys/timex.h +++ /dev/null @@ -1,290 +0,0 @@ -/****************************************************************************** - * * - * Copyright (c) David L. Mills 1993, 1994 * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appears in all copies and that both the * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name University of Delaware not be used in * - * advertising or publicity pertaining to distribution of the software * - * without specific, written prior permission. The University of Delaware * - * makes no representations about the suitability this software for any * - * purpose. It is provided "as is" without express or implied warranty. * - * * - ******************************************************************************/ - -/* - * Modification history timex.h - * - * 19 Mar 94 David L. Mills - * Moved defines from kernel routines to header file and added new - * defines for PPS phase-lock loop. - * - * 20 Feb 94 David L. Mills - * Revised status codes and structures for external clock and PPS - * signal discipline. - * - * 28 Nov 93 David L. Mills - * Adjusted parameters to improve stability and increase poll - * interval. - * - * 17 Sep 93 David L. Mills - * Created file - */ -/* - * This header file defines the Network Time Protocol (NTP) interfaces - * for user and daemon application programs. These are implemented using - * private syscalls and data structures and require specific kernel - * support. - * - * NAME - * ntp_gettime - NTP user application interface - * - * SYNOPSIS - * #include <sys/timex.h> - * - * int syscall(SYS_ntp_gettime, tptr) - * - * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure - * - * NAME - * ntp_adjtime - NTP daemon application interface - * - * SYNOPSIS - * #include <sys/timex.h> - * - * int syscall(SYS_ntp_adjtime, mode, tptr) - * - * int SYS_ntp_adjtime defined in syscall.h header file - * struct timex *tptr pointer to timex structure - * - */ -#ifndef _SYS_TIMEX_H_ -#define _SYS_TIMEX_H_ 1 - -#ifndef MSDOS /* Microsoft specific */ -#include <sys/syscall.h> -#endif /* MSDOS */ - -/* - * The following defines establish the engineering parameters of the - * phase-lock loop (PLL) model used in the kernel implementation. These - * parameters have been carefully chosen by analysis for good stability - * and wide dynamic range. - * - * The hz variable is defined in the kernel build environment. It - * establishes the timer interrupt frequency, 100 Hz for the SunOS - * kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the OSF/1 - * kernel. SHIFT_HZ expresses the same value as the nearest power of two - * in order to avoid hardware multiply operations. - * - * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen - * for a slightly underdamped convergence characteristic. - * - * MAXTC establishes the maximum time constant of the PLL. With the - * SHIFT_KG and SHIFT_KF values given and a time constant range from - * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, - * respectively. - */ -#define SHIFT_HZ 7 /* log2(hz) */ -#define SHIFT_KG 6 /* phase factor (shift) */ -#define SHIFT_KF 16 /* frequency factor (shift) */ -#define MAXTC 6 /* maximum time constant (shift) */ - -/* - * The following defines establish the scaling of the various variables - * used by the PLL. They are chosen to allow the greatest precision - * possible without overflow of a 32-bit word. - * - * SHIFT_SCALE defines the scaling (shift) of the time_phase variable, - * which serves as a an extension to the low-order bits of the system - * clock variable time.tv_usec. - * - * SHIFT_UPDATE defines the scaling (shift) of the time_offset variable, - * which represents the current time offset with respect to standard - * time. - * - * SHIFT_USEC defines the scaling (shift) of the time_freq and - * time_tolerance variables, which represent the current frequency - * offset and maximum frequency tolerance. - * - * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. - */ -#define SHIFT_SCALE 23 /* phase scale (shift) */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ -#define SHIFT_USEC 16 /* frequency offset scale (shift) */ -#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ - -/* - * The following defines establish the performance envelope of the PLL. - * They insure it operates within predefined limits, in order to satisfy - * correctness assertions. An excursion which exceeds these bounds is - * clamped to the bound and operation proceeds accordingly. In practice, - * this can occur only if something has failed or is operating out of - * tolerance, but otherwise the PLL continues to operate in a stable - * mode. - * - * MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), as - * defined in the NTP specification. CLOCK.MAX establishes the maximum - * time offset allowed before the system time is reset, rather than - * incrementally adjusted. Here, the maximum offset is clamped to - * MAXPHASE only in order to prevent overflow errors due to defective - * protocol implementations. - * - * MAXFREQ is the maximum frequency tolerance of the CPU clock - * oscillator plus the maximum slew rate allowed by the protocol. It - * should be set to at least the frequency tolerance of the oscillator - * plus 100 ppm for vernier frequency adjustments. If the kernel - * PPS discipline code is configured (PPS_SYNC), the oscillator time and - * frequency are disciplined to an external source, presumably with - * negligible time and frequency error relative to UTC, and MAXFREQ can - * be reduced. - * - * MAXTIME is the maximum jitter tolerance of the PPS signal if the - * kernel PPS discipline code is configured (PPS_SYNC). - * - * MINSEC and MAXSEC define the lower and upper bounds on the interval - * between protocol updates. - */ -#define MAXPHASE 128000L /* max phase error (us) */ -#ifdef PPS_SYNC -#define MAXFREQ (100L << SHIFT_USEC) /* max freq error (100 ppm) */ -#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ -#else -#define MAXFREQ (200L << SHIFT_USEC) /* max freq error (200 ppm) */ -#endif /* PPS_SYNC */ -#define MINSEC 16L /* min interval between updates (s) */ -#define MAXSEC 1200L /* max interval between updates (s) */ - -#ifdef PPS_SYNC -/* - * The following defines are used only if a pulse-per-second (PPS) - * signal is available and connected via a modem control lead, such as - * produced by the optional ppsclock feature incorporated in the Sun - * asynch driver. They establish the design parameters of the frequency- - * lock loop used to discipline the CPU clock oscillator to the PPS - * signal. - * - * PPS_AVG is the averaging factor for the frequency loop, as well as - * the time and frequency dispersion. - * - * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum - * calibration intervals, respectively, in seconds as a power of two. - * - * PPS_VALID is the maximum interval before the PPS signal is considered - * invalid and protocol updates used directly instead. - * - * MAXGLITCH is the maximum interval before a time offset of more than - * MAXTIME is believed. - */ -#define PPS_AVG 2 /* pps averaging constant (shift) */ -#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ -#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ -#define PPS_VALID 120 /* pps signal watchdog max (s) */ -#define MAXGLITCH 30 /* pps signal glitch max (s) */ -#endif /* PPS_SYNC */ - -/* - * The following defines and structures define the user interface for - * the ntp_gettime() and ntp_adjtime() system calls. - * - * Control mode codes (timex.modes) - */ -#define MOD_OFFSET 0x0001 /* set time offset */ -#define MOD_FREQUENCY 0x0002 /* set frequency offset */ -#define MOD_MAXERROR 0x0004 /* set maximum time error */ -#define MOD_ESTERROR 0x0008 /* set estimated time error */ -#define MOD_STATUS 0x0010 /* set clock status bits */ -#define MOD_TIMECONST 0x0020 /* set pll time constant */ -#define MOD_CLKB 0x4000 /* set clock B */ -#define MOD_CLKA 0x8000 /* set clock A */ - -/* - * Status codes (timex.status) - */ -#define STA_PLL 0x0001 /* enable PLL updates (rw) */ -#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ -#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ - -#define STA_INS 0x0010 /* insert leap (rw) */ -#define STA_DEL 0x0020 /* delete leap (rw) */ -#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ - -#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ -#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ -#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ -#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ - -#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ - -#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ - STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ - -/* - * Clock states (time_state) - */ -#define TIME_OK 0 /* no leap second warning */ -#define TIME_INS 1 /* insert leap second warning */ -#define TIME_DEL 2 /* delete leap second warning */ -#define TIME_OOP 3 /* leap second in progress */ -#define TIME_WAIT 4 /* leap second has occured */ -#define TIME_ERROR 5 /* clock not synchronized */ - -/* - * NTP user interface (ntp_gettime()) - used to read kernel clock values - * - * Note: maximum error = NTP synch distance = dispersion + delay / 2; - * estimated error = NTP dispersion. - */ -struct ntptimeval { - struct timeval time; /* current time (ro) */ - long maxerror; /* maximum error (us) (ro) */ - long esterror; /* estimated error (us) (ro) */ -}; - -/* - * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock - * oscillator - */ -struct timex { - unsigned int modes; /* clock mode bits (wo) */ - long offset; /* time offset (us) (rw) */ - long freq; /* frequency offset (scaled ppm) (rw) */ - long maxerror; /* maximum error (us) (rw) */ - long esterror; /* estimated error (us) (rw) */ - int status; /* clock status bits (rw) */ - long constant; /* pll time constant (rw) */ - long precision; /* clock precision (us) (ro) */ - long tolerance; /* clock frequency tolerance (scaled - * ppm) (ro) */ - /* - * The following read-only structure members are implemented - * only if the PPS signal discipline is configured in the - * kernel. - */ - long ppsfreq; /* pps frequency (scaled ppm) (ro) */ - long jitter; /* pps jitter (us) (ro) */ - int shift; /* interval duration (s) (shift) (ro) */ - long stabil; /* pps stability (scaled ppm) (ro) */ - long jitcnt; /* jitter limit exceeded (ro) */ - long calcnt; /* calibration intervals (ro) */ - long errcnt; /* calibration errors (ro) */ - long stbcnt; /* stability limit exceeded (ro) */ - -}; -#ifdef __FreeBSD__ - -#ifndef KERNEL -#include <sys/cdefs.h> - -__BEGIN_DECLS -extern int ntp_gettime __P((struct ntptimeval *)); -extern int ntp_adjtime __P((struct timex *)); -__END_DECLS - -#endif /* not KERNEL */ - -#endif /* __FreeBSD__ */ -#endif /* _SYS_TIMEX_H_ */ diff --git a/usr.sbin/xntpd/include/sys/tpro.h b/usr.sbin/xntpd/include/sys/tpro.h deleted file mode 100644 index f276f81..0000000 --- a/usr.sbin/xntpd/include/sys/tpro.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Structure for the KSI/Odetics TPRO-S data returned in reponse to a - * read() call. Note that these are driver-specific and not dependent on - * 32/64-bit architecture. - */ -struct tproval { - u_short day100; /* days * 100 */ - u_short day10; /* days * 10 */ - u_short day1; /* days * 1 */ - u_short hour10; /* hours * 10 */ - u_short hour1; /* hours * 1 */ - u_short min10; /* minutes * 10 */ - u_short min1; /* minutes * 1 */ - u_short sec10; /* seconds * 10 */ - u_short sec1; /* seconds * 1*/ - u_short ms100; /* milliseconds * 100 */ - u_short ms10; /* milliseconds * 10 */ - u_short ms1; /* milliseconds * 1 */ - u_short usec100; /* microseconds * 100 */ - u_short usec10; /* microseconds * 10 */ - u_short usec1; /* microseconds * 1 */ - long tv_sec; /* seconds */ - long tv_usec; /* microseconds */ - u_short status; /* status register */ -}; - -/* - * Status register bits - */ -#define TIMEAVAIL 0x0001 /* time available */ -#define NOSIGNAL 0x0002 /* insufficient IRIG-B signal */ -#define NOSYNC 0x0004 /* local oscillator not synchronized */ - -/* end of tpro.h */ |