1285612Sdelphij/* 2181834Sroberto * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) 3285612Sdelphij * 4330567Sgordon * It has been AutoGen-ed February 27, 2018 at 05:15:43 PM by AutoGen 5.18.5 5181834Sroberto * From the definitions ntp-keygen-opts.def 6181834Sroberto * and the template file options 7181834Sroberto * 8285612Sdelphij * Generated from AutoOpts 41:0:16 templates. 9181834Sroberto * 10285612Sdelphij * AutoOpts is a copyrighted work. This header file is not encumbered 11285612Sdelphij * by AutoOpts licensing, but is provided under the licensing terms chosen 12285612Sdelphij * by the ntp-keygen author or copyright holder. AutoOpts is 13285612Sdelphij * licensed under the terms of the LGPL. The redistributable library 14285612Sdelphij * (``libopts'') is licensed under the terms of either the LGPL or, at the 15285612Sdelphij * users discretion, the BSD license. See the AutoOpts and/or libopts sources 16285612Sdelphij * for details. 17181834Sroberto * 18285612Sdelphij * The ntp-keygen program is copyrighted and licensed 19285612Sdelphij * under the following terms: 20181834Sroberto * 21316722Sdelphij * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved. 22285612Sdelphij * This is free software. It is licensed for use, modification and 23285612Sdelphij * redistribution under the terms of the NTP License, copies of which 24285612Sdelphij * can be seen at: 25285612Sdelphij * <http://ntp.org/license> 26285612Sdelphij * <http://opensource.org/licenses/ntp-license.php> 27285612Sdelphij * 28285612Sdelphij * Permission to use, copy, modify, and distribute this software and its 29285612Sdelphij * documentation for any purpose with or without fee is hereby granted, 30285612Sdelphij * provided that the above copyright notice appears in all copies and that 31285612Sdelphij * both the copyright notice and this permission notice appear in 32285612Sdelphij * supporting documentation, and that the name The University of Delaware not be used in 33285612Sdelphij * advertising or publicity pertaining to distribution of the software 34285612Sdelphij * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 35285612Sdelphij * representations about the suitability this software for any purpose. It 36285612Sdelphij * is provided "as is" without express or implied warranty. 37181834Sroberto */ 38285612Sdelphij/** 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 45285612Sdelphij#define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1 46181834Sroberto#include "config.h" 47181834Sroberto#include <autoopts/options.h> 48181834Sroberto 49285612Sdelphij/** 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 */ 56285612Sdelphij#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 63285612Sdelphij/** 64285612Sdelphij * Enumeration of each option type for ntp-keygen 65181834Sroberto */ 66181834Srobertotypedef enum { 67285612Sdelphij INDEX_OPT_IMBITS = 0, 68285612Sdelphij INDEX_OPT_CERTIFICATE = 1, 69285612Sdelphij INDEX_OPT_CIPHER = 2, 70285612Sdelphij INDEX_OPT_DEBUG_LEVEL = 3, 71285612Sdelphij INDEX_OPT_SET_DEBUG_LEVEL = 4, 72285612Sdelphij INDEX_OPT_ID_KEY = 5, 73285612Sdelphij INDEX_OPT_GQ_PARAMS = 6, 74285612Sdelphij INDEX_OPT_HOST_KEY = 7, 75285612Sdelphij INDEX_OPT_IFFKEY = 8, 76285612Sdelphij INDEX_OPT_IDENT = 9, 77285612Sdelphij INDEX_OPT_LIFETIME = 10, 78330567Sgordon INDEX_OPT_MODULUS = 11, 79330567Sgordon INDEX_OPT_MD5KEY = 12, 80285612Sdelphij INDEX_OPT_PVT_CERT = 13, 81285612Sdelphij INDEX_OPT_PASSWORD = 14, 82285612Sdelphij INDEX_OPT_EXPORT_PASSWD = 15, 83330567Sgordon INDEX_OPT_SUBJECT_NAME = 16, 84330567Sgordon INDEX_OPT_SIGN_KEY = 17, 85285612Sdelphij INDEX_OPT_TRUSTED_CERT = 18, 86285612Sdelphij INDEX_OPT_MV_PARAMS = 19, 87285612Sdelphij INDEX_OPT_MV_KEYS = 20, 88285612Sdelphij INDEX_OPT_VERSION = 21, 89285612Sdelphij INDEX_OPT_HELP = 22, 90285612Sdelphij INDEX_OPT_MORE_HELP = 23, 91285612Sdelphij INDEX_OPT_SAVE_OPTS = 24, 92285612Sdelphij INDEX_OPT_LOAD_OPTS = 25 93181834Sroberto} teOptIndex; 94285612Sdelphij/** count of all options for ntp-keygen */ 95285612Sdelphij#define OPTION_CT 26 96285612Sdelphij/** ntp-keygen version */ 97330567Sgordon#define NTP_KEYGEN_VERSION "4.2.8p11" 98285612Sdelphij/** Full ntp-keygen version text */ 99330567Sgordon#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p11" 100181834Sroberto 101285612Sdelphij/** 102181834Sroberto * Interface defines for all options. Replace "n" with the UPPER_CASED 103181834Sroberto * option name (as in the teOptIndex enumeration above). 104285612Sdelphij * e.g. HAVE_OPT(IMBITS) 105181834Sroberto */ 106181834Sroberto#define DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n]) 107285612Sdelphij/** 'true' if an option has been specified in any way */ 108181834Sroberto#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 109285612Sdelphij/** The string argument to an option. The argument type must be \"string\". */ 110181834Sroberto#define OPT_ARG(n) (DESC(n).optArg.argString) 111285612Sdelphij/** Mask the option state revealing how an option was specified. 112285612Sdelphij * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 113285612Sdelphij * \a OPTST_DEFINED, \a OPTST_RESET or zero. 114285612Sdelphij */ 115181834Sroberto#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 116285612Sdelphij/** Count of option's occurrances *on the command line*. */ 117181834Sroberto#define COUNT_OPT(n) (DESC(n).optOccCt) 118285612Sdelphij/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 119181834Sroberto#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 120285612Sdelphij/** 'true' if \a HAVE_OPT would yield 'false'. */ 121181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 122285612Sdelphij/** 'true' if OPTST_DISABLED bit not set. */ 123181834Sroberto#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 124285612Sdelphij/** number of stacked option arguments. 125285612Sdelphij * Valid only for stacked option arguments. */ 126181834Sroberto#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 127285612Sdelphij/** stacked argument vector. 128285612Sdelphij * Valid only for stacked option arguments. */ 129181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 130285612Sdelphij/** Reset an option. */ 131181834Sroberto#define CLEAR_OPT(n) STMTS( \ 132181834Sroberto DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 133285612Sdelphij if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 134181834Sroberto DESC(n).fOptState |= OPTST_DISABLED; \ 135181834Sroberto DESC(n).optCookie = NULL ) 136285612Sdelphij/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 137285612Sdelphij/** 138285612Sdelphij * Enumeration of ntp-keygen exit codes 139285612Sdelphij */ 140285612Sdelphijtypedef enum { 141285612Sdelphij NTP_KEYGEN_EXIT_SUCCESS = 0, 142285612Sdelphij NTP_KEYGEN_EXIT_FAILURE = 1, 143285612Sdelphij NTP_KEYGEN_EXIT_USAGE_ERROR = 64, 144285612Sdelphij NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66, 145285612Sdelphij NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70 146285612Sdelphij} ntp_keygen_exit_code_t; 147285612Sdelphij/** @} */ 148285612Sdelphij/** 149181834Sroberto * Make sure there are no #define name conflicts with the option names 150181834Sroberto */ 151181834Sroberto#ifndef NO_OPTION_NAME_WARNINGS 152285612Sdelphij# ifdef IMBITS 153285612Sdelphij# warning undefining IMBITS due to option name conflict 154285612Sdelphij# undef IMBITS 155285612Sdelphij# endif 156181834Sroberto# ifdef CERTIFICATE 157181834Sroberto# warning undefining CERTIFICATE due to option name conflict 158181834Sroberto# undef CERTIFICATE 159181834Sroberto# endif 160285612Sdelphij# ifdef CIPHER 161285612Sdelphij# warning undefining CIPHER due to option name conflict 162285612Sdelphij# undef CIPHER 163285612Sdelphij# 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 188285612Sdelphij# ifdef IDENT 189285612Sdelphij# warning undefining IDENT due to option name conflict 190285612Sdelphij# undef IDENT 191181834Sroberto# endif 192285612Sdelphij# ifdef LIFETIME 193285612Sdelphij# warning undefining LIFETIME due to option name conflict 194285612Sdelphij# undef LIFETIME 195285612Sdelphij# endif 196330567Sgordon# ifdef MODULUS 197330567Sgordon# warning undefining MODULUS due to option name conflict 198330567Sgordon# undef MODULUS 199330567Sgordon# endif 200181834Sroberto# ifdef MD5KEY 201181834Sroberto# warning undefining MD5KEY due to option name conflict 202181834Sroberto# undef MD5KEY 203181834Sroberto# endif 204181834Sroberto# ifdef PVT_CERT 205181834Sroberto# warning undefining PVT_CERT due to option name conflict 206181834Sroberto# undef PVT_CERT 207181834Sroberto# endif 208285612Sdelphij# ifdef PASSWORD 209285612Sdelphij# warning undefining PASSWORD due to option name conflict 210285612Sdelphij# undef PASSWORD 211181834Sroberto# endif 212285612Sdelphij# ifdef EXPORT_PASSWD 213285612Sdelphij# warning undefining EXPORT_PASSWD due to option name conflict 214285612Sdelphij# undef EXPORT_PASSWD 215181834Sroberto# endif 216330567Sgordon# ifdef SUBJECT_NAME 217330567Sgordon# warning undefining SUBJECT_NAME due to option name conflict 218330567Sgordon# undef SUBJECT_NAME 219330567Sgordon# endif 220181834Sroberto# ifdef SIGN_KEY 221181834Sroberto# warning undefining SIGN_KEY due to option name conflict 222181834Sroberto# undef SIGN_KEY 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 */ 237285612Sdelphij# undef IMBITS 238181834Sroberto# undef CERTIFICATE 239285612Sdelphij# 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 246285612Sdelphij# undef IDENT 247285612Sdelphij# undef LIFETIME 248330567Sgordon# undef MODULUS 249181834Sroberto# undef MD5KEY 250181834Sroberto# undef PVT_CERT 251285612Sdelphij# undef PASSWORD 252285612Sdelphij# undef EXPORT_PASSWD 253330567Sgordon# undef SUBJECT_NAME 254181834Sroberto# undef SIGN_KEY 255181834Sroberto# undef TRUSTED_CERT 256181834Sroberto# undef MV_PARAMS 257181834Sroberto# undef MV_KEYS 258181834Sroberto#endif /* NO_OPTION_NAME_WARNINGS */ 259181834Sroberto 260285612Sdelphij/** 261181834Sroberto * Interface defines for specific options. 262285612Sdelphij * @{ 263181834Sroberto */ 264285612Sdelphij#define VALUE_OPT_IMBITS 'b' 265285612Sdelphij#ifdef AUTOKEY 266285612Sdelphij#define OPT_VALUE_IMBITS (DESC(IMBITS).optArg.argInt) 267285612Sdelphij#endif /* AUTOKEY */ 268181834Sroberto#define VALUE_OPT_CERTIFICATE 'c' 269285612Sdelphij#define VALUE_OPT_CIPHER 'C' 270181834Sroberto#define VALUE_OPT_DEBUG_LEVEL 'd' 271181834Sroberto#define VALUE_OPT_SET_DEBUG_LEVEL 'D' 272285612Sdelphij 273285612Sdelphij#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' 278285612Sdelphij#define VALUE_OPT_IDENT 'i' 279285612Sdelphij#define VALUE_OPT_LIFETIME 'l' 280285612Sdelphij#ifdef AUTOKEY 281285612Sdelphij#define OPT_VALUE_LIFETIME (DESC(LIFETIME).optArg.argInt) 282285612Sdelphij#endif /* AUTOKEY */ 283181834Sroberto#define VALUE_OPT_MODULUS 'm' 284285612Sdelphij#ifdef AUTOKEY 285181834Sroberto#define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt) 286285612Sdelphij#endif /* AUTOKEY */ 287330567Sgordon#define VALUE_OPT_MD5KEY 'M' 288181834Sroberto#define VALUE_OPT_PVT_CERT 'P' 289285612Sdelphij#define VALUE_OPT_PASSWORD 'p' 290285612Sdelphij#define VALUE_OPT_EXPORT_PASSWD 'q' 291330567Sgordon#define VALUE_OPT_SUBJECT_NAME 's' 292181834Sroberto#define VALUE_OPT_SIGN_KEY 'S' 293181834Sroberto#define VALUE_OPT_TRUSTED_CERT 'T' 294181834Sroberto#define VALUE_OPT_MV_PARAMS 'V' 295285612Sdelphij#ifdef AUTOKEY 296181834Sroberto#define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt) 297285612Sdelphij#endif /* AUTOKEY */ 298181834Sroberto#define VALUE_OPT_MV_KEYS 'v' 299285612Sdelphij#ifdef AUTOKEY 300181834Sroberto#define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt) 301285612Sdelphij#endif /* AUTOKEY */ 302285612Sdelphij/** option flag (value) for help-value option */ 303181834Sroberto#define VALUE_OPT_HELP '?' 304285612Sdelphij/** option flag (value) for more-help-value option */ 305181834Sroberto#define VALUE_OPT_MORE_HELP '!' 306285612Sdelphij/** option flag (value) for version-value option */ 307285612Sdelphij#define VALUE_OPT_VERSION 0x1001 308285612Sdelphij/** option flag (value) for save-opts-value option */ 309181834Sroberto#define VALUE_OPT_SAVE_OPTS '>' 310285612Sdelphij/** 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; \ 315285612Sdelphij DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 316181834Sroberto/* 317181834Sroberto * Interface defines not associated with particular options 318181834Sroberto */ 319285612Sdelphij#define ERRSKIP_OPTERR STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP) 320285612Sdelphij#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) 325285612Sdelphij#define USAGE(c) (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c) 326181834Sroberto 327285612Sdelphij#ifdef __cplusplus 328285612Sdelphijextern "C" { 329285612Sdelphij#endif 330285612Sdelphij 331285612Sdelphij 332181834Sroberto/* * * * * * 333181834Sroberto * 334181834Sroberto * Declare the ntp-keygen option descriptor. 335181834Sroberto */ 336285612Sdelphijextern tOptions ntp_keygenOptions; 337181834Sroberto 338285612Sdelphij#if defined(ENABLE_NLS) 339285612Sdelphij# ifndef _ 340285612Sdelphij# include <stdio.h> 341285612Sdelphij# ifndef HAVE_GETTEXT 342285612Sdelphij extern char * gettext(char const *); 343285612Sdelphij# else 344285612Sdelphij# include <libintl.h> 345285612Sdelphij# endif 346181834Sroberto 347285612Sdelphij# ifndef ATTRIBUTE_FORMAT_ARG 348285612Sdelphij# define ATTRIBUTE_FORMAT_ARG(_a) 349285612Sdelphij# endif 350181834Sroberto 351285612Sdelphijstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 352285612Sdelphijstatic inline char* aoGetsText(char const* pz) { 353285612Sdelphij if (pz == NULL) return NULL; 354285612Sdelphij return (char*)gettext(pz); 355285612Sdelphij} 356285612Sdelphij# define _(s) aoGetsText(s) 357285612Sdelphij# endif /* _() */ 358285612Sdelphij 359285612Sdelphij# define OPT_NO_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 360285612Sdelphij OPTPROC_NXLAT_OPT_CFG;) 361285612Sdelphij# define OPT_NO_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ 362285612Sdelphij OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 363285612Sdelphij 364285612Sdelphij# define OPT_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 365285612Sdelphij ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 366285612Sdelphij# define OPT_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ 367285612Sdelphij ~OPTPROC_NXLAT_OPT;) 368285612Sdelphij 369285612Sdelphij#else /* ENABLE_NLS */ 370285612Sdelphij# define OPT_NO_XLAT_CFG_NAMES 371285612Sdelphij# define OPT_NO_XLAT_OPT_NAMES 372285612Sdelphij 373285612Sdelphij# define OPT_XLAT_CFG_NAMES 374285612Sdelphij# define OPT_XLAT_OPT_NAMES 375285612Sdelphij 376285612Sdelphij# ifndef _ 377285612Sdelphij# define _(_s) _s 378285612Sdelphij# endif 379285612Sdelphij#endif /* ENABLE_NLS */ 380285612Sdelphij 381181834Sroberto#ifdef __cplusplus 382181834Sroberto} 383181834Sroberto#endif 384181834Sroberto#endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */ 385285612Sdelphij 386181834Sroberto/* ntp-keygen-opts.h ends here */ 387