diff options
Diffstat (limited to 'contrib/xntpd/include')
| -rw-r--r-- | contrib/xntpd/include/l_stdlib.h | 8 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp.h | 30 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_control.h | 1 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_if.h | 4 | ||||
| -rwxr-xr-x | contrib/xntpd/include/ntp_in.h | 259 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_io.h | 1 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_machine.h | 82 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_request.h | 95 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_stdlib.h | 1 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntp_timex.h | 265 | ||||
| -rw-r--r-- | contrib/xntpd/include/ntpd.h | 13 | ||||
| -rw-r--r-- | contrib/xntpd/include/parse.h | 78 |
12 files changed, 688 insertions, 149 deletions
diff --git a/contrib/xntpd/include/l_stdlib.h b/contrib/xntpd/include/l_stdlib.h index 89a8092853b5..e0b7c474095c 100644 --- a/contrib/xntpd/include/l_stdlib.h +++ b/contrib/xntpd/include/l_stdlib.h @@ -70,11 +70,11 @@ extern int getppid P((void)); extern int close P((int)); extern int ioctl P((int, int, char *)); -extern int read P((int, char *, unsigned)); +extern int read P((int, void *, unsigned)); extern int rename P((char *, char *)); -extern int write P((int, char *, int)); -extern int unlink P((char *)); -extern int link 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 *)); diff --git a/contrib/xntpd/include/ntp.h b/contrib/xntpd/include/ntp.h index 310353f1cda2..01bfa16a7ad8 100644 --- a/contrib/xntpd/include/ntp.h +++ b/contrib/xntpd/include/ntp.h @@ -173,6 +173,7 @@ struct interface { #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) @@ -222,7 +223,7 @@ struct peer { 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 unused; + 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 */ @@ -248,12 +249,6 @@ struct peer { s_fp soffset; /* fp version of above */ s_fp synch; /* synch distance from above */ u_fp selectdisp; /* select dispersion */ - - /* - * Stuff related to the experimental broadcast delay - * determination code. The registers will probably go away - * later. - */ U_LONG estbdelay; /* broadcast delay, as a ts fraction */ /* @@ -346,7 +341,7 @@ struct peer { */ #define REFCLK_NONE 0 /* unknown or missing */ #define REFCLK_LOCALCLOCK 1 /* external (e.g., ACTS) */ -#define REFCLK_WWV_HEATH 2 /* Heath GC-1000 WWV/H */ +#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 */ @@ -579,8 +574,8 @@ struct recvbuf { #define PROTO_AUTHENTICATE 3 #define PROTO_BROADDELAY 4 #define PROTO_AUTHDELAY 5 -#define PROTO_MAXSKEW 6 -#define PROTO_SELECT 7 +#define PROTO_MULTICAST_ADD 6 +#define PROTO_MULTICAST_DEL 7 /* * Configuration items for the loop filter @@ -603,7 +598,7 @@ struct recvbuf { */ #define DEFPRECISION (-5) /* conservatively low */ #define DEFBROADDELAY (0x020c49ba) /* 8 ms. This is round trip delay */ - +#define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 */ /* * Structure used optionally for monitoring when this is turned on. */ @@ -612,6 +607,9 @@ struct mon_data { struct mon_data *hash_prev; /* previous 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 */ @@ -621,7 +619,12 @@ struct mon_data { u_char version; /* version of incoming 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 */ @@ -645,10 +648,11 @@ struct restrictlist { #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_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) /* * Match flags diff --git a/contrib/xntpd/include/ntp_control.h b/contrib/xntpd/include/ntp_control.h index 74f75f17f51a..1e193835660d 100644 --- a/contrib/xntpd/include/ntp_control.h +++ b/contrib/xntpd/include/ntp_control.h @@ -68,6 +68,7 @@ struct ntp_control { #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 diff --git a/contrib/xntpd/include/ntp_if.h b/contrib/xntpd/include/ntp_if.h index 1a76ca02da4b..45a70c51bcd5 100644 --- a/contrib/xntpd/include/ntp_if.h +++ b/contrib/xntpd/include/ntp_if.h @@ -16,6 +16,10 @@ #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> diff --git a/contrib/xntpd/include/ntp_in.h b/contrib/xntpd/include/ntp_in.h new file mode 100755 index 000000000000..80aa45151fc6 --- /dev/null +++ b/contrib/xntpd/include/ntp_in.h @@ -0,0 +1,259 @@ +/* @(#)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/contrib/xntpd/include/ntp_io.h b/contrib/xntpd/include/ntp_io.h index c3b79be0616c..d60f08359b84 100644 --- a/contrib/xntpd/include/ntp_io.h +++ b/contrib/xntpd/include/ntp_io.h @@ -3,6 +3,7 @@ * SEEK_SET symbol form <untisd.h>. */ #if defined(NTP_POSIX_SOURCE) + /* * POSIX way */ diff --git a/contrib/xntpd/include/ntp_machine.h b/contrib/xntpd/include/ntp_machine.h index 1c3983e4a9ef..16c3fbf6da83 100644 --- a/contrib/xntpd/include/ntp_machine.h +++ b/contrib/xntpd/include/ntp_machine.h @@ -44,11 +44,16 @@ Signaled IO - Signled IO defines. 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 defined if you define STREAMS. + 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 - HAVE_TERMIOS - Use POSIX termios.h THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about kernel mucking. @@ -79,6 +84,7 @@ 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 @@ -274,7 +280,6 @@ in this file. #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/Ultrix" #endif -#define HAVE_TERMIOS #endif /* @@ -297,9 +302,9 @@ in this file. #define FORCE_NTPDATE_STEP #define RETSIGTYPE void #define HAVE_ATT_SETPGRP -#define HAVE_BSD_TTYS #define LOG_NTP LOG_LOCAL1 #define HAVE_SIGNALED_IO +#define NTP_NEED_BOPS #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/AUX" #endif @@ -309,6 +314,7 @@ in this file. * Next */ #if defined(SYS_NEXT) +#define RETSIGTYPE void #define DOSYNCTODR #define HAVE_READKMEM #define HAVE_BSD_NICE @@ -329,8 +335,12 @@ in this file. #define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) #define NO_SIGNED_CHAR_DECL #define LOCK_PROCESS -#define HAVE_NO_NICE /* HPUX uses rtprio instead */ #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 @@ -352,8 +362,6 @@ in this file. #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/BSDI" #endif -#define HAVE_BSD_TTYS -#define HAVE_TERMIOS #endif /* @@ -387,6 +395,13 @@ in this file. #define STR_SYSTEM "UNIX/*BSD" #endif #endif +#ifdef SYS_FREEBSD +#define HAVE_TERMIOS +#define HAVE_UNAME +#define HAVE_SYS_TIMEX_H +#define NTP_SYSCALLS_LIBC +#define KERNEL_PLL +#endif /* * DEC AXP OSF/1 @@ -441,9 +456,6 @@ in this file. */ #if defined(SYS_PTX) #define NO_SIGNED_CHAR_DECL -#ifndef HAVE_SYSV_TTYS -#define HAVE_SYSV_TTYS -#endif #define STREAMS_TLI #define HAVE_ATT_SETPGRP #define HAVE_SIGNALED_IO @@ -458,6 +470,7 @@ in this file. #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 !@! @@ -521,13 +534,46 @@ typedef unsigned long u_long; #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 HAVE_BSD_TTYS #define NTP_SYSCALLS_STD #define USE_PROTOTYPES #define UDP_WILDCARD_DELIVERY @@ -565,6 +611,20 @@ typedef unsigned long u_long; 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) diff --git a/contrib/xntpd/include/ntp_request.h b/contrib/xntpd/include/ntp_request.h index e94cb452aac7..b1a947291316 100644 --- a/contrib/xntpd/include/ntp_request.h +++ b/contrib/xntpd/include/ntp_request.h @@ -254,9 +254,8 @@ struct resp_pkt { #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_SET_MAXSKEW 38 /* set the maximum skew factor */ +#define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ #define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ -#define REQ_SET_SELECT_CODE 40 /* set selection algorithm */ #define REQ_SET_PRECISION 41 /* set clock precision */ @@ -267,8 +266,9 @@ struct resp_pkt { #define INFO_FLAG_SYSPEER 0x2 #define INFO_FLAG_MINPOLL 0x4 #define INFO_FLAG_REFCLOCK 0x8 +#define INFO_FLAG_MCLIENT 0x8 /* danger */ #define INFO_FLAG_BCLIENT 0x10 -#define INFO_FLAG_PREFER 0x10 /* SHARES BCLIENT bit - ok since mutually exclusive - Oh why ist flags a u_char ? */ +#define INFO_FLAG_PREFER 0x10 /* danger */ #define INFO_FLAG_AUTHENABLE 0x20 #define INFO_FLAG_SEL_CANDIDATE 0x40 #define INFO_FLAG_SHORTLIST 0x80 @@ -323,10 +323,10 @@ struct info_peer { u_char valid; /* peer.valid */ u_char reach; /* peer.reach */ u_char unreach; /* peer.unreach */ - u_char trust; /* peer.trust */ - u_char unused1; - u_char unused2; - u_char unused3; + 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 */ @@ -344,7 +344,14 @@ struct info_peer { s_fp delay; /* peer.estdelay */ u_fp dispersion; /* peer.estdisp */ l_fp offset; /* peer.estoffset */ - U_LONG bdelay[NTP_SHIFT]; /* broadcast delay filters */ + u_fp selectdisp; /* peer select dispersion */ + LONG unused1; /* (obsolete) */ + LONG unused2; + LONG unused3; + LONG unused4; + LONG unused5; + LONG unused6; + LONG unused7; U_LONG estbdelay; /* broadcast delay */ }; @@ -406,12 +413,13 @@ struct info_sys { U_LONG refid; /* reference ID of sync source */ l_fp reftime; /* system reference time */ U_LONG poll; /* system poll interval */ - u_short flags; /* system flags */ - u_char selection; /* selection algorithm code */ - u_char unused; - l_fp bdelay; /* default broadcast delay, a ts fraction */ + u_char flags; /* system flags */ + u_char unused1; /* unused */ + u_char unused2; /* unused */ + u_char unused3; /* unused */ + l_fp bdelay; /* default broadcast delay */ l_fp authdelay; /* default authentication delay */ - u_fp maxskew; /* maximum skew parameter (obsolete) */ + u_fp maxskew; /* (obsolete) */ }; @@ -428,6 +436,24 @@ struct info_sys_stats { 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; }; @@ -486,7 +512,8 @@ struct conf_peer { u_char minpoll; /* min host poll interval */ u_char maxpoll; /* max host poll interval */ u_char flags; /* flags for this request */ - u_char unused; + u_char ttl; /* time to live (multicast) */ + u_short unused; /* unused */ U_LONG keyid; /* key to use for this association */ }; @@ -516,6 +543,7 @@ struct conf_sys_flags { */ #define SYS_FLAG_BCLIENT 0x1 #define SYS_FLAG_AUTHENTICATE 0x2 +#define SYS_FLAG_MCLIENT 0x4 /* * Structure used for returning restrict entries @@ -546,6 +574,7 @@ struct conf_restrict { 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 */ @@ -553,6 +582,18 @@ struct info_monitor { 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 @@ -711,3 +752,29 @@ struct info_clkbug { 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/contrib/xntpd/include/ntp_stdlib.h b/contrib/xntpd/include/ntp_stdlib.h index 0ec062581616..f68c768d82d3 100644 --- a/contrib/xntpd/include/ntp_stdlib.h +++ b/contrib/xntpd/include/ntp_stdlib.h @@ -79,6 +79,7 @@ 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_LONG netof P((U_LONG)); extern char * numtoa P((U_LONG)); extern char * numtohost P((U_LONG)); extern int octtoint P((const char *, U_LONG *)); diff --git a/contrib/xntpd/include/ntp_timex.h b/contrib/xntpd/include/ntp_timex.h index 1756e2e07f21..cb8396ac23fe 100644 --- a/contrib/xntpd/include/ntp_timex.h +++ b/contrib/xntpd/include/ntp_timex.h @@ -1,6 +1,6 @@ /****************************************************************************** * * - * Copyright (c) David L. Mills 1993 * + * 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 * @@ -17,12 +17,18 @@ /* * 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 + * Adjusted parameters to improve stability and increase poll + * interval. * - * 10 Oct 93 Torsten Duwe - * Changed to ntp_timex.h (#ifdef'd HAVE_SYS_TIMEX_H) - * * 17 Sep 93 David L. Mills * Created file */ @@ -41,7 +47,7 @@ * int syscall(SYS_ntp_gettime, tptr) * * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure + * struct ntptimeval *tptr pointer to ntptimeval structure * * NAME * ntp_adjtime - NTP daemon application interface @@ -55,104 +61,213 @@ * struct timex *tptr pointer to timex structure * */ -#ifndef _NTP_TIMEX_H -#define _NTP_TIMEX_H +#ifndef MSDOS /* Microsoft specific */ +#include <sys/syscall.h> +#endif /* MSDOS */ /* - * Include system timex.h (if appropriate) + * 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. */ -#ifdef HAVE_SYS_TIMEX_H -#include <sys/timex.h> -#else /* provide definitions */ -#include <sys/syscall.h> - -extern int syscall P((int, void *, ...)); +#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) */ -#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) -#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) +/* + * 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 engineering parameters of the PLL - * model. The HZ variable 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. The SHIFT_HZ define expresses the same value as the - * nearest power of two in order to avoid hardware multiply operations. + * 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 SHIFT_HZ 7 /* log2(HZ) */ +#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 SHIFT_KG and SHIFT_KF defines establish the damping of the PLL - * and are chosen by analysis for a slightly underdamped convergence - * characteristic. The MAXTC define establishes the maximum time constant - * of the PLL. With the parameters given and the default time constant of - * zero, the PLL will converge in about 15 minutes. + * 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 SHIFT_KG 6 /* shift for phase increment */ -#define SHIFT_KF 16 /* shift for frequency increment */ -#define MAXTC 6 /* maximum time constant (shift) */ +#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 SHIFT_SCALE define establishes the decimal point of the time_phase - * variable which serves as a an extension to the low-order bits of the - * system clock variable. The SHIFT_UPDATE define establishes the decimal - * point of the time_offset variable which represents the current offset - * with respect to standard time. The SHIFT_USEC define represents 1 us in - * external units (shift), while the FINEUSEC define represents 1 us in - * internal units. + * The following defines and structures define the user interface for + * the ntp_gettime() and ntp_adjtime() system calls. + * + * Control mode codes (timex.modes) */ -#define SHIFT_SCALE 23 /* shift for phase scale factor */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* shift for offset scale factor */ -#define SHIFT_USEC 16 /* shift for 1 us in external units */ -#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in internal units */ +#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 */ /* - * Mode codes (timex.mode) + * Status codes (timex.status) */ -#define ADJ_OFFSET 0x0001 /* time offset */ -#define ADJ_FREQUENCY 0x0002 /* frequency offset */ -#define ADJ_MAXERROR 0x0004 /* maximum time error */ -#define ADJ_ESTERROR 0x0008 /* estimated time error */ -#define ADJ_STATUS 0x0010 /* clock status */ -#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#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 command/status codes (timex.status) + * Clock states (time_state) */ -#define TIME_OK 0 /* clock synchronized */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ +#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_BAD 4 /* clock not synchronized */ +#define TIME_WAIT 4 /* leap second has occured */ +#define TIME_ERROR 5 /* clock not synchronized */ /* - * NTP user interface - used to read kernel clock values + * 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 */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ + struct timeval time; /* current time (ro) */ + LONG maxerror; /* maximum error (us) (ro) */ + LONG esterror; /* estimated error (us) (ro) */ }; /* - * NTP daemon interface - used to discipline kernel clock oscillator + * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock + * oscillator */ struct timex { - int mode; /* mode selector */ - long offset; /* time offset (usec) */ - long frequency; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ - int status; /* clock command/status */ - long time_constant; /* pll time constant */ - long precision; /* clock precision (usec) (read only) */ - long tolerance; /* clock frequency tolerance (ppm) - * (read only) - */ -}; - -#endif /* HAVE_SYS_TIMEX_H */ - -#endif /* _NTP_TIMEX_H */ + 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/contrib/xntpd/include/ntpd.h b/contrib/xntpd/include/ntpd.h index f2c56af20b90..037e8cb366f4 100644 --- a/contrib/xntpd/include/ntpd.h +++ b/contrib/xntpd/include/ntpd.h @@ -63,6 +63,9 @@ 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 *, struct pkt *, int)); #ifdef HAVE_SIGNALED_IO extern void wait_for_signal P((void)); @@ -93,8 +96,8 @@ extern int pps_sample P((l_fp *)); /* ntp_monitor.c */ extern void init_mon P((void)); -extern void mon_start P((void)); -extern void mon_stop P((void)); +extern void mon_start P((int)); +extern void mon_stop P((int)); extern void monitor P((struct recvbuf *)); /* ntp_peer.c */ @@ -102,10 +105,10 @@ 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 *)); extern struct peer *findpeerbyassoc P((int)); -extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, U_LONG)); +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, U_LONG, int)); +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 *)); @@ -131,7 +134,7 @@ 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, LONG)); +extern void proto_config P((int, U_LONG)); extern void proto_clr_stats P((void)); #ifdef REFCLOCK diff --git a/contrib/xntpd/include/parse.h b/contrib/xntpd/include/parse.h index 31041afe292f..6ce3f192754a 100644 --- a/contrib/xntpd/include/parse.h +++ b/contrib/xntpd/include/parse.h @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp * - * parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp * * Copyright (c) 1989,1990,1991,1992,1993,1994 * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg @@ -15,7 +15,7 @@ #ifndef __PARSE_H__ #define __PARSE_H__ #if !(defined(lint) || defined(__GNUC__)) - static char parsehrcsid[]="parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp FAU"; + static char parsehrcsid[]="parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp"; #endif #include "ntp_types.h" @@ -81,35 +81,55 @@ extern int debug; /* * state flags */ -#define PARSEB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */ -#define PARSEB_POWERUP 0x0002 /* no synchronisation */ -#define PARSEB_NOSYNC 0x0004 /* timecode currently not confirmed */ -#define PARSEB_DST 0x0008 /* DST in effect */ -#define PARSEB_UTC 0x0010 /* UTC time */ -#define PARSEB_LEAP 0x0020 /* LEAP warning (1 hour prior to occurence) */ -#define PARSEB_ALTERNATE 0x0040 /* alternate antenna used */ -#define PARSEB_POSITION 0x0080 /* position available */ -#define PARSEB_LEAPSECOND 0x0100 /* actual leap second */ +#define PARSEB_POWERUP 0x00000001 /* no synchronisation */ +#define PARSEB_NOSYNC 0x00000002 /* timecode currently not confirmed */ -#define PARSEB_S_LEAP 0x0200 /* supports LEAP */ -#define PARSEB_S_ANTENNA 0x0400 /* supports antenna information */ -#define PARSEB_S_PPS 0x0800 /* supports PPS time stamping */ -#define PARSEB_S_POSITION 0x1000 /* supports position information (GPS) */ +/* + * 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 */ -#define PARSEB_TIMECODE 0x2000 /* valid time code sample */ -#define PARSEB_PPS 0x4000 /* valid PPS sample */ +/* + * 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_LEAP|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ + 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_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_LEAP(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP)) +#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)) @@ -118,9 +138,9 @@ extern int debug; #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_TIMECODE(x) ((x) & PARSEB_TIMECODE) #define PARSE_PPS(x) ((x) & PARSEB_PPS) -#define PARSE_POSITION(x) ((x) & PARSEB_POSITION) +#define PARSE_POSITION(x) ((x) & PARSEB_POSITION) /* * operation flags - some are also fudge flags @@ -281,6 +301,7 @@ struct clocktime /* clock time broken up from time code */ LONG second; LONG usecond; LONG utcoffset; /* in seconds */ + time_t utctime; /* the actual time - alternative to date/time */ LONG flags; /* current clock status */ }; @@ -365,6 +386,9 @@ extern unsigned LONG pps_simple P((parse_t *, int status, timestamp_t *)); * History: * * parse.h,v + * 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 * |
