2 * EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
4 * It has been AutoGen-ed March 21, 2017 at 10:42:11 AM by AutoGen 5.18.5
5 * From the definitions ntpd-opts.def
6 * and the template file options
8 * Generated from AutoOpts 41:0:16 templates.
10 * AutoOpts is a copyrighted work. This header file is not encumbered
11 * by AutoOpts licensing, but is provided under the licensing terms chosen
12 * by the ntpd author or copyright holder. AutoOpts is
13 * licensed under the terms of the LGPL. The redistributable library
14 * (``libopts'') is licensed under the terms of either the LGPL or, at the
15 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
18 * The ntpd program is copyrighted and licensed
19 * under the following terms:
21 * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.
22 * This is free software. It is licensed for use, modification and
23 * redistribution under the terms of the NTP License, copies of which
25 * <http://ntp.org/license>
26 * <http://opensource.org/licenses/ntp-license.php>
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose with or without fee is hereby granted,
30 * provided that the above copyright notice appears in all copies and that
31 * both the copyright notice and this permission notice appear in
32 * supporting documentation, and that the name The University of Delaware not be used in
33 * advertising or publicity pertaining to distribution of the software
34 * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35 * representations about the suitability this software for any purpose. It
36 * is provided "as is" without express or implied warranty.
39 * This file contains the programmatic interface to the Automated
40 * Options generated for the ntpd program.
41 * These macros are documented in the AutoGen info file in the
42 * "AutoOpts" chapter. Please refer to that doc for usage help.
44 #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
45 #define AUTOOPTS_NTPD_OPTS_H_GUARD 1
47 #include <autoopts/options.h>
50 * Ensure that the library used for compiling this generated header is at
51 * least as new as the version current when the header template was released
52 * (not counting patch version increments). Also ensure that the oldest
53 * tolerable version is at least as old as what was current when the header
54 * template was released.
56 #define AO_TEMPLATE_VERSION 167936
57 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59 # error option template version mismatches autoopts/options.h header
64 * Enumeration of each option type for ntpd
69 INDEX_OPT_AUTHREQ = 2,
70 INDEX_OPT_AUTHNOREQ = 3,
71 INDEX_OPT_BCASTSYNC = 4,
72 INDEX_OPT_CONFIGFILE = 5,
73 INDEX_OPT_DEBUG_LEVEL = 6,
74 INDEX_OPT_SET_DEBUG_LEVEL = 7,
75 INDEX_OPT_DRIFTFILE = 8,
76 INDEX_OPT_PANICGATE = 9,
77 INDEX_OPT_FORCE_STEP_ONCE = 10,
78 INDEX_OPT_JAILDIR = 11,
79 INDEX_OPT_INTERFACE = 12,
80 INDEX_OPT_KEYFILE = 13,
81 INDEX_OPT_LOGFILE = 14,
82 INDEX_OPT_NOVIRTUALIPS = 15,
83 INDEX_OPT_MODIFYMMTIMER = 16,
84 INDEX_OPT_NOFORK = 17,
86 INDEX_OPT_PIDFILE = 19,
87 INDEX_OPT_PRIORITY = 20,
89 INDEX_OPT_PROPAGATIONDELAY = 22,
90 INDEX_OPT_SAVECONFIGQUIT = 23,
91 INDEX_OPT_STATSDIR = 24,
92 INDEX_OPT_TRUSTEDKEY = 25,
94 INDEX_OPT_UPDATEINTERVAL = 27,
97 INDEX_OPT_WAIT_SYNC = 30,
99 INDEX_OPT_USEPCC = 32,
100 INDEX_OPT_PCCFREQ = 33,
102 INDEX_OPT_VERSION = 35,
104 INDEX_OPT_MORE_HELP = 37
106 /** count of all options for ntpd */
109 #define NTPD_VERSION "4.2.8p10"
110 /** Full ntpd version text */
111 #define NTPD_FULL_VERSION "ntpd 4.2.8p10"
114 * Interface defines for all options. Replace "n" with the UPPER_CASED
115 * option name (as in the teOptIndex enumeration above).
116 * e.g. HAVE_OPT(IPV4)
118 #define DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
119 /** 'true' if an option has been specified in any way */
120 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
121 /** The string argument to an option. The argument type must be \"string\". */
122 #define OPT_ARG(n) (DESC(n).optArg.argString)
123 /** Mask the option state revealing how an option was specified.
124 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
125 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
127 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
128 /** Count of option's occurrances *on the command line*. */
129 #define COUNT_OPT(n) (DESC(n).optOccCt)
130 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
131 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
132 /** 'true' if \a HAVE_OPT would yield 'false'. */
133 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
134 /** 'true' if OPTST_DISABLED bit not set. */
135 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
136 /** number of stacked option arguments.
137 * Valid only for stacked option arguments. */
138 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
139 /** stacked argument vector.
140 * Valid only for stacked option arguments. */
141 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
142 /** Reset an option. */
143 #define CLEAR_OPT(n) STMTS( \
144 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
145 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
146 DESC(n).fOptState |= OPTST_DISABLED; \
147 DESC(n).optCookie = NULL )
148 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
150 * Enumeration of ntpd exit codes
153 NTPD_EXIT_SUCCESS = 0,
154 NTPD_EXIT_FAILURE = 1,
155 NTPD_EXIT_USAGE_ERROR = 64,
156 NTPD_EXIT_LIBOPTS_FAILURE = 70
160 * Make sure there are no #define name conflicts with the option names
162 #ifndef NO_OPTION_NAME_WARNINGS
164 # warning undefining IPV4 due to option name conflict
168 # warning undefining IPV6 due to option name conflict
172 # warning undefining AUTHREQ due to option name conflict
176 # warning undefining AUTHNOREQ due to option name conflict
180 # warning undefining BCASTSYNC due to option name conflict
184 # warning undefining CONFIGFILE due to option name conflict
188 # warning undefining DEBUG_LEVEL due to option name conflict
191 # ifdef SET_DEBUG_LEVEL
192 # warning undefining SET_DEBUG_LEVEL due to option name conflict
193 # undef SET_DEBUG_LEVEL
196 # warning undefining DRIFTFILE due to option name conflict
200 # warning undefining PANICGATE due to option name conflict
203 # ifdef FORCE_STEP_ONCE
204 # warning undefining FORCE_STEP_ONCE due to option name conflict
205 # undef FORCE_STEP_ONCE
208 # warning undefining JAILDIR due to option name conflict
212 # warning undefining INTERFACE due to option name conflict
216 # warning undefining KEYFILE due to option name conflict
220 # warning undefining LOGFILE due to option name conflict
224 # warning undefining NOVIRTUALIPS due to option name conflict
227 # ifdef MODIFYMMTIMER
228 # warning undefining MODIFYMMTIMER due to option name conflict
229 # undef MODIFYMMTIMER
232 # warning undefining NOFORK due to option name conflict
236 # warning undefining NICE due to option name conflict
240 # warning undefining PIDFILE due to option name conflict
244 # warning undefining PRIORITY due to option name conflict
248 # warning undefining QUIT due to option name conflict
251 # ifdef PROPAGATIONDELAY
252 # warning undefining PROPAGATIONDELAY due to option name conflict
253 # undef PROPAGATIONDELAY
255 # ifdef SAVECONFIGQUIT
256 # warning undefining SAVECONFIGQUIT due to option name conflict
257 # undef SAVECONFIGQUIT
260 # warning undefining STATSDIR due to option name conflict
264 # warning undefining TRUSTEDKEY due to option name conflict
268 # warning undefining USER due to option name conflict
271 # ifdef UPDATEINTERVAL
272 # warning undefining UPDATEINTERVAL due to option name conflict
273 # undef UPDATEINTERVAL
276 # warning undefining VAR due to option name conflict
280 # warning undefining DVAR due to option name conflict
284 # warning undefining WAIT_SYNC due to option name conflict
288 # warning undefining SLEW due to option name conflict
292 # warning undefining USEPCC due to option name conflict
296 # warning undefining PCCFREQ due to option name conflict
300 # warning undefining MDNS due to option name conflict
303 #else /* NO_OPTION_NAME_WARNINGS */
311 # undef SET_DEBUG_LEVEL
314 # undef FORCE_STEP_ONCE
320 # undef MODIFYMMTIMER
326 # undef PROPAGATIONDELAY
327 # undef SAVECONFIGQUIT
331 # undef UPDATEINTERVAL
339 #endif /* NO_OPTION_NAME_WARNINGS */
342 * Interface defines for specific options.
345 #define VALUE_OPT_IPV4 '4'
346 #define VALUE_OPT_IPV6 '6'
347 #define VALUE_OPT_AUTHREQ 'a'
348 #define VALUE_OPT_AUTHNOREQ 'A'
349 #define VALUE_OPT_BCASTSYNC 'b'
350 #define VALUE_OPT_CONFIGFILE 'c'
351 #define VALUE_OPT_DEBUG_LEVEL 'd'
352 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
354 #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
355 #define VALUE_OPT_DRIFTFILE 'f'
356 #define VALUE_OPT_PANICGATE 'g'
357 #define VALUE_OPT_FORCE_STEP_ONCE 'G'
358 #define VALUE_OPT_JAILDIR 'i'
359 #define VALUE_OPT_INTERFACE 'I'
360 #define VALUE_OPT_KEYFILE 'k'
361 #define VALUE_OPT_LOGFILE 'l'
362 #define VALUE_OPT_NOVIRTUALIPS 'L'
363 #define VALUE_OPT_MODIFYMMTIMER 'M'
364 #define VALUE_OPT_NOFORK 'n'
365 #define VALUE_OPT_NICE 'N'
366 #define VALUE_OPT_PIDFILE 'p'
367 #define VALUE_OPT_PRIORITY 'P'
369 #define OPT_VALUE_PRIORITY (DESC(PRIORITY).optArg.argInt)
370 #define VALUE_OPT_QUIT 'q'
371 #define VALUE_OPT_PROPAGATIONDELAY 'r'
372 #define VALUE_OPT_SAVECONFIGQUIT 0x1001
373 #define VALUE_OPT_STATSDIR 's'
374 #define VALUE_OPT_TRUSTEDKEY 't'
375 #define VALUE_OPT_USER 'u'
376 #define VALUE_OPT_UPDATEINTERVAL 'U'
378 #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
379 #define VALUE_OPT_VAR 0x1002
380 #define VALUE_OPT_DVAR 0x1003
381 #define VALUE_OPT_WAIT_SYNC 'w'
382 #ifdef HAVE_WORKING_FORK
383 #define OPT_VALUE_WAIT_SYNC (DESC(WAIT_SYNC).optArg.argInt)
384 #endif /* HAVE_WORKING_FORK */
385 #define VALUE_OPT_SLEW 'x'
386 #define VALUE_OPT_USEPCC 0x1004
387 #define VALUE_OPT_PCCFREQ 0x1005
388 #define VALUE_OPT_MDNS 'm'
389 /** option flag (value) for help-value option */
390 #define VALUE_OPT_HELP '?'
391 /** option flag (value) for more-help-value option */
392 #define VALUE_OPT_MORE_HELP '!'
393 /** option flag (value) for version-value option */
394 #define VALUE_OPT_VERSION 0x1006
396 * Interface defines not associated with particular options
398 #define ERRSKIP_OPTERR STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
399 #define ERRSTOP_OPTERR STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP)
400 #define RESTART_OPT(n) STMTS( \
401 ntpdOptions.curOptIdx = (n); \
402 ntpdOptions.pzCurOpt = NULL )
403 #define START_OPT RESTART_OPT(1)
404 #define USAGE(c) (*ntpdOptions.pUsageProc)(&ntpdOptions, c)
413 * Declare the ntpd option descriptor.
415 extern tOptions ntpdOptions;
417 #if defined(ENABLE_NLS)
420 # ifndef HAVE_GETTEXT
421 extern char * gettext(char const *);
423 # include <libintl.h>
426 # ifndef ATTRIBUTE_FORMAT_ARG
427 # define ATTRIBUTE_FORMAT_ARG(_a)
430 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
431 static inline char* aoGetsText(char const* pz) {
432 if (pz == NULL) return NULL;
433 return (char*)gettext(pz);
435 # define _(s) aoGetsText(s)
438 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet |= \
439 OPTPROC_NXLAT_OPT_CFG;)
440 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet |= \
441 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
443 # define OPT_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet &= \
444 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
445 # define OPT_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet &= \
448 #else /* ENABLE_NLS */
449 # define OPT_NO_XLAT_CFG_NAMES
450 # define OPT_NO_XLAT_OPT_NAMES
452 # define OPT_XLAT_CFG_NAMES
453 # define OPT_XLAT_OPT_NAMES
458 #endif /* ENABLE_NLS */
463 #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
465 /* ntpd-opts.h ends here */