📄 ntp_request.h
字号:
/* * System info. Mostly the sys.* variables, plus a few unique to * the implementation. */struct info_sys { u_int32 peer; /* system peer address (v4) */ u_char peer_mode; /* mode we are syncing to peer in */ u_char leap; /* system leap bits */ u_char stratum; /* our stratum */ s_char precision; /* local clock precision */ s_fp rootdelay; /* distance from sync source */ u_fp rootdispersion; /* dispersion from sync source */ u_int32 refid; /* reference ID of sync source */ l_fp reftime; /* system reference time */ u_int32 poll; /* system poll interval */ u_char flags; /* system flags */ u_char unused1; /* unused */ u_char unused2; /* unused */ u_char unused3; /* unused */ s_fp bdelay; /* default broadcast offset */ s_fp frequency; /* frequency residual (scaled ppm) */ l_fp authdelay; /* default authentication delay */ u_fp stability; /* clock stability (scaled ppm) */ u_int v6_flag; /* is this v6 or not */ u_int unused4; /* unused, padding for peer6 */ struct in6_addr peer6; /* system peer address (v6) */};/* * System stats. These are collected in the protocol module */struct info_sys_stats { u_int32 timeup; /* time since restart */ u_int32 timereset; /* time since reset */ u_int32 denied; /* access denied */ u_int32 oldversionpkt; /* recent version */ u_int32 newversionpkt; /* current version */ u_int32 unknownversion; /* bad version */ u_int32 badlength; /* bad length or format */ u_int32 processed; /* packets processed */ u_int32 badauth; /* bad authentication */ u_int32 received; /* packets received */ u_int32 limitrejected; /* rate exceeded */};/* * System stats - old version */struct old_info_sys_stats { u_int32 timeup; /* time since restart */ u_int32 timereset; /* time since reset */ u_int32 denied; /* access denied */ u_int32 oldversionpkt; /* recent version */ u_int32 newversionpkt; /* current version */ u_int32 unknownversion; /* bad version */ u_int32 badlength; /* bad length or format */ u_int32 processed; /* packets processed */ u_int32 badauth; /* bad authentication */ u_int32 wanderhold; /* (not used) */};/* * Peer memory statistics. Collected in the peer module. */struct info_mem_stats { u_int32 timereset; /* time since reset */ u_short totalpeermem; u_short freepeermem; u_int32 findpeer_calls; u_int32 allocations; u_int32 demobilizations; u_char hashcount[NTP_HASH_SIZE];};/* * I/O statistics. Collected in the I/O module */struct info_io_stats { u_int32 timereset; /* time since reset */ u_short totalrecvbufs; /* total receive bufs */ u_short freerecvbufs; /* free buffers */ u_short fullrecvbufs; /* full buffers */ u_short lowwater; /* number of times we've added buffers */ u_int32 dropped; /* dropped packets */ u_int32 ignored; /* ignored packets */ u_int32 received; /* received packets */ u_int32 sent; /* packets sent */ u_int32 notsent; /* packets not sent */ u_int32 interrupts; /* interrupts we've handled */ u_int32 int_received; /* received by interrupt handler */};/* * Timer stats. Guess where from. */struct info_timer_stats { u_int32 timereset; /* time since reset */ u_int32 alarms; /* alarms we've handled */ u_int32 overflows; /* timer overflows */ u_int32 xmtcalls; /* calls to xmit */};/* * Structure for passing peer configuration information */struct old_conf_peer { u_int32 peeraddr; /* address to poll */ u_char hmode; /* mode, either broadcast, active or client */ u_char version; /* version number to poll with */ u_char minpoll; /* min host poll interval */ u_char maxpoll; /* max host poll interval */ u_char flags; /* flags for this request */ u_char ttl; /* time to live (multicast) or refclock mode */ u_short unused; /* unused */ keyid_t keyid; /* key to use for this association */};struct conf_peer { u_int32 peeraddr; /* address to poll */ u_char hmode; /* mode, either broadcast, active or client */ u_char version; /* version number to poll with */ u_char minpoll; /* min host poll interval */ u_char maxpoll; /* max host poll interval */ u_char flags; /* flags for this request */ u_char ttl; /* time to live (multicast) or refclock mode */ u_short unused1; /* unused */ keyid_t keyid; /* key to use for this association */ char keystr[MAXFILENAME]; /* public key file name*/ u_int v6_flag; /* is this v6 or not */ u_int unused2; /* unused, padding for peeraddr6 */ struct in6_addr peeraddr6; /* ipv6 address to poll */};#define CONF_FLAG_AUTHENABLE 0x01#define CONF_FLAG_PREFER 0x02#define CONF_FLAG_BURST 0x04#define CONF_FLAG_IBURST 0x08#define CONF_FLAG_NOSELECT 0x10#define CONF_FLAG_SKEY 0x20/* * Structure for passing peer deletion information. Currently * we only pass the address and delete all configured peers with * this addess. */struct conf_unpeer { u_int32 peeraddr; /* address of peer */ u_int v6_flag; /* is this v6 or not */ struct in6_addr peeraddr6; /* address of peer (v6) */};/* * Structure for carrying system flags. */struct conf_sys_flags { u_int32 flags;};/* * System flags we can set/clear */#define SYS_FLAG_BCLIENT 0x01#define SYS_FLAG_PPS 0x02#define SYS_FLAG_NTP 0x04#define SYS_FLAG_KERNEL 0x08#define SYS_FLAG_MONITOR 0x10#define SYS_FLAG_FILEGEN 0x20#define SYS_FLAG_AUTH 0x40#define SYS_FLAG_CAL 0x80/* * Structure used for returning restrict entries */struct info_restrict { u_int32 addr; /* match address */ u_int32 mask; /* match mask */ u_int32 count; /* number of packets matched */ u_short flags; /* restrict flags */ u_short mflags; /* match flags */ u_int v6_flag; /* is this v6 or not */ u_int unused1; /* unused, padding for addr6 */ struct in6_addr addr6; /* match address (v6) */ struct in6_addr mask6; /* match mask (v6) */};/* * Structure used for specifying restrict entries */struct conf_restrict { u_int32 addr; /* match address */ u_int32 mask; /* match mask */ u_short flags; /* restrict flags */ u_short mflags; /* match flags */ u_int v6_flag; /* is this v6 or not */ struct in6_addr addr6; /* match address (v6) */ struct in6_addr mask6; /* match mask (v6) */};/* * Structure used for returning monitor data */struct info_monitor_1 { u_int32 lasttime; /* last packet from this host */ u_int32 firsttime; /* first time we received a packet */ u_int32 lastdrop; /* last time we rejected a packet due to client limitation policy */ u_int32 count; /* count of packets received */ u_int32 addr; /* host address V4 style */ u_int32 daddr; /* destination host address */ u_int32 flags; /* flags about destination */ u_short port; /* port number of last reception */ u_char mode; /* mode of last packet */ u_char version; /* version number of last packet */ u_int v6_flag; /* is this v6 or not */ u_int unused1; /* unused, padding for addr6 */ struct in6_addr addr6; /* host address V6 style */ struct in6_addr daddr6; /* host address V6 style */};/* * Structure used for returning monitor data */struct info_monitor { u_int32 lasttime; /* last packet from this host */ u_int32 firsttime; /* first time we received a packet */ u_int32 lastdrop; /* last time we rejected a packet due to client limitation policy */ u_int32 count; /* count of packets received */ u_int32 addr; /* host address */ u_short port; /* port number of last reception */ u_char mode; /* mode of last packet */ u_char version; /* version number of last packet */ u_int v6_flag; /* is this v6 or not */ u_int unused1; /* unused, padding for addr6 */ struct in6_addr addr6; /* host v6 address */};/* * Structure used for returning monitor data (old format */struct old_info_monitor { u_int32 lasttime; /* last packet from this host */ u_int32 firsttime; /* first time we received a packet */ u_int32 count; /* count of packets received */ u_int32 addr; /* host address */ u_short port; /* port number of last reception */ u_char mode; /* mode of last packet */ u_char version; /* version number of last packet */ u_int v6_flag; /* is this v6 or not */ struct in6_addr addr6; /* host address (v6)*/};/* * Structure used for passing indication of flags to clear */struct reset_flags { u_int32 flags;};#define RESET_FLAG_ALLPEERS 0x01#define RESET_FLAG_IO 0x02#define RESET_FLAG_SYS 0x04#define RESET_FLAG_MEM 0x08#define RESET_FLAG_TIMER 0x10#define RESET_FLAG_AUTH 0x20#define RESET_FLAG_CTL 0x40#define RESET_ALLFLAGS \ (RESET_FLAG_ALLPEERS|RESET_FLAG_IO|RESET_FLAG_SYS \ |RESET_FLAG_MEM|RESET_FLAG_TIMER|RESET_FLAG_AUTH|RESET_FLAG_CTL)/* * Structure used to return information concerning the authentication * module. */struct info_auth { u_int32 timereset; /* time counters were reset */ u_int32 numkeys; /* number of keys we know */ u_int32 numfreekeys; /* number of free keys */ u_int32 keylookups; /* calls to authhavekey() */ u_int32 keynotfound; /* requested key unknown */ u_int32 encryptions; /* number of encryptions */ u_int32 decryptions; /* number of decryptions */ u_int32 expired; /* number of expired keys */ u_int32 keyuncached; /* calls to encrypt/decrypt with uncached key */};/* * Structure used to pass trap information to the client */struct info_trap { u_int32 local_address; /* local interface addres (v4) */ u_int32 trap_address; /* remote client's addres (v4) */ u_short trap_port; /* remote port number */ u_short sequence; /* sequence number */ u_int32 settime; /* time trap last set */ u_int32 origtime; /* time trap originally set */ u_int32 resets; /* number of resets on this trap */ u_int32 flags; /* trap flags, as defined in ntp_control.h */ u_int v6_flag; /* is this v6 or not */ struct in6_addr local_address6; /* local interface address (v6) */ struct in6_addr trap_address6; /* remote client's address (v6) */};/* * Structure used to pass add/clear trap information to the client */struct conf_trap { u_int32 local_address; /* remote client's address */ u_int32 trap_address; /* local interface address */ u_short trap_port; /* remote client's port */ u_short unused; /* (unused) */ u_int v6_flag; /* is this v6 or not */ struct in6_addr local_address6; /* local interface address (v6) */ struct in6_addr trap_address6; /* remote client's address (v6) */};/* * Structure used to return statistics from the control module */struct info_control { u_int32 ctltimereset; u_int32 numctlreq; /* number of requests we've received */ u_int32 numctlbadpkts; /* number of bad control packets */ u_int32 numctlresponses; /* # resp packets sent */ u_int32 numctlfrags; /* # of fragments sent */ u_int32 numctlerrors; /* number of error responses sent */ u_int32 numctltooshort; /* number of too short input packets */ u_int32 numctlinputresp; /* number of responses on input */ u_int32 numctlinputfrag; /* number of fragments on input */ u_int32 numctlinputerr; /* # input pkts with err bit set */ u_int32 numctlbadoffset; /* # input pkts with nonzero offset */ u_int32 numctlbadversion; /* # input pkts with unknown version */ u_int32 numctldatatooshort; /* data too short for count */ u_int32 numctlbadop; /* bad op code found in packet */ u_int32 numasyncmsgs; /* # async messages we've sent */};/* * Structure used to return clock information */struct info_clock { u_int32 clockadr; u_char type; u_char flags; u_char lastevent; u_char currentstatus; u_int32 polls; u_int32 noresponse; u_int32 badformat; u_int32 baddata; u_int32 timestarted; l_fp fudgetime1; l_fp fudgetime2; int32 fudgeval1; int32 fudgeval2;};/* * Structure used for setting clock fudge factors */struct conf_fudge { u_int32 clockadr; u_int32 which; l_fp fudgetime; int32 fudgeval_flags;};#define FUDGE_TIME1 1#define FUDGE_TIME2 2#define FUDGE_VAL1 3#define FUDGE_VAL2 4#define FUDGE_FLAGS 5/* * Structure used for returning clock debugging info */#define NUMCBUGVALUES 16#define NUMCBUGTIMES 32struct info_clkbug { u_int32 clockadr; u_char nvalues; u_char ntimes; u_short svalues; u_int32 stimes; u_int32 values[NUMCBUGVALUES]; l_fp times[NUMCBUGTIMES];};/* * Structure used for returning kernel pll/PPS information */struct info_kernel { int32 offset; int32 freq; int32 maxerror; int32 esterror; u_short status; u_short shift; int32 constant; int32 precision; int32 tolerance;/* * Variables used only if PPS signal discipline is implemented */ int32 ppsfreq; int32 jitter; int32 stabil; int32 jitcnt; int32 calcnt; int32 errcnt; int32 stbcnt;};/* * Info returned with IP -> hostname lookup *//* 144 might need to become 32, matching data[] member of req_pkt */#define NTP_MAXHOSTNAME (32 - sizeof(u_int32) - sizeof(u_short))struct info_dns_assoc { u_int32 peeraddr; /* peer address (HMS: being careful...) */ associd_t associd; /* association ID */ char hostname[NTP_MAXHOSTNAME]; /* hostname */};#endif /* NTP_REQUEST_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -