1 /* 2 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) 3 * 4 * It has been AutoGen-ed May 25, 2024 at 12:04:42 AM by AutoGen 5.18.16 5 * From the definitions ntp-keygen-opts.def 6 * and the template file options 7 * 8 * Generated from AutoOpts 42:1:17 templates. 9 * 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 16 * for details. 17 * 18 * The ntp-keygen program is copyrighted and licensed 19 * under the following terms: 20 * 21 * Copyright (C) 1992-2024 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 24 * can be seen at: 25 * <http://ntp.org/license> 26 * <http://opensource.org/licenses/ntp-license.php> 27 * 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. 37 */ 38 /** 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. 43 */ 44 #ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 45 #define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1 46 #include "config.h" 47 #include <autoopts/options.h> 48 #include <stdarg.h> 49 #include <stdnoreturn.h> 50 51 /** 52 * Ensure that the library used for compiling this generated header is at 53 * least as new as the version current when the header template was released 54 * (not counting patch version increments). Also ensure that the oldest 55 * tolerable version is at least as old as what was current when the header 56 * template was released. 57 */ 58 #define AO_TEMPLATE_VERSION 172033 59 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 60 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 61 # error option template version mismatches autoopts/options.h header 62 Choke Me. 63 #endif 64 65 #if GCC_VERSION > 40400 66 #define NOT_REACHED __builtin_unreachable(); 67 #else 68 #define NOT_REACHED 69 #endif 70 71 /** 72 * Enumeration of each option type for ntp-keygen 73 */ 74 typedef enum { 75 INDEX_OPT_IMBITS = 0, 76 INDEX_OPT_CERTIFICATE = 1, 77 INDEX_OPT_CIPHER = 2, 78 INDEX_OPT_DEBUG_LEVEL = 3, 79 INDEX_OPT_SET_DEBUG_LEVEL = 4, 80 INDEX_OPT_ID_KEY = 5, 81 INDEX_OPT_GQ_PARAMS = 6, 82 INDEX_OPT_HOST_KEY = 7, 83 INDEX_OPT_IFFKEY = 8, 84 INDEX_OPT_IDENT = 9, 85 INDEX_OPT_LIFETIME = 10, 86 INDEX_OPT_MODULUS = 11, 87 INDEX_OPT_MD5KEY = 12, 88 INDEX_OPT_PVT_CERT = 13, 89 INDEX_OPT_PASSWORD = 14, 90 INDEX_OPT_EXPORT_PASSWD = 15, 91 INDEX_OPT_SUBJECT_NAME = 16, 92 INDEX_OPT_SIGN_KEY = 17, 93 INDEX_OPT_TRUSTED_CERT = 18, 94 INDEX_OPT_MV_PARAMS = 19, 95 INDEX_OPT_MV_KEYS = 20, 96 INDEX_OPT_VERSION = 21, 97 INDEX_OPT_HELP = 22, 98 INDEX_OPT_MORE_HELP = 23, 99 INDEX_OPT_SAVE_OPTS = 24, 100 INDEX_OPT_LOAD_OPTS = 25 101 } teOptIndex; 102 /** count of all options for ntp-keygen */ 103 #define OPTION_CT 26 104 /** ntp-keygen version */ 105 #define NTP_KEYGEN_VERSION "4.2.8p18" 106 /** Full ntp-keygen version text */ 107 #define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p18" 108 109 /** 110 * Interface defines for all options. Replace "n" with the UPPER_CASED 111 * option name (as in the teOptIndex enumeration above). 112 * e.g. HAVE_OPT(IMBITS) 113 */ 114 #define DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n]) 115 /** 'true' if an option has been specified in any way */ 116 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 117 /** The string argument to an option. The argument type must be \"string\". */ 118 #define OPT_ARG(n) (DESC(n).optArg.argString) 119 /** Mask the option state revealing how an option was specified. 120 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 121 * \a OPTST_DEFINED, \a OPTST_RESET or zero. 122 */ 123 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 124 /** Count of option's occurrances *on the command line*. */ 125 #define COUNT_OPT(n) (DESC(n).optOccCt) 126 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 127 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 128 /** 'true' if \a HAVE_OPT would yield 'false'. */ 129 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 130 /** 'true' if OPTST_DISABLED bit not set. */ 131 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 132 /** number of stacked option arguments. 133 * Valid only for stacked option arguments. */ 134 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 135 /** stacked argument vector. 136 * Valid only for stacked option arguments. */ 137 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 138 /** Reset an option. */ 139 #define CLEAR_OPT(n) STMTS( \ 140 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 141 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 142 DESC(n).fOptState |= OPTST_DISABLED; \ 143 DESC(n).optCookie = NULL ) 144 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 145 /** 146 * Enumeration of ntp-keygen exit codes 147 */ 148 typedef enum { 149 NTP_KEYGEN_EXIT_SUCCESS = 0, 150 NTP_KEYGEN_EXIT_FAILURE = 1, 151 NTP_KEYGEN_EXIT_USAGE_ERROR = 64, 152 NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66, 153 NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70 154 } ntp_keygen_exit_code_t; 155 /** @} */ 156 /** 157 * Make sure there are no #define name conflicts with the option names 158 */ 159 #ifndef NO_OPTION_NAME_WARNINGS 160 # ifdef IMBITS 161 # warning undefining IMBITS due to option name conflict 162 # undef IMBITS 163 # endif 164 # ifdef CERTIFICATE 165 # warning undefining CERTIFICATE due to option name conflict 166 # undef CERTIFICATE 167 # endif 168 # ifdef CIPHER 169 # warning undefining CIPHER due to option name conflict 170 # undef CIPHER 171 # endif 172 # ifdef DEBUG_LEVEL 173 # warning undefining DEBUG_LEVEL due to option name conflict 174 # undef DEBUG_LEVEL 175 # endif 176 # ifdef SET_DEBUG_LEVEL 177 # warning undefining SET_DEBUG_LEVEL due to option name conflict 178 # undef SET_DEBUG_LEVEL 179 # endif 180 # ifdef ID_KEY 181 # warning undefining ID_KEY due to option name conflict 182 # undef ID_KEY 183 # endif 184 # ifdef GQ_PARAMS 185 # warning undefining GQ_PARAMS due to option name conflict 186 # undef GQ_PARAMS 187 # endif 188 # ifdef HOST_KEY 189 # warning undefining HOST_KEY due to option name conflict 190 # undef HOST_KEY 191 # endif 192 # ifdef IFFKEY 193 # warning undefining IFFKEY due to option name conflict 194 # undef IFFKEY 195 # endif 196 # ifdef IDENT 197 # warning undefining IDENT due to option name conflict 198 # undef IDENT 199 # endif 200 # ifdef LIFETIME 201 # warning undefining LIFETIME due to option name conflict 202 # undef LIFETIME 203 # endif 204 # ifdef MODULUS 205 # warning undefining MODULUS due to option name conflict 206 # undef MODULUS 207 # endif 208 # ifdef MD5KEY 209 # warning undefining MD5KEY due to option name conflict 210 # undef MD5KEY 211 # endif 212 # ifdef PVT_CERT 213 # warning undefining PVT_CERT due to option name conflict 214 # undef PVT_CERT 215 # endif 216 # ifdef PASSWORD 217 # warning undefining PASSWORD due to option name conflict 218 # undef PASSWORD 219 # endif 220 # ifdef EXPORT_PASSWD 221 # warning undefining EXPORT_PASSWD due to option name conflict 222 # undef EXPORT_PASSWD 223 # endif 224 # ifdef SUBJECT_NAME 225 # warning undefining SUBJECT_NAME due to option name conflict 226 # undef SUBJECT_NAME 227 # endif 228 # ifdef SIGN_KEY 229 # warning undefining SIGN_KEY due to option name conflict 230 # undef SIGN_KEY 231 # endif 232 # ifdef TRUSTED_CERT 233 # warning undefining TRUSTED_CERT due to option name conflict 234 # undef TRUSTED_CERT 235 # endif 236 # ifdef MV_PARAMS 237 # warning undefining MV_PARAMS due to option name conflict 238 # undef MV_PARAMS 239 # endif 240 # ifdef MV_KEYS 241 # warning undefining MV_KEYS due to option name conflict 242 # undef MV_KEYS 243 # endif 244 #else /* NO_OPTION_NAME_WARNINGS */ 245 # undef IMBITS 246 # undef CERTIFICATE 247 # undef CIPHER 248 # undef DEBUG_LEVEL 249 # undef SET_DEBUG_LEVEL 250 # undef ID_KEY 251 # undef GQ_PARAMS 252 # undef HOST_KEY 253 # undef IFFKEY 254 # undef IDENT 255 # undef LIFETIME 256 # undef MODULUS 257 # undef MD5KEY 258 # undef PVT_CERT 259 # undef PASSWORD 260 # undef EXPORT_PASSWD 261 # undef SUBJECT_NAME 262 # undef SIGN_KEY 263 # undef TRUSTED_CERT 264 # undef MV_PARAMS 265 # undef MV_KEYS 266 #endif /* NO_OPTION_NAME_WARNINGS */ 267 268 /** 269 * Interface defines for specific options. 270 * @{ 271 */ 272 #define VALUE_OPT_IMBITS 'b' 273 #ifdef AUTOKEY 274 #define OPT_VALUE_IMBITS (DESC(IMBITS).optArg.argInt) 275 #endif /* AUTOKEY */ 276 #define VALUE_OPT_CERTIFICATE 'c' 277 #define VALUE_OPT_CIPHER 'C' 278 #define VALUE_OPT_DEBUG_LEVEL 'd' 279 #define VALUE_OPT_SET_DEBUG_LEVEL 'D' 280 281 #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 282 #define VALUE_OPT_ID_KEY 'e' 283 #define VALUE_OPT_GQ_PARAMS 'G' 284 #define VALUE_OPT_HOST_KEY 'H' 285 #define VALUE_OPT_IFFKEY 'I' 286 #define VALUE_OPT_IDENT 'i' 287 #define VALUE_OPT_LIFETIME 'l' 288 #ifdef AUTOKEY 289 #define OPT_VALUE_LIFETIME (DESC(LIFETIME).optArg.argInt) 290 #endif /* AUTOKEY */ 291 #define VALUE_OPT_MODULUS 'm' 292 #ifdef AUTOKEY 293 #define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt) 294 #endif /* AUTOKEY */ 295 #define VALUE_OPT_MD5KEY 'M' 296 #define VALUE_OPT_PVT_CERT 'P' 297 #define VALUE_OPT_PASSWORD 'p' 298 #define VALUE_OPT_EXPORT_PASSWD 'q' 299 #define VALUE_OPT_SUBJECT_NAME 's' 300 #define VALUE_OPT_SIGN_KEY 'S' 301 #define VALUE_OPT_TRUSTED_CERT 'T' 302 #define VALUE_OPT_MV_PARAMS 'V' 303 #ifdef AUTOKEY 304 #define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt) 305 #endif /* AUTOKEY */ 306 #define VALUE_OPT_MV_KEYS 'v' 307 #ifdef AUTOKEY 308 #define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt) 309 #endif /* AUTOKEY */ 310 /** option flag (value) for help-value option */ 311 #define VALUE_OPT_HELP '?' 312 /** option flag (value) for more-help-value option */ 313 #define VALUE_OPT_MORE_HELP '!' 314 /** option flag (value) for version-value option */ 315 #define VALUE_OPT_VERSION 0x1001 316 /** option flag (value) for save-opts-value option */ 317 #define VALUE_OPT_SAVE_OPTS '>' 318 /** option flag (value) for load-opts-value option */ 319 #define VALUE_OPT_LOAD_OPTS '<' 320 #define SET_OPT_SAVE_OPTS(a) STMTS( \ 321 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 322 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 323 DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 324 /* 325 * Interface defines not associated with particular options 326 */ 327 #define ERRSKIP_OPTERR STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP) 328 #define ERRSTOP_OPTERR STMTS(ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP) 329 #define RESTART_OPT(n) STMTS( \ 330 ntp_keygenOptions.curOptIdx = (n); \ 331 ntp_keygenOptions.pzCurOpt = NULL ) 332 #define START_OPT RESTART_OPT(1) 333 #define USAGE(c) (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c) 334 335 #ifdef __cplusplus 336 extern "C" { 337 #endif 338 339 340 /* * * * * * 341 * 342 * Declare the ntp-keygen option descriptor. 343 */ 344 extern tOptions ntp_keygenOptions; 345 346 #if defined(ENABLE_NLS) 347 # ifndef _ 348 # include <stdio.h> 349 # ifndef HAVE_GETTEXT 350 extern char * gettext(char const *); 351 # else 352 # include <libintl.h> 353 # endif 354 355 # ifndef ATTRIBUTE_FORMAT_ARG 356 # define ATTRIBUTE_FORMAT_ARG(_a) 357 # endif 358 359 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 360 static inline char* aoGetsText(char const* pz) { 361 if (pz == NULL) return NULL; 362 return (char*)gettext(pz); 363 } 364 # define _(s) aoGetsText(s) 365 # endif /* _() */ 366 367 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 368 OPTPROC_NXLAT_OPT_CFG;) 369 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 370 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 371 372 # define OPT_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 373 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 374 # define OPT_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 375 ~OPTPROC_NXLAT_OPT;) 376 377 #else /* ENABLE_NLS */ 378 # define OPT_NO_XLAT_CFG_NAMES 379 # define OPT_NO_XLAT_OPT_NAMES 380 381 # define OPT_XLAT_CFG_NAMES 382 # define OPT_XLAT_OPT_NAMES 383 384 # ifndef _ 385 # define _(_s) _s 386 # endif 387 #endif /* ENABLE_NLS */ 388 389 390 #ifdef __cplusplus 391 } 392 #endif 393 #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */ 394 395 /* ntp-keygen-opts.h ends here */ 396