xref: /netbsd-src/external/bsd/ntp/dist/ntpd/ntpd-opts.h (revision eabc0478de71e4e011a5b4e0392741e01d491794)
1*eabc0478Schristos /*	$NetBSD: ntpd-opts.h,v 1.18 2024/08/18 20:47:18 christos Exp $	*/
2abb0f93cSkardel 
3abb0f93cSkardel /*
4abb0f93cSkardel  *  EDIT THIS FILE WITH CAUTION  (ntpd-opts.h)
5abb0f93cSkardel  *
6*eabc0478Schristos  *  It has been AutoGen-ed  May 25, 2024 at 12:03:08 AM by AutoGen 5.18.16
7abb0f93cSkardel  *  From the definitions    ntpd-opts.def
8abb0f93cSkardel  *  and the template file   options
9abb0f93cSkardel  *
10*eabc0478Schristos  * Generated from AutoOpts 42:1:17 templates.
113123f114Skardel  *
123123f114Skardel  *  AutoOpts is a copyrighted work.  This header file is not encumbered
133123f114Skardel  *  by AutoOpts licensing, but is provided under the licensing terms chosen
143123f114Skardel  *  by the ntpd author or copyright holder.  AutoOpts is
153123f114Skardel  *  licensed under the terms of the LGPL.  The redistributable library
163123f114Skardel  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
173123f114Skardel  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
183123f114Skardel  *  for details.
19abb0f93cSkardel  *
202950cc38Schristos  * The ntpd program is copyrighted and licensed
212950cc38Schristos  * under the following terms:
22abb0f93cSkardel  *
23*eabc0478Schristos  *  Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
242950cc38Schristos  *  This is free software. It is licensed for use, modification and
252950cc38Schristos  *  redistribution under the terms of the NTP License, copies of which
262950cc38Schristos  *  can be seen at:
272950cc38Schristos  *    <http://ntp.org/license>
282950cc38Schristos  *    <http://opensource.org/licenses/ntp-license.php>
293123f114Skardel  *
302950cc38Schristos  *  Permission to use, copy, modify, and distribute this software and its
312950cc38Schristos  *  documentation for any purpose with or without fee is hereby granted,
322950cc38Schristos  *  provided that the above copyright notice appears in all copies and that
332950cc38Schristos  *  both the copyright notice and this permission notice appear in
342950cc38Schristos  *  supporting documentation, and that the name The University of Delaware not be used in
352950cc38Schristos  *  advertising or publicity pertaining to distribution of the software
367476e6e4Schristos  *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
372950cc38Schristos  *  representations about the suitability this software for any purpose. It
382950cc38Schristos  *  is provided "as is" without express or implied warranty.
39abb0f93cSkardel  */
402950cc38Schristos /**
41abb0f93cSkardel  *  This file contains the programmatic interface to the Automated
42abb0f93cSkardel  *  Options generated for the ntpd program.
43abb0f93cSkardel  *  These macros are documented in the AutoGen info file in the
44abb0f93cSkardel  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
45abb0f93cSkardel  */
46abb0f93cSkardel #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
47abb0f93cSkardel #define AUTOOPTS_NTPD_OPTS_H_GUARD 1
48abb0f93cSkardel #include "config.h"
49abb0f93cSkardel #include <autoopts/options.h>
50*eabc0478Schristos #include <stdarg.h>
51*eabc0478Schristos #include <stdnoreturn.h>
52abb0f93cSkardel 
532950cc38Schristos /**
54abb0f93cSkardel  *  Ensure that the library used for compiling this generated header is at
55abb0f93cSkardel  *  least as new as the version current when the header template was released
56abb0f93cSkardel  *  (not counting patch version increments).  Also ensure that the oldest
57abb0f93cSkardel  *  tolerable version is at least as old as what was current when the header
58abb0f93cSkardel  *  template was released.
59abb0f93cSkardel  */
60*eabc0478Schristos #define AO_TEMPLATE_VERSION 172033
61abb0f93cSkardel #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
62abb0f93cSkardel  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
63abb0f93cSkardel # error option template version mismatches autoopts/options.h header
64abb0f93cSkardel   Choke Me.
65abb0f93cSkardel #endif
66abb0f93cSkardel 
67*eabc0478Schristos #if GCC_VERSION > 40400
68*eabc0478Schristos #define NOT_REACHED __builtin_unreachable();
69*eabc0478Schristos #else
70*eabc0478Schristos #define NOT_REACHED
71*eabc0478Schristos #endif
72*eabc0478Schristos 
732950cc38Schristos /**
742950cc38Schristos  *  Enumeration of each option type for ntpd
75abb0f93cSkardel  */
76abb0f93cSkardel typedef enum {
77abb0f93cSkardel     INDEX_OPT_IPV4              =  0,
78abb0f93cSkardel     INDEX_OPT_IPV6              =  1,
79abb0f93cSkardel     INDEX_OPT_AUTHREQ           =  2,
80abb0f93cSkardel     INDEX_OPT_AUTHNOREQ         =  3,
81abb0f93cSkardel     INDEX_OPT_BCASTSYNC         =  4,
82abb0f93cSkardel     INDEX_OPT_CONFIGFILE        =  5,
83abb0f93cSkardel     INDEX_OPT_DEBUG_LEVEL       =  6,
84abb0f93cSkardel     INDEX_OPT_SET_DEBUG_LEVEL   =  7,
85abb0f93cSkardel     INDEX_OPT_DRIFTFILE         =  8,
86abb0f93cSkardel     INDEX_OPT_PANICGATE         =  9,
877476e6e4Schristos     INDEX_OPT_FORCE_STEP_ONCE   = 10,
887476e6e4Schristos     INDEX_OPT_JAILDIR           = 11,
897476e6e4Schristos     INDEX_OPT_INTERFACE         = 12,
907476e6e4Schristos     INDEX_OPT_KEYFILE           = 13,
917476e6e4Schristos     INDEX_OPT_LOGFILE           = 14,
927476e6e4Schristos     INDEX_OPT_NOVIRTUALIPS      = 15,
937476e6e4Schristos     INDEX_OPT_MODIFYMMTIMER     = 16,
947476e6e4Schristos     INDEX_OPT_NOFORK            = 17,
957476e6e4Schristos     INDEX_OPT_NICE              = 18,
967476e6e4Schristos     INDEX_OPT_PIDFILE           = 19,
977476e6e4Schristos     INDEX_OPT_PRIORITY          = 20,
987476e6e4Schristos     INDEX_OPT_QUIT              = 21,
997476e6e4Schristos     INDEX_OPT_PROPAGATIONDELAY  = 22,
1007476e6e4Schristos     INDEX_OPT_SAVECONFIGQUIT    = 23,
1017476e6e4Schristos     INDEX_OPT_STATSDIR          = 24,
1027476e6e4Schristos     INDEX_OPT_TRUSTEDKEY        = 25,
1037476e6e4Schristos     INDEX_OPT_USER              = 26,
1047476e6e4Schristos     INDEX_OPT_UPDATEINTERVAL    = 27,
1057476e6e4Schristos     INDEX_OPT_VAR               = 28,
1067476e6e4Schristos     INDEX_OPT_DVAR              = 29,
1077476e6e4Schristos     INDEX_OPT_WAIT_SYNC         = 30,
1087476e6e4Schristos     INDEX_OPT_SLEW              = 31,
1097476e6e4Schristos     INDEX_OPT_USEPCC            = 32,
1107476e6e4Schristos     INDEX_OPT_PCCFREQ           = 33,
1117476e6e4Schristos     INDEX_OPT_MDNS              = 34,
1127476e6e4Schristos     INDEX_OPT_VERSION           = 35,
1137476e6e4Schristos     INDEX_OPT_HELP              = 36,
1147476e6e4Schristos     INDEX_OPT_MORE_HELP         = 37
115abb0f93cSkardel } teOptIndex;
1162950cc38Schristos /** count of all options for ntpd */
1177476e6e4Schristos #define OPTION_CT    38
1182950cc38Schristos /** ntpd version */
119*eabc0478Schristos #define NTPD_VERSION       "4.2.8p18"
1202950cc38Schristos /** Full ntpd version text */
121*eabc0478Schristos #define NTPD_FULL_VERSION  "ntpd 4.2.8p18"
122abb0f93cSkardel 
1232950cc38Schristos /**
124abb0f93cSkardel  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
125abb0f93cSkardel  *  option name (as in the teOptIndex enumeration above).
126abb0f93cSkardel  *  e.g. HAVE_OPT(IPV4)
127abb0f93cSkardel  */
128abb0f93cSkardel #define         DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
1292950cc38Schristos /** 'true' if an option has been specified in any way */
130abb0f93cSkardel #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
1312950cc38Schristos /** The string argument to an option. The argument type must be \"string\". */
132abb0f93cSkardel #define      OPT_ARG(n) (DESC(n).optArg.argString)
1332950cc38Schristos /** Mask the option state revealing how an option was specified.
1342950cc38Schristos  *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
1352950cc38Schristos  * \a OPTST_DEFINED, \a OPTST_RESET or zero.
1362950cc38Schristos  */
137abb0f93cSkardel #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
1382950cc38Schristos /** Count of option's occurrances *on the command line*. */
139abb0f93cSkardel #define    COUNT_OPT(n) (DESC(n).optOccCt)
1402950cc38Schristos /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
141abb0f93cSkardel #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
1422950cc38Schristos /** 'true' if \a HAVE_OPT would yield 'false'. */
143abb0f93cSkardel #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
1442950cc38Schristos /** 'true' if OPTST_DISABLED bit not set. */
145abb0f93cSkardel #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
1462950cc38Schristos /** number of stacked option arguments.
1472950cc38Schristos  *  Valid only for stacked option arguments. */
148abb0f93cSkardel #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
1492950cc38Schristos /** stacked argument vector.
1502950cc38Schristos  *  Valid only for stacked option arguments. */
151abb0f93cSkardel #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
1522950cc38Schristos /** Reset an option. */
153abb0f93cSkardel #define    CLEAR_OPT(n) STMTS( \
154abb0f93cSkardel                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
155abb0f93cSkardel                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
156abb0f93cSkardel                     DESC(n).fOptState |= OPTST_DISABLED; \
157abb0f93cSkardel                 DESC(n).optCookie = NULL )
1582950cc38Schristos /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1592950cc38Schristos /**
1603123f114Skardel  *  Enumeration of ntpd exit codes
1613123f114Skardel  */
1623123f114Skardel typedef enum {
1633123f114Skardel     NTPD_EXIT_SUCCESS         = 0,
1642950cc38Schristos     NTPD_EXIT_FAILURE         = 1,
1652950cc38Schristos     NTPD_EXIT_USAGE_ERROR     = 64,
1662950cc38Schristos     NTPD_EXIT_LIBOPTS_FAILURE = 70
1673123f114Skardel }   ntpd_exit_code_t;
1682950cc38Schristos /** @} */
1692950cc38Schristos /**
170abb0f93cSkardel  *  Make sure there are no #define name conflicts with the option names
171abb0f93cSkardel  */
172abb0f93cSkardel #ifndef     NO_OPTION_NAME_WARNINGS
173abb0f93cSkardel # ifdef    IPV4
174abb0f93cSkardel #  warning undefining IPV4 due to option name conflict
175abb0f93cSkardel #  undef   IPV4
176abb0f93cSkardel # endif
177abb0f93cSkardel # ifdef    IPV6
178abb0f93cSkardel #  warning undefining IPV6 due to option name conflict
179abb0f93cSkardel #  undef   IPV6
180abb0f93cSkardel # endif
181abb0f93cSkardel # ifdef    AUTHREQ
182abb0f93cSkardel #  warning undefining AUTHREQ due to option name conflict
183abb0f93cSkardel #  undef   AUTHREQ
184abb0f93cSkardel # endif
185abb0f93cSkardel # ifdef    AUTHNOREQ
186abb0f93cSkardel #  warning undefining AUTHNOREQ due to option name conflict
187abb0f93cSkardel #  undef   AUTHNOREQ
188abb0f93cSkardel # endif
189abb0f93cSkardel # ifdef    BCASTSYNC
190abb0f93cSkardel #  warning undefining BCASTSYNC due to option name conflict
191abb0f93cSkardel #  undef   BCASTSYNC
192abb0f93cSkardel # endif
193abb0f93cSkardel # ifdef    CONFIGFILE
194abb0f93cSkardel #  warning undefining CONFIGFILE due to option name conflict
195abb0f93cSkardel #  undef   CONFIGFILE
196abb0f93cSkardel # endif
197abb0f93cSkardel # ifdef    DEBUG_LEVEL
198abb0f93cSkardel #  warning undefining DEBUG_LEVEL due to option name conflict
199abb0f93cSkardel #  undef   DEBUG_LEVEL
200abb0f93cSkardel # endif
201abb0f93cSkardel # ifdef    SET_DEBUG_LEVEL
202abb0f93cSkardel #  warning undefining SET_DEBUG_LEVEL due to option name conflict
203abb0f93cSkardel #  undef   SET_DEBUG_LEVEL
204abb0f93cSkardel # endif
205abb0f93cSkardel # ifdef    DRIFTFILE
206abb0f93cSkardel #  warning undefining DRIFTFILE due to option name conflict
207abb0f93cSkardel #  undef   DRIFTFILE
208abb0f93cSkardel # endif
209abb0f93cSkardel # ifdef    PANICGATE
210abb0f93cSkardel #  warning undefining PANICGATE due to option name conflict
211abb0f93cSkardel #  undef   PANICGATE
212abb0f93cSkardel # endif
2137476e6e4Schristos # ifdef    FORCE_STEP_ONCE
2147476e6e4Schristos #  warning undefining FORCE_STEP_ONCE due to option name conflict
2157476e6e4Schristos #  undef   FORCE_STEP_ONCE
2167476e6e4Schristos # endif
217abb0f93cSkardel # ifdef    JAILDIR
218abb0f93cSkardel #  warning undefining JAILDIR due to option name conflict
219abb0f93cSkardel #  undef   JAILDIR
220abb0f93cSkardel # endif
221abb0f93cSkardel # ifdef    INTERFACE
222abb0f93cSkardel #  warning undefining INTERFACE due to option name conflict
223abb0f93cSkardel #  undef   INTERFACE
224abb0f93cSkardel # endif
225abb0f93cSkardel # ifdef    KEYFILE
226abb0f93cSkardel #  warning undefining KEYFILE due to option name conflict
227abb0f93cSkardel #  undef   KEYFILE
228abb0f93cSkardel # endif
229abb0f93cSkardel # ifdef    LOGFILE
230abb0f93cSkardel #  warning undefining LOGFILE due to option name conflict
231abb0f93cSkardel #  undef   LOGFILE
232abb0f93cSkardel # endif
233abb0f93cSkardel # ifdef    NOVIRTUALIPS
234abb0f93cSkardel #  warning undefining NOVIRTUALIPS due to option name conflict
235abb0f93cSkardel #  undef   NOVIRTUALIPS
236abb0f93cSkardel # endif
237abb0f93cSkardel # ifdef    MODIFYMMTIMER
238abb0f93cSkardel #  warning undefining MODIFYMMTIMER due to option name conflict
239abb0f93cSkardel #  undef   MODIFYMMTIMER
240abb0f93cSkardel # endif
241abb0f93cSkardel # ifdef    NOFORK
242abb0f93cSkardel #  warning undefining NOFORK due to option name conflict
243abb0f93cSkardel #  undef   NOFORK
244abb0f93cSkardel # endif
245abb0f93cSkardel # ifdef    NICE
246abb0f93cSkardel #  warning undefining NICE due to option name conflict
247abb0f93cSkardel #  undef   NICE
248abb0f93cSkardel # endif
249abb0f93cSkardel # ifdef    PIDFILE
250abb0f93cSkardel #  warning undefining PIDFILE due to option name conflict
251abb0f93cSkardel #  undef   PIDFILE
252abb0f93cSkardel # endif
253abb0f93cSkardel # ifdef    PRIORITY
254abb0f93cSkardel #  warning undefining PRIORITY due to option name conflict
255abb0f93cSkardel #  undef   PRIORITY
256abb0f93cSkardel # endif
257abb0f93cSkardel # ifdef    QUIT
258abb0f93cSkardel #  warning undefining QUIT due to option name conflict
259abb0f93cSkardel #  undef   QUIT
260abb0f93cSkardel # endif
261abb0f93cSkardel # ifdef    PROPAGATIONDELAY
262abb0f93cSkardel #  warning undefining PROPAGATIONDELAY due to option name conflict
263abb0f93cSkardel #  undef   PROPAGATIONDELAY
264abb0f93cSkardel # endif
265abb0f93cSkardel # ifdef    SAVECONFIGQUIT
266abb0f93cSkardel #  warning undefining SAVECONFIGQUIT due to option name conflict
267abb0f93cSkardel #  undef   SAVECONFIGQUIT
268abb0f93cSkardel # endif
269abb0f93cSkardel # ifdef    STATSDIR
270abb0f93cSkardel #  warning undefining STATSDIR due to option name conflict
271abb0f93cSkardel #  undef   STATSDIR
272abb0f93cSkardel # endif
273abb0f93cSkardel # ifdef    TRUSTEDKEY
274abb0f93cSkardel #  warning undefining TRUSTEDKEY due to option name conflict
275abb0f93cSkardel #  undef   TRUSTEDKEY
276abb0f93cSkardel # endif
277abb0f93cSkardel # ifdef    USER
278abb0f93cSkardel #  warning undefining USER due to option name conflict
279abb0f93cSkardel #  undef   USER
280abb0f93cSkardel # endif
281abb0f93cSkardel # ifdef    UPDATEINTERVAL
282abb0f93cSkardel #  warning undefining UPDATEINTERVAL due to option name conflict
283abb0f93cSkardel #  undef   UPDATEINTERVAL
284abb0f93cSkardel # endif
285abb0f93cSkardel # ifdef    VAR
286abb0f93cSkardel #  warning undefining VAR due to option name conflict
287abb0f93cSkardel #  undef   VAR
288abb0f93cSkardel # endif
289abb0f93cSkardel # ifdef    DVAR
290abb0f93cSkardel #  warning undefining DVAR due to option name conflict
291abb0f93cSkardel #  undef   DVAR
292abb0f93cSkardel # endif
2932950cc38Schristos # ifdef    WAIT_SYNC
2942950cc38Schristos #  warning undefining WAIT_SYNC due to option name conflict
2952950cc38Schristos #  undef   WAIT_SYNC
2962950cc38Schristos # endif
297abb0f93cSkardel # ifdef    SLEW
298abb0f93cSkardel #  warning undefining SLEW due to option name conflict
299abb0f93cSkardel #  undef   SLEW
300abb0f93cSkardel # endif
3019cf8c537Schristos 
302abb0f93cSkardel # ifdef    USEPCC
303abb0f93cSkardel #  warning undefining USEPCC due to option name conflict
304abb0f93cSkardel #  undef   USEPCC
305abb0f93cSkardel # endif
306abb0f93cSkardel # ifdef    PCCFREQ
307abb0f93cSkardel #  warning undefining PCCFREQ due to option name conflict
308abb0f93cSkardel #  undef   PCCFREQ
309abb0f93cSkardel # endif
3102950cc38Schristos # ifdef    MDNS
3112950cc38Schristos #  warning undefining MDNS due to option name conflict
3122950cc38Schristos #  undef   MDNS
3132950cc38Schristos # endif
314abb0f93cSkardel #else  /* NO_OPTION_NAME_WARNINGS */
315abb0f93cSkardel # undef IPV4
316abb0f93cSkardel # undef IPV6
317abb0f93cSkardel # undef AUTHREQ
318abb0f93cSkardel # undef AUTHNOREQ
319abb0f93cSkardel # undef BCASTSYNC
320abb0f93cSkardel # undef CONFIGFILE
321abb0f93cSkardel # undef DEBUG_LEVEL
322abb0f93cSkardel # undef SET_DEBUG_LEVEL
323abb0f93cSkardel # undef DRIFTFILE
324abb0f93cSkardel # undef PANICGATE
3257476e6e4Schristos # undef FORCE_STEP_ONCE
326abb0f93cSkardel # undef JAILDIR
327abb0f93cSkardel # undef INTERFACE
328abb0f93cSkardel # undef KEYFILE
329abb0f93cSkardel # undef LOGFILE
330abb0f93cSkardel # undef NOVIRTUALIPS
331abb0f93cSkardel # undef MODIFYMMTIMER
332abb0f93cSkardel # undef NOFORK
333abb0f93cSkardel # undef NICE
334abb0f93cSkardel # undef PIDFILE
335abb0f93cSkardel # undef PRIORITY
336abb0f93cSkardel # undef QUIT
337abb0f93cSkardel # undef PROPAGATIONDELAY
338abb0f93cSkardel # undef SAVECONFIGQUIT
339abb0f93cSkardel # undef STATSDIR
340abb0f93cSkardel # undef TRUSTEDKEY
341abb0f93cSkardel # undef USER
342abb0f93cSkardel # undef UPDATEINTERVAL
343abb0f93cSkardel # undef VAR
344abb0f93cSkardel # undef DVAR
3452950cc38Schristos # undef WAIT_SYNC
346abb0f93cSkardel # undef SLEW
347abb0f93cSkardel # undef USEPCC
348abb0f93cSkardel # undef PCCFREQ
3492950cc38Schristos # undef MDNS
350abb0f93cSkardel #endif  /*  NO_OPTION_NAME_WARNINGS */
351abb0f93cSkardel 
3522950cc38Schristos /**
353abb0f93cSkardel  *  Interface defines for specific options.
3542950cc38Schristos  * @{
355abb0f93cSkardel  */
356abb0f93cSkardel #define VALUE_OPT_IPV4           '4'
357abb0f93cSkardel #define VALUE_OPT_IPV6           '6'
358abb0f93cSkardel #define VALUE_OPT_AUTHREQ        'a'
359abb0f93cSkardel #define VALUE_OPT_AUTHNOREQ      'A'
360abb0f93cSkardel #define VALUE_OPT_BCASTSYNC      'b'
361abb0f93cSkardel #define VALUE_OPT_CONFIGFILE     'c'
362abb0f93cSkardel #define VALUE_OPT_DEBUG_LEVEL    'd'
363abb0f93cSkardel #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
3642950cc38Schristos 
3652950cc38Schristos #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
366abb0f93cSkardel #define VALUE_OPT_DRIFTFILE      'f'
367abb0f93cSkardel #define VALUE_OPT_PANICGATE      'g'
3687476e6e4Schristos #define VALUE_OPT_FORCE_STEP_ONCE 'G'
369abb0f93cSkardel #define VALUE_OPT_JAILDIR        'i'
370abb0f93cSkardel #define VALUE_OPT_INTERFACE      'I'
371abb0f93cSkardel #define VALUE_OPT_KEYFILE        'k'
372abb0f93cSkardel #define VALUE_OPT_LOGFILE        'l'
373abb0f93cSkardel #define VALUE_OPT_NOVIRTUALIPS   'L'
374abb0f93cSkardel #define VALUE_OPT_MODIFYMMTIMER  'M'
375abb0f93cSkardel #define VALUE_OPT_NOFORK         'n'
376abb0f93cSkardel #define VALUE_OPT_NICE           'N'
377abb0f93cSkardel #define VALUE_OPT_PIDFILE        'p'
378abb0f93cSkardel #define VALUE_OPT_PRIORITY       'P'
379abb0f93cSkardel 
380abb0f93cSkardel #define OPT_VALUE_PRIORITY       (DESC(PRIORITY).optArg.argInt)
381abb0f93cSkardel #define VALUE_OPT_QUIT           'q'
382abb0f93cSkardel #define VALUE_OPT_PROPAGATIONDELAY 'r'
3832950cc38Schristos #define VALUE_OPT_SAVECONFIGQUIT 0x1001
384abb0f93cSkardel #define VALUE_OPT_STATSDIR       's'
385abb0f93cSkardel #define VALUE_OPT_TRUSTEDKEY     't'
386abb0f93cSkardel #define VALUE_OPT_USER           'u'
387abb0f93cSkardel #define VALUE_OPT_UPDATEINTERVAL 'U'
388abb0f93cSkardel 
389abb0f93cSkardel #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
3902950cc38Schristos #define VALUE_OPT_VAR            0x1002
3912950cc38Schristos #define VALUE_OPT_DVAR           0x1003
3922950cc38Schristos #define VALUE_OPT_WAIT_SYNC      'w'
3932950cc38Schristos #ifdef HAVE_WORKING_FORK
3942950cc38Schristos #define OPT_VALUE_WAIT_SYNC      (DESC(WAIT_SYNC).optArg.argInt)
3952950cc38Schristos #endif /* HAVE_WORKING_FORK */
396abb0f93cSkardel #define VALUE_OPT_SLEW           'x'
3972950cc38Schristos #define VALUE_OPT_USEPCC         0x1004
3982950cc38Schristos #define VALUE_OPT_PCCFREQ        0x1005
3992950cc38Schristos #define VALUE_OPT_MDNS           'm'
400ea66d795Schristos /** option flag (value) for help-value option */
401abb0f93cSkardel #define VALUE_OPT_HELP          '?'
402ea66d795Schristos /** option flag (value) for more-help-value option */
403abb0f93cSkardel #define VALUE_OPT_MORE_HELP     '!'
404ea66d795Schristos /** option flag (value) for version-value option */
4052950cc38Schristos #define VALUE_OPT_VERSION       0x1006
406abb0f93cSkardel /*
407abb0f93cSkardel  *  Interface defines not associated with particular options
408abb0f93cSkardel  */
409abb0f93cSkardel #define ERRSKIP_OPTERR  STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
410abb0f93cSkardel #define ERRSTOP_OPTERR  STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP)
411abb0f93cSkardel #define RESTART_OPT(n)  STMTS( \
412abb0f93cSkardel                 ntpdOptions.curOptIdx = (n); \
413abb0f93cSkardel                 ntpdOptions.pzCurOpt  = NULL )
414abb0f93cSkardel #define START_OPT       RESTART_OPT(1)
415abb0f93cSkardel #define USAGE(c)        (*ntpdOptions.pUsageProc)(&ntpdOptions, c)
4163123f114Skardel 
4173123f114Skardel #ifdef  __cplusplus
4183123f114Skardel extern "C" {
4193123f114Skardel #endif
420abb0f93cSkardel 
4212950cc38Schristos 
422abb0f93cSkardel /* * * * * *
423abb0f93cSkardel  *
424abb0f93cSkardel  *  Declare the ntpd option descriptor.
425abb0f93cSkardel  */
426abb0f93cSkardel extern tOptions ntpdOptions;
427abb0f93cSkardel 
428abb0f93cSkardel #if defined(ENABLE_NLS)
429abb0f93cSkardel # ifndef _
430abb0f93cSkardel #   include <stdio.h>
4312950cc38Schristos #   ifndef HAVE_GETTEXT
4322950cc38Schristos       extern char * gettext(char const *);
4332950cc38Schristos #   else
4342950cc38Schristos #     include <libintl.h>
4352950cc38Schristos #   endif
4362950cc38Schristos 
437ea66d795Schristos # ifndef ATTRIBUTE_FORMAT_ARG
438ea66d795Schristos #   define ATTRIBUTE_FORMAT_ARG(_a)
439ea66d795Schristos # endif
440ea66d795Schristos 
441ea66d795Schristos static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
442abb0f93cSkardel static inline char* aoGetsText(char const* pz) {
443abb0f93cSkardel     if (pz == NULL) return NULL;
444abb0f93cSkardel     return (char*)gettext(pz);
445abb0f93cSkardel }
446abb0f93cSkardel #   define _(s)  aoGetsText(s)
447abb0f93cSkardel # endif /* _() */
448abb0f93cSkardel 
449abb0f93cSkardel # define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpdOptions.fOptSet |= \
450abb0f93cSkardel                                     OPTPROC_NXLAT_OPT_CFG;)
451abb0f93cSkardel # define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpdOptions.fOptSet |= \
452abb0f93cSkardel                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
453abb0f93cSkardel 
454abb0f93cSkardel # define OPT_XLAT_CFG_NAMES     STMTS(ntpdOptions.fOptSet &= \
455abb0f93cSkardel                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
456abb0f93cSkardel # define OPT_XLAT_OPT_NAMES     STMTS(ntpdOptions.fOptSet &= \
457abb0f93cSkardel                                   ~OPTPROC_NXLAT_OPT;)
458abb0f93cSkardel 
459abb0f93cSkardel #else   /* ENABLE_NLS */
460abb0f93cSkardel # define OPT_NO_XLAT_CFG_NAMES
461abb0f93cSkardel # define OPT_NO_XLAT_OPT_NAMES
462abb0f93cSkardel 
463abb0f93cSkardel # define OPT_XLAT_CFG_NAMES
464abb0f93cSkardel # define OPT_XLAT_OPT_NAMES
465abb0f93cSkardel 
466abb0f93cSkardel # ifndef _
467abb0f93cSkardel #   define _(_s)  _s
468abb0f93cSkardel # endif
469abb0f93cSkardel #endif  /* ENABLE_NLS */
470abb0f93cSkardel 
471*eabc0478Schristos 
472abb0f93cSkardel #ifdef  __cplusplus
473abb0f93cSkardel }
474abb0f93cSkardel #endif
475abb0f93cSkardel #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
4762950cc38Schristos 
477abb0f93cSkardel /* ntpd-opts.h ends here */
478