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