xref: /netbsd-src/external/bsd/ntp/dist/ntpd/ntpd-opts.h (revision 9ac63422b666fbe53a067de74d8af2aa4e45a08b)
1 /*	$NetBSD: ntpd-opts.h,v 1.3 2012/02/01 07:46:22 kardel Exp $	*/
2 
3 /*
4  *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.h)
5  *
6  *  It has been AutoGen-ed  December 24, 2011 at 06:34:00 PM by AutoGen 5.12
7  *  From the definitions    ntpd-opts.def
8  *  and the template file   options
9  *
10  * Generated from AutoOpts 35:0:10 templates.
11  *
12  *  AutoOpts is a copyrighted work.  This header file is not encumbered
13  *  by AutoOpts licensing, but is provided under the licensing terms chosen
14  *  by the ntpd author or copyright holder.  AutoOpts is
15  *  licensed under the terms of the LGPL.  The redistributable library
16  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
17  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
18  *  for details.
19  *
20  * This source file is copyrighted and licensed under the following terms:
21  *
22  *  see html/copyright.html
23  *
24  */
25 /*
26  *  This file contains the programmatic interface to the Automated
27  *  Options generated for the ntpd program.
28  *  These macros are documented in the AutoGen info file in the
29  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
30  */
31 #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
32 #define AUTOOPTS_NTPD_OPTS_H_GUARD 1
33 #include "config.h"
34 #include <autoopts/options.h>
35 
36 /*
37  *  Ensure that the library used for compiling this generated header is at
38  *  least as new as the version current when the header template was released
39  *  (not counting patch version increments).  Also ensure that the oldest
40  *  tolerable version is at least as old as what was current when the header
41  *  template was released.
42  */
43 #define AO_TEMPLATE_VERSION 143360
44 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
45  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
46 # error option template version mismatches autoopts/options.h header
47   Choke Me.
48 #endif
49 
50 /*
51  *  Enumeration of each option:
52  */
53 typedef enum {
54     INDEX_OPT_IPV4              =  0,
55     INDEX_OPT_IPV6              =  1,
56     INDEX_OPT_AUTHREQ           =  2,
57     INDEX_OPT_AUTHNOREQ         =  3,
58     INDEX_OPT_BCASTSYNC         =  4,
59     INDEX_OPT_CONFIGFILE        =  5,
60     INDEX_OPT_DEBUG_LEVEL       =  6,
61     INDEX_OPT_SET_DEBUG_LEVEL   =  7,
62     INDEX_OPT_DRIFTFILE         =  8,
63     INDEX_OPT_PANICGATE         =  9,
64     INDEX_OPT_JAILDIR           = 10,
65     INDEX_OPT_INTERFACE         = 11,
66     INDEX_OPT_KEYFILE           = 12,
67     INDEX_OPT_LOGFILE           = 13,
68     INDEX_OPT_NOVIRTUALIPS      = 14,
69     INDEX_OPT_MODIFYMMTIMER     = 15,
70     INDEX_OPT_NOFORK            = 16,
71     INDEX_OPT_NICE              = 17,
72     INDEX_OPT_PIDFILE           = 18,
73     INDEX_OPT_PRIORITY          = 19,
74     INDEX_OPT_QUIT              = 20,
75     INDEX_OPT_PROPAGATIONDELAY  = 21,
76     INDEX_OPT_SAVECONFIGQUIT    = 22,
77     INDEX_OPT_STATSDIR          = 23,
78     INDEX_OPT_TRUSTEDKEY        = 24,
79     INDEX_OPT_USER              = 25,
80     INDEX_OPT_UPDATEINTERVAL    = 26,
81     INDEX_OPT_VAR               = 27,
82     INDEX_OPT_DVAR              = 28,
83     INDEX_OPT_SLEW              = 29,
84     INDEX_OPT_USEPCC            = 30,
85     INDEX_OPT_PCCFREQ           = 31,
86     INDEX_OPT_VERSION           = 32,
87     INDEX_OPT_HELP              = 33,
88     INDEX_OPT_MORE_HELP         = 34
89 } teOptIndex;
90 
91 #define OPTION_CT    35
92 #define NTPD_VERSION       "4.2.6p5"
93 #define NTPD_FULL_VERSION  "ntpd 4.2.6p5"
94 
95 /*
96  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
97  *  option name (as in the teOptIndex enumeration above).
98  *  e.g. HAVE_OPT(IPV4)
99  */
100 #define         DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
101 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
102 #define      OPT_ARG(n) (DESC(n).optArg.argString)
103 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
104 #define    COUNT_OPT(n) (DESC(n).optOccCt)
105 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
106 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
107 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
108 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
109 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
110 #define    CLEAR_OPT(n) STMTS( \
111                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
112                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
113                     DESC(n).fOptState |= OPTST_DISABLED; \
114                 DESC(n).optCookie = NULL )
115 
116 /* * * * * *
117  *
118  *  Enumeration of ntpd exit codes
119  */
120 typedef enum {
121     NTPD_EXIT_SUCCESS = 0,
122     NTPD_EXIT_FAILURE = 1
123 } ntpd_exit_code_t;
124 /*
125  *  Make sure there are no #define name conflicts with the option names
126  */
127 #ifndef     NO_OPTION_NAME_WARNINGS
128 # ifdef    IPV4
129 #  warning undefining IPV4 due to option name conflict
130 #  undef   IPV4
131 # endif
132 # ifdef    IPV6
133 #  warning undefining IPV6 due to option name conflict
134 #  undef   IPV6
135 # endif
136 # ifdef    AUTHREQ
137 #  warning undefining AUTHREQ due to option name conflict
138 #  undef   AUTHREQ
139 # endif
140 # ifdef    AUTHNOREQ
141 #  warning undefining AUTHNOREQ due to option name conflict
142 #  undef   AUTHNOREQ
143 # endif
144 # ifdef    BCASTSYNC
145 #  warning undefining BCASTSYNC due to option name conflict
146 #  undef   BCASTSYNC
147 # endif
148 # ifdef    CONFIGFILE
149 #  warning undefining CONFIGFILE due to option name conflict
150 #  undef   CONFIGFILE
151 # endif
152 # ifdef    DEBUG_LEVEL
153 #  warning undefining DEBUG_LEVEL due to option name conflict
154 #  undef   DEBUG_LEVEL
155 # endif
156 # ifdef    SET_DEBUG_LEVEL
157 #  warning undefining SET_DEBUG_LEVEL due to option name conflict
158 #  undef   SET_DEBUG_LEVEL
159 # endif
160 # ifdef    DRIFTFILE
161 #  warning undefining DRIFTFILE due to option name conflict
162 #  undef   DRIFTFILE
163 # endif
164 # ifdef    PANICGATE
165 #  warning undefining PANICGATE due to option name conflict
166 #  undef   PANICGATE
167 # endif
168 # ifdef    JAILDIR
169 #  warning undefining JAILDIR due to option name conflict
170 #  undef   JAILDIR
171 # endif
172 # ifdef    INTERFACE
173 #  warning undefining INTERFACE due to option name conflict
174 #  undef   INTERFACE
175 # endif
176 # ifdef    KEYFILE
177 #  warning undefining KEYFILE due to option name conflict
178 #  undef   KEYFILE
179 # endif
180 # ifdef    LOGFILE
181 #  warning undefining LOGFILE due to option name conflict
182 #  undef   LOGFILE
183 # endif
184 # ifdef    NOVIRTUALIPS
185 #  warning undefining NOVIRTUALIPS due to option name conflict
186 #  undef   NOVIRTUALIPS
187 # endif
188 # ifdef    MODIFYMMTIMER
189 #  warning undefining MODIFYMMTIMER due to option name conflict
190 #  undef   MODIFYMMTIMER
191 # endif
192 # ifdef    NOFORK
193 #  warning undefining NOFORK due to option name conflict
194 #  undef   NOFORK
195 # endif
196 # ifdef    NICE
197 #  warning undefining NICE due to option name conflict
198 #  undef   NICE
199 # endif
200 # ifdef    PIDFILE
201 #  warning undefining PIDFILE due to option name conflict
202 #  undef   PIDFILE
203 # endif
204 # ifdef    PRIORITY
205 #  warning undefining PRIORITY due to option name conflict
206 #  undef   PRIORITY
207 # endif
208 # ifdef    QUIT
209 #  warning undefining QUIT due to option name conflict
210 #  undef   QUIT
211 # endif
212 # ifdef    PROPAGATIONDELAY
213 #  warning undefining PROPAGATIONDELAY due to option name conflict
214 #  undef   PROPAGATIONDELAY
215 # endif
216 # ifdef    SAVECONFIGQUIT
217 #  warning undefining SAVECONFIGQUIT due to option name conflict
218 #  undef   SAVECONFIGQUIT
219 # endif
220 # ifdef    STATSDIR
221 #  warning undefining STATSDIR due to option name conflict
222 #  undef   STATSDIR
223 # endif
224 # ifdef    TRUSTEDKEY
225 #  warning undefining TRUSTEDKEY due to option name conflict
226 #  undef   TRUSTEDKEY
227 # endif
228 # ifdef    USER
229 #  warning undefining USER due to option name conflict
230 #  undef   USER
231 # endif
232 # ifdef    UPDATEINTERVAL
233 #  warning undefining UPDATEINTERVAL due to option name conflict
234 #  undef   UPDATEINTERVAL
235 # endif
236 # ifdef    VAR
237 #  warning undefining VAR due to option name conflict
238 #  undef   VAR
239 # endif
240 # ifdef    DVAR
241 #  warning undefining DVAR due to option name conflict
242 #  undef   DVAR
243 # endif
244 
245 /* Defined in ntpsim.h!
246 # ifdef    SLEW
247 #  warning undefining SLEW due to option name conflict
248 #  undef   SLEW
249 # endif
250 */
251 
252 # ifdef    USEPCC
253 #  warning undefining USEPCC due to option name conflict
254 #  undef   USEPCC
255 # endif
256 # ifdef    PCCFREQ
257 #  warning undefining PCCFREQ due to option name conflict
258 #  undef   PCCFREQ
259 # endif
260 #else  /* NO_OPTION_NAME_WARNINGS */
261 # undef IPV4
262 # undef IPV6
263 # undef AUTHREQ
264 # undef AUTHNOREQ
265 # undef BCASTSYNC
266 # undef CONFIGFILE
267 # undef DEBUG_LEVEL
268 # undef SET_DEBUG_LEVEL
269 # undef DRIFTFILE
270 # undef PANICGATE
271 # undef JAILDIR
272 # undef INTERFACE
273 # undef KEYFILE
274 # undef LOGFILE
275 # undef NOVIRTUALIPS
276 # undef MODIFYMMTIMER
277 # undef NOFORK
278 # undef NICE
279 # undef PIDFILE
280 # undef PRIORITY
281 # undef QUIT
282 # undef PROPAGATIONDELAY
283 # undef SAVECONFIGQUIT
284 # undef STATSDIR
285 # undef TRUSTEDKEY
286 # undef USER
287 # undef UPDATEINTERVAL
288 # undef VAR
289 # undef DVAR
290 # undef SLEW
291 # undef USEPCC
292 # undef PCCFREQ
293 #endif  /*  NO_OPTION_NAME_WARNINGS */
294 
295 /* * * * * *
296  *
297  *  Interface defines for specific options.
298  */
299 #define VALUE_OPT_IPV4           '4'
300 #define VALUE_OPT_IPV6           '6'
301 #define VALUE_OPT_AUTHREQ        'a'
302 #define VALUE_OPT_AUTHNOREQ      'A'
303 #define VALUE_OPT_BCASTSYNC      'b'
304 #define VALUE_OPT_CONFIGFILE     'c'
305 #define VALUE_OPT_DEBUG_LEVEL    'd'
306 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
307 #define VALUE_OPT_DRIFTFILE      'f'
308 #define VALUE_OPT_PANICGATE      'g'
309 #define VALUE_OPT_JAILDIR        'i'
310 #define VALUE_OPT_INTERFACE      'I'
311 #define VALUE_OPT_KEYFILE        'k'
312 #define VALUE_OPT_LOGFILE        'l'
313 #define VALUE_OPT_NOVIRTUALIPS   'L'
314 #define VALUE_OPT_MODIFYMMTIMER  'M'
315 #define VALUE_OPT_NOFORK         'n'
316 #define VALUE_OPT_NICE           'N'
317 #define VALUE_OPT_PIDFILE        'p'
318 #define VALUE_OPT_PRIORITY       'P'
319 
320 #define OPT_VALUE_PRIORITY       (DESC(PRIORITY).optArg.argInt)
321 #define VALUE_OPT_QUIT           'q'
322 #define VALUE_OPT_PROPAGATIONDELAY 'r'
323 #define VALUE_OPT_SAVECONFIGQUIT 22
324 #define VALUE_OPT_STATSDIR       's'
325 #define VALUE_OPT_TRUSTEDKEY     't'
326 #define VALUE_OPT_USER           'u'
327 #define VALUE_OPT_UPDATEINTERVAL 'U'
328 
329 #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
330 #define VALUE_OPT_VAR            27
331 #define VALUE_OPT_DVAR           28
332 #define VALUE_OPT_SLEW           'x'
333 #define VALUE_OPT_USEPCC         30
334 #define VALUE_OPT_PCCFREQ        31
335 #define VALUE_OPT_HELP          '?'
336 #define VALUE_OPT_MORE_HELP     '!'
337 #define VALUE_OPT_VERSION       INDEX_OPT_VERSION
338 /*
339  *  Interface defines not associated with particular options
340  */
341 #define ERRSKIP_OPTERR  STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
342 #define ERRSTOP_OPTERR  STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP)
343 #define RESTART_OPT(n)  STMTS( \
344                 ntpdOptions.curOptIdx = (n); \
345                 ntpdOptions.pzCurOpt  = NULL)
346 #define START_OPT       RESTART_OPT(1)
347 #define USAGE(c)        (*ntpdOptions.pUsageProc)(&ntpdOptions, c)
348 /* extracted from opthead.tlib near line 451 */
349 
350 #ifdef  __cplusplus
351 extern "C" {
352 #endif
353 
354 /* * * * * *
355  *
356  *  Declare the ntpd option descriptor.
357  */
358 extern tOptions ntpdOptions;
359 
360 #if defined(ENABLE_NLS)
361 # ifndef _
362 #   include <stdio.h>
363 static inline char* aoGetsText(char const* pz) {
364     if (pz == NULL) return NULL;
365     return (char*)gettext(pz);
366 }
367 #   define _(s)  aoGetsText(s)
368 # endif /* _() */
369 
370 # define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpdOptions.fOptSet |= \
371                                     OPTPROC_NXLAT_OPT_CFG;)
372 # define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpdOptions.fOptSet |= \
373                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
374 
375 # define OPT_XLAT_CFG_NAMES     STMTS(ntpdOptions.fOptSet &= \
376                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
377 # define OPT_XLAT_OPT_NAMES     STMTS(ntpdOptions.fOptSet &= \
378                                   ~OPTPROC_NXLAT_OPT;)
379 
380 #else   /* ENABLE_NLS */
381 # define OPT_NO_XLAT_CFG_NAMES
382 # define OPT_NO_XLAT_OPT_NAMES
383 
384 # define OPT_XLAT_CFG_NAMES
385 # define OPT_XLAT_OPT_NAMES
386 
387 # ifndef _
388 #   define _(_s)  _s
389 # endif
390 #endif  /* ENABLE_NLS */
391 
392 #ifdef  __cplusplus
393 }
394 #endif
395 #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
396 /* ntpd-opts.h ends here */
397