struct ntp_control {
u_char li_vn_mode; /* leap, version, mode */
u_char r_m_e_op; /* response, more, error, opcode */
u_short sequence; /* sequence number of request */
u_short status; /* status word for association */
associd_t associd; /* association ID */
u_short offset; /* offset of this batch of data */
u_short count; /* count of data in this packet */
ctl_pkt_u u;
};
/*
* Length of the control header, in octets
*/
#define CTL_HEADER_LEN (offsetof(struct ntp_control, u))
#define CTL_MAX_DATA_LEN 468
/*
* Limits and things
*/
#define CTL_MAXTRAPS 3 /* maximum number of traps we allow */
#define CTL_TRAPTIME (60*60) /* time out traps in 1 hour */
#define CTL_MAXAUTHSIZE 64 /* maximum size of an authen'ed req */
/*
* Decoding for the r_m_e_op field
*/
#define CTL_RESPONSE 0x80
#define CTL_ERROR 0x40
#define CTL_MORE 0x20
#define CTL_OP_MASK 0x1f
/*
* Error code responses returned when the E bit is set.
*/
#define CERR_UNSPEC 0
#define CERR_PERMISSION 1
#define CERR_BADFMT 2
#define CERR_BADOP 3
#define CERR_BADASSOC 4
#define CERR_UNKNOWNVAR 5
#define CERR_BADVALUE 6
#define CERR_RESTRICT 7
#define CERR_NORESOURCE CERR_PERMISSION /* wish there was a different code */
/*
* Definition of the structure used internally to hold trap information.
* ntp_request.c wants to see this.
*/
struct ctl_trap {
sockaddr_u tr_addr; /* address of trap recipient */
endpt *tr_localaddr; /* interface to send this through */
u_long tr_settime; /* time trap was set */
u_long tr_count; /* async messages sent to this guy */
u_long tr_origtime; /* time trap was originally set */
u_long tr_resets; /* count of resets for this trap */
u_short tr_sequence; /* trap sequence id */
u_char tr_flags; /* trap flags */
u_char tr_version; /* version number of trapper */
};
extern struct ctl_trap ctl_traps[CTL_MAXTRAPS];
/*
* Flag bits
*/
#define TRAP_INUSE 0x1 /* this trap is active */
#define TRAP_NONPRIO 0x2 /* this trap is non-priority */
#define TRAP_CONFIGURED 0x4 /* this trap was configured */
/*
* Types of things we may deal with
* shared between ntpq and library
*/
#define TYPE_SYS 1
#define TYPE_PEER 2
#define TYPE_CLOCK 3
/*
* IFSTATS_FIELDS is the number of fields ntpd supplies for each ifstats
* row. Similarly RESLIST_FIELDS for reslist.
*/
#define IFSTATS_FIELDS 12
#define RESLIST_FIELDS 4