?? ntp.h
字號:
#define MIN_MAC_LEN 3 * sizeof(u_int32) /* DES */#define MAX_MAC_LEN 5 * sizeof(u_int32) /* MD5 */ /* * The length of the packet less MAC must be a multiple of 64 * with an RSA modulus and Diffie-Hellman prime of 64 octets * and maximum host name of 128 octets, the maximum autokey * command is 152 octets and maximum autokey response is 460 * octets. A packet can contain no more than one command and one * response, so the maximum total extension field length is 672 * octets. But, to handle humungus certificates, the bank must * be broke. */#ifdef OPENSSL u_int32 exten[NTP_MAXEXTEN / 4]; /* max extension field */#else /* OPENSSL */ u_int32 exten[1]; /* misused */#endif /* OPENSSL */ u_char mac[MAX_MAC_LEN]; /* mac */};/* * Stuff for extracting things from li_vn_mode */#define PKT_MODE(li_vn_mode) ((u_char)((li_vn_mode) & 0x7))#define PKT_VERSION(li_vn_mode) ((u_char)(((li_vn_mode) >> 3) & 0x7))#define PKT_LEAP(li_vn_mode) ((u_char)(((li_vn_mode) >> 6) & 0x3))/* * Stuff for putting things back into li_vn_mode */#define PKT_LI_VN_MODE(li, vn, md) \ ((u_char)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))/* * Dealing with stratum. 0 gets mapped to 16 incoming, and back to 0 * on output. */#define PKT_TO_STRATUM(s) ((u_char)(((s) == (STRATUM_PKT_UNSPEC)) ?\ (STRATUM_UNSPEC) : (s)))#define STRATUM_TO_PKT(s) ((u_char)(((s) == (STRATUM_UNSPEC)) ?\ (STRATUM_PKT_UNSPEC) : (s)))/* * Event codes. Used for reporting errors/events to the control module */#define PEER_EVENT 0x080 /* this is a peer event */#define CRPT_EVENT 0x100 /* this is a crypto event *//* * System event codes */#define EVNT_UNSPEC 0 /* unspecified */#define EVNT_SYSRESTART 1 /* system restart */#define EVNT_SYSFAULT 2 /* wsystem or hardware fault */#define EVNT_SYNCCHG 3 /* new leap or synch change */#define EVNT_PEERSTCHG 4 /* new source or stratum */#define EVNT_CLOCKRESET 5 /* clock reset */#define EVNT_BADDATETIM 6 /* invalid time or date */#define EVNT_CLOCKEXCPT 7 /* reference clock exception *//* * Peer event codes */#define EVNT_PEERIPERR (1 | PEER_EVENT) /* IP error */#define EVNT_PEERAUTH (2 | PEER_EVENT) /* authentication failure */#define EVNT_UNREACH (3 | PEER_EVENT) /* change to unreachable */#define EVNT_REACH (4 | PEER_EVENT) /* change to reachable */#define EVNT_PEERCLOCK (5 | PEER_EVENT) /* clock exception *//* * Clock event codes */#define CEVNT_NOMINAL 0 /* unspecified */#define CEVNT_TIMEOUT 1 /* poll timeout */#define CEVNT_BADREPLY 2 /* bad reply format */#define CEVNT_FAULT 3 /* hardware or software fault */#define CEVNT_PROP 4 /* propagation failure */#define CEVNT_BADDATE 5 /* bad date format or value */#define CEVNT_BADTIME 6 /* bad time format or value */#define CEVNT_MAX CEVNT_BADTIME/* * Very misplaced value. Default port through which we send traps. */#define TRAPPORT 18447/* * To speed lookups, peers are hashed by the low order bits of the * remote IP address. These definitions relate to that. */#define NTP_HASH_SIZE 128#define NTP_HASH_MASK (NTP_HASH_SIZE-1)#define NTP_HASH_ADDR(src) sock_hash(src)/* * How we randomize polls. The poll interval is a power of two. We chose * a random interval which is this value plus-minus one second. */#define RANDPOLL(x) ((1 << (x)) - 1 + (ntp_random() & 0x3))/* * min, min3 and max. Makes it easier to transliterate the spec without * thinking about it. */#define min(a,b) (((a) < (b)) ? (a) : (b))#define max(a,b) (((a) > (b)) ? (a) : (b))#define min3(a,b,c) min(min((a),(b)), (c))/* * Configuration items. These are for the protocol module (proto_config()) */#define PROTO_BROADCLIENT 1#define PROTO_PRECISION 2 /* (not used) */#define PROTO_AUTHENTICATE 3#define PROTO_BROADDELAY 4#define PROTO_AUTHDELAY 5 /* (not used) */#define PROTO_MULTICAST_ADD 6#define PROTO_MULTICAST_DEL 7#define PROTO_NTP 8#define PROTO_KERNEL 9#define PROTO_MONITOR 10#define PROTO_FILEGEN 11#define PROTO_PPS 12#define PROTO_CAL 13#define PROTO_MINCLOCK 14#define PROTO_MAXCLOCK 15#define PROTO_MINSANE 16#define PROTO_FLOOR 17#define PROTO_CEILING 18#define PROTO_COHORT 19#define PROTO_CALLDELAY 20#define PROTO_MINDISP 21#define PROTO_MAXDIST 22#define PROTO_ADJ 23#define PROTO_MAXHOP 24#define PROTO_BEACON 25#define PROTO_ORPHAN 26/* * Configuration items for the loop filter */#define LOOP_DRIFTINIT 1 /* set initial frequency offset */#define LOOP_DRIFTCOMP 2 /* set frequency offset */#define LOOP_MAX 3 /* set step offset */#define LOOP_PANIC 4 /* set panic offseet */#define LOOP_PHI 5 /* set dispersion rate */#define LOOP_MINSTEP 6 /* set step timeout */#define LOOP_MINPOLL 7 /* set min poll interval (log2 s) */#define LOOP_ALLAN 8 /* set minimum Allan intercept */#define LOOP_HUFFPUFF 9 /* set huff-n'-puff filter length */#define LOOP_FREQ 10 /* set initial frequency *//* * Configuration items for the stats printer */#define STATS_FREQ_FILE 1 /* configure drift file */#define STATS_STATSDIR 2 /* directory prefix for stats files */#define STATS_PID_FILE 3 /* configure ntpd PID file */#define MJD_1900 15020 /* MJD for 1 Jan 1900 *//* * Default parameters. We use these in the absence of something better. */#define DEFBROADDELAY 4e-3 /* default broadcast offset */#define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 *//* * Structure used optionally for monitoring when this is turned on. */struct mon_data { struct mon_data *hash_next; /* next structure in hash list */ struct mon_data *mru_next; /* next structure in MRU list */ struct mon_data *mru_prev; /* previous structure in MRU list */ u_long drop_count; /* dropped due RESLIMIT*/ double avg_interval; /* average interpacket interval */ u_long lasttime; /* interval since last packet */ u_long count; /* total packet count */ struct sockaddr_storage rmtadr; /* address of remote host */ struct interface *interface; /* interface on which this arrived */ u_short rmtport; /* remote port last came from */ u_char mode; /* mode of incoming packet */ u_char version; /* version of incoming packet */ u_char cast_flags; /* flags MDF_?CAST */};/* * Values for cast_flags */#define MDF_UCAST 0x01 /* unicast */#define MDF_MCAST 0x02 /* multicast */#define MDF_BCAST 0x04 /* broadcast */#define MDF_LCAST 0x08 /* localcast */#define MDF_ACAST 0x10 /* manycast */#define MDF_BCLNT 0x20 /* broadcast client */#define MDF_ACLNT 0x40 /* manycast client *//* * Values used with mon_enabled to indicate reason for enabling monitoring */#define MON_OFF 0x00 /* no monitoring */#define MON_ON 0x01 /* monitoring explicitly enabled */#define MON_RES 0x02 /* implicit monitoring for RES_LIMITED *//* * Structure used for restrictlist entries */struct restrictlist { struct restrictlist *next; /* link to next entry */ u_int32 addr; /* Ipv4 host address (host byte order) */ u_int32 mask; /* Ipv4 mask for address (host byte order) */ u_long count; /* number of packets matched */ u_short flags; /* accesslist flags */ u_short mflags; /* match flags */};struct restrictlist6 { struct restrictlist6 *next; /* link to next entry */ struct in6_addr addr6; /* Ipv6 host address */ struct in6_addr mask6; /* Ipv6 mask address */ u_long count; /* number of packets matched */ u_short flags; /* accesslist flags */ u_short mflags; /* match flags */};/* * Access flags */#define RES_IGNORE 0x001 /* ignore packet */#define RES_DONTSERVE 0x002 /* access denied */#define RES_DONTTRUST 0x004 /* authentication required */#define RES_VERSION 0x008 /* version mismatch */#define RES_NOPEER 0x010 /* new association denied */#define RES_LIMITED 0x020 /* packet rate exceeded */#define RES_FLAGS (RES_IGNORE | RES_DONTSERVE |\ RES_DONTTRUST | RES_VERSION |\ RES_NOPEER | RES_LIMITED)#define RES_NOQUERY 0x040 /* mode 6/7 packet denied */#define RES_NOMODIFY 0x080 /* mode 6/7 modify denied */#define RES_NOTRAP 0x100 /* mode 6/7 set trap denied */#define RES_LPTRAP 0x200 /* mode 6/7 low priority trap */#define RES_DEMOBILIZE 0x400 /* send kiss of death packet */#define RES_TIMEOUT 0x800 /* timeout this entry */#define RES_ALLFLAGS (RES_FLAGS | RES_NOQUERY |\ RES_NOMODIFY | RES_NOTRAP |\ RES_LPTRAP | RES_DEMOBILIZE |\ RES_TIMEOUT)/* * Match flags */#define RESM_INTERFACE 0x1 /* this is an interface */#define RESM_NTPONLY 0x2 /* match ntp port only *//* * Restriction configuration ops */#define RESTRICT_FLAGS 1 /* add flags to restrict entry */#define RESTRICT_UNFLAG 2 /* remove flags from restrict entry */#define RESTRICT_REMOVE 3 /* remove a restrict entry *//* * Endpoint structure for the select algorithm */struct endpoint { double val; /* offset of endpoint */ int type; /* interval entry/exit */};/* * Association matching AM[] return codes */#define AM_ERR -1 /* error */#define AM_NOMATCH 0 /* no match */#define AM_PROCPKT 1 /* server/symmetric packet */ #define AM_BCST 2 /* broadcast packet */ #define AM_FXMIT 3 /* client packet */#define AM_MANYCAST 4 /* manycast packet */#define AM_NEWPASS 5 /* new passive */#define AM_NEWBCL 6 /* new broadcast */#define AM_POSSBCL 7 /* discard broadcast *//* NetInfo configuration locations */#ifdef HAVE_NETINFO#define NETINFO_CONFIG_DIR "/config/ntp"#endif#endif /* NTP_H */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -