xref: /freebsd/contrib/ntp/ntpd/ntpd-opts.h (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
1ea906c41SOllivier Robert /*
2ea906c41SOllivier Robert  *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.h)
3ea906c41SOllivier Robert  *
4*f5f40dd6SCy Schubert  *  It has been AutoGen-ed  May 25, 2024 at 12:03:08 AM by AutoGen 5.18.16
5ea906c41SOllivier Robert  *  From the definitions    ntpd-opts.def
6ea906c41SOllivier Robert  *  and the template file   options
7ea906c41SOllivier Robert  *
8a466cc55SCy Schubert  * Generated from AutoOpts 42:1:17 templates.
92b15cb3dSCy Schubert  *
102b15cb3dSCy Schubert  *  AutoOpts is a copyrighted work.  This header file is not encumbered
112b15cb3dSCy Schubert  *  by AutoOpts licensing, but is provided under the licensing terms chosen
122b15cb3dSCy Schubert  *  by the ntpd author or copyright holder.  AutoOpts is
132b15cb3dSCy Schubert  *  licensed under the terms of the LGPL.  The redistributable library
142b15cb3dSCy Schubert  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
152b15cb3dSCy Schubert  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
162b15cb3dSCy Schubert  *  for details.
172b15cb3dSCy Schubert  *
182b15cb3dSCy Schubert  * The ntpd program is copyrighted and licensed
192b15cb3dSCy Schubert  * under the following terms:
202b15cb3dSCy Schubert  *
21*f5f40dd6SCy Schubert  *  Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
222b15cb3dSCy Schubert  *  This is free software. It is licensed for use, modification and
232b15cb3dSCy Schubert  *  redistribution under the terms of the NTP License, copies of which
242b15cb3dSCy Schubert  *  can be seen at:
252b15cb3dSCy Schubert  *    <http://ntp.org/license>
262b15cb3dSCy Schubert  *    <http://opensource.org/licenses/ntp-license.php>
272b15cb3dSCy Schubert  *
282b15cb3dSCy Schubert  *  Permission to use, copy, modify, and distribute this software and its
292b15cb3dSCy Schubert  *  documentation for any purpose with or without fee is hereby granted,
302b15cb3dSCy Schubert  *  provided that the above copyright notice appears in all copies and that
312b15cb3dSCy Schubert  *  both the copyright notice and this permission notice appear in
322b15cb3dSCy Schubert  *  supporting documentation, and that the name The University of Delaware not be used in
332b15cb3dSCy Schubert  *  advertising or publicity pertaining to distribution of the software
342b15cb3dSCy Schubert  *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
352b15cb3dSCy Schubert  *  representations about the suitability this software for any purpose. It
362b15cb3dSCy Schubert  *  is provided "as is" without express or implied warranty.
37ea906c41SOllivier Robert  */
382b15cb3dSCy Schubert /**
39ea906c41SOllivier Robert  *  This file contains the programmatic interface to the Automated
40ea906c41SOllivier Robert  *  Options generated for the ntpd program.
41ea906c41SOllivier Robert  *  These macros are documented in the AutoGen info file in the
42ea906c41SOllivier Robert  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
43ea906c41SOllivier Robert  */
44ea906c41SOllivier Robert #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
452b15cb3dSCy Schubert #define AUTOOPTS_NTPD_OPTS_H_GUARD 1
46ea906c41SOllivier Robert #include "config.h"
47ea906c41SOllivier Robert #include <autoopts/options.h>
48a466cc55SCy Schubert #include <stdarg.h>
49a466cc55SCy Schubert #include <stdnoreturn.h>
50ea906c41SOllivier Robert 
512b15cb3dSCy Schubert /**
52ea906c41SOllivier Robert  *  Ensure that the library used for compiling this generated header is at
53ea906c41SOllivier Robert  *  least as new as the version current when the header template was released
54ea906c41SOllivier Robert  *  (not counting patch version increments).  Also ensure that the oldest
55ea906c41SOllivier Robert  *  tolerable version is at least as old as what was current when the header
56ea906c41SOllivier Robert  *  template was released.
57ea906c41SOllivier Robert  */
58a466cc55SCy Schubert #define AO_TEMPLATE_VERSION 172033
59ea906c41SOllivier Robert #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
60ea906c41SOllivier Robert  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
61ea906c41SOllivier Robert # error option template version mismatches autoopts/options.h header
62ea906c41SOllivier Robert   Choke Me.
63ea906c41SOllivier Robert #endif
64ea906c41SOllivier Robert 
65a466cc55SCy Schubert #if GCC_VERSION > 40400
66a466cc55SCy Schubert #define NOT_REACHED __builtin_unreachable();
67a466cc55SCy Schubert #else
68a466cc55SCy Schubert #define NOT_REACHED
69a466cc55SCy Schubert #endif
70a466cc55SCy Schubert 
712b15cb3dSCy Schubert /**
722b15cb3dSCy Schubert  *  Enumeration of each option type for ntpd
73ea906c41SOllivier Robert  */
74ea906c41SOllivier Robert typedef enum {
75ea906c41SOllivier Robert     INDEX_OPT_IPV4              =  0,
76ea906c41SOllivier Robert     INDEX_OPT_IPV6              =  1,
77ea906c41SOllivier Robert     INDEX_OPT_AUTHREQ           =  2,
78ea906c41SOllivier Robert     INDEX_OPT_AUTHNOREQ         =  3,
79ea906c41SOllivier Robert     INDEX_OPT_BCASTSYNC         =  4,
80ea906c41SOllivier Robert     INDEX_OPT_CONFIGFILE        =  5,
81ea906c41SOllivier Robert     INDEX_OPT_DEBUG_LEVEL       =  6,
82ea906c41SOllivier Robert     INDEX_OPT_SET_DEBUG_LEVEL   =  7,
83ea906c41SOllivier Robert     INDEX_OPT_DRIFTFILE         =  8,
84ea906c41SOllivier Robert     INDEX_OPT_PANICGATE         =  9,
85a25439b6SCy Schubert     INDEX_OPT_FORCE_STEP_ONCE   = 10,
86a25439b6SCy Schubert     INDEX_OPT_JAILDIR           = 11,
87a25439b6SCy Schubert     INDEX_OPT_INTERFACE         = 12,
88a25439b6SCy Schubert     INDEX_OPT_KEYFILE           = 13,
89a25439b6SCy Schubert     INDEX_OPT_LOGFILE           = 14,
90a25439b6SCy Schubert     INDEX_OPT_NOVIRTUALIPS      = 15,
91a25439b6SCy Schubert     INDEX_OPT_MODIFYMMTIMER     = 16,
92a25439b6SCy Schubert     INDEX_OPT_NOFORK            = 17,
93a25439b6SCy Schubert     INDEX_OPT_NICE              = 18,
94a25439b6SCy Schubert     INDEX_OPT_PIDFILE           = 19,
95a25439b6SCy Schubert     INDEX_OPT_PRIORITY          = 20,
96a25439b6SCy Schubert     INDEX_OPT_QUIT              = 21,
97a25439b6SCy Schubert     INDEX_OPT_PROPAGATIONDELAY  = 22,
98a25439b6SCy Schubert     INDEX_OPT_SAVECONFIGQUIT    = 23,
99a25439b6SCy Schubert     INDEX_OPT_STATSDIR          = 24,
100a25439b6SCy Schubert     INDEX_OPT_TRUSTEDKEY        = 25,
101a25439b6SCy Schubert     INDEX_OPT_USER              = 26,
102a25439b6SCy Schubert     INDEX_OPT_UPDATEINTERVAL    = 27,
103a25439b6SCy Schubert     INDEX_OPT_VAR               = 28,
104a25439b6SCy Schubert     INDEX_OPT_DVAR              = 29,
105a25439b6SCy Schubert     INDEX_OPT_WAIT_SYNC         = 30,
106a25439b6SCy Schubert     INDEX_OPT_SLEW              = 31,
107a25439b6SCy Schubert     INDEX_OPT_USEPCC            = 32,
108a25439b6SCy Schubert     INDEX_OPT_PCCFREQ           = 33,
109a25439b6SCy Schubert     INDEX_OPT_MDNS              = 34,
110a25439b6SCy Schubert     INDEX_OPT_VERSION           = 35,
111a25439b6SCy Schubert     INDEX_OPT_HELP              = 36,
112a25439b6SCy Schubert     INDEX_OPT_MORE_HELP         = 37
113ea906c41SOllivier Robert } teOptIndex;
1142b15cb3dSCy Schubert /** count of all options for ntpd */
115a25439b6SCy Schubert #define OPTION_CT    38
1162b15cb3dSCy Schubert /** ntpd version */
117*f5f40dd6SCy Schubert #define NTPD_VERSION       "4.2.8p18"
1182b15cb3dSCy Schubert /** Full ntpd version text */
119*f5f40dd6SCy Schubert #define NTPD_FULL_VERSION  "ntpd 4.2.8p18"
120ea906c41SOllivier Robert 
1212b15cb3dSCy Schubert /**
122ea906c41SOllivier Robert  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
123ea906c41SOllivier Robert  *  option name (as in the teOptIndex enumeration above).
124ea906c41SOllivier Robert  *  e.g. HAVE_OPT(IPV4)
125ea906c41SOllivier Robert  */
126ea906c41SOllivier Robert #define         DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
1272b15cb3dSCy Schubert /** 'true' if an option has been specified in any way */
128ea906c41SOllivier Robert #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
1292b15cb3dSCy Schubert /** The string argument to an option. The argument type must be \"string\". */
130ea906c41SOllivier Robert #define      OPT_ARG(n) (DESC(n).optArg.argString)
1312b15cb3dSCy Schubert /** Mask the option state revealing how an option was specified.
1322b15cb3dSCy Schubert  *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
1332b15cb3dSCy Schubert  * \a OPTST_DEFINED, \a OPTST_RESET or zero.
1342b15cb3dSCy Schubert  */
135ea906c41SOllivier Robert #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
1362b15cb3dSCy Schubert /** Count of option's occurrances *on the command line*. */
137ea906c41SOllivier Robert #define    COUNT_OPT(n) (DESC(n).optOccCt)
1382b15cb3dSCy Schubert /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
139ea906c41SOllivier Robert #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
1402b15cb3dSCy Schubert /** 'true' if \a HAVE_OPT would yield 'false'. */
141ea906c41SOllivier Robert #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
1422b15cb3dSCy Schubert /** 'true' if OPTST_DISABLED bit not set. */
143ea906c41SOllivier Robert #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
1442b15cb3dSCy Schubert /** number of stacked option arguments.
1452b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
146ea906c41SOllivier Robert #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
1472b15cb3dSCy Schubert /** stacked argument vector.
1482b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
149ea906c41SOllivier Robert #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
1502b15cb3dSCy Schubert /** Reset an option. */
151ea906c41SOllivier Robert #define    CLEAR_OPT(n) STMTS( \
152ea906c41SOllivier Robert                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
153ea906c41SOllivier Robert                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
154ea906c41SOllivier Robert                     DESC(n).fOptState |= OPTST_DISABLED; \
155ea906c41SOllivier Robert                 DESC(n).optCookie = NULL )
1562b15cb3dSCy Schubert /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1572b15cb3dSCy Schubert /**
1582b15cb3dSCy Schubert  *  Enumeration of ntpd exit codes
1592b15cb3dSCy Schubert  */
1602b15cb3dSCy Schubert typedef enum {
1612b15cb3dSCy Schubert     NTPD_EXIT_SUCCESS         = 0,
1622b15cb3dSCy Schubert     NTPD_EXIT_FAILURE         = 1,
1632b15cb3dSCy Schubert     NTPD_EXIT_USAGE_ERROR     = 64,
1642b15cb3dSCy Schubert     NTPD_EXIT_LIBOPTS_FAILURE = 70
1652b15cb3dSCy Schubert }   ntpd_exit_code_t;
1662b15cb3dSCy Schubert /** @} */
1672b15cb3dSCy Schubert /**
168ea906c41SOllivier Robert  *  Make sure there are no #define name conflicts with the option names
169ea906c41SOllivier Robert  */
170ea906c41SOllivier Robert #ifndef     NO_OPTION_NAME_WARNINGS
171ea906c41SOllivier Robert # ifdef    IPV4
172ea906c41SOllivier Robert #  warning undefining IPV4 due to option name conflict
173ea906c41SOllivier Robert #  undef   IPV4
174ea906c41SOllivier Robert # endif
175ea906c41SOllivier Robert # ifdef    IPV6
176ea906c41SOllivier Robert #  warning undefining IPV6 due to option name conflict
177ea906c41SOllivier Robert #  undef   IPV6
178ea906c41SOllivier Robert # endif
179ea906c41SOllivier Robert # ifdef    AUTHREQ
180ea906c41SOllivier Robert #  warning undefining AUTHREQ due to option name conflict
181ea906c41SOllivier Robert #  undef   AUTHREQ
182ea906c41SOllivier Robert # endif
183ea906c41SOllivier Robert # ifdef    AUTHNOREQ
184ea906c41SOllivier Robert #  warning undefining AUTHNOREQ due to option name conflict
185ea906c41SOllivier Robert #  undef   AUTHNOREQ
186ea906c41SOllivier Robert # endif
187ea906c41SOllivier Robert # ifdef    BCASTSYNC
188ea906c41SOllivier Robert #  warning undefining BCASTSYNC due to option name conflict
189ea906c41SOllivier Robert #  undef   BCASTSYNC
190ea906c41SOllivier Robert # endif
191ea906c41SOllivier Robert # ifdef    CONFIGFILE
192ea906c41SOllivier Robert #  warning undefining CONFIGFILE due to option name conflict
193ea906c41SOllivier Robert #  undef   CONFIGFILE
194ea906c41SOllivier Robert # endif
195ea906c41SOllivier Robert # ifdef    DEBUG_LEVEL
196ea906c41SOllivier Robert #  warning undefining DEBUG_LEVEL due to option name conflict
197ea906c41SOllivier Robert #  undef   DEBUG_LEVEL
198ea906c41SOllivier Robert # endif
199ea906c41SOllivier Robert # ifdef    SET_DEBUG_LEVEL
200ea906c41SOllivier Robert #  warning undefining SET_DEBUG_LEVEL due to option name conflict
201ea906c41SOllivier Robert #  undef   SET_DEBUG_LEVEL
202ea906c41SOllivier Robert # endif
203ea906c41SOllivier Robert # ifdef    DRIFTFILE
204ea906c41SOllivier Robert #  warning undefining DRIFTFILE due to option name conflict
205ea906c41SOllivier Robert #  undef   DRIFTFILE
206ea906c41SOllivier Robert # endif
207ea906c41SOllivier Robert # ifdef    PANICGATE
208ea906c41SOllivier Robert #  warning undefining PANICGATE due to option name conflict
209ea906c41SOllivier Robert #  undef   PANICGATE
210ea906c41SOllivier Robert # endif
211a25439b6SCy Schubert # ifdef    FORCE_STEP_ONCE
212a25439b6SCy Schubert #  warning undefining FORCE_STEP_ONCE due to option name conflict
213a25439b6SCy Schubert #  undef   FORCE_STEP_ONCE
214a25439b6SCy Schubert # endif
215ea906c41SOllivier Robert # ifdef    JAILDIR
216ea906c41SOllivier Robert #  warning undefining JAILDIR due to option name conflict
217ea906c41SOllivier Robert #  undef   JAILDIR
218ea906c41SOllivier Robert # endif
219ea906c41SOllivier Robert # ifdef    INTERFACE
220ea906c41SOllivier Robert #  warning undefining INTERFACE due to option name conflict
221ea906c41SOllivier Robert #  undef   INTERFACE
222ea906c41SOllivier Robert # endif
223ea906c41SOllivier Robert # ifdef    KEYFILE
224ea906c41SOllivier Robert #  warning undefining KEYFILE due to option name conflict
225ea906c41SOllivier Robert #  undef   KEYFILE
226ea906c41SOllivier Robert # endif
227ea906c41SOllivier Robert # ifdef    LOGFILE
228ea906c41SOllivier Robert #  warning undefining LOGFILE due to option name conflict
229ea906c41SOllivier Robert #  undef   LOGFILE
230ea906c41SOllivier Robert # endif
231ea906c41SOllivier Robert # ifdef    NOVIRTUALIPS
232ea906c41SOllivier Robert #  warning undefining NOVIRTUALIPS due to option name conflict
233ea906c41SOllivier Robert #  undef   NOVIRTUALIPS
234ea906c41SOllivier Robert # endif
235ea906c41SOllivier Robert # ifdef    MODIFYMMTIMER
236ea906c41SOllivier Robert #  warning undefining MODIFYMMTIMER due to option name conflict
237ea906c41SOllivier Robert #  undef   MODIFYMMTIMER
238ea906c41SOllivier Robert # endif
239ea906c41SOllivier Robert # ifdef    NOFORK
240ea906c41SOllivier Robert #  warning undefining NOFORK due to option name conflict
241ea906c41SOllivier Robert #  undef   NOFORK
242ea906c41SOllivier Robert # endif
243ea906c41SOllivier Robert # ifdef    NICE
244ea906c41SOllivier Robert #  warning undefining NICE due to option name conflict
245ea906c41SOllivier Robert #  undef   NICE
246ea906c41SOllivier Robert # endif
247ea906c41SOllivier Robert # ifdef    PIDFILE
248ea906c41SOllivier Robert #  warning undefining PIDFILE due to option name conflict
249ea906c41SOllivier Robert #  undef   PIDFILE
250ea906c41SOllivier Robert # endif
251ea906c41SOllivier Robert # ifdef    PRIORITY
252ea906c41SOllivier Robert #  warning undefining PRIORITY due to option name conflict
253ea906c41SOllivier Robert #  undef   PRIORITY
254ea906c41SOllivier Robert # endif
255ea906c41SOllivier Robert # ifdef    QUIT
256ea906c41SOllivier Robert #  warning undefining QUIT due to option name conflict
257ea906c41SOllivier Robert #  undef   QUIT
258ea906c41SOllivier Robert # endif
259ea906c41SOllivier Robert # ifdef    PROPAGATIONDELAY
260ea906c41SOllivier Robert #  warning undefining PROPAGATIONDELAY due to option name conflict
261ea906c41SOllivier Robert #  undef   PROPAGATIONDELAY
262ea906c41SOllivier Robert # endif
2632b15cb3dSCy Schubert # ifdef    SAVECONFIGQUIT
2642b15cb3dSCy Schubert #  warning undefining SAVECONFIGQUIT due to option name conflict
2652b15cb3dSCy Schubert #  undef   SAVECONFIGQUIT
266ea906c41SOllivier Robert # endif
267ea906c41SOllivier Robert # ifdef    STATSDIR
268ea906c41SOllivier Robert #  warning undefining STATSDIR due to option name conflict
269ea906c41SOllivier Robert #  undef   STATSDIR
270ea906c41SOllivier Robert # endif
271ea906c41SOllivier Robert # ifdef    TRUSTEDKEY
272ea906c41SOllivier Robert #  warning undefining TRUSTEDKEY due to option name conflict
273ea906c41SOllivier Robert #  undef   TRUSTEDKEY
274ea906c41SOllivier Robert # endif
275ea906c41SOllivier Robert # ifdef    USER
276ea906c41SOllivier Robert #  warning undefining USER due to option name conflict
277ea906c41SOllivier Robert #  undef   USER
278ea906c41SOllivier Robert # endif
2792b15cb3dSCy Schubert # ifdef    UPDATEINTERVAL
2802b15cb3dSCy Schubert #  warning undefining UPDATEINTERVAL due to option name conflict
2812b15cb3dSCy Schubert #  undef   UPDATEINTERVAL
2822b15cb3dSCy Schubert # endif
283ea906c41SOllivier Robert # ifdef    VAR
284ea906c41SOllivier Robert #  warning undefining VAR due to option name conflict
285ea906c41SOllivier Robert #  undef   VAR
286ea906c41SOllivier Robert # endif
287ea906c41SOllivier Robert # ifdef    DVAR
288ea906c41SOllivier Robert #  warning undefining DVAR due to option name conflict
289ea906c41SOllivier Robert #  undef   DVAR
290ea906c41SOllivier Robert # endif
2912b15cb3dSCy Schubert # ifdef    WAIT_SYNC
2922b15cb3dSCy Schubert #  warning undefining WAIT_SYNC due to option name conflict
2932b15cb3dSCy Schubert #  undef   WAIT_SYNC
2942b15cb3dSCy Schubert # endif
295ea906c41SOllivier Robert # ifdef    SLEW
296ea906c41SOllivier Robert #  warning undefining SLEW due to option name conflict
297ea906c41SOllivier Robert #  undef   SLEW
298ea906c41SOllivier Robert # endif
2992b15cb3dSCy Schubert # ifdef    USEPCC
3002b15cb3dSCy Schubert #  warning undefining USEPCC due to option name conflict
3012b15cb3dSCy Schubert #  undef   USEPCC
3022b15cb3dSCy Schubert # endif
3032b15cb3dSCy Schubert # ifdef    PCCFREQ
3042b15cb3dSCy Schubert #  warning undefining PCCFREQ due to option name conflict
3052b15cb3dSCy Schubert #  undef   PCCFREQ
3062b15cb3dSCy Schubert # endif
3072b15cb3dSCy Schubert # ifdef    MDNS
3082b15cb3dSCy Schubert #  warning undefining MDNS due to option name conflict
3092b15cb3dSCy Schubert #  undef   MDNS
3102b15cb3dSCy Schubert # endif
311ea906c41SOllivier Robert #else  /* NO_OPTION_NAME_WARNINGS */
312ea906c41SOllivier Robert # undef IPV4
313ea906c41SOllivier Robert # undef IPV6
314ea906c41SOllivier Robert # undef AUTHREQ
315ea906c41SOllivier Robert # undef AUTHNOREQ
316ea906c41SOllivier Robert # undef BCASTSYNC
317ea906c41SOllivier Robert # undef CONFIGFILE
318ea906c41SOllivier Robert # undef DEBUG_LEVEL
319ea906c41SOllivier Robert # undef SET_DEBUG_LEVEL
320ea906c41SOllivier Robert # undef DRIFTFILE
321ea906c41SOllivier Robert # undef PANICGATE
322a25439b6SCy Schubert # undef FORCE_STEP_ONCE
323ea906c41SOllivier Robert # undef JAILDIR
324ea906c41SOllivier Robert # undef INTERFACE
325ea906c41SOllivier Robert # undef KEYFILE
326ea906c41SOllivier Robert # undef LOGFILE
327ea906c41SOllivier Robert # undef NOVIRTUALIPS
328ea906c41SOllivier Robert # undef MODIFYMMTIMER
329ea906c41SOllivier Robert # undef NOFORK
330ea906c41SOllivier Robert # undef NICE
331ea906c41SOllivier Robert # undef PIDFILE
332ea906c41SOllivier Robert # undef PRIORITY
333ea906c41SOllivier Robert # undef QUIT
334ea906c41SOllivier Robert # undef PROPAGATIONDELAY
3352b15cb3dSCy Schubert # undef SAVECONFIGQUIT
336ea906c41SOllivier Robert # undef STATSDIR
337ea906c41SOllivier Robert # undef TRUSTEDKEY
338ea906c41SOllivier Robert # undef USER
3392b15cb3dSCy Schubert # undef UPDATEINTERVAL
340ea906c41SOllivier Robert # undef VAR
341ea906c41SOllivier Robert # undef DVAR
3422b15cb3dSCy Schubert # undef WAIT_SYNC
343ea906c41SOllivier Robert # undef SLEW
3442b15cb3dSCy Schubert # undef USEPCC
3452b15cb3dSCy Schubert # undef PCCFREQ
3462b15cb3dSCy Schubert # undef MDNS
347ea906c41SOllivier Robert #endif  /*  NO_OPTION_NAME_WARNINGS */
348ea906c41SOllivier Robert 
3492b15cb3dSCy Schubert /**
350ea906c41SOllivier Robert  *  Interface defines for specific options.
3512b15cb3dSCy Schubert  * @{
352ea906c41SOllivier Robert  */
353ea906c41SOllivier Robert #define VALUE_OPT_IPV4           '4'
354ea906c41SOllivier Robert #define VALUE_OPT_IPV6           '6'
355ea906c41SOllivier Robert #define VALUE_OPT_AUTHREQ        'a'
356ea906c41SOllivier Robert #define VALUE_OPT_AUTHNOREQ      'A'
357ea906c41SOllivier Robert #define VALUE_OPT_BCASTSYNC      'b'
358ea906c41SOllivier Robert #define VALUE_OPT_CONFIGFILE     'c'
359ea906c41SOllivier Robert #define VALUE_OPT_DEBUG_LEVEL    'd'
360ea906c41SOllivier Robert #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
3612b15cb3dSCy Schubert 
3622b15cb3dSCy Schubert #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
363ea906c41SOllivier Robert #define VALUE_OPT_DRIFTFILE      'f'
364ea906c41SOllivier Robert #define VALUE_OPT_PANICGATE      'g'
365a25439b6SCy Schubert #define VALUE_OPT_FORCE_STEP_ONCE 'G'
366ea906c41SOllivier Robert #define VALUE_OPT_JAILDIR        'i'
367ea906c41SOllivier Robert #define VALUE_OPT_INTERFACE      'I'
368ea906c41SOllivier Robert #define VALUE_OPT_KEYFILE        'k'
369ea906c41SOllivier Robert #define VALUE_OPT_LOGFILE        'l'
370ea906c41SOllivier Robert #define VALUE_OPT_NOVIRTUALIPS   'L'
371ea906c41SOllivier Robert #define VALUE_OPT_MODIFYMMTIMER  'M'
372ea906c41SOllivier Robert #define VALUE_OPT_NOFORK         'n'
373ea906c41SOllivier Robert #define VALUE_OPT_NICE           'N'
374ea906c41SOllivier Robert #define VALUE_OPT_PIDFILE        'p'
375ea906c41SOllivier Robert #define VALUE_OPT_PRIORITY       'P'
3762b15cb3dSCy Schubert 
377ea906c41SOllivier Robert #define OPT_VALUE_PRIORITY       (DESC(PRIORITY).optArg.argInt)
378ea906c41SOllivier Robert #define VALUE_OPT_QUIT           'q'
379ea906c41SOllivier Robert #define VALUE_OPT_PROPAGATIONDELAY 'r'
3802b15cb3dSCy Schubert #define VALUE_OPT_SAVECONFIGQUIT 0x1001
381ea906c41SOllivier Robert #define VALUE_OPT_STATSDIR       's'
382ea906c41SOllivier Robert #define VALUE_OPT_TRUSTEDKEY     't'
383ea906c41SOllivier Robert #define VALUE_OPT_USER           'u'
3842b15cb3dSCy Schubert #define VALUE_OPT_UPDATEINTERVAL 'U'
385ea906c41SOllivier Robert 
3862b15cb3dSCy Schubert #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
3872b15cb3dSCy Schubert #define VALUE_OPT_VAR            0x1002
3882b15cb3dSCy Schubert #define VALUE_OPT_DVAR           0x1003
3892b15cb3dSCy Schubert #define VALUE_OPT_WAIT_SYNC      'w'
3902b15cb3dSCy Schubert #ifdef HAVE_WORKING_FORK
3912b15cb3dSCy Schubert #define OPT_VALUE_WAIT_SYNC      (DESC(WAIT_SYNC).optArg.argInt)
3922b15cb3dSCy Schubert #endif /* HAVE_WORKING_FORK */
3932b15cb3dSCy Schubert #define VALUE_OPT_SLEW           'x'
3942b15cb3dSCy Schubert #define VALUE_OPT_USEPCC         0x1004
3952b15cb3dSCy Schubert #define VALUE_OPT_PCCFREQ        0x1005
3962b15cb3dSCy Schubert #define VALUE_OPT_MDNS           'm'
3972b15cb3dSCy Schubert /** option flag (value) for help-value option */
398ea906c41SOllivier Robert #define VALUE_OPT_HELP          '?'
3992b15cb3dSCy Schubert /** option flag (value) for more-help-value option */
400ea906c41SOllivier Robert #define VALUE_OPT_MORE_HELP     '!'
4012b15cb3dSCy Schubert /** option flag (value) for version-value option */
4022b15cb3dSCy Schubert #define VALUE_OPT_VERSION       0x1006
403ea906c41SOllivier Robert /*
404ea906c41SOllivier Robert  *  Interface defines not associated with particular options
405ea906c41SOllivier Robert  */
406ea906c41SOllivier Robert #define ERRSKIP_OPTERR  STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
407ea906c41SOllivier Robert #define ERRSTOP_OPTERR  STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP)
408ea906c41SOllivier Robert #define RESTART_OPT(n)  STMTS( \
409ea906c41SOllivier Robert                 ntpdOptions.curOptIdx = (n); \
410ea906c41SOllivier Robert                 ntpdOptions.pzCurOpt  = NULL )
411ea906c41SOllivier Robert #define START_OPT       RESTART_OPT(1)
412ea906c41SOllivier Robert #define USAGE(c)        (*ntpdOptions.pUsageProc)(&ntpdOptions, c)
4132b15cb3dSCy Schubert 
4142b15cb3dSCy Schubert #ifdef  __cplusplus
4152b15cb3dSCy Schubert extern "C" {
4162b15cb3dSCy Schubert #endif
4172b15cb3dSCy Schubert 
418ea906c41SOllivier Robert 
419ea906c41SOllivier Robert /* * * * * *
420ea906c41SOllivier Robert  *
421ea906c41SOllivier Robert  *  Declare the ntpd option descriptor.
422ea906c41SOllivier Robert  */
423ea906c41SOllivier Robert extern tOptions ntpdOptions;
424ea906c41SOllivier Robert 
4252b15cb3dSCy Schubert #if defined(ENABLE_NLS)
426ea906c41SOllivier Robert # ifndef _
427ea906c41SOllivier Robert #   include <stdio.h>
4282b15cb3dSCy Schubert #   ifndef HAVE_GETTEXT
4292b15cb3dSCy Schubert       extern char * gettext(char const *);
4302b15cb3dSCy Schubert #   else
4312b15cb3dSCy Schubert #     include <libintl.h>
4322b15cb3dSCy Schubert #   endif
4332b15cb3dSCy Schubert 
4342b15cb3dSCy Schubert # ifndef ATTRIBUTE_FORMAT_ARG
4352b15cb3dSCy Schubert #   define ATTRIBUTE_FORMAT_ARG(_a)
4362b15cb3dSCy Schubert # endif
4372b15cb3dSCy Schubert 
4382b15cb3dSCy Schubert static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
439ea906c41SOllivier Robert static inline char* aoGetsText(char const* pz) {
440ea906c41SOllivier Robert     if (pz == NULL) return NULL;
441ea906c41SOllivier Robert     return (char*)gettext(pz);
442ea906c41SOllivier Robert }
443ea906c41SOllivier Robert #   define _(s)  aoGetsText(s)
4442b15cb3dSCy Schubert # endif /* _() */
4452b15cb3dSCy Schubert 
4462b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpdOptions.fOptSet |= \
4472b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT_CFG;)
4482b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpdOptions.fOptSet |= \
4492b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
4502b15cb3dSCy Schubert 
4512b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES     STMTS(ntpdOptions.fOptSet &= \
4522b15cb3dSCy Schubert                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
4532b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES     STMTS(ntpdOptions.fOptSet &= \
4542b15cb3dSCy Schubert                                   ~OPTPROC_NXLAT_OPT;)
4552b15cb3dSCy Schubert 
456ea906c41SOllivier Robert #else   /* ENABLE_NLS */
4572b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES
4582b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES
4592b15cb3dSCy Schubert 
4602b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES
4612b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES
4622b15cb3dSCy Schubert 
4632b15cb3dSCy Schubert # ifndef _
4642b15cb3dSCy Schubert #   define _(_s)  _s
465ea906c41SOllivier Robert # endif
4662b15cb3dSCy Schubert #endif  /* ENABLE_NLS */
467ea906c41SOllivier Robert 
468a466cc55SCy Schubert 
469ea906c41SOllivier Robert #ifdef  __cplusplus
470ea906c41SOllivier Robert }
471ea906c41SOllivier Robert #endif
472ea906c41SOllivier Robert #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
4732b15cb3dSCy Schubert 
474ea906c41SOllivier Robert /* ntpd-opts.h ends here */
475