xref: /freebsd/contrib/ntp/include/ntpd.h (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1 /*
2  * ntpd.h - Prototypes and external variables for ntpd.
3  *
4  * Note the first half is primarily function prototypes, type
5  * declarations, and preprocessor macros, with variables declared
6  * primarily in the second half.
7  *
8  * Each half is further divided into sections for each source file.
9  */
10 
11 #include "ntp.h"
12 #include "ntp_stdlib.h"
13 #include "ntp_syslog.h"
14 #include "ntp_debug.h"
15 #include "ntp_syslog.h"
16 #include "ntp_select.h"
17 #include "ntp_malloc.h"
18 #include "ntp_refclock.h"
19 #include "ntp_intres.h"
20 #include "recvbuff.h"
21 
22 /*
23  * First half: ntpd types, functions, macros
24  * -----------------------------------------
25  */
26 
27 /*
28  * macro for debugging output - cut down on #ifdef pollution.
29  *
30  * DPRINTF() is for use by ntpd only, and compiles away to nothing
31  * without DEBUG (configure --disable-debugging).
32  *
33  * TRACE() is similar for libntp and utilities, which retain full
34  * debug capability even when compiled without DEBUG.
35  *
36  * The calling convention is not attractive:
37  *     DPRINTF(debuglevel, (fmt, ...));
38  *     DPRINTF(2, ("shows #ifdef DEBUG and if debug >= %d\n", 2));
39  */
40 #ifdef DEBUG
41 # define DPRINTF(lvl, arg)				\
42 	do { 						\
43 		if (debug >= (lvl))			\
44 			mprintf arg;			\
45 	} while (0)
46 #else
47 # define DPRINTF(lvl, arg)	do {} while (0)
48 #endif
49 
50 
51 /* nt_clockstuff.c */
52 #ifdef SYS_WINNT
53 extern	void	win_time_stepped(void);
54 #endif
55 
56 /* ntp_config.c */
57 #define	TAI_1972	10	/* initial TAI offset (s) */
58 extern	char	*keysdir;	/* crypto keys and leaptable directory */
59 extern	char *	saveconfigdir;	/* ntpq saveconfig output directory */
60 
61 extern	void	getconfig	(int, char **);
62 extern	void	ctl_clr_stats	(void);
63 extern	int	ctlclrtrap	(sockaddr_u *, struct interface *, int);
64 extern	u_short ctlpeerstatus	(struct peer *);
65 extern	int	ctlsettrap	(sockaddr_u *, struct interface *, int, int);
66 extern	u_short ctlsysstatus	(void);
67 extern	void	init_control	(void);
68 extern	void	process_control (struct recvbuf *, int);
69 extern	void	report_event	(int, struct peer *, const char *);
70 extern	int	mprintf_event	(int, struct peer *, const char *, ...)
71 			NTP_PRINTF(3, 4);
72 
73 /* ntp_control.c */
74 /*
75  * Structure for translation tables between internal system
76  * variable indices and text format.
77  */
78 struct ctl_var {
79 	u_short code;
80 	u_short flags;
81 	const char *text;
82 };
83 /*
84  * Flag values
85  */
86 #define	CAN_READ	0x01
87 #define	CAN_WRITE	0x02
88 
89 #define DEF		0x20
90 #define	PADDING		0x40
91 #define	EOV		0x80
92 
93 #define	RO	(CAN_READ)
94 #define	WO	(CAN_WRITE)
95 #define	RW	(CAN_READ|CAN_WRITE)
96 
97 extern	char *	add_var (struct ctl_var **, u_long, u_short);
98 extern	void	free_varlist (struct ctl_var *);
99 extern	void	set_var (struct ctl_var **, const char *, u_long, u_short);
100 extern	void	set_sys_var (const char *, u_long, u_short);
101 extern	const char *	get_ext_sys_var(const char *tag);
102 
103 /* ntp_io.c */
104 typedef struct interface_info {
105 	endpt *	ep;
106 	u_char	action;
107 } interface_info_t;
108 
109 typedef void	(*interface_receiver_t)	(void *, interface_info_t *);
110 
111 extern	void	interface_enumerate	(interface_receiver_t, void *);
112 extern	endpt *	getinterface		(sockaddr_u *, u_int32);
113 extern	endpt *	select_peerinterface	(struct peer *, sockaddr_u *,
114 					 endpt *);
115 extern	endpt *	findinterface		(sockaddr_u *);
116 extern	endpt *	findbcastinter		(sockaddr_u *);
117 extern	void	enable_broadcast	(endpt *, sockaddr_u *);
118 extern	void	enable_multicast_if	(endpt *, sockaddr_u *);
119 extern	void	interface_update	(interface_receiver_t, void *);
120 #ifndef HAVE_IO_COMPLETION_PORT
121 extern  void    io_handler              (void);
122 #endif
123 extern	void	init_io 	(void);
124 extern	void	io_open_sockets	(void);
125 extern	void	io_clr_stats	(void);
126 extern	void	io_setbclient	(void);
127 extern	void	io_unsetbclient	(void);
128 extern	void	io_multicast_add(sockaddr_u *);
129 extern	void	io_multicast_del(sockaddr_u *);
130 extern	void	sendpkt 	(sockaddr_u *, struct interface *, int, struct pkt *, int);
131 #ifdef DEBUG
132 extern	void	collect_timing  (struct recvbuf *, const char *, int, l_fp *);
133 #endif
134 #ifdef HAVE_SIGNALED_IO
135 extern	void	wait_for_signal		(void);
136 extern	void	unblock_io_and_alarm	(void);
137 extern	void	block_io_and_alarm	(void);
138 # define	UNBLOCK_IO_AND_ALARM()	unblock_io_and_alarm()
139 # define	BLOCK_IO_AND_ALARM()	block_io_and_alarm()
140 #else
141 # define	UNBLOCK_IO_AND_ALARM()	do {} while (0)
142 # define	BLOCK_IO_AND_ALARM()	do {} while (0)
143 #endif
144 #define		latoa(pif)	localaddrtoa(pif)
145 extern const char * localaddrtoa(endpt *);
146 
147 /* ntp_loopfilter.c */
148 extern	void	init_loopfilter(void);
149 extern	int 	local_clock(struct peer *, double);
150 extern	void	adj_host_clock(void);
151 extern	void	loop_config(int, double);
152 extern	void	select_loop(int);
153 extern	void	huffpuff(void);
154 extern	u_long	sys_clocktime;
155 extern	u_int	sys_tai;
156 extern 	int	freq_cnt;
157 
158 /* ntp_monitor.c */
159 #define MON_HASH_SIZE		((size_t)1U << mon_hash_bits)
160 #define MON_HASH_MASK		(MON_HASH_SIZE - 1)
161 #define	MON_HASH(addr)		(sock_hash(addr) & MON_HASH_MASK)
162 extern	void	init_mon	(void);
163 extern	void	mon_start	(int);
164 extern	void	mon_stop	(int);
165 extern	u_short	ntp_monitor	(struct recvbuf *, u_short);
166 extern	void	mon_clearinterface(endpt *interface);
167 
168 /* ntp_peer.c */
169 extern	void	init_peer	(void);
170 extern	struct peer *findexistingpeer(sockaddr_u *, const char *,
171 				      struct peer *, int, u_char);
172 extern	struct peer *findpeer	(struct recvbuf *, int, int *);
173 extern	struct peer *findpeerbyassoc(associd_t);
174 extern  void	set_peerdstadr	(struct peer *, endpt *);
175 extern	struct peer *newpeer	(sockaddr_u *, const char *,
176 				 endpt *, u_char, u_char,
177 				 u_char, u_char, u_int, u_char, u_int32,
178 				 keyid_t, const char *);
179 extern	void	peer_all_reset	(void);
180 extern	void	peer_clr_stats	(void);
181 extern	struct peer *peer_config(sockaddr_u *, const char *,
182 				 endpt *, u_char, u_char,
183 				 u_char, u_char, u_int, u_int32,
184 				 keyid_t, const char *);
185 extern	void	peer_reset	(struct peer *);
186 extern	void	refresh_all_peerinterfaces(void);
187 extern	void	unpeer		(struct peer *);
188 extern	void	clear_all	(void);
189 extern	int	score_all	(struct peer *);
190 extern	struct peer *findmanycastpeer(struct recvbuf *);
191 extern	void	peer_cleanup	(void);
192 
193 /* ntp_crypto.c */
194 #ifdef AUTOKEY
195 extern	int	crypto_recv	(struct peer *, struct recvbuf *);
196 extern	int	crypto_xmit	(struct peer *, struct pkt *,
197 				    struct recvbuf *, int,
198 				    struct exten *, keyid_t);
199 extern	keyid_t	session_key	(sockaddr_u *, sockaddr_u *, keyid_t,
200 				    keyid_t, u_long);
201 extern	int	make_keylist	(struct peer *, struct interface *);
202 extern	void	key_expire	(struct peer *);
203 extern	void	crypto_update	(void);
204 extern	void	crypto_update_taichange(void);
205 extern	void	crypto_config	(int, char *);
206 extern	void	crypto_setup	(void);
207 extern	u_int	crypto_ident	(struct peer *);
208 extern	struct exten *crypto_args (struct peer *, u_int, associd_t, char *);
209 extern	int	crypto_public	(struct peer *, u_char *, u_int);
210 extern	void	value_free	(struct value *);
211 extern	char	*iffpar_file;
212 extern	EVP_PKEY *iffpar_pkey;
213 extern	char	*gqpar_file;
214 extern	EVP_PKEY *gqpar_pkey;
215 extern	char	*mvpar_file;
216 extern	EVP_PKEY *mvpar_pkey;
217 extern struct value tai_leap;
218 #endif	/* AUTOKEY */
219 
220 /* ntp_proto.c */
221 extern	void	transmit	(struct peer *);
222 extern	void	receive 	(struct recvbuf *);
223 extern	void	peer_clear	(struct peer *, const char *);
224 extern	void 	process_packet	(struct peer *, struct pkt *, u_int);
225 extern	void	clock_select	(void);
226 extern	void	set_sys_leap	(u_char);
227 
228 extern	u_long	leapsec;	/* seconds to next leap (proximity class) */
229 extern  int     leapdif;        /* TAI difference step at next leap second*/
230 extern	int	sys_orphan;
231 extern	double	sys_mindisp;
232 extern	double	sys_maxdist;
233 
234 extern	char	*sys_ident;	/* identity scheme */
235 extern	void	poll_update	(struct peer *, u_char);
236 
237 extern	void	clear		(struct peer *);
238 extern	void	clock_filter	(struct peer *, double, double, double);
239 extern	void	init_proto	(void);
240 extern	void	set_sys_tick_precision(double);
241 extern	void	proto_config	(int, u_long, double, sockaddr_u *);
242 extern	void	proto_clr_stats (void);
243 
244 /* ntp_refclock.c */
245 #ifdef	REFCLOCK
246 extern	int	refclock_newpeer (struct peer *);
247 extern	void	refclock_unpeer (struct peer *);
248 extern	void	refclock_receive (struct peer *);
249 extern	void	refclock_transmit (struct peer *);
250 extern	void	init_refclock	(void);
251 #endif	/* REFCLOCK */
252 
253 /* ntp_request.c */
254 extern	void	init_request	(void);
255 extern	void	process_private (struct recvbuf *, int);
256 extern	void	reset_auth_stats(void);
257 
258 /* ntp_restrict.c */
259 extern	void	init_restrict	(void);
260 extern	u_short	restrictions	(sockaddr_u *);
261 extern	void	hack_restrict	(int, sockaddr_u *, sockaddr_u *,
262 				 u_short, u_short, u_long);
263 extern	void	restrict_source	(sockaddr_u *, int, u_long);
264 
265 /* ntp_timer.c */
266 extern	void	init_timer	(void);
267 extern	void	reinit_timer	(void);
268 extern	void	timer		(void);
269 extern	void	timer_clr_stats (void);
270 extern	void	timer_interfacetimeout (u_long);
271 extern	volatile int interface_interval;
272 extern	u_long	orphwait;		/* orphan wait time */
273 #ifdef AUTOKEY
274 extern	char	*sys_hostname;	/* host name */
275 extern	char	*sys_groupname;	/* group name */
276 extern	char	*group_name;	/* group name */
277 extern	u_long	sys_revoke;	/* keys revoke timeout */
278 extern	u_long	sys_automax;	/* session key timeout */
279 #endif	/* AUTOKEY */
280 
281 /* ntp_util.c */
282 extern	void	init_util	(void);
283 extern	void	write_stats	(void);
284 extern	void	stats_config	(int, const char *);
285 extern	void	record_peer_stats (sockaddr_u *, int, double, double, double, double);
286 extern	void	record_proto_stats (char *);
287 extern	void	record_loop_stats (double, double, double, double, int);
288 extern	void	record_clock_stats (sockaddr_u *, const char *);
289 extern	int	mprintf_clock_stats(sockaddr_u *, const char *, ...)
290 			NTP_PRINTF(2, 3);
291 extern	void	record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int ppoll, int precision, double root_delay, double root_dispersion, u_int32 refid);
292 extern	void	check_leap_file	(int is_daily_check, u_int32 ntptime, const time_t * systime);
293 extern	void	record_crypto_stats (sockaddr_u *, const char *);
294 #ifdef DEBUG
295 extern	void	record_timing_stats (const char *);
296 #endif
297 extern	char *	fstostr(time_t);	/* NTP timescale seconds */
298 
299 /* ntpd.c */
300 extern	void	parse_cmdline_opts(int *, char ***);
301 /*
302  * Signals we catch for debugging.
303  */
304 #define MOREDEBUGSIG	SIGUSR1
305 #define LESSDEBUGSIG	SIGUSR2
306 /*
307  * Signals which terminate us gracefully.
308  */
309 #ifndef SYS_WINNT
310 # define SIGDIE1	SIGHUP
311 # define SIGDIE2	SIGINT
312 # define SIGDIE3	SIGQUIT
313 # define SIGDIE4	SIGTERM
314 #endif /* SYS_WINNT */
315 
316 
317 /*
318  * Last half: ntpd variables
319  * -------------------------
320  */
321 
322 /* ntp_config.c */
323 extern char const *	progname;
324 extern char	*sys_phone[];		/* ACTS phone numbers */
325 #if defined(HAVE_SCHED_SETSCHEDULER)
326 extern int	config_priority_override;
327 extern int	config_priority;
328 #endif
329 extern char *ntp_signd_socket;
330 extern struct config_tree_tag *cfg_tree_history;
331 
332 #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED
333 /*
334  * backwards compatibility flags
335  */
336 typedef struct bc_entry_tag {
337 	int	token;
338 	int	enabled;
339 } bc_entry;
340 
341 extern bc_entry bc_list[];
342 #endif
343 
344 /* ntp_control.c */
345 extern int	num_ctl_traps;
346 extern keyid_t	ctl_auth_keyid;		/* keyid used for authenticating write requests */
347 
348 /*
349  * Statistic counters to keep track of requests and responses.
350  */
351 extern u_long	ctltimereset;		/* time stats reset */
352 extern u_long	numctlreq;		/* number of requests we've received */
353 extern u_long	numctlbadpkts;		/* number of bad control packets */
354 extern u_long	numctlresponses; 	/* number of resp packets sent with data */
355 extern u_long	numctlfrags; 		/* number of fragments sent */
356 extern u_long	numctlerrors;		/* number of error responses sent */
357 extern u_long	numctltooshort;		/* number of too short input packets */
358 extern u_long	numctlinputresp; 	/* number of responses on input */
359 extern u_long	numctlinputfrag; 	/* number of fragments on input */
360 extern u_long	numctlinputerr;		/* number of input pkts with err bit set */
361 extern u_long	numctlbadoffset; 	/* number of input pkts with nonzero offset */
362 extern u_long	numctlbadversion;	/* number of input pkts with unknown version */
363 extern u_long	numctldatatooshort;	/* data too short for count */
364 extern u_long	numctlbadop; 		/* bad op code found in packet */
365 extern u_long	numasyncmsgs;		/* number of async messages we've sent */
366 
367 /*
368  * Other statistics of possible interest
369  */
370 extern volatile u_long packets_dropped;	/* total number of packets dropped on reception */
371 extern volatile u_long packets_ignored;	/* packets received on wild card interface */
372 extern volatile u_long packets_received;/* total number of packets received */
373 extern u_long	packets_sent;		/* total number of packets sent */
374 extern u_long	packets_notsent; 	/* total number of packets which couldn't be sent */
375 
376 extern volatile u_long handler_calls;	/* number of calls to interrupt handler */
377 extern volatile u_long handler_pkts;	/* number of pkts received by handler */
378 extern u_long	io_timereset;		/* time counters were reset */
379 
380 /* ntp_io.c */
381 extern  int	disable_dynamic_updates;
382 extern u_int	sys_ifnum;		/* next .ifnum to assign */
383 extern endpt *	any_interface;		/* IPv4 wildcard */
384 extern endpt *	any6_interface;		/* IPv6 wildcard */
385 extern endpt *	loopback_interface;	/* IPv4 loopback for refclocks */
386 extern endpt *	ep_list;		/* linked list */
387 
388 /* ntp_loopfilter.c */
389 extern double	drift_comp;		/* clock frequency (s/s) */
390 extern double	clock_stability;	/* clock stability (s/s) */
391 extern double	clock_max_back;		/* max backward offset before step (s) */
392 extern double	clock_max_fwd;		/* max forward offset before step (s) */
393 extern double	clock_panic;		/* max offset before panic (s) */
394 extern double	clock_phi;		/* dispersion rate (s/s) */
395 extern double	clock_minstep;		/* step timeout (s) */
396 extern double	clock_codec;		/* codec frequency */
397 #ifdef KERNEL_PLL
398 extern int	pll_status;		/* status bits for kernel pll */
399 #endif /* KERNEL_PLL */
400 
401 /*
402  * Clock state machine control flags
403  */
404 extern int	ntp_enable;		/* clock discipline enabled */
405 extern int	pll_control;		/* kernel support available */
406 extern int	kern_enable;		/* kernel support enabled */
407 extern int	hardpps_enable;		/* kernel PPS discipline enabled */
408 extern int	ext_enable;		/* external clock enabled */
409 extern int	cal_enable;		/* refclock calibrate enable */
410 extern int	allow_panic;		/* allow panic correction (-g) */
411 extern int	enable_panic_check;	/* Can we check allow_panic's state? */
412 extern int	force_step_once;	/* always step time once at startup (-G) */
413 extern int	mode_ntpdate;		/* exit on first clock set (-q) */
414 extern int	peer_ntpdate;		/* count of ntpdate peers */
415 
416 /*
417  * Clock state machine variables
418  */
419 extern u_char	sys_poll;		/* system poll interval (log2 s) */
420 extern int	state;			/* clock discipline state */
421 extern int	tc_counter;		/* poll-adjust counter */
422 extern u_long	last_time;		/* time of last clock update (s) */
423 extern double	last_offset;		/* last clock offset (s) */
424 extern u_char	allan_xpt;		/* Allan intercept (log2 s) */
425 extern double	clock_jitter;		/* clock jitter (s) */
426 extern double	sys_offset;		/* system offset (s) */
427 extern double	sys_jitter;		/* system jitter (s) */
428 
429 /* ntp_monitor.c */
430 extern u_char	mon_hash_bits;		/* log2 size of hash table */
431 extern mon_entry ** mon_hash;		/* MRU hash table */
432 extern mon_entry mon_mru_list;		/* mru listhead */
433 extern u_int	mon_enabled;		/* MON_OFF (0) or other MON_* */
434 extern u_int	mru_alloc;		/* mru list + free list count */
435 extern u_int	mru_entries;		/* mru list count */
436 extern u_int	mru_peakentries;	/* highest mru_entries */
437 extern u_int	mru_initalloc;		/* entries to preallocate */
438 extern u_int	mru_incalloc;		/* allocation batch factor */
439 extern u_int	mru_mindepth;		/* preempt above this */
440 extern int	mru_maxage;		/* for entries older than */
441 extern u_int	mru_maxdepth; 		/* MRU size hard limit */
442 extern int	mon_age;		/* preemption limit */
443 
444 /* ntp_peer.c */
445 extern struct peer *peer_hash[NTP_HASH_SIZE];	/* peer hash table */
446 extern int	peer_hash_count[NTP_HASH_SIZE];	/* count of in each bucket */
447 extern struct peer *assoc_hash[NTP_HASH_SIZE];	/* association ID hash table */
448 extern int	assoc_hash_count[NTP_HASH_SIZE];/* count of in each bucket */
449 extern struct peer *peer_list;		/* peer structures list */
450 extern int	peer_count;		/* count in peer_list */
451 extern int	peer_free_count;	/* count in peer_free */
452 
453 /*
454  * Miscellaneous statistic counters which may be queried.
455  */
456 extern u_long	peer_timereset;		/* time stat counters were zeroed */
457 extern u_long	findpeer_calls;		/* number of calls to findpeer */
458 extern u_long	assocpeer_calls;	/* number of calls to findpeerbyassoc */
459 extern u_long	peer_allocations;	/* number of allocations from the free list */
460 extern u_long	peer_demobilizations;	/* number of structs freed to free list */
461 extern int	total_peer_structs;	/* number of peer structs in circulation */
462 extern int	peer_associations;	/* mobilized associations */
463 extern int	peer_preempt;		/* preemptable associations */
464 
465 /* ntp_proto.c */
466 /*
467  * System variables are declared here.	See Section 3.2 of the
468  * specification.
469  */
470 extern u_char	sys_leap;		/* system leap indicator */
471 extern u_char	sys_stratum;		/* system stratum */
472 extern s_char	sys_precision;		/* local clock precision */
473 extern double	sys_rootdelay;		/* roundtrip delay to primary source */
474 extern double	sys_rootdisp;		/* dispersion to primary source */
475 extern u_int32	sys_refid;		/* reference id */
476 extern l_fp	sys_reftime;		/* last update time */
477 extern struct peer *sys_peer;		/* current peer */
478 
479 /*
480  * Nonspecified system state variables.
481  */
482 extern int	sys_bclient;		/* we set our time to broadcasts */
483 extern double	sys_bdelay; 		/* broadcast client default delay */
484 extern int	sys_authenticate;	/* requre authentication for config */
485 extern l_fp	sys_authdelay;		/* authentication delay */
486 extern u_long 	sys_epoch;		/* last clock update time */
487 extern keyid_t	sys_private;		/* private value for session seed */
488 extern int	sys_manycastserver;	/* respond to manycast client pkts */
489 extern int	sys_minclock;		/* minimum survivors */
490 extern int	sys_minsane;		/* minimum candidates */
491 extern int	sys_floor;		/* cluster stratum floor */
492 extern int	sys_ceiling;		/* cluster stratum ceiling */
493 extern u_char	sys_ttl[MAX_TTL];	/* ttl mapping vector */
494 extern int	sys_ttlmax;		/* max ttl mapping vector index */
495 
496 /*
497  * Statistics counters
498  */
499 extern u_long	sys_stattime;		/* time since reset */
500 extern u_long	sys_received;		/* packets received */
501 extern u_long	sys_processed;		/* packets for this host */
502 extern u_long	sys_restricted;	 	/* restricted packets */
503 extern u_long	sys_newversion;		/* current version  */
504 extern u_long	sys_oldversion;		/* old version */
505 extern u_long	sys_restricted;		/* access denied */
506 extern u_long	sys_badlength;		/* bad length or format */
507 extern u_long	sys_badauth;		/* bad authentication */
508 extern u_long	sys_declined;		/* declined */
509 extern u_long	sys_limitrejected;	/* rate exceeded */
510 extern u_long	sys_kodsent;		/* KoD sent */
511 
512 /* ntp_request.c */
513 extern keyid_t	info_auth_keyid;	/* keyid used to authenticate requests */
514 extern u_long	auth_timereset;
515 
516 /* ntp_restrict.c */
517 extern restrict_u *	restrictlist4;	/* IPv4 restriction list */
518 extern restrict_u *	restrictlist6;	/* IPv6 restriction list */
519 extern int		ntp_minpkt;
520 extern u_char		ntp_minpoll;
521 
522 /* ntp_scanner.c */
523 extern u_int32		conf_file_sum;	/* Simple sum of characters */
524 
525 /* ntp_signd.c */
526 #ifdef HAVE_NTP_SIGND
527 extern void send_via_ntp_signd(struct recvbuf *, int, keyid_t, int,
528 			       struct pkt *);
529 #endif
530 
531 /* ntp_timer.c */
532 extern volatile int alarm_flag;		/* alarm flag */
533 extern volatile u_long alarm_overflow;
534 extern u_long	current_time;		/* seconds since startup */
535 extern u_long	timer_timereset;
536 extern u_long	timer_overflows;
537 extern u_long	timer_xmtcalls;
538 extern int	leap_sec_in_progress;
539 #ifdef LEAP_SMEAR
540 extern struct leap_smear_info leap_smear;
541 extern int	leap_smear_intv;
542 #endif
543 #ifdef SYS_WINNT
544 HANDLE WaitableTimerHandle;
545 #endif
546 
547 /* ntp_util.c */
548 extern	char	statsdir[MAXFILENAME];
549 extern	int	stats_control;		/* write stats to fileset? */
550 extern	int	stats_write_period;	/* # of seconds between writes. */
551 extern	double	stats_write_tolerance;
552 extern	double	wander_threshold;
553 
554 /* ntpd.c */
555 extern	int	nofork;		/* no-fork flag */
556 extern	int	initializing;	/* initializing flag */
557 #ifdef HAVE_DROPROOT
558 extern	int	droproot;	/* flag: try to drop root privileges after startup */
559 extern	int	root_dropped;	/* root has been dropped */
560 extern char *user;		/* user to switch to */
561 extern char *group;		/* group to switch to */
562 extern const char *chrootdir;	/* directory to chroot() to */
563 #endif
564 #ifdef HAVE_WORKING_FORK
565 extern	int	waitsync_fd_to_close;	/* -w/--wait-sync */
566 #endif
567 
568 /* ntservice.c */
569 #ifdef SYS_WINNT
570 extern int accept_wildcard_if_for_winnt;
571 #endif
572 
573 /* refclock_conf.c */
574 #ifdef REFCLOCK
575 /* refclock configuration table */
576 extern struct refclock * const refclock_conf[];
577 extern u_char	num_refclock_conf;
578 #endif
579 
580