source: trunk/third/xntp/include/ntp_request.h @ 10832

Revision 10832, 25.6 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 * ntp_request.h - definitions for the xntpd remote query facility
3 */
4
5#include "ntp_types.h"
6
7/*
8 * A mode 7 packet is used exchanging data between an NTP server
9 * and a client for purposes other than time synchronization, e.g.
10 * monitoring, statistics gathering and configuration.  A mode 7
11 * packet has the following format:
12 *
13 *    0                   1                   2                   3
14 *    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
15 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 *   |R|M| VN  | Mode|A|  Sequence   | Implementation|   Req Code    |
17 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 *   |  Err  | Number of data items  |  MBZ  |   Size of data item   |
19 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 *   |                                                               |
21 *   |            Data (Minimum 0 octets, maximum 500 octets)        |
22 *   |                                                               |
23 *                            [...]
24 *   |                                                               |
25 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26 *   |               Encryption Keyid (when A bit set)               |
27 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28 *   |                                                               |
29 *   |          Message Authentication Code (when A bit set)         |
30 *   |                                                               |
31 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 *
33 * where the fields are (note that the client sends requests, the server
34 * responses):
35 *
36 * Response Bit:  This packet is a response (if clear, packet is a request).
37 *
38 * More Bit:    Set for all packets but the last in a response which
39 *              requires more than one packet.
40 *
41 * Version Number: 2 for current version
42 *
43 * Mode:        Always 7
44 *
45 * Authenticated bit: If set, this packet is authenticated.
46 *
47 * Sequence number: For a multipacket response, contains the sequence
48 *              number of this packet.  0 is the first in the sequence,
49 *              127 (or less) is the last.  The More Bit must be set in
50 *              all packets but the last.
51 *
52 * Implementation number: The number of the implementation this request code
53 *              is defined by.  An implementation number of zero is used
54 *              for requst codes/data formats which all implementations
55 *              agree on.  Implementation number 255 is reserved (for
56 *              extensions, in case we run out).
57 *
58 * Request code: An implementation-specific code which specifies the
59 *              operation to be (which has been) performed and/or the
60 *              format and semantics of the data included in the packet.
61 *
62 * Err:         Must be 0 for a request.  For a response, holds an error
63 *              code relating to the request.  If nonzero, the operation
64 *              requested wasn't performed.
65 *
66 *              0 - no error
67 *              1 - incompatable implementation number
68 *              2 - unimplemented request code
69 *              3 - format error (wrong data items, data size, packet size etc.)
70 *              4 - no data available (e.g. request for details on unknown peer)
71 *              5-6 I don't know
72 *              7 - authentication failure (i.e. permission denied)
73 *
74 * Number of data items: number of data items in packet.  0 to 500
75 *
76 * MBZ:         A reserved data field, must be zero in requests and responses.
77 *
78 * Size of data item: size of each data item in packet.  0 to 500
79 *
80 * Data:        Variable sized area containing request/response data.  For
81 *              requests and responses the size in octets must be greater
82 *              than or equal to the product of the number of data items
83 *              and the size of a data item.  For requests the data area
84 *              must be exactly 40 octets in length.  For responses the
85 *              data area may be any length between 0 and 500 octets
86 *              inclusive.
87 *
88 * Message Authentication Code: Same as NTP spec, in definition and function.
89 *              May optionally be included in requests which require
90 *              authentication, is never included in responses.
91 *
92 * The version number, mode and keyid have the same function and are
93 * in the same location as a standard NTP packet.  The request packet
94 * is the same size as a standard NTP packet to ease receive buffer
95 * management, and to allow the same encryption procedure to be used
96 * both on mode 7 and standard NTP packets.  The mac is included when
97 * it is required that a request be authenticated, the keyid should be
98 * zero in requests in which the mac is not included.
99 *
100 * The data format depends on the implementation number/request code pair
101 * and whether the packet is a request or a response.  The only requirement
102 * is that data items start in the octet immediately following the size
103 * word and that data items be concatenated without padding between (i.e.
104 * if the data area is larger than data_items*size, all padding is at
105 * the end).  Padding is ignored, other than for encryption purposes.
106 * Implementations using encryption might want to include a time stamp
107 * or other data in the request packet padding.  The key used for requests
108 * is implementation defined, but key 15 is suggested as a default.
109 */
110
111/*
112 * A request packet.  These are almost a fixed length.
113 */
114struct req_pkt {
115        u_char rm_vn_mode;              /* response, more, version, mode */
116        u_char auth_seq;                /* key, sequence number */
117        u_char implementation;          /* implementation number */
118        u_char request;                 /* request number */
119        u_short err_nitems;             /* error code/number of data items */
120        u_short mbz_itemsize;           /* item size */
121        char data[32];                  /* data area */
122        l_fp tstamp;                    /* time stamp, for authentication */
123        u_int32 keyid;                  /* encryption key */
124        char mac[MAX_MAC_LEN-sizeof(u_int32)]; /* (optional) 8 byte auth code */
125};
126
127/*
128 * Input packet lengths.  One with the mac, one without.
129 */
130#define REQ_LEN_MAC     (sizeof(struct req_pkt))
131#define REQ_LEN_NOMAC   (sizeof(struct req_pkt) - MAX_MAC_LEN)
132
133/*
134 * A response packet.  The length here is variable, this is a
135 * maximally sized one.  Note that this implementation doesn't
136 * authenticate responses.
137 */
138#define RESP_HEADER_SIZE        (8)
139#define RESP_DATA_SIZE          (500)
140
141struct resp_pkt {
142        u_char rm_vn_mode;              /* response, more, version, mode */
143        u_char auth_seq;                /* key, sequence number */
144        u_char implementation;          /* implementation number */
145        u_char request;                 /* request number */
146        u_short err_nitems;             /* error code/number of data items */
147        u_short mbz_itemsize;           /* item size */
148        char data[RESP_DATA_SIZE];      /* data area */
149};
150
151
152/*
153 * Information error codes
154 */
155#define INFO_OKAY       0
156#define INFO_ERR_IMPL   1       /* incompatable implementation */
157#define INFO_ERR_REQ    2       /* unknown request code */
158#define INFO_ERR_FMT    3       /* format error */
159#define INFO_ERR_NODATA 4       /* no data for this request */
160#define INFO_ERR_AUTH   7       /* authentication failure */
161
162/*
163 * Maximum sequence number.
164 */
165#define MAXSEQ  127
166
167
168/*
169 * Bit setting macros for multifield items.
170 */
171#define RESP_BIT        0x80
172#define MORE_BIT        0x40
173
174#define ISRESPONSE(rm_vn_mode)  (((rm_vn_mode)&RESP_BIT)!=0)
175#define ISMORE(rm_vn_mode)      (((rm_vn_mode)&MORE_BIT)!=0)
176#define INFO_VERSION(rm_vn_mode) ((u_char)(((rm_vn_mode)>>3)&0x7))
177#define INFO_MODE(rm_vn_mode)   ((rm_vn_mode)&0x7)
178
179#define RM_VN_MODE(resp, more)  ((u_char)(((resp)?RESP_BIT:0)\
180                                |((more)?MORE_BIT:0)\
181                                |((NTP_VERSION)<<3)\
182                                |(MODE_PRIVATE)))
183
184#define INFO_IS_AUTH(auth_seq)  (((auth_seq) & 0x80) != 0)
185#define INFO_SEQ(auth_seq)      ((auth_seq)&0x7f)
186#define AUTH_SEQ(auth, seq)     ((u_char)((((auth)!=0)?0x80:0)|((seq)&0x7f)))
187
188#define INFO_ERR(err_nitems)    ((u_short)((ntohs(err_nitems)>>12)&0xf))
189#define INFO_NITEMS(err_nitems) ((u_short)(ntohs(err_nitems)&0xfff))
190#define ERR_NITEMS(err, nitems) (htons((u_short)((((u_short)(err)<<12)&0xf000)\
191                                |((u_short)(nitems)&0xfff))))
192
193#define INFO_MBZ(mbz_itemsize)  ((ntohs(mbz_itemsize)>>12)&0xf)
194#define INFO_ITEMSIZE(mbz_itemsize)     (ntohs(mbz_itemsize)&0xfff)
195#define MBZ_ITEMSIZE(itemsize)  (htons((u_short)(itemsize)))
196
197
198/*
199 * Implementation numbers.  One for universal use and one for xntpd.
200 */
201#define IMPL_UNIV       0
202#define IMPL_XNTPD      2
203
204/*
205 * Some limits related to authentication.  Frames which are
206 * authenticated must include a time stamp which differs from
207 * the receive time stamp by no more than 10 seconds.
208 */
209#define INFO_TS_MAXSKEW_UI      10
210
211/*
212 * Universal request codes go here.  There aren't any.
213 */
214
215/*
216 * XNTPD request codes go here.
217 */
218#define REQ_PEER_LIST           0       /* return list of peers */
219#define REQ_PEER_LIST_SUM       1       /* return summary info for all peers */
220#define REQ_PEER_INFO           2       /* get standard information on peer */
221#define REQ_PEER_STATS          3       /* get statistics for peer */
222#define REQ_SYS_INFO            4       /* get system information */
223#define REQ_SYS_STATS           5       /* get system stats */
224#define REQ_IO_STATS            6       /* get I/O stats */
225#define REQ_MEM_STATS           7       /* stats related to peer list maint */
226#define REQ_LOOP_INFO           8       /* info from the loop filter */
227#define REQ_TIMER_STATS         9       /* get timer stats */
228#define REQ_CONFIG              10      /* configure a new peer */
229#define REQ_UNCONFIG            11      /* unconfigure an existing peer */
230#define REQ_SET_SYS_FLAG        12      /* set system flags */
231#define REQ_CLR_SYS_FLAG        13      /* clear system flags */
232#define REQ_MONITOR             14      /* (not used) */
233#define REQ_NOMONITOR           15      /* (not used) */
234#define REQ_GET_RESTRICT        16      /* return restrict list */
235#define REQ_RESADDFLAGS         17      /* add flags to restrict list */
236#define REQ_RESSUBFLAGS         18      /* remove flags from restrict list */
237#define REQ_UNRESTRICT          19      /* remove entry from restrict list */
238#define REQ_MON_GETLIST         20      /* return data collected by monitor */
239#define REQ_RESET_STATS         21      /* reset stat counters */
240#define REQ_RESET_PEER          22      /* reset peer stat counters */
241#define REQ_REREAD_KEYS         23      /* reread the encryption key file */
242#define REQ_DO_DIRTY_HACK       24      /* (not used) */
243#define REQ_DONT_DIRTY_HACK     25      /* (not used) */
244#define REQ_TRUSTKEY            26      /* add a trusted key */
245#define REQ_UNTRUSTKEY          27      /* remove a trusted key */
246#define REQ_AUTHINFO            28      /* return authentication info */
247#define REQ_TRAPS               29      /* return currently set traps */
248#define REQ_ADD_TRAP            30      /* add a trap */
249#define REQ_CLR_TRAP            31      /* clear a trap */
250#define REQ_REQUEST_KEY         32      /* define a new request keyid */
251#define REQ_CONTROL_KEY         33      /* define a new control keyid */
252#define REQ_GET_CTLSTATS        34      /* get stats from the control module */
253#define REQ_GET_LEAPINFO        35      /* get leap information */
254#define REQ_GET_CLOCKINFO       36      /* get clock information */
255#define REQ_SET_CLKFUDGE        37      /* set clock fudge factors */
256#define REQ_GET_KERNEL          38      /* get kernel pll/pps information */
257#define REQ_GET_CLKBUGINFO      39      /* get clock debugging info */
258#define REQ_SET_PRECISION       41      /* (not used) */
259#define REQ_MON_GETLIST_1       42      /* return data collected by monitor v1 */
260
261/*
262 * Flags in the peer information returns
263 */
264#define INFO_FLAG_CONFIG        0x1
265#define INFO_FLAG_SYSPEER       0x2
266#define INFO_FLAG_UNUSED        0x4
267#define INFO_FLAG_REFCLOCK      0x8
268#define INFO_FLAG_PREFER        0x10
269#define INFO_FLAG_AUTHENABLE    0x20
270#define INFO_FLAG_SEL_CANDIDATE 0x40
271#define INFO_FLAG_SHORTLIST     0x80
272
273/*
274 * Flags in the system information returns
275 */
276#define INFO_FLAG_BCLIENT       0x1
277#define INFO_FLAG_AUTHENTICATE  0x2
278#define INFO_FLAG_PLL           0x4
279#define INFO_FLAG_PPS           0x8
280#define INFO_FLAG_PLL_SYNC      0x10
281#define INFO_FLAG_PPS_SYNC      0x20
282#define INFO_FLAG_MONITOR       0x40
283#define INFO_FLAG_FILEGEN       0x80
284
285/*
286 * Peer list structure.  Used to return raw lists of peers.  It goes
287 * without saying that everything returned is in network byte order.
288 */
289struct info_peer_list {
290        u_int32 address;        /* address of peer */
291        u_short port;           /* port number of peer */
292        u_char hmode;           /* mode for this peer */
293        u_char flags;           /* flags (from above) */
294};
295
296
297/*
298 * Peer summary structure.  Sort of the info that ntpdc returns by default.
299 */
300struct info_peer_summary {
301        u_int32 dstadr;         /* local address (zero for undetermined) */
302        u_int32 srcadr;         /* source address */
303        u_short srcport;        /* source port */
304        u_char stratum;         /* stratum of peer */
305        s_char hpoll;           /* host polling interval */
306        s_char ppoll;           /* peer polling interval */
307        u_char reach;           /* reachability register */
308        u_char flags;           /* flags, from above */
309        u_char hmode;           /* peer mode */
310        s_fp delay;             /* peer.estdelay */
311        l_fp offset;            /* peer.estoffset */
312        u_fp dispersion;        /* peer.estdisp */
313};
314
315
316/*
317 * Peer information structure.
318 */
319struct info_peer {
320        u_int32 dstadr;         /* local address */
321        u_int32 srcadr;         /* remote address */
322        u_short srcport;        /* remote port */
323        u_char flags;           /* peer flags */
324        u_char leap;            /* peer.leap */
325        u_char hmode;           /* peer.hmode */
326        u_char pmode;           /* peer.pmode */
327        u_char stratum;         /* peer.stratum */
328        u_char ppoll;           /* peer.ppoll */
329        u_char hpoll;           /* peer.hpoll */
330        s_char precision;       /* peer.precision */
331        u_char version;         /* peer.version */
332        u_char valid;           /* peer.valid */
333        u_char reach;           /* peer.reach */
334        u_char unreach;         /* peer.unreach */
335        u_char flash;           /* peer.flash */
336        u_char ttl;             /* peer.ttl */
337        u_char unused8;         /* (obsolete) */
338        u_char unused9;
339        u_short associd;        /* association ID */
340        u_int32 keyid;          /* auth key in use */
341        u_int32 pkeyid;         /* peer.pkeyid */
342        u_int32 refid;          /* peer.refid */
343        u_int32 timer;          /* peer.timer */
344        s_fp rootdelay;         /* peer.distance */
345        u_fp rootdispersion;    /* peer.dispersion */
346        l_fp reftime;           /* peer.reftime */
347        l_fp org;               /* peer.org */
348        l_fp rec;               /* peer.rec */
349        l_fp xmt;               /* peer.xmt */
350        s_fp filtdelay[NTP_SHIFT];      /* delay shift register */
351        l_fp filtoffset[NTP_SHIFT];     /* offset shift register */
352        u_char order[NTP_SHIFT];        /* order of peers from last filter */
353        s_fp delay;             /* peer.estdelay */
354        u_fp dispersion;        /* peer.estdisp */
355        l_fp offset;            /* peer.estoffset */
356        u_fp selectdisp;        /* peer select dispersion */
357        int32 unused1;          /* (obsolete) */
358        int32 unused2;
359        int32 unused3;
360        int32 unused4;
361        int32 unused5;
362        int32 unused6;
363        int32 unused7;
364        s_fp estbdelay;         /* broadcast offset */
365};
366
367
368/*
369 * Peer statistics structure
370 */
371struct info_peer_stats {
372        u_int32 dstadr;         /* local address */
373        u_int32 srcadr;         /* remote address */
374        u_short srcport;        /* remote port */
375        u_short flags;          /* peer flags */
376        u_int32 timereset;      /* time counters were reset */
377        u_int32 timereceived;   /* time since a packet received */
378        u_int32 timetosend;     /* time until a packet sent */
379        u_int32 timereachable;  /* time peer has been reachable */
380        u_int32 sent;           /* number sent */
381        u_int32 unused1;        /* (unused) */
382        u_int32 processed;      /* number processed */
383        u_int32 unused2;        /* (unused) */
384        u_int32 badauth;        /* bad authentication */
385        u_int32 bogusorg;       /* bogus origin */
386        u_int32 oldpkt;         /* duplicate */
387        u_int32 unused3;        /* (unused) */
388        u_int32 unused4;        /* (unused) */
389        u_int32 seldisp;        /* bad dispersion */
390        u_int32 selbroken;      /* bad reference time */
391        u_int32 unused5;        /* (unused) */
392        u_char candidate;       /* select order */
393        u_char unused6;         /* (unused) */
394        u_char unused7;         /* (unused) */
395        u_char unused8;         /* (unused) */
396};
397
398
399/*
400 * Loop filter variables
401 */
402struct info_loop {
403        l_fp last_offset;
404        l_fp drift_comp;
405        u_int32 compliance;
406        u_int32 watchdog_timer;
407};
408
409
410/*
411 * System info.  Mostly the sys.* variables, plus a few unique to
412 * the implementation.
413 */
414struct info_sys {
415        u_int32 peer;           /* system peer address */
416        u_char peer_mode;       /* mode we are syncing to peer in */
417        u_char leap;            /* system leap bits */
418        u_char stratum;         /* our stratum */
419        s_char precision;       /* local clock precision */
420        s_fp rootdelay;         /* distance from sync source */
421        u_fp rootdispersion;    /* dispersion from sync source */
422        u_int32 refid;          /* reference ID of sync source */
423        l_fp reftime;           /* system reference time */
424        u_int32 poll;           /* system poll interval */
425        u_char flags;           /* system flags */
426        u_char unused1;         /* unused */
427        u_char unused2;         /* unused */
428        u_char unused3;         /* unused */
429        s_fp bdelay;            /* default broadcast offset */
430        s_fp frequency;         /* frequency residual (scaled ppm)  */
431        l_fp authdelay;         /* default authentication delay */
432        u_fp stability;         /* clock stability (scaled ppm) */
433};
434
435
436/*
437 * System stats.  These are collected in the protocol module
438 */
439struct info_sys_stats {
440        u_int32 timeup;         /* time we have been up and running */
441        u_int32 timereset;      /* time since these were last cleared */
442        u_int32 badstratum;     /* packets claiming an invalid stratum */
443        u_int32 oldversionpkt;  /* old version packets received */
444        u_int32 newversionpkt;  /* new version packets received */
445        u_int32 unknownversion; /* don't know version packets */
446        u_int32 badlength;      /* packets with bad length */
447        u_int32 processed;      /* packets processed */
448        u_int32 badauth;                /* packets dropped because of authorization */
449        u_int32 wanderhold;     /* (obsolete) */
450        u_int32 limitrejected;  /* rejected because of client limitation */
451};
452
453
454/*
455 * System stats - old version
456 */
457struct old_info_sys_stats {
458        u_int32 timeup;         /* time we have been up and running */
459        u_int32 timereset;      /* time since these were last cleared */
460        u_int32 badstratum;     /* packets claiming an invalid stratum */
461        u_int32 oldversionpkt;  /* old version packets received */
462        u_int32 newversionpkt;  /* new version packets received */
463        u_int32 unknownversion; /* don't know version packets */
464        u_int32 badlength;      /* packets with bad length */
465        u_int32 processed;      /* packets processed */
466        u_int32 badauth;                /* packets dropped because of authorization */
467        u_int32 wanderhold;
468};
469
470
471/*
472 * Peer memory statistics.  Collected in the peer module.
473 */
474struct info_mem_stats {
475        u_int32 timereset;      /* time since reset */
476        u_short totalpeermem;
477        u_short freepeermem;
478        u_int32 findpeer_calls;
479        u_int32 allocations;
480        u_int32 demobilizations;
481        u_char hashcount[HASH_SIZE];
482};
483
484
485/*
486 * I/O statistics.  Collected in the I/O module
487 */
488struct info_io_stats {
489        u_int32 timereset;      /* time since reset */
490        u_short totalrecvbufs;  /* total receive bufs */
491        u_short freerecvbufs;   /* free buffers */
492        u_short fullrecvbufs;   /* full buffers */
493        u_short lowwater;       /* number of times we've added buffers */
494        u_int32 dropped;        /* dropped packets */
495        u_int32 ignored;        /* ignored packets */
496        u_int32 received;       /* received packets */
497        u_int32 sent;           /* packets sent */
498        u_int32 notsent;        /* packets not sent */
499        u_int32 interrupts;     /* interrupts we've handled */
500        u_int32 int_received;   /* received by interrupt handler */
501};
502
503
504/*
505 * Timer stats.  Guess where from.
506 */
507struct info_timer_stats {
508        u_int32 timereset;      /* time since reset */
509        u_int32 alarms;         /* alarms we've handled */
510        u_int32 overflows;      /* timer overflows */
511        u_int32 xmtcalls;       /* calls to xmit */
512};
513
514
515/*
516 * Structure for passing peer configuration information
517 */
518struct conf_peer {
519        u_int32 peeraddr;       /* address to poll */
520        u_char hmode;           /* mode, either broadcast, active or client */
521        u_char version;         /* version number to poll with */
522        u_char minpoll;         /* min host poll interval */
523        u_char maxpoll;         /* max host poll interval */
524        u_char flags;           /* flags for this request */
525        u_char ttl;             /* time to live (multicast) or refclock mode */
526        u_short unused;         /* unused */
527        u_int32 keyid;          /* key to use for this association */
528};
529
530#define CONF_FLAG_AUTHENABLE    0x1
531#define CONF_FLAG_PREFER        0x2
532
533/*
534 * Structure for passing peer deletion information.  Currently
535 * we only pass the address and delete all configured peers with
536 * this addess.
537 */
538struct conf_unpeer {
539        u_int32 peeraddr;       /* address of peer */
540};
541
542/*
543 * Structure for carrying system flags.
544 */
545struct conf_sys_flags {
546        u_int32 flags;
547};
548
549/*
550 * System flags we can set/clear
551 */
552#define SYS_FLAG_BCLIENT        0x1
553#define SYS_FLAG_AUTHENTICATE   0x2
554#define SYS_FLAG_PLL            0x4
555#define SYS_FLAG_PPS            0x8
556#define SYS_FLAG_MONITOR        0x10
557#define SYS_FLAG_FILEGEN        0x20
558
559/*
560 * Structure used for returning restrict entries
561 */
562struct info_restrict {
563        u_int32 addr;           /* match address */
564        u_int32 mask;           /* match mask */
565        u_int32 count;          /* number of packets matched */
566        u_short flags;          /* restrict flags */
567        u_short mflags;         /* match flags */
568};
569
570
571/*
572 * Structure used for specifying restrict entries
573 */
574struct conf_restrict {
575        u_int32 addr;           /* match address */
576        u_int32 mask;           /* match mask */
577        u_short flags;          /* restrict flags */
578        u_short mflags;         /* match flags */
579};
580
581
582/*
583 * Structure used for returning monitor data
584 */
585struct info_monitor_1 {
586        u_int32 lasttime;       /* last packet from this host */
587        u_int32 firsttime;      /* first time we received a packet */
588        u_int32 lastdrop;        /* last time we rejected a packet due to client limitation policy */
589        u_int32 count;          /* count of packets received */
590        u_int32 addr;           /* host address */
591        u_int32 daddr;          /* destination host address */
592        u_int32 flags;          /* flags about destination */
593        u_short port;           /* port number of last reception */
594        u_char mode;            /* mode of last packet */
595        u_char version;         /* version number of last packet */
596};
597
598
599/*
600 * Structure used for returning monitor data
601 */
602struct info_monitor {   
603        u_int32 lasttime;       /* last packet from this host */
604        u_int32 firsttime;      /* first time we received a packet */
605        u_int32 lastdrop;       /* last time we rejected a packet due to client limitation policy */
606        u_int32 count;          /* count of packets received */
607        u_int32 addr;           /* host address */
608        u_short port;           /* port number of last reception */
609        u_char mode;            /* mode of last packet */
610        u_char version;         /* version number of last packet */
611};
612
613/*
614 * Structure used for returning monitor data (old format
615 */
616struct old_info_monitor {       
617        u_int32 lasttime;       /* last packet from this host */
618        u_int32 firsttime;      /* first time we received a packet */
619        u_int32 count;          /* count of packets received */
620        u_int32 addr;           /* host address */
621        u_short port;           /* port number of last reception */
622        u_char mode;            /* mode of last packet */
623        u_char version;         /* version number of last packet */
624};
625
626/*
627 * Structure used for passing indication of flags to clear
628 */
629struct reset_flags {
630        u_int32 flags;
631};
632
633#define RESET_FLAG_ALLPEERS     0x01
634#define RESET_FLAG_IO           0x02
635#define RESET_FLAG_SYS          0x04
636#define RESET_FLAG_MEM          0x08
637#define RESET_FLAG_TIMER        0x10
638#define RESET_FLAG_AUTH         0x20
639#define RESET_FLAG_CTL          0x40
640
641#define RESET_ALLFLAGS \
642        (RESET_FLAG_ALLPEERS|RESET_FLAG_IO|RESET_FLAG_SYS \
643        |RESET_FLAG_MEM|RESET_FLAG_TIMER|RESET_FLAG_AUTH|RESET_FLAG_CTL)
644
645/*
646 * Structure used to return information concerning the authentication
647 * module.
648 */
649struct info_auth {
650        u_int32 timereset;      /* time counters were reset */
651        u_int32 numkeys;        /* number of keys we know */
652        u_int32 numfreekeys;    /* number of free keys */
653        u_int32 keylookups;     /* calls to authhavekey() */
654        u_int32 keynotfound;    /* requested key unknown */
655        u_int32 encryptions;    /* number of encryptions */
656        u_int32 decryptions;    /* number of decryptions */
657        u_int32 unused;         /* (unused) */
658        u_int32 keyuncached;    /* calls to encrypt/decrypt with uncached key */
659};
660
661
662/*
663 * Structure used to pass trap information to the client
664 */
665struct info_trap {
666        u_int32 local_address;  /* local interface address */
667        u_int32 trap_address;   /* remote client's address */
668        u_short trap_port;      /* remote port number */
669        u_short sequence;       /* sequence number */
670        u_int32 settime;        /* time trap last set */
671        u_int32 origtime;       /* time trap originally set */
672        u_int32 resets;         /* number of resets on this trap */
673        u_int32 flags;          /* trap flags, as defined in ntp_control.h */
674};
675
676/*
677 * Structure used to pass add/clear trap information to the client
678 */
679struct conf_trap {
680        u_int32 local_address;  /* local interface address */
681        u_int32 trap_address;   /* remote client's address */
682        u_short trap_port;      /* remote client's port */
683        u_short unused;         /* (unused) */
684};
685
686
687/*
688 * Structure used to return statistics from the control module
689 */
690struct info_control {
691        u_int32 ctltimereset;
692        u_int32 numctlreq;      /* number of requests we've received */
693        u_int32 numctlbadpkts;  /* number of bad control packets */
694        u_int32 numctlresponses;        /* # resp packets sent */
695        u_int32 numctlfrags;    /* # of fragments sent */
696        u_int32 numctlerrors;   /* number of error responses sent */
697        u_int32 numctltooshort; /* number of too short input packets */
698        u_int32 numctlinputresp;        /* number of responses on input */
699        u_int32 numctlinputfrag;        /* number of fragments on input */
700        u_int32 numctlinputerr; /* # input pkts with err bit set */
701        u_int32 numctlbadoffset;        /* # input pkts with nonzero offset */
702        u_int32 numctlbadversion;       /* # input pkts with unknown version */
703        u_int32 numctldatatooshort;     /* data too short for count */
704        u_int32 numctlbadop;    /* bad op code found in packet */
705        u_int32 numasyncmsgs;           /* # async messages we've sent */
706};
707
708
709/*
710 * Structure used to return leap information.
711 */
712struct info_leap {
713        u_char sys_leap;        /* current sys_leap */
714        u_char leap_indicator;  /* current leap indicator */
715        u_char leap_warning;    /* current leap warning */
716        u_char leap_bits;       /* leap flags */
717        u_int32 leap_timer;     /* seconds to next interrupt */
718        u_int32 leap_processcalls;      /* calls to the leap process */
719        u_int32 leap_notclose;  /* found leap was not close */
720        u_int32 leap_monthofleap;       /* in month of leap */
721        u_int32 leap_dayofleap; /* in day of leap */
722        u_int32 leap_hoursfromleap;     /* leap within two hours */
723        u_int32 leap_happened;  /* leap second happened */
724};
725
726#define INFO_LEAP_MASK          0x3     /* flag for leap_bits */
727#define INFO_LEAP_SEENSTRATUM1  0x4     /* server has seen stratum 1 */
728#define INFO_LEAP_OVERRIDE      0x8     /* server will override the leap information */
729
730/*
731 * Structure used to return clock information
732 */
733struct info_clock {
734        u_int32 clockadr;
735        u_char type;
736        u_char flags;
737        u_char lastevent;
738        u_char currentstatus;
739        u_int32 polls;
740        u_int32 noresponse;
741        u_int32 badformat;
742        u_int32 baddata;
743        u_int32 timestarted;
744        l_fp fudgetime1;
745        l_fp fudgetime2;
746        int32 fudgeval1;
747        int32 fudgeval2;
748};
749
750
751/*
752 * Structure used for setting clock fudge factors
753 */
754struct conf_fudge {
755        u_int32 clockadr;
756        u_int32 which;
757        l_fp fudgetime;
758        int32 fudgeval_flags;
759};
760
761#define FUDGE_TIME1     1
762#define FUDGE_TIME2     2
763#define FUDGE_VAL1      3
764#define FUDGE_VAL2      4
765#define FUDGE_FLAGS     5
766
767
768/*
769 * Structure used for returning clock debugging info
770 */
771#define NUMCBUGVALUES   16
772#define NUMCBUGTIMES    32
773
774struct info_clkbug {
775        u_int32 clockadr;
776        u_char nvalues;
777        u_char ntimes;
778        u_short svalues;
779        u_int32 stimes;
780        u_int32 values[NUMCBUGVALUES];
781        l_fp times[NUMCBUGTIMES];
782};
783
784/*
785 * Structure used for returning kernel pll/PPS information
786 */
787struct info_kernel {
788        int32 offset;
789        int32 freq;
790        int32 maxerror;
791        int32 esterror;
792        u_short status;
793        u_short shift;
794        int32 constant;
795        int32 precision;
796        int32 tolerance;
797
798/*
799 * Variables used only if PPS signal discipline is implemented
800 */
801        int32 ppsfreq;
802        int32 jitter;
803        int32 stabil;
804        int32 jitcnt;
805        int32 calcnt;
806        int32 errcnt;
807        int32 stbcnt;
808};
Note: See TracBrowser for help on using the repository browser.