1280849Scy/* 2181834Sroberto * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) 3280849Scy * 4316722Sdelphij * It has been AutoGen-ed March 21, 2017 at 10:45:47 AM by AutoGen 5.18.5 5181834Sroberto * From the definitions ntp-keygen-opts.def 6181834Sroberto * and the template file options 7181834Sroberto * 8280849Scy * Generated from AutoOpts 41:0:16 templates. 9181834Sroberto * 10280849Scy * AutoOpts is a copyrighted work. This header file is not encumbered 11280849Scy * by AutoOpts licensing, but is provided under the licensing terms chosen 12280849Scy * by the ntp-keygen author or copyright holder. AutoOpts is 13280849Scy * licensed under the terms of the LGPL. The redistributable library 14280849Scy * (``libopts'') is licensed under the terms of either the LGPL or, at the 15280849Scy * users discretion, the BSD license. See the AutoOpts and/or libopts sources 16280849Scy * for details. 17181834Sroberto * 18280849Scy * The ntp-keygen program is copyrighted and licensed 19280849Scy * under the following terms: 20181834Sroberto * 21316722Sdelphij * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved. 22280849Scy * This is free software. It is licensed for use, modification and 23280849Scy * redistribution under the terms of the NTP License, copies of which 24280849Scy * can be seen at: 25280849Scy * <http://ntp.org/license> 26280849Scy * <http://opensource.org/licenses/ntp-license.php> 27280849Scy * 28280849Scy * Permission to use, copy, modify, and distribute this software and its 29280849Scy * documentation for any purpose with or without fee is hereby granted, 30280849Scy * provided that the above copyright notice appears in all copies and that 31280849Scy * both the copyright notice and this permission notice appear in 32280849Scy * supporting documentation, and that the name The University of Delaware not be used in 33280849Scy * advertising or publicity pertaining to distribution of the software 34280849Scy * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 35280849Scy * representations about the suitability this software for any purpose. It 36280849Scy * is provided "as is" without express or implied warranty. 37181834Sroberto */ 38280849Scy/** 39181834Sroberto * This file contains the programmatic interface to the Automated 40181834Sroberto * Options generated for the ntp-keygen program. 41181834Sroberto * These macros are documented in the AutoGen info file in the 42181834Sroberto * "AutoOpts" chapter. Please refer to that doc for usage help. 43181834Sroberto */ 44181834Sroberto#ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 45280849Scy#define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1 46181834Sroberto#include "config.h" 47181834Sroberto#include <autoopts/options.h> 48181834Sroberto 49280849Scy/** 50181834Sroberto * Ensure that the library used for compiling this generated header is at 51181834Sroberto * least as new as the version current when the header template was released 52181834Sroberto * (not counting patch version increments). Also ensure that the oldest 53181834Sroberto * tolerable version is at least as old as what was current when the header 54181834Sroberto * template was released. 55181834Sroberto */ 56280849Scy#define AO_TEMPLATE_VERSION 167936 57181834Sroberto#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 58181834Sroberto || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 59181834Sroberto# error option template version mismatches autoopts/options.h header 60181834Sroberto Choke Me. 61181834Sroberto#endif 62181834Sroberto 63280849Scy/** 64280849Scy * Enumeration of each option type for ntp-keygen 65181834Sroberto */ 66181834Srobertotypedef enum { 67280849Scy INDEX_OPT_IMBITS = 0, 68280849Scy INDEX_OPT_CERTIFICATE = 1, 69280849Scy INDEX_OPT_CIPHER = 2, 70280849Scy INDEX_OPT_DEBUG_LEVEL = 3, 71280849Scy INDEX_OPT_SET_DEBUG_LEVEL = 4, 72280849Scy INDEX_OPT_ID_KEY = 5, 73280849Scy INDEX_OPT_GQ_PARAMS = 6, 74280849Scy INDEX_OPT_HOST_KEY = 7, 75280849Scy INDEX_OPT_IFFKEY = 8, 76280849Scy INDEX_OPT_IDENT = 9, 77280849Scy INDEX_OPT_LIFETIME = 10, 78280849Scy INDEX_OPT_MD5KEY = 11, 79280849Scy INDEX_OPT_MODULUS = 12, 80280849Scy INDEX_OPT_PVT_CERT = 13, 81280849Scy INDEX_OPT_PASSWORD = 14, 82280849Scy INDEX_OPT_EXPORT_PASSWD = 15, 83280849Scy INDEX_OPT_SIGN_KEY = 16, 84280849Scy INDEX_OPT_SUBJECT_NAME = 17, 85280849Scy INDEX_OPT_TRUSTED_CERT = 18, 86280849Scy INDEX_OPT_MV_PARAMS = 19, 87280849Scy INDEX_OPT_MV_KEYS = 20, 88280849Scy INDEX_OPT_VERSION = 21, 89280849Scy INDEX_OPT_HELP = 22, 90280849Scy INDEX_OPT_MORE_HELP = 23, 91280849Scy INDEX_OPT_SAVE_OPTS = 24, 92280849Scy INDEX_OPT_LOAD_OPTS = 25 93181834Sroberto} teOptIndex; 94280849Scy/** count of all options for ntp-keygen */ 95280849Scy#define OPTION_CT 26 96280849Scy/** ntp-keygen version */ 97316722Sdelphij#define NTP_KEYGEN_VERSION "4.2.8p10" 98280849Scy/** Full ntp-keygen version text */ 99316722Sdelphij#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p10" 100181834Sroberto 101280849Scy/** 102181834Sroberto * Interface defines for all options. Replace "n" with the UPPER_CASED 103181834Sroberto * option name (as in the teOptIndex enumeration above). 104280849Scy * e.g. HAVE_OPT(IMBITS) 105181834Sroberto */ 106181834Sroberto#define DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n]) 107280849Scy/** 'true' if an option has been specified in any way */ 108181834Sroberto#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 109280849Scy/** The string argument to an option. The argument type must be \"string\". */ 110181834Sroberto#define OPT_ARG(n) (DESC(n).optArg.argString) 111280849Scy/** Mask the option state revealing how an option was specified. 112280849Scy * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 113280849Scy * \a OPTST_DEFINED, \a OPTST_RESET or zero. 114280849Scy */ 115181834Sroberto#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 116280849Scy/** Count of option's occurrances *on the command line*. */ 117181834Sroberto#define COUNT_OPT(n) (DESC(n).optOccCt) 118280849Scy/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 119181834Sroberto#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 120280849Scy/** 'true' if \a HAVE_OPT would yield 'false'. */ 121181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 122280849Scy/** 'true' if OPTST_DISABLED bit not set. */ 123181834Sroberto#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 124280849Scy/** number of stacked option arguments. 125280849Scy * Valid only for stacked option arguments. */ 126181834Sroberto#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 127280849Scy/** stacked argument vector. 128280849Scy * Valid only for stacked option arguments. */ 129181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 130280849Scy/** Reset an option. */ 131181834Sroberto#define CLEAR_OPT(n) STMTS( \ 132181834Sroberto DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 133280849Scy if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 134181834Sroberto DESC(n).fOptState |= OPTST_DISABLED; \ 135181834Sroberto DESC(n).optCookie = NULL ) 136280849Scy/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 137280849Scy/** 138280849Scy * Enumeration of ntp-keygen exit codes 139280849Scy */ 140280849Scytypedef enum { 141280849Scy NTP_KEYGEN_EXIT_SUCCESS = 0, 142280849Scy NTP_KEYGEN_EXIT_FAILURE = 1, 143280849Scy NTP_KEYGEN_EXIT_USAGE_ERROR = 64, 144280849Scy NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66, 145280849Scy NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70 146280849Scy} ntp_keygen_exit_code_t; 147280849Scy/** @} */ 148280849Scy/** 149181834Sroberto * Make sure there are no #define name conflicts with the option names 150181834Sroberto */ 151181834Sroberto#ifndef NO_OPTION_NAME_WARNINGS 152280849Scy# ifdef IMBITS 153280849Scy# warning undefining IMBITS due to option name conflict 154280849Scy# undef IMBITS 155280849Scy# endif 156181834Sroberto# ifdef CERTIFICATE 157181834Sroberto# warning undefining CERTIFICATE due to option name conflict 158181834Sroberto# undef CERTIFICATE 159181834Sroberto# endif 160280849Scy# ifdef CIPHER 161280849Scy# warning undefining CIPHER due to option name conflict 162280849Scy# undef CIPHER 163280849Scy# endif 164181834Sroberto# ifdef DEBUG_LEVEL 165181834Sroberto# warning undefining DEBUG_LEVEL due to option name conflict 166181834Sroberto# undef DEBUG_LEVEL 167181834Sroberto# endif 168181834Sroberto# ifdef SET_DEBUG_LEVEL 169181834Sroberto# warning undefining SET_DEBUG_LEVEL due to option name conflict 170181834Sroberto# undef SET_DEBUG_LEVEL 171181834Sroberto# endif 172181834Sroberto# ifdef ID_KEY 173181834Sroberto# warning undefining ID_KEY due to option name conflict 174181834Sroberto# undef ID_KEY 175181834Sroberto# endif 176181834Sroberto# ifdef GQ_PARAMS 177181834Sroberto# warning undefining GQ_PARAMS due to option name conflict 178181834Sroberto# undef GQ_PARAMS 179181834Sroberto# endif 180181834Sroberto# ifdef HOST_KEY 181181834Sroberto# warning undefining HOST_KEY due to option name conflict 182181834Sroberto# undef HOST_KEY 183181834Sroberto# endif 184181834Sroberto# ifdef IFFKEY 185181834Sroberto# warning undefining IFFKEY due to option name conflict 186181834Sroberto# undef IFFKEY 187181834Sroberto# endif 188280849Scy# ifdef IDENT 189280849Scy# warning undefining IDENT due to option name conflict 190280849Scy# undef IDENT 191181834Sroberto# endif 192280849Scy# ifdef LIFETIME 193280849Scy# warning undefining LIFETIME due to option name conflict 194280849Scy# undef LIFETIME 195280849Scy# endif 196181834Sroberto# ifdef MD5KEY 197181834Sroberto# warning undefining MD5KEY due to option name conflict 198181834Sroberto# undef MD5KEY 199181834Sroberto# endif 200181834Sroberto# ifdef MODULUS 201181834Sroberto# warning undefining MODULUS due to option name conflict 202181834Sroberto# undef MODULUS 203181834Sroberto# endif 204181834Sroberto# ifdef PVT_CERT 205181834Sroberto# warning undefining PVT_CERT due to option name conflict 206181834Sroberto# undef PVT_CERT 207181834Sroberto# endif 208280849Scy# ifdef PASSWORD 209280849Scy# warning undefining PASSWORD due to option name conflict 210280849Scy# undef PASSWORD 211181834Sroberto# endif 212280849Scy# ifdef EXPORT_PASSWD 213280849Scy# warning undefining EXPORT_PASSWD due to option name conflict 214280849Scy# undef EXPORT_PASSWD 215181834Sroberto# endif 216181834Sroberto# ifdef SIGN_KEY 217181834Sroberto# warning undefining SIGN_KEY due to option name conflict 218181834Sroberto# undef SIGN_KEY 219181834Sroberto# endif 220181834Sroberto# ifdef SUBJECT_NAME 221181834Sroberto# warning undefining SUBJECT_NAME due to option name conflict 222181834Sroberto# undef SUBJECT_NAME 223181834Sroberto# endif 224181834Sroberto# ifdef TRUSTED_CERT 225181834Sroberto# warning undefining TRUSTED_CERT due to option name conflict 226181834Sroberto# undef TRUSTED_CERT 227181834Sroberto# endif 228181834Sroberto# ifdef MV_PARAMS 229181834Sroberto# warning undefining MV_PARAMS due to option name conflict 230181834Sroberto# undef MV_PARAMS 231181834Sroberto# endif 232181834Sroberto# ifdef MV_KEYS 233181834Sroberto# warning undefining MV_KEYS due to option name conflict 234181834Sroberto# undef MV_KEYS 235181834Sroberto# endif 236181834Sroberto#else /* NO_OPTION_NAME_WARNINGS */ 237280849Scy# undef IMBITS 238181834Sroberto# undef CERTIFICATE 239280849Scy# undef CIPHER 240181834Sroberto# undef DEBUG_LEVEL 241181834Sroberto# undef SET_DEBUG_LEVEL 242181834Sroberto# undef ID_KEY 243181834Sroberto# undef GQ_PARAMS 244181834Sroberto# undef HOST_KEY 245181834Sroberto# undef IFFKEY 246280849Scy# undef IDENT 247280849Scy# undef LIFETIME 248181834Sroberto# undef MD5KEY 249181834Sroberto# undef MODULUS 250181834Sroberto# undef PVT_CERT 251280849Scy# undef PASSWORD 252280849Scy# undef EXPORT_PASSWD 253181834Sroberto# undef SIGN_KEY 254181834Sroberto# undef SUBJECT_NAME 255181834Sroberto# undef TRUSTED_CERT 256181834Sroberto# undef MV_PARAMS 257181834Sroberto# undef MV_KEYS 258181834Sroberto#endif /* NO_OPTION_NAME_WARNINGS */ 259181834Sroberto 260280849Scy/** 261181834Sroberto * Interface defines for specific options. 262280849Scy * @{ 263181834Sroberto */ 264280849Scy#define VALUE_OPT_IMBITS 'b' 265280849Scy#ifdef AUTOKEY 266280849Scy#define OPT_VALUE_IMBITS (DESC(IMBITS).optArg.argInt) 267280849Scy#endif /* AUTOKEY */ 268181834Sroberto#define VALUE_OPT_CERTIFICATE 'c' 269280849Scy#define VALUE_OPT_CIPHER 'C' 270181834Sroberto#define VALUE_OPT_DEBUG_LEVEL 'd' 271181834Sroberto#define VALUE_OPT_SET_DEBUG_LEVEL 'D' 272280849Scy 273280849Scy#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 274181834Sroberto#define VALUE_OPT_ID_KEY 'e' 275181834Sroberto#define VALUE_OPT_GQ_PARAMS 'G' 276181834Sroberto#define VALUE_OPT_HOST_KEY 'H' 277181834Sroberto#define VALUE_OPT_IFFKEY 'I' 278280849Scy#define VALUE_OPT_IDENT 'i' 279280849Scy#define VALUE_OPT_LIFETIME 'l' 280280849Scy#ifdef AUTOKEY 281280849Scy#define OPT_VALUE_LIFETIME (DESC(LIFETIME).optArg.argInt) 282280849Scy#endif /* AUTOKEY */ 283181834Sroberto#define VALUE_OPT_MD5KEY 'M' 284181834Sroberto#define VALUE_OPT_MODULUS 'm' 285280849Scy#ifdef AUTOKEY 286181834Sroberto#define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt) 287280849Scy#endif /* AUTOKEY */ 288181834Sroberto#define VALUE_OPT_PVT_CERT 'P' 289280849Scy#define VALUE_OPT_PASSWORD 'p' 290280849Scy#define VALUE_OPT_EXPORT_PASSWD 'q' 291181834Sroberto#define VALUE_OPT_SIGN_KEY 'S' 292181834Sroberto#define VALUE_OPT_SUBJECT_NAME 's' 293181834Sroberto#define VALUE_OPT_TRUSTED_CERT 'T' 294181834Sroberto#define VALUE_OPT_MV_PARAMS 'V' 295280849Scy#ifdef AUTOKEY 296181834Sroberto#define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt) 297280849Scy#endif /* AUTOKEY */ 298181834Sroberto#define VALUE_OPT_MV_KEYS 'v' 299280849Scy#ifdef AUTOKEY 300181834Sroberto#define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt) 301280849Scy#endif /* AUTOKEY */ 302280849Scy/** option flag (value) for help-value option */ 303181834Sroberto#define VALUE_OPT_HELP '?' 304280849Scy/** option flag (value) for more-help-value option */ 305181834Sroberto#define VALUE_OPT_MORE_HELP '!' 306280849Scy/** option flag (value) for version-value option */ 307280849Scy#define VALUE_OPT_VERSION 0x1001 308280849Scy/** option flag (value) for save-opts-value option */ 309181834Sroberto#define VALUE_OPT_SAVE_OPTS '>' 310280849Scy/** option flag (value) for load-opts-value option */ 311181834Sroberto#define VALUE_OPT_LOAD_OPTS '<' 312181834Sroberto#define SET_OPT_SAVE_OPTS(a) STMTS( \ 313181834Sroberto DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 314181834Sroberto DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 315280849Scy DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 316181834Sroberto/* 317181834Sroberto * Interface defines not associated with particular options 318181834Sroberto */ 319280849Scy#define ERRSKIP_OPTERR STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP) 320280849Scy#define ERRSTOP_OPTERR STMTS(ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP) 321181834Sroberto#define RESTART_OPT(n) STMTS( \ 322181834Sroberto ntp_keygenOptions.curOptIdx = (n); \ 323181834Sroberto ntp_keygenOptions.pzCurOpt = NULL ) 324181834Sroberto#define START_OPT RESTART_OPT(1) 325280849Scy#define USAGE(c) (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c) 326181834Sroberto 327280849Scy#ifdef __cplusplus 328280849Scyextern "C" { 329280849Scy#endif 330280849Scy 331280849Scy 332181834Sroberto/* * * * * * 333181834Sroberto * 334181834Sroberto * Declare the ntp-keygen option descriptor. 335181834Sroberto */ 336280849Scyextern tOptions ntp_keygenOptions; 337181834Sroberto 338280849Scy#if defined(ENABLE_NLS) 339280849Scy# ifndef _ 340280849Scy# include <stdio.h> 341280849Scy# ifndef HAVE_GETTEXT 342280849Scy extern char * gettext(char const *); 343280849Scy# else 344280849Scy# include <libintl.h> 345280849Scy# endif 346181834Sroberto 347280849Scy# ifndef ATTRIBUTE_FORMAT_ARG 348280849Scy# define ATTRIBUTE_FORMAT_ARG(_a) 349280849Scy# endif 350181834Sroberto 351280849Scystatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 352280849Scystatic inline char* aoGetsText(char const* pz) { 353280849Scy if (pz == NULL) return NULL; 354280849Scy return (char*)gettext(pz); 355280849Scy} 356280849Scy# define _(s) aoGetsText(s) 357280849Scy# endif /* _() */ 358280849Scy 359280849Scy# define OPT_NO_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 360280849Scy OPTPROC_NXLAT_OPT_CFG;) 361280849Scy# define OPT_NO_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 362280849Scy OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 363280849Scy 364280849Scy# define OPT_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 365280849Scy ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 366280849Scy# define OPT_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 367280849Scy ~OPTPROC_NXLAT_OPT;) 368280849Scy 369280849Scy#else /* ENABLE_NLS */ 370280849Scy# define OPT_NO_XLAT_CFG_NAMES 371280849Scy# define OPT_NO_XLAT_OPT_NAMES 372280849Scy 373280849Scy# define OPT_XLAT_CFG_NAMES 374280849Scy# define OPT_XLAT_OPT_NAMES 375280849Scy 376280849Scy# ifndef _ 377280849Scy# define _(_s) _s 378280849Scy# endif 379280849Scy#endif /* ENABLE_NLS */ 380280849Scy 381181834Sroberto#ifdef __cplusplus 382181834Sroberto} 383181834Sroberto#endif 384181834Sroberto#endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */ 385280849Scy 386181834Sroberto/* ntp-keygen-opts.h ends here */ 387