source: trunk/third/xntp/ntpdate/ntpdate.h @ 10832

Revision 10832, 3.1 KB checked in by brlewis, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10831, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * ntpdate.h - declarations for the ntpdate program
3 */
4
5#include "ntp_malloc.h"
6
7/*
8 * The server structure is a much simplified version of the
9 * peer structure, for ntpdate's use.  Since we always send
10 * in client mode and expect to receive in server mode, this
11 * leaves only a very limited number of things we need to
12 * remember about the server.
13 */
14struct server {
15        struct sockaddr_in srcadr;      /* address of remote host */
16        u_char leap;                    /* leap indicator */
17        u_char stratum;                 /* stratum of remote server */
18        s_char precision;               /* server's clock precision */
19        u_char trust;                   /* trustability of the filtered data */
20        u_fp rootdelay;                 /* distance from primary clock */
21        u_fp rootdispersion;            /* peer clock dispersion */
22        u_int32 refid;                  /* peer reference ID */
23        l_fp reftime;                   /* time of peer's last update */
24        u_long event_time;              /* time for next timeout */
25        u_short xmtcnt;                 /* number of packets transmitted */
26        u_short filter_nextpt;          /* index into filter shift register */
27        s_fp filter_delay[NTP_SHIFT];   /* delay part of shift register */
28        l_fp filter_offset[NTP_SHIFT];  /* offset part of shift register */
29        s_fp filter_soffset[NTP_SHIFT]; /* offset in s_fp format, for disp */
30        u_fp filter_error[NTP_SHIFT];   /* error part of shift register */
31        l_fp org;                       /* peer's originate time stamp */
32        l_fp xmt;                       /* transmit time stamp */
33        u_fp delay;                     /* filter estimated delay */
34        u_fp dispersion;                /* filter estimated dispersion */
35        l_fp offset;                    /* filter estimated clock offset */
36        s_fp soffset;                   /* fp version of above */
37};
38
39
40/*
41 * ntpdate runs everything on a simple, short timeout.  It sends a
42 * packet and sets the timeout (by default, to a small value suitable
43 * for a LAN).  If it receives a response it sends another request.
44 * If it times out it shifts zeroes into the filter and sends another
45 * request.
46 *
47 * The timer routine is run often (once every 1/5 second currently)
48 * so that time outs are done with reasonable precision.
49 */
50#define TIMER_HZ        (5)             /* 5 per second */
51
52/*
53 * ntpdate will make a long adjustment using adjtime() if the times
54 * are close, or step the time if the times are farther apart.  The
55 * following defines what is "close".
56 */
57#define NTPDATE_THRESHOLD       (FP_SECOND >> 1)        /* 1/2 second */
58
59/*
60 * When doing adjustments, ntpdate actually overadjusts (currently
61 * by 50%, though this may change).  While this will make it take longer
62 * to reach a steady state condition, it will typically result in
63 * the clock keeping more accurate time, on average.  The amount of
64 * overshoot is limited.
65 */
66#ifdef  NOTNOW
67#define ADJ_OVERSHOOT   1/2     /* this is hard coded */
68#endif  /* NOTNOW */
69#define ADJ_MAXOVERSHOOT        0x10000000      /* 50 ms as a ts fraction */
70
71/*
72 * Since ntpdate isn't aware of some of the things that normally get
73 * put in an NTP packet, we fix some values.
74 */
75#define NTPDATE_PRECISION       (-6)            /* use this precision */
76#define NTPDATE_DISTANCE        FP_SECOND       /* distance is 1 sec */
77#define NTPDATE_DISP            FP_SECOND       /* so is the dispersion */
78#define NTPDATE_REFID           (0)             /* reference ID to use */
79
80
81/*
82 * Some defaults
83 */
84#define DEFTIMEOUT      5               /* 5 timer increments */
85#define DEFSAMPLES      4               /* get 4 samples per server */
Note: See TracBrowser for help on using the repository browser.