1 /* 2 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) 3 * 4 * It has been AutoGen-ed March 21, 2017 at 10:45:47 AM by AutoGen 5.18.5 5 * From the definitions ntp-keygen-opts.def 6 * and the template file options 7 * 8 * Generated from AutoOpts 41:0:16 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-2017 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 49 /** 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. 55 */ 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 60 Choke Me. 61 #endif 62 63 /** 64 * Enumeration of each option type for ntp-keygen 65 */ 66 typedef enum { 67 INDEX_OPT_IMBITS = 0, 68 INDEX_OPT_CERTIFICATE = 1, 69 INDEX_OPT_CIPHER = 2, 70 INDEX_OPT_DEBUG_LEVEL = 3, 71 INDEX_OPT_SET_DEBUG_LEVEL = 4, 72 INDEX_OPT_ID_KEY = 5, 73 INDEX_OPT_GQ_PARAMS = 6, 74 INDEX_OPT_HOST_KEY = 7, 75 INDEX_OPT_IFFKEY = 8, 76 INDEX_OPT_IDENT = 9, 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, 89 INDEX_OPT_HELP = 22, 90 INDEX_OPT_MORE_HELP = 23, 91 INDEX_OPT_SAVE_OPTS = 24, 92 INDEX_OPT_LOAD_OPTS = 25 93 } teOptIndex; 94 /** count of all options for ntp-keygen */ 95 #define OPTION_CT 26 96 /** ntp-keygen version */ 97 #define NTP_KEYGEN_VERSION "4.2.8p10" 98 /** Full ntp-keygen version text */ 99 #define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p10" 100 101 /** 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) 105 */ 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. 114 */ 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 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 137 /** 138 * Enumeration of ntp-keygen exit codes 139 */ 140 typedef enum { 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; 147 /** @} */ 148 /** 149 * Make sure there are no #define name conflicts with the option names 150 */ 151 #ifndef NO_OPTION_NAME_WARNINGS 152 # ifdef IMBITS 153 # warning undefining IMBITS due to option name conflict 154 # undef IMBITS 155 # endif 156 # ifdef CERTIFICATE 157 # warning undefining CERTIFICATE due to option name conflict 158 # undef CERTIFICATE 159 # endif 160 # ifdef CIPHER 161 # warning undefining CIPHER due to option name conflict 162 # undef CIPHER 163 # endif 164 # ifdef DEBUG_LEVEL 165 # warning undefining DEBUG_LEVEL due to option name conflict 166 # undef DEBUG_LEVEL 167 # endif 168 # ifdef SET_DEBUG_LEVEL 169 # warning undefining SET_DEBUG_LEVEL due to option name conflict 170 # undef SET_DEBUG_LEVEL 171 # endif 172 # ifdef ID_KEY 173 # warning undefining ID_KEY due to option name conflict 174 # undef ID_KEY 175 # endif 176 # ifdef GQ_PARAMS 177 # warning undefining GQ_PARAMS due to option name conflict 178 # undef GQ_PARAMS 179 # endif 180 # ifdef HOST_KEY 181 # warning undefining HOST_KEY due to option name conflict 182 # undef HOST_KEY 183 # endif 184 # ifdef IFFKEY 185 # warning undefining IFFKEY due to option name conflict 186 # undef IFFKEY 187 # endif 188 # ifdef IDENT 189 # warning undefining IDENT due to option name conflict 190 # undef IDENT 191 # endif 192 # ifdef LIFETIME 193 # warning undefining LIFETIME due to option name conflict 194 # undef LIFETIME 195 # endif 196 # ifdef MD5KEY 197 # warning undefining MD5KEY due to option name conflict 198 # undef MD5KEY 199 # endif 200 # ifdef MODULUS 201 # warning undefining MODULUS due to option name conflict 202 # undef MODULUS 203 # endif 204 # ifdef PVT_CERT 205 # warning undefining PVT_CERT due to option name conflict 206 # undef PVT_CERT 207 # endif 208 # ifdef PASSWORD 209 # warning undefining PASSWORD due to option name conflict 210 # undef PASSWORD 211 # endif 212 # ifdef EXPORT_PASSWD 213 # warning undefining EXPORT_PASSWD due to option name conflict 214 # undef EXPORT_PASSWD 215 # endif 216 # ifdef SIGN_KEY 217 # warning undefining SIGN_KEY due to option name conflict 218 # undef SIGN_KEY 219 # endif 220 # ifdef SUBJECT_NAME 221 # warning undefining SUBJECT_NAME due to option name conflict 222 # undef SUBJECT_NAME 223 # endif 224 # ifdef TRUSTED_CERT 225 # warning undefining TRUSTED_CERT due to option name conflict 226 # undef TRUSTED_CERT 227 # endif 228 # ifdef MV_PARAMS 229 # warning undefining MV_PARAMS due to option name conflict 230 # undef MV_PARAMS 231 # endif 232 # ifdef MV_KEYS 233 # warning undefining MV_KEYS due to option name conflict 234 # undef MV_KEYS 235 # endif 236 #else /* NO_OPTION_NAME_WARNINGS */ 237 # undef IMBITS 238 # undef CERTIFICATE 239 # undef CIPHER 240 # undef DEBUG_LEVEL 241 # undef SET_DEBUG_LEVEL 242 # undef ID_KEY 243 # undef GQ_PARAMS 244 # undef HOST_KEY 245 # undef IFFKEY 246 # undef IDENT 247 # undef LIFETIME 248 # undef MD5KEY 249 # undef MODULUS 250 # undef PVT_CERT 251 # undef PASSWORD 252 # undef EXPORT_PASSWD 253 # undef SIGN_KEY 254 # undef SUBJECT_NAME 255 # undef TRUSTED_CERT 256 # undef MV_PARAMS 257 # undef MV_KEYS 258 #endif /* NO_OPTION_NAME_WARNINGS */ 259 260 /** 261 * Interface defines for specific options. 262 * @{ 263 */ 264 #define VALUE_OPT_IMBITS 'b' 265 #ifdef AUTOKEY 266 #define OPT_VALUE_IMBITS (DESC(IMBITS).optArg.argInt) 267 #endif /* AUTOKEY */ 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' 272 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' 280 #ifdef AUTOKEY 281 #define OPT_VALUE_LIFETIME (DESC(LIFETIME).optArg.argInt) 282 #endif /* AUTOKEY */ 283 #define VALUE_OPT_MD5KEY 'M' 284 #define VALUE_OPT_MODULUS 'm' 285 #ifdef AUTOKEY 286 #define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt) 287 #endif /* AUTOKEY */ 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' 295 #ifdef AUTOKEY 296 #define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt) 297 #endif /* AUTOKEY */ 298 #define VALUE_OPT_MV_KEYS 'v' 299 #ifdef AUTOKEY 300 #define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt) 301 #endif /* AUTOKEY */ 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)) 316 /* 317 * Interface defines not associated with particular options 318 */ 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) 326 327 #ifdef __cplusplus 328 extern "C" { 329 #endif 330 331 332 /* * * * * * 333 * 334 * Declare the ntp-keygen option descriptor. 335 */ 336 extern tOptions ntp_keygenOptions; 337 338 #if defined(ENABLE_NLS) 339 # ifndef _ 340 # include <stdio.h> 341 # ifndef HAVE_GETTEXT 342 extern char * gettext(char const *); 343 # else 344 # include <libintl.h> 345 # endif 346 347 # ifndef ATTRIBUTE_FORMAT_ARG 348 # define ATTRIBUTE_FORMAT_ARG(_a) 349 # endif 350 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); 355 } 356 # define _(s) aoGetsText(s) 357 # endif /* _() */ 358 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;) 363 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 &= \ 367 ~OPTPROC_NXLAT_OPT;) 368 369 #else /* ENABLE_NLS */ 370 # define OPT_NO_XLAT_CFG_NAMES 371 # define OPT_NO_XLAT_OPT_NAMES 372 373 # define OPT_XLAT_CFG_NAMES 374 # define OPT_XLAT_OPT_NAMES 375 376 # ifndef _ 377 # define _(_s) _s 378 # endif 379 #endif /* ENABLE_NLS */ 380 381 #ifdef __cplusplus 382 } 383 #endif 384 #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */ 385 386 /* ntp-keygen-opts.h ends here */ 387