PR/3774: Torsten Duwe: Add missing clocks to xntp; fix some bugs in xntp2netbsd
This commit is contained in:
parent
085df7da2f
commit
228c411fb5
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.1.1.1 1997/04/18 13:29:03 christos Exp $
|
||||
SUBDIR= ntpdate ntpq ntptrace xntpd xntpdc
|
||||
# $NetBSD: Makefile,v 1.2 1997/06/23 17:34:15 christos Exp $
|
||||
SUBDIR= ntpdate ntpq ntptime ntptrace xntpd xntpdc
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# $NetBSD: Makefile.inc,v 1.3 1997/04/21 03:07:28 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.4 1997/06/23 17:34:18 christos Exp $
|
||||
CFLAGS += -I${.CURDIR}/../include -DHAVE_CONFIG_H
|
||||
LDADD += -lntp
|
||||
DPADD += ${LIBNTP}
|
||||
BINDIR=/usr/sbin
|
||||
BINDIR = /usr/sbin
|
||||
|
@ -82,31 +82,31 @@
|
||||
/* #undef BANC */
|
||||
|
||||
/* ELV/DCF7000 clock */
|
||||
/* #undef CLOCK_DCF7000 */
|
||||
#define CLOCK_DCF7000
|
||||
|
||||
/* HOPF 6021 clock */
|
||||
/* #undef CLOCK_HOPF6021 */
|
||||
#define CLOCK_HOPF6021
|
||||
|
||||
/* Meinberg clocks */
|
||||
/* #undef CLOCK_MEINBERG */
|
||||
#define CLOCK_MEINBERG
|
||||
|
||||
/* DCF77 raw time code */
|
||||
/* #undef CLOCK_RAWDCF */
|
||||
#define CLOCK_RAWDCF
|
||||
|
||||
/* RCC 8000 clock */
|
||||
/* #undef CLOCK_RCC8000 */
|
||||
#define CLOCK_RCC8000
|
||||
|
||||
/* Schmid DCF77 clock */
|
||||
/* #undef CLOCK_SCHMID */
|
||||
#define CLOCK_SCHMID
|
||||
|
||||
/* Trimble GPS receiver/TAIP protocol */
|
||||
/* #undef CLOCK_TRIMTAIP */
|
||||
#define CLOCK_TRIMTAIP
|
||||
|
||||
/* Trimble GPS receiver/TSIP protocol */
|
||||
/* #undef CLOCK_TRIMTSIP */
|
||||
#define CLOCK_TRIMTSIP
|
||||
|
||||
/* Diems Computime Radio Clock */
|
||||
/* #undef CLOCK_COMPUTIME */
|
||||
#define CLOCK_COMPUTIME
|
||||
|
||||
/* Datum Programmable Time System */
|
||||
#define DATUM 1
|
||||
@ -133,13 +133,13 @@
|
||||
#define MSFEES 1
|
||||
|
||||
/* Magnavox MX4200 GPS receiver */
|
||||
/* #undef MX4200 */
|
||||
#define MX4200
|
||||
|
||||
/* NMEA GPS receiver */
|
||||
#define NMEA 1
|
||||
|
||||
/* PARSE driver interface */
|
||||
/* #undef PARSE */
|
||||
#define PARSE
|
||||
|
||||
/* PARSE kernel PLL PPS support */
|
||||
/* #undef PPS_SYNC */
|
||||
@ -187,7 +187,7 @@
|
||||
/* #undef NEED_HPUX_FINDCONFIG */
|
||||
|
||||
/* canonical system (cpu-vendor-os) string */
|
||||
#define STR_SYSTEM "i386-unknown-netbsd1.2D"
|
||||
#define STR_SYSTEM "i386-unknown-netbsd1.3"
|
||||
|
||||
/* define if [gs]ettimeofday() only takes 1 argument */
|
||||
/* #undef SYSV_TIMEOFDAY */
|
||||
@ -232,7 +232,7 @@
|
||||
/* #undef UDP_BACKWARDS_SETOWN */
|
||||
|
||||
/* must we have a CTTY for fsetown? */
|
||||
/* #undef USE_FSETOWNCTTY */
|
||||
#define USE_FSETOWNCTTY
|
||||
|
||||
/* can we use SIGIO for tcp and udp IO? */
|
||||
#define HAVE_SIGNALED_IO 1
|
||||
|
466
usr.sbin/xntp/include/parse.h
Normal file
466
usr.sbin/xntp/include/parse.h
Normal file
@ -0,0 +1,466 @@
|
||||
/*
|
||||
* /src/NTP/REPOSITORY/v4/include/parse.h,v 3.31 1996/12/01 16:02:46 kardel Exp
|
||||
*
|
||||
* parse.h,v 3.31 1996/12/01 16:02:46 kardel Exp
|
||||
*
|
||||
* Copyright (C) 1989,1990,1991,1992,1993,1994,1995,1996 by Frank Kardel
|
||||
* Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
|
||||
*
|
||||
* 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.31 1996/12/01 16:02:46 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>
|
||||
#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 availability
|
||||
*/
|
||||
#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_STATISTICS 0x08 /* enable statistics */
|
||||
#define PARSE_LEAP_DELETE 0x04 /* delete leap - overides 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 usec error */
|
||||
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_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 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 */
|
||||
|
||||
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 int, timestamp_t *));
|
||||
extern int parse_iopps P((parse_t *, int, timestamp_t *));
|
||||
extern void parse_iodone P((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.31 1996/12/01 16:02:46 kardel
|
||||
* freeze for 5.86.12.2 PARSE-Patch
|
||||
*
|
||||
* Revision 3.30 1996/11/24 20:09:17 kardel
|
||||
* RELEASE_5_86_12_2 reconcilation
|
||||
*
|
||||
* Revision 3.29 1996/10/05 13:30:13 kardel
|
||||
* general update
|
||||
*
|
||||
* Revision 3.28 1996/06/01 16:49:59 kardel
|
||||
* changed flag value for statistics preparation
|
||||
*
|
||||
* Revision 3.27 1995/10/15 23:46:05 duwe
|
||||
* look for ntp_syslog.h in the right place
|
||||
*
|
||||
* Revision 3.26 1995/07/02 20:01:00 kardel
|
||||
* keep ANSI happy...
|
||||
*
|
||||
* Revision 3.25 1995/06/18 12:14:56 kardel
|
||||
* removed dispersion calulation from parse subsystem
|
||||
*
|
||||
* Revision 3.24 1995/04/09 20:53:39 kardel
|
||||
* 3.4n reconcilation
|
||||
*
|
||||
* Revision 3.23 1994/10/03 22:13:04 kardel
|
||||
* typoe...
|
||||
*
|
||||
* Revision 3.22 1994/10/03 10:03:19 kardel
|
||||
* 3.4e reconcilation
|
||||
*
|
||||
* Revision 3.21 1994/05/30 20:58:34 kardel
|
||||
* fix prototypes
|
||||
*
|
||||
* Revision 3.20 1994/05/30 10:19:44 kardel
|
||||
* int32 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...
|
||||
*
|
||||
*/
|
54
usr.sbin/xntp/include/parse_conf.h
Normal file
54
usr.sbin/xntp/include/parse_conf.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* /src/NTP/REPOSITORY/v4/include/parse_conf.h,v 3.8 1996/12/01 16:02:47 kardel Exp
|
||||
*
|
||||
* parse_conf.h,v 3.8 1996/12/01 16:02:47 kardel Exp
|
||||
*
|
||||
* Copyright (c) 1993,1994,1995,1996 by Frank Kardel
|
||||
* Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
|
||||
*
|
||||
* 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.8 1996/12/01 16:02:47 kardel Exp";
|
||||
#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
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.1.1.1 1997/04/18 13:29:07 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1997/06/23 17:34:31 christos Exp $
|
||||
|
||||
PROG= ntpdate
|
||||
SRCS= ntpdate.c ntpdate.h
|
||||
SRCS= ntpdate.h ntpdate.c
|
||||
MAN+= ntpdate.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ntpdate.8,v 1.4 1997/05/29 07:47:05 mikel Exp $
|
||||
.\" $NetBSD: ntpdate.8,v 1.5 1997/06/23 17:34:33 christos Exp $
|
||||
.\" Converted from HTML to mandoc by Christos Zoulas <christos@netbsd.org>
|
||||
.\"
|
||||
.Dd April 17, 1997
|
||||
@ -91,7 +91,8 @@ The following options are available:
|
||||
.It Fl a Ar key
|
||||
Enable the authentication function and specify the key identifier to
|
||||
be used for authentication as the argument
|
||||
.Ar key .
|
||||
.Ar key
|
||||
.Nm
|
||||
The keys and key identifiers must match
|
||||
in both the client and server key files. The default is to disable the
|
||||
authentication function.
|
||||
@ -160,13 +161,13 @@ scripts.
|
||||
.It Fl t Ar timeout
|
||||
Specify the maximum time waiting for a server response as the value
|
||||
.Ar timeout ,
|
||||
in seconds and fraction. The value is rounded to a
|
||||
in seconds and fraction. The value is is rounded to a
|
||||
multiple of 0.2 seconds. The default is 1 second, a value suitable for
|
||||
polling across a LAN.
|
||||
.It Fl u
|
||||
Direct
|
||||
.Nm
|
||||
to use an unprivileged port for outgoing
|
||||
to use an unprivileged port or outgoing
|
||||
packets. This is most useful when behind a firewall that blocks incoming
|
||||
traffic to privileged ports, and you want to synchronise with hosts
|
||||
beyond the firewall. Note that the
|
||||
@ -181,8 +182,7 @@ identification string to be logged.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/ntp.keys -compact
|
||||
.It Pa /etc/ntp.keys
|
||||
default authentication key file.
|
||||
.It Pa /etc/gettytab
|
||||
.El
|
||||
.Sh BUGS
|
||||
The slew adjustment is actually 50% larger than the measured offset,
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.1.1.1 1997/04/18 13:29:08 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1997/06/23 17:34:35 christos Exp $
|
||||
|
||||
PROG= ntpq
|
||||
SRCS= ntpq.c ntpq.h ntpq_ops.c
|
||||
SRCS= ntpq_ops.c ntpq.h ntpq.c
|
||||
MAN+= ntpq.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.1.1.1 1997/04/18 13:29:08 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1997/06/23 17:34:38 christos Exp $
|
||||
|
||||
PROG= ntptrace
|
||||
SRCS= ntptrace.c ntptrace.h
|
||||
SRCS= ntptrace.h ntptrace.c
|
||||
MAN+= ntptrace.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/local/bin/perl
|
||||
#
|
||||
# $NetBSD: xntp2netbsd,v 1.6 1997/04/21 03:07:30 christos Exp $
|
||||
# $NetBSD: xntp2netbsd,v 1.7 1997/06/23 17:34:20 christos Exp $
|
||||
#
|
||||
# Perl script to convert a standard distribution directory for xntp into
|
||||
# a NetBSD source tree.
|
||||
@ -24,14 +24,16 @@ $version = "3-5.90";
|
||||
|
||||
@subdirs = ("lib/libntp", "domestic/lib/libntp",
|
||||
"usr.sbin/xntp/include", "usr.sbin/xntp/ntpdate",
|
||||
"usr.sbin/xntp/ntpq", "usr.sbin/xntp/ntptrace",
|
||||
"usr.sbin/xntp/xntpd", "usr.sbin/xntp/xntpdc");
|
||||
"usr.sbin/xntp/ntptime", "usr.sbin/xntp/ntpq",
|
||||
"usr.sbin/xntp/ntptrace", "usr.sbin/xntp/xntpd",
|
||||
"usr.sbin/xntp/xntpdc");
|
||||
|
||||
@includef = ("l_stdlib.h", "ntp.h", "ntp_calendar.h", "ntp_control.h",
|
||||
"ntp_filegen.h", "ntp_fp.h", "ntp_if.h", "ntp_io.h",
|
||||
"ntp_machine.h", "ntp_malloc.h", "ntp_refclock.h", "ntp_request.h",
|
||||
"ntp_select.h", "ntp_stdlib.h", "ntp_string.h", "ntp_syslog.h",
|
||||
"ntp_types.h", "ntp_unixtime.h", "ntpd.h");
|
||||
"ntp_types.h", "ntp_unixtime.h", "ntpd.h",
|
||||
"parse.h", "parse_conf.h");
|
||||
|
||||
@libntpf = ("a_md512crypt.c", "a_md5decrypt.c", "a_md5encrypt.c",
|
||||
"adjtime.c", "atoint.c", "atolfp.c", "atouint.c", "auth12crypt.c",
|
||||
@ -62,10 +64,17 @@ $version = "3-5.90";
|
||||
"refclock_ptbacts.c", "refclock_tpro.c", "refclock_trak.c",
|
||||
"refclock_true.c", "refclock_usno.c", "refclock_wwvb.c");
|
||||
|
||||
@xntpd_pf = ("parse.c", "parse_conf.c", "clk_computime.c",
|
||||
"clk_dcf7000.c", "clk_hopf6021.c", "clk_meinberg.c",
|
||||
"clk_rawdcf.c", "clk_rcc8000.c", "clk_schmid.c",
|
||||
"clk_trimtaip.c", "clk_trimtsip.c");
|
||||
|
||||
@xntpdcf = ("ntpdc.c", "ntpdc.h", "ntpdc_ops.c");
|
||||
|
||||
@ntpdatef = ("ntpdate.c", "ntpdate.h");
|
||||
|
||||
@ntptimef = ("ntptime.c");
|
||||
|
||||
@ntpqf = ("ntpq.c", "ntpq.h", "ntpq_ops.c");
|
||||
|
||||
@ntptracef = ("ntptrace.c", "ntptrace.h");
|
||||
@ -109,9 +118,9 @@ sub dumpsrcs {
|
||||
|
||||
print ODATA "SRCS=\t";
|
||||
$count = 0;
|
||||
foreach $f (@names) {
|
||||
while ($f = pop(@names)) {
|
||||
print ODATA "$f ";
|
||||
if ($count == 5) {
|
||||
if ($count == 5 && @names > 0) {
|
||||
print ODATA "\\\n";
|
||||
$count = 0;
|
||||
} else {
|
||||
@ -158,6 +167,7 @@ print "Populating the usr.sbin/xntp/include directory.\n";
|
||||
|
||||
print "Populating the usr.sbin/xntp/xntpd directory.\n";
|
||||
©files ("$srcdir/xntpd", "$targetdir/usr.sbin/xntp/xntpd", @xntpdf);
|
||||
©files ("$srcdir/libparse", "$targetdir/usr.sbin/xntp/xntpd", @xntpd_pf);
|
||||
|
||||
print "Populating the usr.sbin/xntp/xntpdc directory.\n";
|
||||
©files ("$srcdir/xntpdc", "$targetdir/usr.sbin/xntp/xntpdc", @xntpdcf);
|
||||
@ -165,6 +175,9 @@ print "Populating the usr.sbin/xntp/xntpdc directory.\n";
|
||||
print "Populating the usr.sbin/xntp/ntpdate directory.\n";
|
||||
©files ("$srcdir/ntpdate", "$targetdir/usr.sbin/xntp/ntpdate", @ntpdatef);
|
||||
|
||||
print "Populating the usr.sbin/xntp/ntptime directory.\n";
|
||||
©files ("$srcdir/util", "$targetdir/usr.sbin/xntp/ntptime", @ntptimef);
|
||||
|
||||
print "Populating the usr.sbin/xntp/ntpq directory.\n";
|
||||
©files ("$srcdir/ntpq", "$targetdir/usr.sbin/xntp/ntpq", @ntpqf);
|
||||
|
||||
@ -188,20 +201,22 @@ while ($line = <DATA>) {
|
||||
$first = "";
|
||||
}
|
||||
open (ODATA, ">$targetdir/$cmd[2]") ||
|
||||
die "Could now create $targetdir/$cmd[2]";
|
||||
die "Could not create $targetdir/$cmd[2]";
|
||||
} elsif ($cmd[1] eq "srcs") {
|
||||
print " Defining SRCS for $cmd[2]\n";
|
||||
if ($first) {
|
||||
die "Data file must start with a %% file!";
|
||||
}
|
||||
if ($cmd[2] eq "xntpd") {
|
||||
&dumpsrcs (@xntpdf);
|
||||
&dumpsrcs (@xntpdf, @xntpd_pf);
|
||||
} elsif ($cmd[2] eq "xntpdc") {
|
||||
&dumpsrcs (@xntpdcf);
|
||||
} elsif ($cmd[2] eq "ntpq") {
|
||||
&dumpsrcs (@ntpqf);
|
||||
} elsif ($cmd[2] eq "ntpdate") {
|
||||
&dumpsrcs (@ntpdatef);
|
||||
} elsif ($cmd[2] eq "ntptime") {
|
||||
&dumpsrcs (@ntptimef);
|
||||
} elsif ($cmd[2] eq "ntptrace") {
|
||||
&dumpsrcs (@ntptracef);
|
||||
} elsif ($cmd[2] eq "libntp") {
|
||||
@ -243,7 +258,7 @@ foreach $n (keys(%sedlist)) {
|
||||
__END__
|
||||
%% file usr.sbin/xntp/Makefile
|
||||
%% NetBSD #
|
||||
SUBDIR= ntpdate ntpq ntptrace xntpd xntpdc
|
||||
SUBDIR= ntpdate ntpq ntptime ntptrace xntpd xntpdc
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
%% file usr.sbin/xntp/Makefile.inc
|
||||
@ -291,6 +306,14 @@ PROG= ntptrace
|
||||
%% srcs ntptrace
|
||||
MAN+= ntptrace.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
%% file usr.sbin/xntp/ntptime/Makefile
|
||||
%% NetBSD #
|
||||
|
||||
PROG= ntptime
|
||||
%% srcs ntptime
|
||||
MAN+= ntptime.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
%% file lib/libntp/Makefile
|
||||
%% NetBSD #
|
||||
@ -409,31 +432,31 @@ char * Version = "5.90 3-NetBSD Thu Apr 17 17:15:47 EDT 1997 (1)";
|
||||
/* #undef BANC */
|
||||
|
||||
/* ELV/DCF7000 clock */
|
||||
/* #undef CLOCK_DCF7000 */
|
||||
#define CLOCK_DCF7000
|
||||
|
||||
/* HOPF 6021 clock */
|
||||
/* #undef CLOCK_HOPF6021 */
|
||||
#define CLOCK_HOPF6021
|
||||
|
||||
/* Meinberg clocks */
|
||||
/* #undef CLOCK_MEINBERG */
|
||||
#define CLOCK_MEINBERG
|
||||
|
||||
/* DCF77 raw time code */
|
||||
/* #undef CLOCK_RAWDCF */
|
||||
#define CLOCK_RAWDCF
|
||||
|
||||
/* RCC 8000 clock */
|
||||
/* #undef CLOCK_RCC8000 */
|
||||
#define CLOCK_RCC8000
|
||||
|
||||
/* Schmid DCF77 clock */
|
||||
/* #undef CLOCK_SCHMID */
|
||||
#define CLOCK_SCHMID
|
||||
|
||||
/* Trimble GPS receiver/TAIP protocol */
|
||||
/* #undef CLOCK_TRIMTAIP */
|
||||
#define CLOCK_TRIMTAIP
|
||||
|
||||
/* Trimble GPS receiver/TSIP protocol */
|
||||
/* #undef CLOCK_TRIMTSIP */
|
||||
#define CLOCK_TRIMTSIP
|
||||
|
||||
/* Diems Computime Radio Clock */
|
||||
/* #undef CLOCK_COMPUTIME */
|
||||
#define CLOCK_COMPUTIME
|
||||
|
||||
/* Datum Programmable Time System */
|
||||
#define DATUM 1
|
||||
@ -460,13 +483,13 @@ char * Version = "5.90 3-NetBSD Thu Apr 17 17:15:47 EDT 1997 (1)";
|
||||
#define MSFEES 1
|
||||
|
||||
/* Magnavox MX4200 GPS receiver */
|
||||
/* #undef MX4200 */
|
||||
#define MX4200
|
||||
|
||||
/* NMEA GPS receiver */
|
||||
#define NMEA 1
|
||||
|
||||
/* PARSE driver interface */
|
||||
/* #undef PARSE */
|
||||
#define PARSE
|
||||
|
||||
/* PARSE kernel PLL PPS support */
|
||||
/* #undef PPS_SYNC */
|
||||
@ -514,7 +537,7 @@ char * Version = "5.90 3-NetBSD Thu Apr 17 17:15:47 EDT 1997 (1)";
|
||||
/* #undef NEED_HPUX_FINDCONFIG */
|
||||
|
||||
/* canonical system (cpu-vendor-os) string */
|
||||
#define STR_SYSTEM "i386-unknown-netbsd1.2D"
|
||||
#define STR_SYSTEM "i386-unknown-netbsd1.3"
|
||||
|
||||
/* define if [gs]ettimeofday() only takes 1 argument */
|
||||
/* #undef SYSV_TIMEOFDAY */
|
||||
@ -559,7 +582,7 @@ char * Version = "5.90 3-NetBSD Thu Apr 17 17:15:47 EDT 1997 (1)";
|
||||
/* #undef UDP_BACKWARDS_SETOWN */
|
||||
|
||||
/* must we have a CTTY for fsetown? */
|
||||
/* #undef USE_FSETOWNCTTY */
|
||||
#define USE_FSETOWNCTTY
|
||||
|
||||
/* can we use SIGIO for tcp and udp IO? */
|
||||
#define HAVE_SIGNALED_IO 1
|
||||
@ -961,6 +984,9 @@ char * Version = "5.90 3-NetBSD Thu Apr 17 17:15:47 EDT 1997 (1)";
|
||||
/* Define if you have the kvm library (-lkvm). */
|
||||
#define HAVE_LIBKVM 1
|
||||
|
||||
/* Define if you have sysctl() to get the clockrate */
|
||||
#define HAVE_SYSCTL_CLOCKRATE 1
|
||||
|
||||
/* Define if you have the ld library (-lld). */
|
||||
/* #undef HAVE_LIBLD */
|
||||
|
||||
@ -1172,6 +1198,61 @@ and
|
||||
.Xr tickadj 9 .
|
||||
.Sh AUTHOR
|
||||
David L. Mills (mills@udel.edu)
|
||||
%% file usr.sbin/xntp/ntptime/ntptime.8
|
||||
%% NetBSD .\"
|
||||
.\" Converted from HTML to mandoc by Christos Zoulas
|
||||
.Dd June 23, 1997
|
||||
.Dt NTPTIME 8
|
||||
.Os NetBSD
|
||||
.Sh NAME
|
||||
.Nm ntptime
|
||||
.Nd read kernel time variables
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl cdhr
|
||||
.Op Fl e Ar est_error
|
||||
.Op Fl f Ar frequency
|
||||
.Op Fl m Ar max_error
|
||||
.Op Fl o Ar offset
|
||||
.Op Fl s Ar status
|
||||
.Op Fl t Ar time_constant
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
reads and displays time-related kernel variables using the
|
||||
.Ar ntp_gettime
|
||||
system call. A similar display can be
|
||||
obtained using the
|
||||
.Xr xntpdc 8
|
||||
program.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl c
|
||||
Display the execution time of
|
||||
.Nm
|
||||
itself.
|
||||
.It Fl d
|
||||
Turn on debugging.
|
||||
.It Fl e Ar est_error
|
||||
Specify estimated error, in microseconds.
|
||||
.It Fl f Ar frequency
|
||||
Specify frequency offset, in parts per million.
|
||||
.It Fl h
|
||||
Display help information.
|
||||
.It Fl m Ar max_error
|
||||
Specify maximum error, in microseconds.
|
||||
.It Fl o Ar offset
|
||||
Specify clock offset, in microseconds.
|
||||
.It Fl r
|
||||
Display Unix and NTP times in raw format.
|
||||
.It Fl s Ar status
|
||||
Specify clock status. Better know what you are doing.
|
||||
.It Fl t Ar time_constant
|
||||
Specify time constant, an integer in the range 0-4.
|
||||
.El
|
||||
.Pp
|
||||
.Sh AUTHOR
|
||||
David L. Mills (mills@udel.edu)
|
||||
%% file usr.sbin/xntp/ntpq/ntpq.8
|
||||
%% NetBSD .\"
|
||||
.\" Converted from HTML to mandoc by Christos Zoulas <christos@netbsd.org>
|
||||
@ -1773,7 +1854,7 @@ page. The
|
||||
.Pa Notes on Configuring NTP and Setting up a NTP Subnet
|
||||
page contains
|
||||
an extended discussion of these options.
|
||||
.\" XXX fuck
|
||||
.\" XXX
|
||||
.\" <p><a href="confopt.html"> Configuration Options </a>
|
||||
.\" <br><a href="authopt.html"> Authentication Options </a>
|
||||
.\" <br><a href="monopt.html"> Monitoring Options </a>
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.1.1.1 1997/04/18 13:29:14 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1997/06/23 17:34:40 christos Exp $
|
||||
|
||||
PROG= xntpdc
|
||||
SRCS= ntpdc.c ntpdc.h ntpdc_ops.c
|
||||
SRCS= ntpdc_ops.c ntpdc.h ntpdc.c
|
||||
MAN+= xntpdc.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
Loading…
x
Reference in New Issue
Block a user