2 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
4 * It has been AutoGen-ed November 21, 2016 at 08:03:29 AM by AutoGen 5.18.5
5 * From the definitions ntp-keygen-opts.def
6 * and the template file options
8 * Generated from AutoOpts 41:0:16 templates.
10 * AutoOpts is a copyrighted work. This header file is not encumbered
11 * by AutoOpts licensing, but is provided under the licensing terms chosen
12 * by the ntp-keygen author or copyright holder. AutoOpts is
13 * licensed under the terms of the LGPL. The redistributable library
14 * (``libopts'') is licensed under the terms of either the LGPL or, at the
15 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
18 * The ntp-keygen program is copyrighted and licensed
19 * under the following terms:
21 * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
22 * This is free software. It is licensed for use, modification and
23 * redistribution under the terms of the NTP License, copies of which
25 * <http://ntp.org/license>
26 * <http://opensource.org/licenses/ntp-license.php>
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose with or without fee is hereby granted,
30 * provided that the above copyright notice appears in all copies and that
31 * both the copyright notice and this permission notice appear in
32 * supporting documentation, and that the name The University of Delaware not be used in
33 * advertising or publicity pertaining to distribution of the software
34 * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35 * representations about the suitability this software for any purpose. It
36 * is provided "as is" without express or implied warranty.
39 * This file contains the programmatic interface to the Automated
40 * Options generated for the ntp-keygen program.
41 * These macros are documented in the AutoGen info file in the
42 * "AutoOpts" chapter. Please refer to that doc for usage help.
44 #ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD
45 #define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1
47 #include <autoopts/options.h>
50 * Ensure that the library used for compiling this generated header is at
51 * least as new as the version current when the header template was released
52 * (not counting patch version increments). Also ensure that the oldest
53 * tolerable version is at least as old as what was current when the header
54 * template was released.
56 #define AO_TEMPLATE_VERSION 167936
57 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59 # error option template version mismatches autoopts/options.h header
64 * Enumeration of each option type for ntp-keygen
68 INDEX_OPT_CERTIFICATE = 1,
70 INDEX_OPT_DEBUG_LEVEL = 3,
71 INDEX_OPT_SET_DEBUG_LEVEL = 4,
73 INDEX_OPT_GQ_PARAMS = 6,
74 INDEX_OPT_HOST_KEY = 7,
77 INDEX_OPT_LIFETIME = 10,
78 INDEX_OPT_MD5KEY = 11,
79 INDEX_OPT_MODULUS = 12,
80 INDEX_OPT_PVT_CERT = 13,
81 INDEX_OPT_PASSWORD = 14,
82 INDEX_OPT_EXPORT_PASSWD = 15,
83 INDEX_OPT_SIGN_KEY = 16,
84 INDEX_OPT_SUBJECT_NAME = 17,
85 INDEX_OPT_TRUSTED_CERT = 18,
86 INDEX_OPT_MV_PARAMS = 19,
87 INDEX_OPT_MV_KEYS = 20,
88 INDEX_OPT_VERSION = 21,
90 INDEX_OPT_MORE_HELP = 23,
91 INDEX_OPT_SAVE_OPTS = 24,
92 INDEX_OPT_LOAD_OPTS = 25
94 /** count of all options for ntp-keygen */
96 /** ntp-keygen version */
97 #define NTP_KEYGEN_VERSION "4.2.8p9"
98 /** Full ntp-keygen version text */
99 #define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p9"
102 * Interface defines for all options. Replace "n" with the UPPER_CASED
103 * option name (as in the teOptIndex enumeration above).
104 * e.g. HAVE_OPT(IMBITS)
106 #define DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n])
107 /** 'true' if an option has been specified in any way */
108 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
109 /** The string argument to an option. The argument type must be \"string\". */
110 #define OPT_ARG(n) (DESC(n).optArg.argString)
111 /** Mask the option state revealing how an option was specified.
112 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
113 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
115 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
116 /** Count of option's occurrances *on the command line*. */
117 #define COUNT_OPT(n) (DESC(n).optOccCt)
118 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
119 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
120 /** 'true' if \a HAVE_OPT would yield 'false'. */
121 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
122 /** 'true' if OPTST_DISABLED bit not set. */
123 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
124 /** number of stacked option arguments.
125 * Valid only for stacked option arguments. */
126 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
127 /** stacked argument vector.
128 * Valid only for stacked option arguments. */
129 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
130 /** Reset an option. */
131 #define CLEAR_OPT(n) STMTS( \
132 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
133 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
134 DESC(n).fOptState |= OPTST_DISABLED; \
135 DESC(n).optCookie = NULL )
136 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138 * Enumeration of ntp-keygen exit codes
141 NTP_KEYGEN_EXIT_SUCCESS = 0,
142 NTP_KEYGEN_EXIT_FAILURE = 1,
143 NTP_KEYGEN_EXIT_USAGE_ERROR = 64,
144 NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66,
145 NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70
146 } ntp_keygen_exit_code_t;
149 * Make sure there are no #define name conflicts with the option names
151 #ifndef NO_OPTION_NAME_WARNINGS
153 # warning undefining IMBITS due to option name conflict
157 # warning undefining CERTIFICATE due to option name conflict
161 # warning undefining CIPHER due to option name conflict
165 # warning undefining DEBUG_LEVEL due to option name conflict
168 # ifdef SET_DEBUG_LEVEL
169 # warning undefining SET_DEBUG_LEVEL due to option name conflict
170 # undef SET_DEBUG_LEVEL
173 # warning undefining ID_KEY due to option name conflict
177 # warning undefining GQ_PARAMS due to option name conflict
181 # warning undefining HOST_KEY due to option name conflict
185 # warning undefining IFFKEY due to option name conflict
189 # warning undefining IDENT due to option name conflict
193 # warning undefining LIFETIME due to option name conflict
197 # warning undefining MD5KEY due to option name conflict
201 # warning undefining MODULUS due to option name conflict
205 # warning undefining PVT_CERT due to option name conflict
209 # warning undefining PASSWORD due to option name conflict
212 # ifdef EXPORT_PASSWD
213 # warning undefining EXPORT_PASSWD due to option name conflict
214 # undef EXPORT_PASSWD
217 # warning undefining SIGN_KEY due to option name conflict
221 # warning undefining SUBJECT_NAME due to option name conflict
225 # warning undefining TRUSTED_CERT due to option name conflict
229 # warning undefining MV_PARAMS due to option name conflict
233 # warning undefining MV_KEYS due to option name conflict
236 #else /* NO_OPTION_NAME_WARNINGS */
241 # undef SET_DEBUG_LEVEL
252 # undef EXPORT_PASSWD
258 #endif /* NO_OPTION_NAME_WARNINGS */
261 * Interface defines for specific options.
264 #define VALUE_OPT_IMBITS 'b'
266 #define OPT_VALUE_IMBITS (DESC(IMBITS).optArg.argInt)
268 #define VALUE_OPT_CERTIFICATE 'c'
269 #define VALUE_OPT_CIPHER 'C'
270 #define VALUE_OPT_DEBUG_LEVEL 'd'
271 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
273 #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
274 #define VALUE_OPT_ID_KEY 'e'
275 #define VALUE_OPT_GQ_PARAMS 'G'
276 #define VALUE_OPT_HOST_KEY 'H'
277 #define VALUE_OPT_IFFKEY 'I'
278 #define VALUE_OPT_IDENT 'i'
279 #define VALUE_OPT_LIFETIME 'l'
281 #define OPT_VALUE_LIFETIME (DESC(LIFETIME).optArg.argInt)
283 #define VALUE_OPT_MD5KEY 'M'
284 #define VALUE_OPT_MODULUS 'm'
286 #define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt)
288 #define VALUE_OPT_PVT_CERT 'P'
289 #define VALUE_OPT_PASSWORD 'p'
290 #define VALUE_OPT_EXPORT_PASSWD 'q'
291 #define VALUE_OPT_SIGN_KEY 'S'
292 #define VALUE_OPT_SUBJECT_NAME 's'
293 #define VALUE_OPT_TRUSTED_CERT 'T'
294 #define VALUE_OPT_MV_PARAMS 'V'
296 #define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt)
298 #define VALUE_OPT_MV_KEYS 'v'
300 #define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt)
302 /** option flag (value) for help-value option */
303 #define VALUE_OPT_HELP '?'
304 /** option flag (value) for more-help-value option */
305 #define VALUE_OPT_MORE_HELP '!'
306 /** option flag (value) for version-value option */
307 #define VALUE_OPT_VERSION 0x1001
308 /** option flag (value) for save-opts-value option */
309 #define VALUE_OPT_SAVE_OPTS '>'
310 /** option flag (value) for load-opts-value option */
311 #define VALUE_OPT_LOAD_OPTS '<'
312 #define SET_OPT_SAVE_OPTS(a) STMTS( \
313 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
314 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
315 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
317 * Interface defines not associated with particular options
319 #define ERRSKIP_OPTERR STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP)
320 #define ERRSTOP_OPTERR STMTS(ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP)
321 #define RESTART_OPT(n) STMTS( \
322 ntp_keygenOptions.curOptIdx = (n); \
323 ntp_keygenOptions.pzCurOpt = NULL )
324 #define START_OPT RESTART_OPT(1)
325 #define USAGE(c) (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c)
334 * Declare the ntp-keygen option descriptor.
336 extern tOptions ntp_keygenOptions;
338 #if defined(ENABLE_NLS)
341 # ifndef HAVE_GETTEXT
342 extern char * gettext(char const *);
344 # include <libintl.h>
347 # ifndef ATTRIBUTE_FORMAT_ARG
348 # define ATTRIBUTE_FORMAT_ARG(_a)
351 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
352 static inline char* aoGetsText(char const* pz) {
353 if (pz == NULL) return NULL;
354 return (char*)gettext(pz);
356 # define _(s) aoGetsText(s)
359 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet |= \
360 OPTPROC_NXLAT_OPT_CFG;)
361 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet |= \
362 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
364 # define OPT_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet &= \
365 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
366 # define OPT_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet &= \
369 #else /* ENABLE_NLS */
370 # define OPT_NO_XLAT_CFG_NAMES
371 # define OPT_NO_XLAT_OPT_NAMES
373 # define OPT_XLAT_CFG_NAMES
374 # define OPT_XLAT_OPT_NAMES
379 #endif /* ENABLE_NLS */
384 #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */
386 /* ntp-keygen-opts.h ends here */