154359Sroberto/* 254359Sroberto * ntp_request.h - definitions for the ntpd remote query facility 354359Sroberto */ 454359Sroberto 5290001Sglebius#ifndef NTP_REQUEST_H 6290001Sglebius#define NTP_REQUEST_H 7132451Sroberto 8290001Sglebius#include "stddef.h" 954359Sroberto#include "ntp_types.h" 10290001Sglebius#include "recvbuff.h" 1154359Sroberto 1254359Sroberto/* 1354359Sroberto * A mode 7 packet is used exchanging data between an NTP server 1454359Sroberto * and a client for purposes other than time synchronization, e.g. 1554359Sroberto * monitoring, statistics gathering and configuration. A mode 7 1654359Sroberto * packet has the following format: 1754359Sroberto * 1854359Sroberto * 0 1 2 3 1954359Sroberto * 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 2054359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2154359Sroberto * |R|M| VN | Mode|A| Sequence | Implementation| Req Code | 2254359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2354359Sroberto * | Err | Number of data items | MBZ | Size of data item | 2454359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2554359Sroberto * | | 2654359Sroberto * | Data (Minimum 0 octets, maximum 500 octets) | 2754359Sroberto * | | 2854359Sroberto * [...] 2954359Sroberto * | | 3054359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 3154359Sroberto * | Encryption Keyid (when A bit set) | 3254359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 3354359Sroberto * | | 3454359Sroberto * | Message Authentication Code (when A bit set) | 3554359Sroberto * | | 3654359Sroberto * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 3754359Sroberto * 3854359Sroberto * where the fields are (note that the client sends requests, the server 3954359Sroberto * responses): 4054359Sroberto * 4154359Sroberto * Response Bit: This packet is a response (if clear, packet is a request). 4254359Sroberto * 4354359Sroberto * More Bit: Set for all packets but the last in a response which 4454359Sroberto * requires more than one packet. 4554359Sroberto * 4654359Sroberto * Version Number: 2 for current version 4754359Sroberto * 4854359Sroberto * Mode: Always 7 4954359Sroberto * 5054359Sroberto * Authenticated bit: If set, this packet is authenticated. 5154359Sroberto * 5254359Sroberto * Sequence number: For a multipacket response, contains the sequence 5354359Sroberto * number of this packet. 0 is the first in the sequence, 5454359Sroberto * 127 (or less) is the last. The More Bit must be set in 5554359Sroberto * all packets but the last. 5654359Sroberto * 5754359Sroberto * Implementation number: The number of the implementation this request code 5854359Sroberto * is defined by. An implementation number of zero is used 5954359Sroberto * for requst codes/data formats which all implementations 6054359Sroberto * agree on. Implementation number 255 is reserved (for 6154359Sroberto * extensions, in case we run out). 6254359Sroberto * 6354359Sroberto * Request code: An implementation-specific code which specifies the 6454359Sroberto * operation to be (which has been) performed and/or the 6554359Sroberto * format and semantics of the data included in the packet. 6654359Sroberto * 6754359Sroberto * Err: Must be 0 for a request. For a response, holds an error 6854359Sroberto * code relating to the request. If nonzero, the operation 6954359Sroberto * requested wasn't performed. 7054359Sroberto * 7154359Sroberto * 0 - no error 72290001Sglebius * 1 - incompatible implementation number 7354359Sroberto * 2 - unimplemented request code 7454359Sroberto * 3 - format error (wrong data items, data size, packet size etc.) 7554359Sroberto * 4 - no data available (e.g. request for details on unknown peer) 7654359Sroberto * 5-6 I don't know 7754359Sroberto * 7 - authentication failure (i.e. permission denied) 7854359Sroberto * 7954359Sroberto * Number of data items: number of data items in packet. 0 to 500 8054359Sroberto * 8154359Sroberto * MBZ: A reserved data field, must be zero in requests and responses. 8254359Sroberto * 8354359Sroberto * Size of data item: size of each data item in packet. 0 to 500 8454359Sroberto * 8554359Sroberto * Data: Variable sized area containing request/response data. For 8654359Sroberto * requests and responses the size in octets must be greater 8754359Sroberto * than or equal to the product of the number of data items 8854359Sroberto * and the size of a data item. For requests the data area 8954359Sroberto * must be exactly 40 octets in length. For responses the 9054359Sroberto * data area may be any length between 0 and 500 octets 9154359Sroberto * inclusive. 9254359Sroberto * 9354359Sroberto * Message Authentication Code: Same as NTP spec, in definition and function. 9454359Sroberto * May optionally be included in requests which require 9554359Sroberto * authentication, is never included in responses. 9654359Sroberto * 9754359Sroberto * The version number, mode and keyid have the same function and are 9854359Sroberto * in the same location as a standard NTP packet. The request packet 9954359Sroberto * is the same size as a standard NTP packet to ease receive buffer 10054359Sroberto * management, and to allow the same encryption procedure to be used 10154359Sroberto * both on mode 7 and standard NTP packets. The mac is included when 10254359Sroberto * it is required that a request be authenticated, the keyid should be 10354359Sroberto * zero in requests in which the mac is not included. 10454359Sroberto * 10554359Sroberto * The data format depends on the implementation number/request code pair 10654359Sroberto * and whether the packet is a request or a response. The only requirement 10754359Sroberto * is that data items start in the octet immediately following the size 10854359Sroberto * word and that data items be concatenated without padding between (i.e. 10954359Sroberto * if the data area is larger than data_items*size, all padding is at 11054359Sroberto * the end). Padding is ignored, other than for encryption purposes. 11154359Sroberto * Implementations using encryption might want to include a time stamp 11254359Sroberto * or other data in the request packet padding. The key used for requests 11354359Sroberto * is implementation defined, but key 15 is suggested as a default. 11454359Sroberto */ 11554359Sroberto 11654359Sroberto/* 117182007Sroberto * union of raw addresses to save space 118182007Sroberto */ 119290001Sglebiusunion addrun { 120182007Sroberto struct in6_addr addr6; 121182007Sroberto struct in_addr addr; 122182007Sroberto}; 123182007Sroberto 124290001Sglebius#define MODE7_PAYLOAD_LIM 176 125290001Sglebius 126290001Sglebiustypedef union req_data_u_tag { 127290001Sglebius u_int32 u32[MODE7_PAYLOAD_LIM / sizeof(u_int32)]; 128290001Sglebius char data[MODE7_PAYLOAD_LIM]; /* data area (176 byte max) */ 129290001Sglebius} req_data_u; /* struct conf_peer must fit */ 130290001Sglebius 131182007Sroberto/* 13254359Sroberto * A request packet. These are almost a fixed length. 13354359Sroberto */ 13454359Srobertostruct req_pkt { 13554359Sroberto u_char rm_vn_mode; /* response, more, version, mode */ 13654359Sroberto u_char auth_seq; /* key, sequence number */ 13754359Sroberto u_char implementation; /* implementation number */ 13854359Sroberto u_char request; /* request number */ 13954359Sroberto u_short err_nitems; /* error code/number of data items */ 14054359Sroberto u_short mbz_itemsize; /* item size */ 141290001Sglebius req_data_u u; /* data area */ 14254359Sroberto l_fp tstamp; /* time stamp, for authentication */ 143290001Sglebius keyid_t keyid; /* (optional) encryption key */ 144290001Sglebius char mac[MAX_MAC_LEN-sizeof(keyid_t)]; /* (optional) auth code */ 14554359Sroberto}; 14654359Sroberto 14754359Sroberto/* 148106163Sroberto * The req_pkt_tail structure is used by ntpd to adjust for different 149106163Sroberto * packet sizes that may arrive. 150106163Sroberto */ 151106163Srobertostruct req_pkt_tail { 152106163Sroberto l_fp tstamp; /* time stamp, for authentication */ 153290001Sglebius keyid_t keyid; /* (optional) encryption key */ 154290001Sglebius char mac[MAX_MAC_LEN-sizeof(keyid_t)]; /* (optional) auth code */ 155106163Sroberto}; 156106163Sroberto 157290001Sglebius/* MODE_PRIVATE request packet header length before optional items. */ 158290001Sglebius#define REQ_LEN_HDR (offsetof(struct req_pkt, u)) 159290001Sglebius/* MODE_PRIVATE request packet fixed length without MAC. */ 160290001Sglebius#define REQ_LEN_NOMAC (offsetof(struct req_pkt, keyid)) 161290001Sglebius/* MODE_PRIVATE req_pkt_tail minimum size (16 octet digest) */ 162290001Sglebius#define REQ_TAIL_MIN \ 163290001Sglebius (sizeof(struct req_pkt_tail) - (MAX_MAC_LEN - MAX_MD5_LEN)) 16454359Sroberto 16554359Sroberto/* 166290001Sglebius * A MODE_PRIVATE response packet. The length here is variable, this 167290001Sglebius * is a maximally sized one. Note that this implementation doesn't 16854359Sroberto * authenticate responses. 16954359Sroberto */ 170290001Sglebius#define RESP_HEADER_SIZE (offsetof(struct resp_pkt, u)) 171290001Sglebius#define RESP_DATA_SIZE 500 17254359Sroberto 173290001Sglebiustypedef union resp_pkt_u_tag { 174290001Sglebius char data[RESP_DATA_SIZE]; 175290001Sglebius u_int32 u32[RESP_DATA_SIZE / sizeof(u_int32)]; 176290001Sglebius} resp_pkt_u; 177290001Sglebius 17854359Srobertostruct resp_pkt { 17954359Sroberto u_char rm_vn_mode; /* response, more, version, mode */ 18054359Sroberto u_char auth_seq; /* key, sequence number */ 18154359Sroberto u_char implementation; /* implementation number */ 18254359Sroberto u_char request; /* request number */ 18354359Sroberto u_short err_nitems; /* error code/number of data items */ 18454359Sroberto u_short mbz_itemsize; /* item size */ 185290001Sglebius resp_pkt_u u; /* data area */ 18654359Sroberto}; 18754359Sroberto 18854359Sroberto 18954359Sroberto/* 19054359Sroberto * Information error codes 19154359Sroberto */ 19254359Sroberto#define INFO_OKAY 0 193290001Sglebius#define INFO_ERR_IMPL 1 /* incompatible implementation */ 19454359Sroberto#define INFO_ERR_REQ 2 /* unknown request code */ 19554359Sroberto#define INFO_ERR_FMT 3 /* format error */ 19654359Sroberto#define INFO_ERR_NODATA 4 /* no data for this request */ 19754359Sroberto#define INFO_ERR_AUTH 7 /* authentication failure */ 198290001Sglebius#define MAX_INFO_ERR INFO_ERR_AUTH 19954359Sroberto 20054359Sroberto/* 20154359Sroberto * Maximum sequence number. 20254359Sroberto */ 20354359Sroberto#define MAXSEQ 127 20454359Sroberto 20554359Sroberto 20654359Sroberto/* 20754359Sroberto * Bit setting macros for multifield items. 20854359Sroberto */ 20954359Sroberto#define RESP_BIT 0x80 21054359Sroberto#define MORE_BIT 0x40 21154359Sroberto 21254359Sroberto#define ISRESPONSE(rm_vn_mode) (((rm_vn_mode)&RESP_BIT)!=0) 21354359Sroberto#define ISMORE(rm_vn_mode) (((rm_vn_mode)&MORE_BIT)!=0) 21454359Sroberto#define INFO_VERSION(rm_vn_mode) ((u_char)(((rm_vn_mode)>>3)&0x7)) 21554359Sroberto#define INFO_MODE(rm_vn_mode) ((rm_vn_mode)&0x7) 21654359Sroberto 21754359Sroberto#define RM_VN_MODE(resp, more, version) \ 21854359Sroberto ((u_char)(((resp)?RESP_BIT:0)\ 21954359Sroberto |((more)?MORE_BIT:0)\ 22054359Sroberto |((version?version:(NTP_OLDVERSION+1))<<3)\ 22154359Sroberto |(MODE_PRIVATE))) 22254359Sroberto 22354359Sroberto#define INFO_IS_AUTH(auth_seq) (((auth_seq) & 0x80) != 0) 22454359Sroberto#define INFO_SEQ(auth_seq) ((auth_seq)&0x7f) 22554359Sroberto#define AUTH_SEQ(auth, seq) ((u_char)((((auth)!=0)?0x80:0)|((seq)&0x7f))) 22654359Sroberto 22754359Sroberto#define INFO_ERR(err_nitems) ((u_short)((ntohs(err_nitems)>>12)&0xf)) 22854359Sroberto#define INFO_NITEMS(err_nitems) ((u_short)(ntohs(err_nitems)&0xfff)) 22954359Sroberto#define ERR_NITEMS(err, nitems) (htons((u_short)((((u_short)(err)<<12)&0xf000)\ 23054359Sroberto |((u_short)(nitems)&0xfff)))) 23154359Sroberto 23254359Sroberto#define INFO_MBZ(mbz_itemsize) ((ntohs(mbz_itemsize)>>12)&0xf) 233132451Sroberto#define INFO_ITEMSIZE(mbz_itemsize) ((u_short)(ntohs(mbz_itemsize)&0xfff)) 23454359Sroberto#define MBZ_ITEMSIZE(itemsize) (htons((u_short)(itemsize))) 23554359Sroberto 23654359Sroberto 23754359Sroberto/* 23854359Sroberto * Implementation numbers. One for universal use and one for ntpd. 23954359Sroberto */ 24054359Sroberto#define IMPL_UNIV 0 241132451Sroberto#define IMPL_XNTPD_OLD 2 /* Used by pre ipv6 ntpdc */ 242132451Sroberto#define IMPL_XNTPD 3 /* Used by post ipv6 ntpdc */ 24354359Sroberto 24454359Sroberto/* 24554359Sroberto * Some limits related to authentication. Frames which are 24654359Sroberto * authenticated must include a time stamp which differs from 24754359Sroberto * the receive time stamp by no more than 10 seconds. 24854359Sroberto */ 24954359Sroberto#define INFO_TS_MAXSKEW 10. 25054359Sroberto 25154359Sroberto/* 25254359Sroberto * Universal request codes go here. There aren't any. 25354359Sroberto */ 25454359Sroberto 25554359Sroberto/* 256290001Sglebius * ntpdc -> ntpd request codes go here. 25754359Sroberto */ 25854359Sroberto#define REQ_PEER_LIST 0 /* return list of peers */ 25954359Sroberto#define REQ_PEER_LIST_SUM 1 /* return summary info for all peers */ 26054359Sroberto#define REQ_PEER_INFO 2 /* get standard information on peer */ 26154359Sroberto#define REQ_PEER_STATS 3 /* get statistics for peer */ 26254359Sroberto#define REQ_SYS_INFO 4 /* get system information */ 26354359Sroberto#define REQ_SYS_STATS 5 /* get system stats */ 26454359Sroberto#define REQ_IO_STATS 6 /* get I/O stats */ 26554359Sroberto#define REQ_MEM_STATS 7 /* stats related to peer list maint */ 26654359Sroberto#define REQ_LOOP_INFO 8 /* info from the loop filter */ 26754359Sroberto#define REQ_TIMER_STATS 9 /* get timer stats */ 26854359Sroberto#define REQ_CONFIG 10 /* configure a new peer */ 26954359Sroberto#define REQ_UNCONFIG 11 /* unconfigure an existing peer */ 27054359Sroberto#define REQ_SET_SYS_FLAG 12 /* set system flags */ 27154359Sroberto#define REQ_CLR_SYS_FLAG 13 /* clear system flags */ 27254359Sroberto#define REQ_MONITOR 14 /* (not used) */ 27354359Sroberto#define REQ_NOMONITOR 15 /* (not used) */ 27454359Sroberto#define REQ_GET_RESTRICT 16 /* return restrict list */ 27554359Sroberto#define REQ_RESADDFLAGS 17 /* add flags to restrict list */ 27654359Sroberto#define REQ_RESSUBFLAGS 18 /* remove flags from restrict list */ 27754359Sroberto#define REQ_UNRESTRICT 19 /* remove entry from restrict list */ 27854359Sroberto#define REQ_MON_GETLIST 20 /* return data collected by monitor */ 27954359Sroberto#define REQ_RESET_STATS 21 /* reset stat counters */ 28054359Sroberto#define REQ_RESET_PEER 22 /* reset peer stat counters */ 28154359Sroberto#define REQ_REREAD_KEYS 23 /* reread the encryption key file */ 28254359Sroberto#define REQ_DO_DIRTY_HACK 24 /* (not used) */ 28354359Sroberto#define REQ_DONT_DIRTY_HACK 25 /* (not used) */ 28454359Sroberto#define REQ_TRUSTKEY 26 /* add a trusted key */ 28554359Sroberto#define REQ_UNTRUSTKEY 27 /* remove a trusted key */ 28654359Sroberto#define REQ_AUTHINFO 28 /* return authentication info */ 28754359Sroberto#define REQ_TRAPS 29 /* return currently set traps */ 28854359Sroberto#define REQ_ADD_TRAP 30 /* add a trap */ 28954359Sroberto#define REQ_CLR_TRAP 31 /* clear a trap */ 29054359Sroberto#define REQ_REQUEST_KEY 32 /* define a new request keyid */ 29154359Sroberto#define REQ_CONTROL_KEY 33 /* define a new control keyid */ 29254359Sroberto#define REQ_GET_CTLSTATS 34 /* get stats from the control module */ 29354359Sroberto#define REQ_GET_LEAPINFO 35 /* (not used) */ 29454359Sroberto#define REQ_GET_CLOCKINFO 36 /* get clock information */ 29554359Sroberto#define REQ_SET_CLKFUDGE 37 /* set clock fudge factors */ 29654359Sroberto#define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ 29754359Sroberto#define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ 29854359Sroberto#define REQ_SET_PRECISION 41 /* (not used) */ 29982498Sroberto#define REQ_MON_GETLIST_1 42 /* return collected v1 monitor data */ 30082498Sroberto#define REQ_HOSTNAME_ASSOCID 43 /* Here is a hostname + assoc_id */ 301182007Sroberto#define REQ_IF_STATS 44 /* get interface statistics */ 302182007Sroberto#define REQ_IF_RELOAD 45 /* reload interface list */ 30354359Sroberto 304132451Sroberto/* Determine size of pre-v6 version of structures */ 305132451Sroberto#define v4sizeof(type) offsetof(type, v6_flag) 306132451Sroberto 30754359Sroberto/* 30854359Sroberto * Flags in the peer information returns 30954359Sroberto */ 31054359Sroberto#define INFO_FLAG_CONFIG 0x1 31154359Sroberto#define INFO_FLAG_SYSPEER 0x2 31254359Sroberto#define INFO_FLAG_BURST 0x4 31354359Sroberto#define INFO_FLAG_REFCLOCK 0x8 31454359Sroberto#define INFO_FLAG_PREFER 0x10 31554359Sroberto#define INFO_FLAG_AUTHENABLE 0x20 31654359Sroberto#define INFO_FLAG_SEL_CANDIDATE 0x40 31754359Sroberto#define INFO_FLAG_SHORTLIST 0x80 318182007Sroberto#define INFO_FLAG_IBURST 0x100 31954359Sroberto 32054359Sroberto/* 32154359Sroberto * Flags in the system information returns 32254359Sroberto */ 32354359Sroberto#define INFO_FLAG_BCLIENT 0x1 32454359Sroberto#define INFO_FLAG_AUTHENTICATE 0x2 32554359Sroberto#define INFO_FLAG_NTP 0x4 32654359Sroberto#define INFO_FLAG_KERNEL 0x8 32754359Sroberto#define INFO_FLAG_MONITOR 0x40 32854359Sroberto#define INFO_FLAG_FILEGEN 0x80 329106163Sroberto#define INFO_FLAG_CAL 0x10 33054359Sroberto#define INFO_FLAG_PPS_SYNC 0x20 33154359Sroberto 33254359Sroberto/* 33354359Sroberto * Peer list structure. Used to return raw lists of peers. It goes 33454359Sroberto * without saying that everything returned is in network byte order. 33582498Sroberto * Well, it *would* have gone without saying, but somebody said it. 33654359Sroberto */ 33754359Srobertostruct info_peer_list { 338132451Sroberto u_int32 addr; /* address of peer */ 33954359Sroberto u_short port; /* port number of peer */ 34054359Sroberto u_char hmode; /* mode for this peer */ 34154359Sroberto u_char flags; /* flags (from above) */ 342132451Sroberto u_int v6_flag; /* is this v6 or not */ 343132451Sroberto u_int unused1; /* (unused) padding for addr6 */ 344132451Sroberto struct in6_addr addr6; /* v6 address of peer */ 34554359Sroberto}; 34654359Sroberto 34754359Sroberto 34854359Sroberto/* 34954359Sroberto * Peer summary structure. Sort of the info that ntpdc returns by default. 35054359Sroberto */ 35154359Srobertostruct info_peer_summary { 35254359Sroberto u_int32 dstadr; /* local address (zero for undetermined) */ 35354359Sroberto u_int32 srcadr; /* source address */ 35454359Sroberto u_short srcport; /* source port */ 35554359Sroberto u_char stratum; /* stratum of peer */ 35654359Sroberto s_char hpoll; /* host polling interval */ 35754359Sroberto s_char ppoll; /* peer polling interval */ 35854359Sroberto u_char reach; /* reachability register */ 35954359Sroberto u_char flags; /* flags, from above */ 36054359Sroberto u_char hmode; /* peer mode */ 36154359Sroberto s_fp delay; /* peer.estdelay */ 36254359Sroberto l_fp offset; /* peer.estoffset */ 36354359Sroberto u_fp dispersion; /* peer.estdisp */ 364132451Sroberto u_int v6_flag; /* is this v6 or not */ 365132451Sroberto u_int unused1; /* (unused) padding for dstadr6 */ 366132451Sroberto struct in6_addr dstadr6; /* local address (v6) */ 367132451Sroberto struct in6_addr srcadr6; /* source address (v6) */ 36854359Sroberto}; 36954359Sroberto 37054359Sroberto 37154359Sroberto/* 37254359Sroberto * Peer information structure. 37354359Sroberto */ 37454359Srobertostruct info_peer { 37554359Sroberto u_int32 dstadr; /* local address */ 376132451Sroberto u_int32 srcadr; /* source address */ 37754359Sroberto u_short srcport; /* remote port */ 37854359Sroberto u_char flags; /* peer flags */ 37954359Sroberto u_char leap; /* peer.leap */ 38054359Sroberto u_char hmode; /* peer.hmode */ 38154359Sroberto u_char pmode; /* peer.pmode */ 38254359Sroberto u_char stratum; /* peer.stratum */ 38354359Sroberto u_char ppoll; /* peer.ppoll */ 38454359Sroberto u_char hpoll; /* peer.hpoll */ 38554359Sroberto s_char precision; /* peer.precision */ 38654359Sroberto u_char version; /* peer.version */ 38782498Sroberto u_char unused8; 38854359Sroberto u_char reach; /* peer.reach */ 38954359Sroberto u_char unreach; /* peer.unreach */ 39054359Sroberto u_char flash; /* old peer.flash */ 39154359Sroberto u_char ttl; /* peer.ttl */ 39254359Sroberto u_short flash2; /* new peer.flash */ 39382498Sroberto associd_t associd; /* association ID */ 39482498Sroberto keyid_t keyid; /* peer.keyid */ 39554359Sroberto u_int32 pkeyid; /* unused */ 39654359Sroberto u_int32 refid; /* peer.refid */ 39754359Sroberto u_int32 timer; /* peer.timer */ 398290001Sglebius s_fp rootdelay; /* peer.delay */ 39954359Sroberto u_fp rootdispersion; /* peer.dispersion */ 40054359Sroberto l_fp reftime; /* peer.reftime */ 40154359Sroberto l_fp org; /* peer.org */ 40254359Sroberto l_fp rec; /* peer.rec */ 40354359Sroberto l_fp xmt; /* peer.xmt */ 40454359Sroberto s_fp filtdelay[NTP_SHIFT]; /* delay shift register */ 40554359Sroberto l_fp filtoffset[NTP_SHIFT]; /* offset shift register */ 40654359Sroberto u_char order[NTP_SHIFT]; /* order of peers from last filter */ 40754359Sroberto s_fp delay; /* peer.estdelay */ 40854359Sroberto u_fp dispersion; /* peer.estdisp */ 40954359Sroberto l_fp offset; /* peer.estoffset */ 41054359Sroberto u_fp selectdisp; /* peer select dispersion */ 41154359Sroberto int32 unused1; /* (obsolete) */ 41254359Sroberto int32 unused2; 41354359Sroberto int32 unused3; 41454359Sroberto int32 unused4; 41554359Sroberto int32 unused5; 41654359Sroberto int32 unused6; 41754359Sroberto int32 unused7; 41854359Sroberto s_fp estbdelay; /* broadcast offset */ 419132451Sroberto u_int v6_flag; /* is this v6 or not */ 420132451Sroberto u_int unused9; /* (unused) padding for dstadr6 */ 421132451Sroberto struct in6_addr dstadr6; /* local address (v6-like) */ 422132451Sroberto struct in6_addr srcadr6; /* sources address (v6-like) */ 42354359Sroberto}; 42454359Sroberto 42554359Sroberto 42654359Sroberto/* 42754359Sroberto * Peer statistics structure 42854359Sroberto */ 42954359Srobertostruct info_peer_stats { 43054359Sroberto u_int32 dstadr; /* local address */ 43154359Sroberto u_int32 srcadr; /* remote address */ 43254359Sroberto u_short srcport; /* remote port */ 43354359Sroberto u_short flags; /* peer flags */ 43454359Sroberto u_int32 timereset; /* time counters were reset */ 43554359Sroberto u_int32 timereceived; /* time since a packet received */ 43654359Sroberto u_int32 timetosend; /* time until a packet sent */ 43754359Sroberto u_int32 timereachable; /* time peer has been reachable */ 43854359Sroberto u_int32 sent; /* number sent */ 43954359Sroberto u_int32 unused1; /* (unused) */ 44054359Sroberto u_int32 processed; /* number processed */ 44154359Sroberto u_int32 unused2; /* (unused) */ 44254359Sroberto u_int32 badauth; /* bad authentication */ 44354359Sroberto u_int32 bogusorg; /* bogus origin */ 44454359Sroberto u_int32 oldpkt; /* duplicate */ 44554359Sroberto u_int32 unused3; /* (unused) */ 44654359Sroberto u_int32 unused4; /* (unused) */ 44754359Sroberto u_int32 seldisp; /* bad dispersion */ 44854359Sroberto u_int32 selbroken; /* bad reference time */ 44954359Sroberto u_int32 unused5; /* (unused) */ 45054359Sroberto u_char candidate; /* select order */ 45154359Sroberto u_char unused6; /* (unused) */ 45254359Sroberto u_char unused7; /* (unused) */ 45354359Sroberto u_char unused8; /* (unused) */ 454132451Sroberto u_int v6_flag; /* is this v6 or not */ 455132451Sroberto u_int unused9; /* (unused) padding for dstadr6 */ 456132451Sroberto struct in6_addr dstadr6; /* local address */ 457132451Sroberto struct in6_addr srcadr6; /* remote address */ 45854359Sroberto}; 45954359Sroberto 46054359Sroberto 46154359Sroberto/* 46254359Sroberto * Loop filter variables 46354359Sroberto */ 46454359Srobertostruct info_loop { 46554359Sroberto l_fp last_offset; 46654359Sroberto l_fp drift_comp; 46754359Sroberto u_int32 compliance; 46854359Sroberto u_int32 watchdog_timer; 46954359Sroberto}; 47054359Sroberto 47154359Sroberto 47254359Sroberto/* 47354359Sroberto * System info. Mostly the sys.* variables, plus a few unique to 47454359Sroberto * the implementation. 47554359Sroberto */ 47654359Srobertostruct info_sys { 477132451Sroberto u_int32 peer; /* system peer address (v4) */ 47854359Sroberto u_char peer_mode; /* mode we are syncing to peer in */ 47954359Sroberto u_char leap; /* system leap bits */ 48054359Sroberto u_char stratum; /* our stratum */ 48154359Sroberto s_char precision; /* local clock precision */ 482290001Sglebius s_fp rootdelay; /* delay from sync source */ 48354359Sroberto u_fp rootdispersion; /* dispersion from sync source */ 48454359Sroberto u_int32 refid; /* reference ID of sync source */ 48554359Sroberto l_fp reftime; /* system reference time */ 48654359Sroberto u_int32 poll; /* system poll interval */ 48754359Sroberto u_char flags; /* system flags */ 48854359Sroberto u_char unused1; /* unused */ 48954359Sroberto u_char unused2; /* unused */ 49054359Sroberto u_char unused3; /* unused */ 49154359Sroberto s_fp bdelay; /* default broadcast offset */ 49254359Sroberto s_fp frequency; /* frequency residual (scaled ppm) */ 49354359Sroberto l_fp authdelay; /* default authentication delay */ 49454359Sroberto u_fp stability; /* clock stability (scaled ppm) */ 495132451Sroberto u_int v6_flag; /* is this v6 or not */ 496132451Sroberto u_int unused4; /* unused, padding for peer6 */ 497132451Sroberto struct in6_addr peer6; /* system peer address (v6) */ 49854359Sroberto}; 49954359Sroberto 50054359Sroberto 50154359Sroberto/* 50254359Sroberto * System stats. These are collected in the protocol module 50354359Sroberto */ 50454359Srobertostruct info_sys_stats { 505132451Sroberto u_int32 timeup; /* time since restart */ 506132451Sroberto u_int32 timereset; /* time since reset */ 507132451Sroberto u_int32 denied; /* access denied */ 508132451Sroberto u_int32 oldversionpkt; /* recent version */ 509132451Sroberto u_int32 newversionpkt; /* current version */ 510132451Sroberto u_int32 unknownversion; /* bad version */ 511132451Sroberto u_int32 badlength; /* bad length or format */ 51254359Sroberto u_int32 processed; /* packets processed */ 513132451Sroberto u_int32 badauth; /* bad authentication */ 514132451Sroberto u_int32 received; /* packets received */ 515132451Sroberto u_int32 limitrejected; /* rate exceeded */ 51654359Sroberto}; 51754359Sroberto 51854359Sroberto 51954359Sroberto/* 52054359Sroberto * System stats - old version 52154359Sroberto */ 52254359Srobertostruct old_info_sys_stats { 523132451Sroberto u_int32 timeup; /* time since restart */ 524132451Sroberto u_int32 timereset; /* time since reset */ 525132451Sroberto u_int32 denied; /* access denied */ 526132451Sroberto u_int32 oldversionpkt; /* recent version */ 527132451Sroberto u_int32 newversionpkt; /* current version */ 528132451Sroberto u_int32 unknownversion; /* bad version */ 529132451Sroberto u_int32 badlength; /* bad length or format */ 53054359Sroberto u_int32 processed; /* packets processed */ 531132451Sroberto u_int32 badauth; /* bad authentication */ 532132451Sroberto u_int32 wanderhold; /* (not used) */ 53354359Sroberto}; 53454359Sroberto 53554359Sroberto 53654359Sroberto/* 53754359Sroberto * Peer memory statistics. Collected in the peer module. 53854359Sroberto */ 53954359Srobertostruct info_mem_stats { 54054359Sroberto u_int32 timereset; /* time since reset */ 54154359Sroberto u_short totalpeermem; 54254359Sroberto u_short freepeermem; 54354359Sroberto u_int32 findpeer_calls; 54454359Sroberto u_int32 allocations; 54554359Sroberto u_int32 demobilizations; 546182007Sroberto u_char hashcount[NTP_HASH_SIZE]; 54754359Sroberto}; 54854359Sroberto 54954359Sroberto 55054359Sroberto/* 55154359Sroberto * I/O statistics. Collected in the I/O module 55254359Sroberto */ 55354359Srobertostruct info_io_stats { 55454359Sroberto u_int32 timereset; /* time since reset */ 55554359Sroberto u_short totalrecvbufs; /* total receive bufs */ 55654359Sroberto u_short freerecvbufs; /* free buffers */ 55754359Sroberto u_short fullrecvbufs; /* full buffers */ 55854359Sroberto u_short lowwater; /* number of times we've added buffers */ 55954359Sroberto u_int32 dropped; /* dropped packets */ 56054359Sroberto u_int32 ignored; /* ignored packets */ 56154359Sroberto u_int32 received; /* received packets */ 56254359Sroberto u_int32 sent; /* packets sent */ 56354359Sroberto u_int32 notsent; /* packets not sent */ 56454359Sroberto u_int32 interrupts; /* interrupts we've handled */ 56554359Sroberto u_int32 int_received; /* received by interrupt handler */ 56654359Sroberto}; 56754359Sroberto 56854359Sroberto 56954359Sroberto/* 57054359Sroberto * Timer stats. Guess where from. 57154359Sroberto */ 57254359Srobertostruct info_timer_stats { 57354359Sroberto u_int32 timereset; /* time since reset */ 57454359Sroberto u_int32 alarms; /* alarms we've handled */ 57554359Sroberto u_int32 overflows; /* timer overflows */ 57654359Sroberto u_int32 xmtcalls; /* calls to xmit */ 57754359Sroberto}; 57854359Sroberto 57954359Sroberto 58054359Sroberto/* 58154359Sroberto * Structure for passing peer configuration information 58254359Sroberto */ 583106163Srobertostruct old_conf_peer { 584106163Sroberto u_int32 peeraddr; /* address to poll */ 585106163Sroberto u_char hmode; /* mode, either broadcast, active or client */ 586106163Sroberto u_char version; /* version number to poll with */ 587106163Sroberto u_char minpoll; /* min host poll interval */ 588106163Sroberto u_char maxpoll; /* max host poll interval */ 589106163Sroberto u_char flags; /* flags for this request */ 590106163Sroberto u_char ttl; /* time to live (multicast) or refclock mode */ 591106163Sroberto u_short unused; /* unused */ 592106163Sroberto keyid_t keyid; /* key to use for this association */ 593106163Sroberto}; 594106163Sroberto 59554359Srobertostruct conf_peer { 59654359Sroberto u_int32 peeraddr; /* address to poll */ 59754359Sroberto u_char hmode; /* mode, either broadcast, active or client */ 59854359Sroberto u_char version; /* version number to poll with */ 59954359Sroberto u_char minpoll; /* min host poll interval */ 60054359Sroberto u_char maxpoll; /* max host poll interval */ 60154359Sroberto u_char flags; /* flags for this request */ 60254359Sroberto u_char ttl; /* time to live (multicast) or refclock mode */ 603132451Sroberto u_short unused1; /* unused */ 60482498Sroberto keyid_t keyid; /* key to use for this association */ 605290001Sglebius char keystr[128]; /* public key file name */ 606132451Sroberto u_int v6_flag; /* is this v6 or not */ 607132451Sroberto u_int unused2; /* unused, padding for peeraddr6 */ 608132451Sroberto struct in6_addr peeraddr6; /* ipv6 address to poll */ 60954359Sroberto}; 61054359Sroberto 61182498Sroberto#define CONF_FLAG_AUTHENABLE 0x01 61282498Sroberto#define CONF_FLAG_PREFER 0x02 61382498Sroberto#define CONF_FLAG_BURST 0x04 61482498Sroberto#define CONF_FLAG_IBURST 0x08 61582498Sroberto#define CONF_FLAG_NOSELECT 0x10 61682498Sroberto#define CONF_FLAG_SKEY 0x20 61754359Sroberto 61854359Sroberto/* 61954359Sroberto * Structure for passing peer deletion information. Currently 62054359Sroberto * we only pass the address and delete all configured peers with 62154359Sroberto * this addess. 62254359Sroberto */ 62354359Srobertostruct conf_unpeer { 624132451Sroberto u_int32 peeraddr; /* address of peer */ 625132451Sroberto u_int v6_flag; /* is this v6 or not */ 626132451Sroberto struct in6_addr peeraddr6; /* address of peer (v6) */ 62754359Sroberto}; 62854359Sroberto 62954359Sroberto/* 63054359Sroberto * Structure for carrying system flags. 63154359Sroberto */ 63254359Srobertostruct conf_sys_flags { 63354359Sroberto u_int32 flags; 63454359Sroberto}; 63554359Sroberto 63654359Sroberto/* 63754359Sroberto * System flags we can set/clear 63854359Sroberto */ 639106163Sroberto#define SYS_FLAG_BCLIENT 0x01 640106163Sroberto#define SYS_FLAG_PPS 0x02 641106163Sroberto#define SYS_FLAG_NTP 0x04 642106163Sroberto#define SYS_FLAG_KERNEL 0x08 64354359Sroberto#define SYS_FLAG_MONITOR 0x10 64454359Sroberto#define SYS_FLAG_FILEGEN 0x20 645106163Sroberto#define SYS_FLAG_AUTH 0x40 646106163Sroberto#define SYS_FLAG_CAL 0x80 64754359Sroberto 64854359Sroberto/* 64954359Sroberto * Structure used for returning restrict entries 65054359Sroberto */ 65154359Srobertostruct info_restrict { 65254359Sroberto u_int32 addr; /* match address */ 65354359Sroberto u_int32 mask; /* match mask */ 65454359Sroberto u_int32 count; /* number of packets matched */ 65554359Sroberto u_short flags; /* restrict flags */ 65654359Sroberto u_short mflags; /* match flags */ 657132451Sroberto u_int v6_flag; /* is this v6 or not */ 658132451Sroberto u_int unused1; /* unused, padding for addr6 */ 659132451Sroberto struct in6_addr addr6; /* match address (v6) */ 660132451Sroberto struct in6_addr mask6; /* match mask (v6) */ 66154359Sroberto}; 66254359Sroberto 66354359Sroberto 66454359Sroberto/* 66554359Sroberto * Structure used for specifying restrict entries 66654359Sroberto */ 66754359Srobertostruct conf_restrict { 668132451Sroberto u_int32 addr; /* match address */ 66954359Sroberto u_int32 mask; /* match mask */ 67054359Sroberto u_short flags; /* restrict flags */ 67154359Sroberto u_short mflags; /* match flags */ 672132451Sroberto u_int v6_flag; /* is this v6 or not */ 673132451Sroberto struct in6_addr addr6; /* match address (v6) */ 674132451Sroberto struct in6_addr mask6; /* match mask (v6) */ 67554359Sroberto}; 67654359Sroberto 67754359Sroberto 67854359Sroberto/* 67954359Sroberto * Structure used for returning monitor data 68054359Sroberto */ 68154359Srobertostruct info_monitor_1 { 682290001Sglebius u_int32 avg_int; /* avg s between packets from this host */ 683290001Sglebius u_int32 last_int; /* s since we last received a packet */ 684290001Sglebius u_int32 restr; /* restrict bits (was named lastdrop) */ 68554359Sroberto u_int32 count; /* count of packets received */ 686132451Sroberto u_int32 addr; /* host address V4 style */ 68754359Sroberto u_int32 daddr; /* destination host address */ 68854359Sroberto u_int32 flags; /* flags about destination */ 68954359Sroberto u_short port; /* port number of last reception */ 69054359Sroberto u_char mode; /* mode of last packet */ 69154359Sroberto u_char version; /* version number of last packet */ 692132451Sroberto u_int v6_flag; /* is this v6 or not */ 693132451Sroberto u_int unused1; /* unused, padding for addr6 */ 694132451Sroberto struct in6_addr addr6; /* host address V6 style */ 695132451Sroberto struct in6_addr daddr6; /* host address V6 style */ 69654359Sroberto}; 69754359Sroberto 69854359Sroberto 69954359Sroberto/* 70054359Sroberto * Structure used for returning monitor data 70154359Sroberto */ 70254359Srobertostruct info_monitor { 703290001Sglebius u_int32 avg_int; /* avg s between packets from this host */ 704290001Sglebius u_int32 last_int; /* s since we last received a packet */ 705290001Sglebius u_int32 restr; /* restrict bits (was named lastdrop) */ 70654359Sroberto u_int32 count; /* count of packets received */ 70754359Sroberto u_int32 addr; /* host address */ 70854359Sroberto u_short port; /* port number of last reception */ 70954359Sroberto u_char mode; /* mode of last packet */ 71054359Sroberto u_char version; /* version number of last packet */ 711132451Sroberto u_int v6_flag; /* is this v6 or not */ 712132451Sroberto u_int unused1; /* unused, padding for addr6 */ 713132451Sroberto struct in6_addr addr6; /* host v6 address */ 71454359Sroberto}; 71554359Sroberto 71654359Sroberto/* 717290001Sglebius * Structure used for returning monitor data (old format) 71854359Sroberto */ 71954359Srobertostruct old_info_monitor { 72054359Sroberto u_int32 lasttime; /* last packet from this host */ 72154359Sroberto u_int32 firsttime; /* first time we received a packet */ 72254359Sroberto u_int32 count; /* count of packets received */ 72354359Sroberto u_int32 addr; /* host address */ 72454359Sroberto u_short port; /* port number of last reception */ 72554359Sroberto u_char mode; /* mode of last packet */ 72654359Sroberto u_char version; /* version number of last packet */ 727132451Sroberto u_int v6_flag; /* is this v6 or not */ 728132451Sroberto struct in6_addr addr6; /* host address (v6)*/ 72954359Sroberto}; 73054359Sroberto 73154359Sroberto/* 73254359Sroberto * Structure used for passing indication of flags to clear 73354359Sroberto */ 73454359Srobertostruct reset_flags { 73554359Sroberto u_int32 flags; 73654359Sroberto}; 73754359Sroberto 73854359Sroberto#define RESET_FLAG_ALLPEERS 0x01 73954359Sroberto#define RESET_FLAG_IO 0x02 74054359Sroberto#define RESET_FLAG_SYS 0x04 74154359Sroberto#define RESET_FLAG_MEM 0x08 74254359Sroberto#define RESET_FLAG_TIMER 0x10 74354359Sroberto#define RESET_FLAG_AUTH 0x20 74454359Sroberto#define RESET_FLAG_CTL 0x40 74554359Sroberto 746290001Sglebius#define RESET_ALLFLAGS ( \ 747290001Sglebius RESET_FLAG_ALLPEERS | \ 748290001Sglebius RESET_FLAG_IO | \ 749290001Sglebius RESET_FLAG_SYS | \ 750290001Sglebius RESET_FLAG_MEM | \ 751290001Sglebius RESET_FLAG_TIMER | \ 752290001Sglebius RESET_FLAG_AUTH | \ 753290001Sglebius RESET_FLAG_CTL \ 754290001Sglebius) 75554359Sroberto 75654359Sroberto/* 75754359Sroberto * Structure used to return information concerning the authentication 75854359Sroberto * module. 75954359Sroberto */ 76054359Srobertostruct info_auth { 76154359Sroberto u_int32 timereset; /* time counters were reset */ 76254359Sroberto u_int32 numkeys; /* number of keys we know */ 76354359Sroberto u_int32 numfreekeys; /* number of free keys */ 76454359Sroberto u_int32 keylookups; /* calls to authhavekey() */ 76554359Sroberto u_int32 keynotfound; /* requested key unknown */ 76654359Sroberto u_int32 encryptions; /* number of encryptions */ 76754359Sroberto u_int32 decryptions; /* number of decryptions */ 76854359Sroberto u_int32 expired; /* number of expired keys */ 76954359Sroberto u_int32 keyuncached; /* calls to encrypt/decrypt with uncached key */ 77054359Sroberto}; 77154359Sroberto 77254359Sroberto 77354359Sroberto/* 77454359Sroberto * Structure used to pass trap information to the client 77554359Sroberto */ 77654359Srobertostruct info_trap { 777132451Sroberto u_int32 local_address; /* local interface addres (v4) */ 778132451Sroberto u_int32 trap_address; /* remote client's addres (v4) */ 77954359Sroberto u_short trap_port; /* remote port number */ 78054359Sroberto u_short sequence; /* sequence number */ 78154359Sroberto u_int32 settime; /* time trap last set */ 78254359Sroberto u_int32 origtime; /* time trap originally set */ 78354359Sroberto u_int32 resets; /* number of resets on this trap */ 78454359Sroberto u_int32 flags; /* trap flags, as defined in ntp_control.h */ 785132451Sroberto u_int v6_flag; /* is this v6 or not */ 786132451Sroberto struct in6_addr local_address6; /* local interface address (v6) */ 787132451Sroberto struct in6_addr trap_address6; /* remote client's address (v6) */ 78854359Sroberto}; 78954359Sroberto 79054359Sroberto/* 79154359Sroberto * Structure used to pass add/clear trap information to the client 79254359Sroberto */ 79354359Srobertostruct conf_trap { 794132451Sroberto u_int32 local_address; /* remote client's address */ 795132451Sroberto u_int32 trap_address; /* local interface address */ 79654359Sroberto u_short trap_port; /* remote client's port */ 79754359Sroberto u_short unused; /* (unused) */ 798132451Sroberto u_int v6_flag; /* is this v6 or not */ 799132451Sroberto struct in6_addr local_address6; /* local interface address (v6) */ 800132451Sroberto struct in6_addr trap_address6; /* remote client's address (v6) */ 80154359Sroberto}; 80254359Sroberto 80354359Sroberto 80454359Sroberto/* 80554359Sroberto * Structure used to return statistics from the control module 80654359Sroberto */ 80754359Srobertostruct info_control { 80854359Sroberto u_int32 ctltimereset; 80954359Sroberto u_int32 numctlreq; /* number of requests we've received */ 81054359Sroberto u_int32 numctlbadpkts; /* number of bad control packets */ 81154359Sroberto u_int32 numctlresponses; /* # resp packets sent */ 81254359Sroberto u_int32 numctlfrags; /* # of fragments sent */ 81354359Sroberto u_int32 numctlerrors; /* number of error responses sent */ 81454359Sroberto u_int32 numctltooshort; /* number of too short input packets */ 81554359Sroberto u_int32 numctlinputresp; /* number of responses on input */ 81654359Sroberto u_int32 numctlinputfrag; /* number of fragments on input */ 81754359Sroberto u_int32 numctlinputerr; /* # input pkts with err bit set */ 81854359Sroberto u_int32 numctlbadoffset; /* # input pkts with nonzero offset */ 81954359Sroberto u_int32 numctlbadversion; /* # input pkts with unknown version */ 82054359Sroberto u_int32 numctldatatooshort; /* data too short for count */ 82154359Sroberto u_int32 numctlbadop; /* bad op code found in packet */ 82254359Sroberto u_int32 numasyncmsgs; /* # async messages we've sent */ 82354359Sroberto}; 82454359Sroberto 82554359Sroberto 82654359Sroberto/* 82754359Sroberto * Structure used to return clock information 82854359Sroberto */ 82954359Srobertostruct info_clock { 83054359Sroberto u_int32 clockadr; 83154359Sroberto u_char type; 83254359Sroberto u_char flags; 83354359Sroberto u_char lastevent; 83454359Sroberto u_char currentstatus; 83554359Sroberto u_int32 polls; 83654359Sroberto u_int32 noresponse; 83754359Sroberto u_int32 badformat; 83854359Sroberto u_int32 baddata; 83954359Sroberto u_int32 timestarted; 84054359Sroberto l_fp fudgetime1; 84154359Sroberto l_fp fudgetime2; 84254359Sroberto int32 fudgeval1; 843290001Sglebius u_int32 fudgeval2; 84454359Sroberto}; 84554359Sroberto 84654359Sroberto 84754359Sroberto/* 84854359Sroberto * Structure used for setting clock fudge factors 84954359Sroberto */ 85054359Srobertostruct conf_fudge { 85154359Sroberto u_int32 clockadr; 85254359Sroberto u_int32 which; 85354359Sroberto l_fp fudgetime; 854290001Sglebius u_int32 fudgeval_flags; 85554359Sroberto}; 85654359Sroberto 85754359Sroberto#define FUDGE_TIME1 1 85854359Sroberto#define FUDGE_TIME2 2 85954359Sroberto#define FUDGE_VAL1 3 86054359Sroberto#define FUDGE_VAL2 4 86154359Sroberto#define FUDGE_FLAGS 5 86254359Sroberto 86354359Sroberto 86454359Sroberto/* 86554359Sroberto * Structure used for returning clock debugging info 86654359Sroberto */ 86754359Sroberto#define NUMCBUGVALUES 16 86854359Sroberto#define NUMCBUGTIMES 32 86954359Sroberto 87054359Srobertostruct info_clkbug { 87154359Sroberto u_int32 clockadr; 87254359Sroberto u_char nvalues; 87354359Sroberto u_char ntimes; 87454359Sroberto u_short svalues; 87554359Sroberto u_int32 stimes; 87654359Sroberto u_int32 values[NUMCBUGVALUES]; 87754359Sroberto l_fp times[NUMCBUGTIMES]; 87854359Sroberto}; 87954359Sroberto 88054359Sroberto/* 88154359Sroberto * Structure used for returning kernel pll/PPS information 88254359Sroberto */ 88354359Srobertostruct info_kernel { 88454359Sroberto int32 offset; 88554359Sroberto int32 freq; 88654359Sroberto int32 maxerror; 88754359Sroberto int32 esterror; 88854359Sroberto u_short status; 88954359Sroberto u_short shift; 89054359Sroberto int32 constant; 89154359Sroberto int32 precision; 89254359Sroberto int32 tolerance; 89354359Sroberto 89454359Sroberto/* 89554359Sroberto * Variables used only if PPS signal discipline is implemented 89654359Sroberto */ 89754359Sroberto int32 ppsfreq; 89854359Sroberto int32 jitter; 89954359Sroberto int32 stabil; 90054359Sroberto int32 jitcnt; 90154359Sroberto int32 calcnt; 90254359Sroberto int32 errcnt; 90354359Sroberto int32 stbcnt; 90454359Sroberto}; 90582498Sroberto 90682498Sroberto/* 907182007Sroberto * interface statistics 908182007Sroberto */ 909182007Srobertostruct info_if_stats { 910290001Sglebius union addrun unaddr; /* address */ 911290001Sglebius union addrun unbcast; /* broadcast */ 912290001Sglebius union addrun unmask; /* mask */ 913290001Sglebius u_int32 v6_flag; /* is this v6 */ 914182007Sroberto char name[32]; /* name of interface */ 915182007Sroberto int32 flags; /* interface flags */ 916182007Sroberto int32 last_ttl; /* last TTL specified */ 917182007Sroberto int32 num_mcast; /* No. of IP addresses in multicast socket */ 918290001Sglebius int32 received; /* number of incoming packets */ 919182007Sroberto int32 sent; /* number of outgoing packets */ 920182007Sroberto int32 notsent; /* number of send failures */ 921290001Sglebius int32 uptime; /* number of seconds this interface was active */ 922182007Sroberto u_int32 scopeid; /* Scope used for Multicasting */ 923182007Sroberto u_int32 ifindex; /* interface index - from system */ 924290001Sglebius u_int32 ifnum; /* sequential interface number */ 925290001Sglebius u_int32 peercnt; /* number of peers referencinf this interface - informational only */ 926182007Sroberto u_short family; /* Address family */ 927290001Sglebius u_char ignore_packets; /* Specify whether the packet should be ignored */ 928290001Sglebius u_char action; /* reason the item is listed */ 929290001Sglebius int32 _filler0; /* pad to a 64 bit size boundary */ 930182007Sroberto}; 931182007Sroberto 932182007Sroberto#define IFS_EXISTS 1 /* just exists */ 933182007Sroberto#define IFS_CREATED 2 /* was just created */ 934182007Sroberto#define IFS_DELETED 3 /* was just delete */ 935182007Sroberto 936182007Sroberto/* 93782498Sroberto * Info returned with IP -> hostname lookup 93882498Sroberto */ 93982498Sroberto/* 144 might need to become 32, matching data[] member of req_pkt */ 94082498Sroberto#define NTP_MAXHOSTNAME (32 - sizeof(u_int32) - sizeof(u_short)) 94182498Srobertostruct info_dns_assoc { 94282498Sroberto u_int32 peeraddr; /* peer address (HMS: being careful...) */ 94382498Sroberto associd_t associd; /* association ID */ 94482498Sroberto char hostname[NTP_MAXHOSTNAME]; /* hostname */ 94582498Sroberto}; 946290001Sglebius 947290001Sglebius/* 948290001Sglebius * function declarations 949290001Sglebius */ 950290001Sglebiusint get_packet_mode(struct recvbuf *rbufp); /* Return packet mode */ 951290001Sglebius 952132451Sroberto#endif /* NTP_REQUEST_H */ 953