ntpd-opts.h revision 290001
1272343Sngie/*
2272343Sngie *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.h)
3272343Sngie *
4272343Sngie *  It has been AutoGen-ed  October 21, 2015 at 12:35:59 PM by AutoGen 5.18.5
5272343Sngie *  From the definitions    ntpd-opts.def
6272343Sngie *  and the template file   options
7272343Sngie *
8272343Sngie * Generated from AutoOpts 41:0:16 templates.
9272343Sngie *
10272343Sngie *  AutoOpts is a copyrighted work.  This header file is not encumbered
11272343Sngie *  by AutoOpts licensing, but is provided under the licensing terms chosen
12272343Sngie *  by the ntpd author or copyright holder.  AutoOpts is
13272343Sngie *  licensed under the terms of the LGPL.  The redistributable library
14272343Sngie *  (``libopts'') is licensed under the terms of either the LGPL or, at the
15272343Sngie *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
16272343Sngie *  for details.
17272343Sngie *
18272343Sngie * The ntpd program is copyrighted and licensed
19272343Sngie * under the following terms:
20272343Sngie *
21272343Sngie *  Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
22272343Sngie *  This is free software. It is licensed for use, modification and
23272343Sngie *  redistribution under the terms of the NTP License, copies of which
24272343Sngie *  can be seen at:
25272343Sngie *    <http://ntp.org/license>
26272343Sngie *    <http://opensource.org/licenses/ntp-license.php>
27272343Sngie *
28272343Sngie *  Permission to use, copy, modify, and distribute this software and its
29272343Sngie *  documentation for any purpose with or without fee is hereby granted,
30272343Sngie *  provided that the above copyright notice appears in all copies and that
31272343Sngie *  both the copyright notice and this permission notice appear in
32272343Sngie *  supporting documentation, and that the name The University of Delaware not be used in
33272343Sngie *  advertising or publicity pertaining to distribution of the software
34272343Sngie *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35272343Sngie *  representations about the suitability this software for any purpose. It
36272343Sngie *  is provided "as is" without express or implied warranty.
37272343Sngie */
38272343Sngie/**
39272343Sngie *  This file contains the programmatic interface to the Automated
40272343Sngie *  Options generated for the ntpd program.
41272343Sngie *  These macros are documented in the AutoGen info file in the
42272343Sngie *  "AutoOpts" chapter.  Please refer to that doc for usage help.
43272343Sngie */
44272343Sngie#ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
45272343Sngie#define AUTOOPTS_NTPD_OPTS_H_GUARD 1
46272343Sngie#include "config.h"
47272343Sngie#include <autoopts/options.h>
48272343Sngie
49272343Sngie/**
50272343Sngie *  Ensure that the library used for compiling this generated header is at
51272343Sngie *  least as new as the version current when the header template was released
52272343Sngie *  (not counting patch version increments).  Also ensure that the oldest
53272343Sngie *  tolerable version is at least as old as what was current when the header
54272343Sngie *  template was released.
55272343Sngie */
56272343Sngie#define AO_TEMPLATE_VERSION 167936
57272343Sngie#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58272343Sngie || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59272343Sngie# error option template version mismatches autoopts/options.h header
60272343Sngie  Choke Me.
61272343Sngie#endif
62272343Sngie
63272343Sngie/**
64272343Sngie *  Enumeration of each option type for ntpd
65272343Sngie */
66272343Sngietypedef enum {
67272343Sngie    INDEX_OPT_IPV4              =  0,
68272343Sngie    INDEX_OPT_IPV6              =  1,
69272343Sngie    INDEX_OPT_AUTHREQ           =  2,
70272343Sngie    INDEX_OPT_AUTHNOREQ         =  3,
71272343Sngie    INDEX_OPT_BCASTSYNC         =  4,
72272343Sngie    INDEX_OPT_CONFIGFILE        =  5,
73272343Sngie    INDEX_OPT_DEBUG_LEVEL       =  6,
74272343Sngie    INDEX_OPT_SET_DEBUG_LEVEL   =  7,
75272343Sngie    INDEX_OPT_DRIFTFILE         =  8,
76272343Sngie    INDEX_OPT_PANICGATE         =  9,
77272343Sngie    INDEX_OPT_FORCE_STEP_ONCE   = 10,
78272343Sngie    INDEX_OPT_JAILDIR           = 11,
79272343Sngie    INDEX_OPT_INTERFACE         = 12,
80272343Sngie    INDEX_OPT_KEYFILE           = 13,
81272343Sngie    INDEX_OPT_LOGFILE           = 14,
82272343Sngie    INDEX_OPT_NOVIRTUALIPS      = 15,
83272343Sngie    INDEX_OPT_MODIFYMMTIMER     = 16,
84272343Sngie    INDEX_OPT_NOFORK            = 17,
85272343Sngie    INDEX_OPT_NICE              = 18,
86272343Sngie    INDEX_OPT_PIDFILE           = 19,
87272343Sngie    INDEX_OPT_PRIORITY          = 20,
88272343Sngie    INDEX_OPT_QUIT              = 21,
89272343Sngie    INDEX_OPT_PROPAGATIONDELAY  = 22,
90272343Sngie    INDEX_OPT_SAVECONFIGQUIT    = 23,
91272343Sngie    INDEX_OPT_STATSDIR          = 24,
92272343Sngie    INDEX_OPT_TRUSTEDKEY        = 25,
93272343Sngie    INDEX_OPT_USER              = 26,
94272343Sngie    INDEX_OPT_UPDATEINTERVAL    = 27,
95272343Sngie    INDEX_OPT_VAR               = 28,
96272343Sngie    INDEX_OPT_DVAR              = 29,
97272343Sngie    INDEX_OPT_WAIT_SYNC         = 30,
98272343Sngie    INDEX_OPT_SLEW              = 31,
99272343Sngie    INDEX_OPT_USEPCC            = 32,
100272343Sngie    INDEX_OPT_PCCFREQ           = 33,
101272343Sngie    INDEX_OPT_MDNS              = 34,
102272343Sngie    INDEX_OPT_VERSION           = 35,
103272343Sngie    INDEX_OPT_HELP              = 36,
104272343Sngie    INDEX_OPT_MORE_HELP         = 37
105272343Sngie} teOptIndex;
106272343Sngie/** count of all options for ntpd */
107272343Sngie#define OPTION_CT    38
108272343Sngie/** ntpd version */
109272343Sngie#define NTPD_VERSION       "4.2.8p4"
110272343Sngie/** Full ntpd version text */
111272343Sngie#define NTPD_FULL_VERSION  "ntpd 4.2.8p4"
112272343Sngie
113272343Sngie/**
114272343Sngie *  Interface defines for all options.  Replace "n" with the UPPER_CASED
115272343Sngie *  option name (as in the teOptIndex enumeration above).
116272343Sngie *  e.g. HAVE_OPT(IPV4)
117272343Sngie */
118272343Sngie#define         DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
119272343Sngie/** 'true' if an option has been specified in any way */
120272343Sngie#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
121272343Sngie/** The string argument to an option. The argument type must be \"string\". */
122272343Sngie#define      OPT_ARG(n) (DESC(n).optArg.argString)
123272343Sngie/** Mask the option state revealing how an option was specified.
124272343Sngie *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
125272343Sngie * \a OPTST_DEFINED, \a OPTST_RESET or zero.
126272343Sngie */
127272343Sngie#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
128272343Sngie/** Count of option's occurrances *on the command line*. */
129272343Sngie#define    COUNT_OPT(n) (DESC(n).optOccCt)
130272343Sngie/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
131272343Sngie#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
132272343Sngie/** 'true' if \a HAVE_OPT would yield 'false'. */
133272343Sngie#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
134272343Sngie/** 'true' if OPTST_DISABLED bit not set. */
135272343Sngie#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
136272343Sngie/** number of stacked option arguments.
137272343Sngie *  Valid only for stacked option arguments. */
138272343Sngie#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
139272343Sngie/** stacked argument vector.
140272343Sngie *  Valid only for stacked option arguments. */
141272343Sngie#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
142272343Sngie/** Reset an option. */
143272343Sngie#define    CLEAR_OPT(n) STMTS( \
144272343Sngie                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
145272343Sngie                if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
146272343Sngie                    DESC(n).fOptState |= OPTST_DISABLED; \
147272343Sngie                DESC(n).optCookie = NULL )
148272343Sngie/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
149272343Sngie/**
150272343Sngie *  Enumeration of ntpd exit codes
151272343Sngie */
152272343Sngietypedef enum {
153272343Sngie    NTPD_EXIT_SUCCESS         = 0,
154272343Sngie    NTPD_EXIT_FAILURE         = 1,
155272343Sngie    NTPD_EXIT_USAGE_ERROR     = 64,
156272343Sngie    NTPD_EXIT_LIBOPTS_FAILURE = 70
157272343Sngie}   ntpd_exit_code_t;
158272343Sngie/** @} */
159272343Sngie/**
160272343Sngie *  Make sure there are no #define name conflicts with the option names
161272343Sngie */
162272343Sngie#ifndef     NO_OPTION_NAME_WARNINGS
163272343Sngie# ifdef    IPV4
164272343Sngie#  warning undefining IPV4 due to option name conflict
165272343Sngie#  undef   IPV4
166272343Sngie# endif
167272343Sngie# ifdef    IPV6
168272343Sngie#  warning undefining IPV6 due to option name conflict
169272343Sngie#  undef   IPV6
170272343Sngie# endif
171272343Sngie# ifdef    AUTHREQ
172272343Sngie#  warning undefining AUTHREQ due to option name conflict
173272343Sngie#  undef   AUTHREQ
174272343Sngie# endif
175272343Sngie# ifdef    AUTHNOREQ
176272343Sngie#  warning undefining AUTHNOREQ due to option name conflict
177272343Sngie#  undef   AUTHNOREQ
178272343Sngie# endif
179272343Sngie# ifdef    BCASTSYNC
180272343Sngie#  warning undefining BCASTSYNC due to option name conflict
181272343Sngie#  undef   BCASTSYNC
182272343Sngie# endif
183272343Sngie# ifdef    CONFIGFILE
184272343Sngie#  warning undefining CONFIGFILE due to option name conflict
185272343Sngie#  undef   CONFIGFILE
186272343Sngie# endif
187272343Sngie# ifdef    DEBUG_LEVEL
188272343Sngie#  warning undefining DEBUG_LEVEL due to option name conflict
189272343Sngie#  undef   DEBUG_LEVEL
190272343Sngie# endif
191272343Sngie# ifdef    SET_DEBUG_LEVEL
192272343Sngie#  warning undefining SET_DEBUG_LEVEL due to option name conflict
193272343Sngie#  undef   SET_DEBUG_LEVEL
194272343Sngie# endif
195272343Sngie# ifdef    DRIFTFILE
196272343Sngie#  warning undefining DRIFTFILE due to option name conflict
197272343Sngie#  undef   DRIFTFILE
198272343Sngie# endif
199272343Sngie# ifdef    PANICGATE
200272343Sngie#  warning undefining PANICGATE due to option name conflict
201272343Sngie#  undef   PANICGATE
202272343Sngie# endif
203272343Sngie# ifdef    FORCE_STEP_ONCE
204272343Sngie#  warning undefining FORCE_STEP_ONCE due to option name conflict
205272343Sngie#  undef   FORCE_STEP_ONCE
206272343Sngie# endif
207272343Sngie# ifdef    JAILDIR
208272343Sngie#  warning undefining JAILDIR due to option name conflict
209272343Sngie#  undef   JAILDIR
210272343Sngie# endif
211272343Sngie# ifdef    INTERFACE
212272343Sngie#  warning undefining INTERFACE due to option name conflict
213272343Sngie#  undef   INTERFACE
214272343Sngie# endif
215272343Sngie# ifdef    KEYFILE
216272343Sngie#  warning undefining KEYFILE due to option name conflict
217272343Sngie#  undef   KEYFILE
218272343Sngie# endif
219272343Sngie# ifdef    LOGFILE
220272343Sngie#  warning undefining LOGFILE due to option name conflict
221272343Sngie#  undef   LOGFILE
222272343Sngie# endif
223272343Sngie# ifdef    NOVIRTUALIPS
224272343Sngie#  warning undefining NOVIRTUALIPS due to option name conflict
225272343Sngie#  undef   NOVIRTUALIPS
226272343Sngie# endif
227272343Sngie# ifdef    MODIFYMMTIMER
228272343Sngie#  warning undefining MODIFYMMTIMER due to option name conflict
229272343Sngie#  undef   MODIFYMMTIMER
230272343Sngie# endif
231272343Sngie# ifdef    NOFORK
232272343Sngie#  warning undefining NOFORK due to option name conflict
233272343Sngie#  undef   NOFORK
234272343Sngie# endif
235272343Sngie# ifdef    NICE
236#  warning undefining NICE due to option name conflict
237#  undef   NICE
238# endif
239# ifdef    PIDFILE
240#  warning undefining PIDFILE due to option name conflict
241#  undef   PIDFILE
242# endif
243# ifdef    PRIORITY
244#  warning undefining PRIORITY due to option name conflict
245#  undef   PRIORITY
246# endif
247# ifdef    QUIT
248#  warning undefining QUIT due to option name conflict
249#  undef   QUIT
250# endif
251# ifdef    PROPAGATIONDELAY
252#  warning undefining PROPAGATIONDELAY due to option name conflict
253#  undef   PROPAGATIONDELAY
254# endif
255# ifdef    SAVECONFIGQUIT
256#  warning undefining SAVECONFIGQUIT due to option name conflict
257#  undef   SAVECONFIGQUIT
258# endif
259# ifdef    STATSDIR
260#  warning undefining STATSDIR due to option name conflict
261#  undef   STATSDIR
262# endif
263# ifdef    TRUSTEDKEY
264#  warning undefining TRUSTEDKEY due to option name conflict
265#  undef   TRUSTEDKEY
266# endif
267# ifdef    USER
268#  warning undefining USER due to option name conflict
269#  undef   USER
270# endif
271# ifdef    UPDATEINTERVAL
272#  warning undefining UPDATEINTERVAL due to option name conflict
273#  undef   UPDATEINTERVAL
274# endif
275# ifdef    VAR
276#  warning undefining VAR due to option name conflict
277#  undef   VAR
278# endif
279# ifdef    DVAR
280#  warning undefining DVAR due to option name conflict
281#  undef   DVAR
282# endif
283# ifdef    WAIT_SYNC
284#  warning undefining WAIT_SYNC due to option name conflict
285#  undef   WAIT_SYNC
286# endif
287# ifdef    SLEW
288#  warning undefining SLEW due to option name conflict
289#  undef   SLEW
290# endif
291# ifdef    USEPCC
292#  warning undefining USEPCC due to option name conflict
293#  undef   USEPCC
294# endif
295# ifdef    PCCFREQ
296#  warning undefining PCCFREQ due to option name conflict
297#  undef   PCCFREQ
298# endif
299# ifdef    MDNS
300#  warning undefining MDNS due to option name conflict
301#  undef   MDNS
302# endif
303#else  /* NO_OPTION_NAME_WARNINGS */
304# undef IPV4
305# undef IPV6
306# undef AUTHREQ
307# undef AUTHNOREQ
308# undef BCASTSYNC
309# undef CONFIGFILE
310# undef DEBUG_LEVEL
311# undef SET_DEBUG_LEVEL
312# undef DRIFTFILE
313# undef PANICGATE
314# undef FORCE_STEP_ONCE
315# undef JAILDIR
316# undef INTERFACE
317# undef KEYFILE
318# undef LOGFILE
319# undef NOVIRTUALIPS
320# undef MODIFYMMTIMER
321# undef NOFORK
322# undef NICE
323# undef PIDFILE
324# undef PRIORITY
325# undef QUIT
326# undef PROPAGATIONDELAY
327# undef SAVECONFIGQUIT
328# undef STATSDIR
329# undef TRUSTEDKEY
330# undef USER
331# undef UPDATEINTERVAL
332# undef VAR
333# undef DVAR
334# undef WAIT_SYNC
335# undef SLEW
336# undef USEPCC
337# undef PCCFREQ
338# undef MDNS
339#endif  /*  NO_OPTION_NAME_WARNINGS */
340
341/**
342 *  Interface defines for specific options.
343 * @{
344 */
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'
353
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'
368
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'
377
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
395/*
396 *  Interface defines not associated with particular options
397 */
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)
405
406#ifdef  __cplusplus
407extern "C" {
408#endif
409
410
411/* * * * * *
412 *
413 *  Declare the ntpd option descriptor.
414 */
415extern tOptions ntpdOptions;
416
417#if defined(ENABLE_NLS)
418# ifndef _
419#   include <stdio.h>
420#   ifndef HAVE_GETTEXT
421      extern char * gettext(char const *);
422#   else
423#     include <libintl.h>
424#   endif
425
426# ifndef ATTRIBUTE_FORMAT_ARG
427#   define ATTRIBUTE_FORMAT_ARG(_a)
428# endif
429
430static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
431static inline char* aoGetsText(char const* pz) {
432    if (pz == NULL) return NULL;
433    return (char*)gettext(pz);
434}
435#   define _(s)  aoGetsText(s)
436# endif /* _() */
437
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;)
442
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 &= \
446                                  ~OPTPROC_NXLAT_OPT;)
447
448#else   /* ENABLE_NLS */
449# define OPT_NO_XLAT_CFG_NAMES
450# define OPT_NO_XLAT_OPT_NAMES
451
452# define OPT_XLAT_CFG_NAMES
453# define OPT_XLAT_OPT_NAMES
454
455# ifndef _
456#   define _(_s)  _s
457# endif
458#endif  /* ENABLE_NLS */
459
460#ifdef  __cplusplus
461}
462#endif
463#endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
464
465/* ntpd-opts.h ends here */
466