xref: /freebsd/contrib/ntp/include/ntpd.h (revision 1c05a6ea6b849ff95e539c31adea887c644a6a01)
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 int saved_argc;
325 extern char **saved_argv;
326 extern char	*sys_phone[];		/* ACTS phone numbers */
327 #if defined(HAVE_SCHED_SETSCHEDULER)
328 extern int	config_priority_override;
329 extern int	config_priority;
330 #endif
331 extern char *ntp_signd_socket;
332 extern struct config_tree_tag *cfg_tree_history;
333 
334 #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED
335 /*
336  * backwards compatibility flags
337  */
338 typedef struct bc_entry_tag {
339 	int	token;
340 	int	enabled;
341 } bc_entry;
342 
343 extern bc_entry bc_list[];
344 #endif
345 
346 /* ntp_control.c */
347 extern int	num_ctl_traps;
348 extern keyid_t	ctl_auth_keyid;		/* keyid used for authenticating write requests */
349 
350 /*
351  * Statistic counters to keep track of requests and responses.
352  */
353 extern u_long	ctltimereset;		/* time stats reset */
354 extern u_long	numctlreq;		/* number of requests we've received */
355 extern u_long	numctlbadpkts;		/* number of bad control packets */
356 extern u_long	numctlresponses; 	/* number of resp packets sent with data */
357 extern u_long	numctlfrags; 		/* number of fragments sent */
358 extern u_long	numctlerrors;		/* number of error responses sent */
359 extern u_long	numctltooshort;		/* number of too short input packets */
360 extern u_long	numctlinputresp; 	/* number of responses on input */
361 extern u_long	numctlinputfrag; 	/* number of fragments on input */
362 extern u_long	numctlinputerr;		/* number of input pkts with err bit set */
363 extern u_long	numctlbadoffset; 	/* number of input pkts with nonzero offset */
364 extern u_long	numctlbadversion;	/* number of input pkts with unknown version */
365 extern u_long	numctldatatooshort;	/* data too short for count */
366 extern u_long	numctlbadop; 		/* bad op code found in packet */
367 extern u_long	numasyncmsgs;		/* number of async messages we've sent */
368 
369 /*
370  * Other statistics of possible interest
371  */
372 extern volatile u_long packets_dropped;	/* total number of packets dropped on reception */
373 extern volatile u_long packets_ignored;	/* packets received on wild card interface */
374 extern volatile u_long packets_received;/* total number of packets received */
375 extern u_long	packets_sent;		/* total number of packets sent */
376 extern u_long	packets_notsent; 	/* total number of packets which couldn't be sent */
377 
378 extern volatile u_long handler_calls;	/* number of calls to interrupt handler */
379 extern volatile u_long handler_pkts;	/* number of pkts received by handler */
380 extern u_long	io_timereset;		/* time counters were reset */
381 
382 /* ntp_io.c */
383 extern  int	disable_dynamic_updates;
384 extern u_int	sys_ifnum;		/* next .ifnum to assign */
385 extern endpt *	any_interface;		/* IPv4 wildcard */
386 extern endpt *	any6_interface;		/* IPv6 wildcard */
387 extern endpt *	loopback_interface;	/* IPv4 loopback for refclocks */
388 extern endpt *	ep_list;		/* linked list */
389 
390 /* ntp_loopfilter.c */
391 extern double	drift_comp;		/* clock frequency (s/s) */
392 extern double	clock_stability;	/* clock stability (s/s) */
393 extern double	clock_max_back;		/* max backward offset before step (s) */
394 extern double	clock_max_fwd;		/* max forward offset before step (s) */
395 extern double	clock_panic;		/* max offset before panic (s) */
396 extern double	clock_phi;		/* dispersion rate (s/s) */
397 extern double	clock_minstep;		/* step timeout (s) */
398 extern double	clock_codec;		/* codec frequency */
399 #ifdef KERNEL_PLL
400 extern int	pll_status;		/* status bits for kernel pll */
401 #endif /* KERNEL_PLL */
402 
403 /*
404  * Clock state machine control flags
405  */
406 extern int	ntp_enable;		/* clock discipline enabled */
407 extern int	pll_control;		/* kernel support available */
408 extern int	kern_enable;		/* kernel support enabled */
409 extern int	hardpps_enable;		/* kernel PPS discipline enabled */
410 extern int	ext_enable;		/* external clock enabled */
411 extern int	cal_enable;		/* refclock calibrate enable */
412 extern int	allow_panic;		/* allow panic correction (-g) */
413 extern int	enable_panic_check;	/* Can we check allow_panic's state? */
414 extern int	force_step_once;	/* always step time once at startup (-G) */
415 extern int	mode_ntpdate;		/* exit on first clock set (-q) */
416 extern int	peer_ntpdate;		/* count of ntpdate peers */
417 
418 /*
419  * Clock state machine variables
420  */
421 extern u_char	sys_poll;		/* system poll interval (log2 s) */
422 extern int	state;			/* clock discipline state */
423 extern int	tc_counter;		/* poll-adjust counter */
424 extern u_long	last_time;		/* time of last clock update (s) */
425 extern double	last_offset;		/* last clock offset (s) */
426 extern u_char	allan_xpt;		/* Allan intercept (log2 s) */
427 extern double	clock_jitter;		/* clock jitter (s) */
428 extern double	sys_offset;		/* system offset (s) */
429 extern double	sys_jitter;		/* system jitter (s) */
430 
431 /* ntp_monitor.c */
432 extern u_char	mon_hash_bits;		/* log2 size of hash table */
433 extern mon_entry ** mon_hash;		/* MRU hash table */
434 extern mon_entry mon_mru_list;		/* mru listhead */
435 extern u_int	mon_enabled;		/* MON_OFF (0) or other MON_* */
436 extern u_int	mru_alloc;		/* mru list + free list count */
437 extern u_int	mru_entries;		/* mru list count */
438 extern u_int	mru_peakentries;	/* highest mru_entries */
439 extern u_int	mru_initalloc;		/* entries to preallocate */
440 extern u_int	mru_incalloc;		/* allocation batch factor */
441 extern u_int	mru_mindepth;		/* preempt above this */
442 extern int	mru_maxage;		/* for entries older than */
443 extern u_int	mru_maxdepth; 		/* MRU size hard limit */
444 extern int	mon_age;		/* preemption limit */
445 
446 /* ntp_peer.c */
447 extern struct peer *peer_hash[NTP_HASH_SIZE];	/* peer hash table */
448 extern int	peer_hash_count[NTP_HASH_SIZE];	/* count of in each bucket */
449 extern struct peer *assoc_hash[NTP_HASH_SIZE];	/* association ID hash table */
450 extern int	assoc_hash_count[NTP_HASH_SIZE];/* count of in each bucket */
451 extern struct peer *peer_list;		/* peer structures list */
452 extern int	peer_count;		/* count in peer_list */
453 extern int	peer_free_count;	/* count in peer_free */
454 
455 /*
456  * Miscellaneous statistic counters which may be queried.
457  */
458 extern u_long	peer_timereset;		/* time stat counters were zeroed */
459 extern u_long	findpeer_calls;		/* number of calls to findpeer */
460 extern u_long	assocpeer_calls;	/* number of calls to findpeerbyassoc */
461 extern u_long	peer_allocations;	/* number of allocations from the free list */
462 extern u_long	peer_demobilizations;	/* number of structs freed to free list */
463 extern int	total_peer_structs;	/* number of peer structs in circulation */
464 extern int	peer_associations;	/* mobilized associations */
465 extern int	peer_preempt;		/* preemptable associations */
466 
467 /* ntp_proto.c */
468 /*
469  * System variables are declared here.	See Section 3.2 of the
470  * specification.
471  */
472 extern u_char	sys_leap;		/* system leap indicator */
473 extern u_char	sys_stratum;		/* system stratum */
474 extern s_char	sys_precision;		/* local clock precision */
475 extern double	sys_rootdelay;		/* roundtrip delay to primary source */
476 extern double	sys_rootdisp;		/* dispersion to primary source */
477 extern u_int32	sys_refid;		/* reference id */
478 extern l_fp	sys_reftime;		/* last update time */
479 extern struct peer *sys_peer;		/* current peer */
480 
481 /*
482  * Nonspecified system state variables.
483  */
484 extern int	sys_bclient;		/* we set our time to broadcasts */
485 extern double	sys_bdelay; 		/* broadcast client default delay */
486 extern int	sys_authenticate;	/* requre authentication for config */
487 extern l_fp	sys_authdelay;		/* authentication delay */
488 extern u_char	sys_bcpollbstep;	/* broadcast poll backstep gate */
489 extern u_long 	sys_epoch;		/* last clock update time */
490 extern keyid_t	sys_private;		/* private value for session seed */
491 extern int	sys_manycastserver;	/* respond to manycast client pkts */
492 extern int	sys_maxclock;		/* maximum survivors */
493 extern int	sys_minclock;		/* minimum survivors */
494 extern int	sys_minsane;		/* minimum candidates */
495 extern int	sys_floor;		/* cluster stratum floor */
496 extern int	sys_ceiling;		/* cluster stratum ceiling */
497 extern u_char	sys_ttl[MAX_TTL];	/* ttl mapping vector */
498 extern u_int	sys_ttlmax;		/* max ttl mapping vector index */
499 
500 /*
501  * Statistics counters
502  */
503 extern u_long	sys_stattime;		/* time since reset */
504 extern u_long	sys_received;		/* packets received */
505 extern u_long	sys_processed;		/* packets for this host */
506 extern u_long	sys_restricted;	 	/* restricted packets */
507 extern u_long	sys_newversion;		/* current version  */
508 extern u_long	sys_oldversion;		/* old version */
509 extern u_long	sys_restricted;		/* access denied */
510 extern u_long	sys_badlength;		/* bad length or format */
511 extern u_long	sys_badauth;		/* bad authentication */
512 extern u_long	sys_declined;		/* declined */
513 extern u_long	sys_limitrejected;	/* rate exceeded */
514 extern u_long	sys_kodsent;		/* KoD sent */
515 
516 /* ntp_request.c */
517 extern keyid_t	info_auth_keyid;	/* keyid used to authenticate requests */
518 extern u_long	auth_timereset;
519 
520 /* ntp_restrict.c */
521 extern restrict_u *	restrictlist4;	/* IPv4 restriction list */
522 extern restrict_u *	restrictlist6;	/* IPv6 restriction list */
523 extern int		ntp_minpkt;
524 extern u_char		ntp_minpoll;
525 
526 /* ntp_scanner.c */
527 extern u_int32		conf_file_sum;	/* Simple sum of characters */
528 
529 /* ntp_signd.c */
530 #ifdef HAVE_NTP_SIGND
531 extern void send_via_ntp_signd(struct recvbuf *, int, keyid_t, int,
532 			       struct pkt *);
533 #endif
534 
535 /* ntp_timer.c */
536 extern volatile int alarm_flag;		/* alarm flag */
537 extern volatile u_long alarm_overflow;
538 extern u_long	current_time;		/* seconds since startup */
539 extern u_long	timer_timereset;
540 extern u_long	timer_overflows;
541 extern u_long	timer_xmtcalls;
542 extern int	leap_sec_in_progress;
543 #ifdef LEAP_SMEAR
544 extern struct leap_smear_info leap_smear;
545 extern int	leap_smear_intv;
546 #endif
547 #ifdef SYS_WINNT
548 HANDLE WaitableTimerHandle;
549 #endif
550 
551 /* ntp_util.c */
552 extern	char	statsdir[MAXFILENAME];
553 extern	int	stats_control;		/* write stats to fileset? */
554 extern	int	stats_write_period;	/* # of seconds between writes. */
555 extern	double	stats_write_tolerance;
556 extern	double	wander_threshold;
557 
558 /* ntpd.c */
559 extern	int	nofork;		/* no-fork flag */
560 extern	int	initializing;	/* initializing flag */
561 #ifdef HAVE_DROPROOT
562 extern	int	droproot;	/* flag: try to drop root privileges after startup */
563 extern	int	root_dropped;	/* root has been dropped */
564 extern char *user;		/* user to switch to */
565 extern char *group;		/* group to switch to */
566 extern const char *chrootdir;	/* directory to chroot() to */
567 #endif
568 #ifdef HAVE_WORKING_FORK
569 extern	int	waitsync_fd_to_close;	/* -w/--wait-sync */
570 #endif
571 
572 /* ntservice.c */
573 #ifdef SYS_WINNT
574 extern int accept_wildcard_if_for_winnt;
575 #endif
576 
577 /* refclock_conf.c */
578 #ifdef REFCLOCK
579 /* refclock configuration table */
580 extern struct refclock * const refclock_conf[];
581 extern u_char	num_refclock_conf;
582 #endif
583 
584