1290001Sglebius/*
2181834Sroberto *  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.h)
3290001Sglebius *
4310419Sdelphij *  It has been AutoGen-ed  November 21, 2016 at 08:03:29 AM by AutoGen 5.18.5
5181834Sroberto *  From the definitions    ntp-keygen-opts.def
6181834Sroberto *  and the template file   options
7181834Sroberto *
8290001Sglebius * Generated from AutoOpts 41:0:16 templates.
9181834Sroberto *
10290001Sglebius *  AutoOpts is a copyrighted work.  This header file is not encumbered
11290001Sglebius *  by AutoOpts licensing, but is provided under the licensing terms chosen
12290001Sglebius *  by the ntp-keygen author or copyright holder.  AutoOpts is
13290001Sglebius *  licensed under the terms of the LGPL.  The redistributable library
14290001Sglebius *  (``libopts'') is licensed under the terms of either the LGPL or, at the
15290001Sglebius *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
16290001Sglebius *  for details.
17181834Sroberto *
18290001Sglebius * The ntp-keygen program is copyrighted and licensed
19290001Sglebius * under the following terms:
20181834Sroberto *
21294905Sdelphij *  Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
22290001Sglebius *  This is free software. It is licensed for use, modification and
23290001Sglebius *  redistribution under the terms of the NTP License, copies of which
24290001Sglebius *  can be seen at:
25290001Sglebius *    <http://ntp.org/license>
26290001Sglebius *    <http://opensource.org/licenses/ntp-license.php>
27290001Sglebius *
28290001Sglebius *  Permission to use, copy, modify, and distribute this software and its
29290001Sglebius *  documentation for any purpose with or without fee is hereby granted,
30290001Sglebius *  provided that the above copyright notice appears in all copies and that
31290001Sglebius *  both the copyright notice and this permission notice appear in
32290001Sglebius *  supporting documentation, and that the name The University of Delaware not be used in
33290001Sglebius *  advertising or publicity pertaining to distribution of the software
34290001Sglebius *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35290001Sglebius *  representations about the suitability this software for any purpose. It
36290001Sglebius *  is provided "as is" without express or implied warranty.
37181834Sroberto */
38290001Sglebius/**
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
45290001Sglebius#define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1
46181834Sroberto#include "config.h"
47181834Sroberto#include <autoopts/options.h>
48181834Sroberto
49290001Sglebius/**
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 */
56290001Sglebius#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
63290001Sglebius/**
64290001Sglebius *  Enumeration of each option type for ntp-keygen
65181834Sroberto */
66181834Srobertotypedef enum {
67290001Sglebius    INDEX_OPT_IMBITS           =  0,
68290001Sglebius    INDEX_OPT_CERTIFICATE      =  1,
69290001Sglebius    INDEX_OPT_CIPHER           =  2,
70290001Sglebius    INDEX_OPT_DEBUG_LEVEL      =  3,
71290001Sglebius    INDEX_OPT_SET_DEBUG_LEVEL  =  4,
72290001Sglebius    INDEX_OPT_ID_KEY           =  5,
73290001Sglebius    INDEX_OPT_GQ_PARAMS        =  6,
74290001Sglebius    INDEX_OPT_HOST_KEY         =  7,
75290001Sglebius    INDEX_OPT_IFFKEY           =  8,
76290001Sglebius    INDEX_OPT_IDENT            =  9,
77290001Sglebius    INDEX_OPT_LIFETIME         = 10,
78290001Sglebius    INDEX_OPT_MD5KEY           = 11,
79290001Sglebius    INDEX_OPT_MODULUS          = 12,
80290001Sglebius    INDEX_OPT_PVT_CERT         = 13,
81290001Sglebius    INDEX_OPT_PASSWORD         = 14,
82290001Sglebius    INDEX_OPT_EXPORT_PASSWD    = 15,
83290001Sglebius    INDEX_OPT_SIGN_KEY         = 16,
84290001Sglebius    INDEX_OPT_SUBJECT_NAME     = 17,
85290001Sglebius    INDEX_OPT_TRUSTED_CERT     = 18,
86290001Sglebius    INDEX_OPT_MV_PARAMS        = 19,
87290001Sglebius    INDEX_OPT_MV_KEYS          = 20,
88290001Sglebius    INDEX_OPT_VERSION          = 21,
89290001Sglebius    INDEX_OPT_HELP             = 22,
90290001Sglebius    INDEX_OPT_MORE_HELP        = 23,
91290001Sglebius    INDEX_OPT_SAVE_OPTS        = 24,
92290001Sglebius    INDEX_OPT_LOAD_OPTS        = 25
93181834Sroberto} teOptIndex;
94290001Sglebius/** count of all options for ntp-keygen */
95290001Sglebius#define OPTION_CT    26
96290001Sglebius/** ntp-keygen version */
97310419Sdelphij#define NTP_KEYGEN_VERSION       "4.2.8p9"
98290001Sglebius/** Full ntp-keygen version text */
99310419Sdelphij#define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) 4.2.8p9"
100181834Sroberto
101290001Sglebius/**
102181834Sroberto *  Interface defines for all options.  Replace "n" with the UPPER_CASED
103181834Sroberto *  option name (as in the teOptIndex enumeration above).
104290001Sglebius *  e.g. HAVE_OPT(IMBITS)
105181834Sroberto */
106181834Sroberto#define         DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n])
107290001Sglebius/** 'true' if an option has been specified in any way */
108181834Sroberto#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
109290001Sglebius/** The string argument to an option. The argument type must be \"string\". */
110181834Sroberto#define      OPT_ARG(n) (DESC(n).optArg.argString)
111290001Sglebius/** Mask the option state revealing how an option was specified.
112290001Sglebius *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
113290001Sglebius * \a OPTST_DEFINED, \a OPTST_RESET or zero.
114290001Sglebius */
115181834Sroberto#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
116290001Sglebius/** Count of option's occurrances *on the command line*. */
117181834Sroberto#define    COUNT_OPT(n) (DESC(n).optOccCt)
118290001Sglebius/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
119181834Sroberto#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
120290001Sglebius/** 'true' if \a HAVE_OPT would yield 'false'. */
121181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
122290001Sglebius/** 'true' if OPTST_DISABLED bit not set. */
123181834Sroberto#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
124290001Sglebius/** number of stacked option arguments.
125290001Sglebius *  Valid only for stacked option arguments. */
126181834Sroberto#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
127290001Sglebius/** stacked argument vector.
128290001Sglebius *  Valid only for stacked option arguments. */
129181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
130290001Sglebius/** Reset an option. */
131181834Sroberto#define    CLEAR_OPT(n) STMTS( \
132181834Sroberto                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
133290001Sglebius                if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
134181834Sroberto                    DESC(n).fOptState |= OPTST_DISABLED; \
135181834Sroberto                DESC(n).optCookie = NULL )
136290001Sglebius/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
137290001Sglebius/**
138290001Sglebius *  Enumeration of ntp-keygen exit codes
139290001Sglebius */
140290001Sglebiustypedef enum {
141290001Sglebius    NTP_KEYGEN_EXIT_SUCCESS         = 0,
142290001Sglebius    NTP_KEYGEN_EXIT_FAILURE         = 1,
143290001Sglebius    NTP_KEYGEN_EXIT_USAGE_ERROR     = 64,
144290001Sglebius    NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66,
145290001Sglebius    NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70
146290001Sglebius}   ntp_keygen_exit_code_t;
147290001Sglebius/** @} */
148290001Sglebius/**
149181834Sroberto *  Make sure there are no #define name conflicts with the option names
150181834Sroberto */
151181834Sroberto#ifndef     NO_OPTION_NAME_WARNINGS
152290001Sglebius# ifdef    IMBITS
153290001Sglebius#  warning undefining IMBITS due to option name conflict
154290001Sglebius#  undef   IMBITS
155290001Sglebius# endif
156181834Sroberto# ifdef    CERTIFICATE
157181834Sroberto#  warning undefining CERTIFICATE due to option name conflict
158181834Sroberto#  undef   CERTIFICATE
159181834Sroberto# endif
160290001Sglebius# ifdef    CIPHER
161290001Sglebius#  warning undefining CIPHER due to option name conflict
162290001Sglebius#  undef   CIPHER
163290001Sglebius# 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
188290001Sglebius# ifdef    IDENT
189290001Sglebius#  warning undefining IDENT due to option name conflict
190290001Sglebius#  undef   IDENT
191181834Sroberto# endif
192290001Sglebius# ifdef    LIFETIME
193290001Sglebius#  warning undefining LIFETIME due to option name conflict
194290001Sglebius#  undef   LIFETIME
195290001Sglebius# 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
208290001Sglebius# ifdef    PASSWORD
209290001Sglebius#  warning undefining PASSWORD due to option name conflict
210290001Sglebius#  undef   PASSWORD
211181834Sroberto# endif
212290001Sglebius# ifdef    EXPORT_PASSWD
213290001Sglebius#  warning undefining EXPORT_PASSWD due to option name conflict
214290001Sglebius#  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 */
237290001Sglebius# undef IMBITS
238181834Sroberto# undef CERTIFICATE
239290001Sglebius# 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
246290001Sglebius# undef IDENT
247290001Sglebius# undef LIFETIME
248181834Sroberto# undef MD5KEY
249181834Sroberto# undef MODULUS
250181834Sroberto# undef PVT_CERT
251290001Sglebius# undef PASSWORD
252290001Sglebius# 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
260290001Sglebius/**
261181834Sroberto *  Interface defines for specific options.
262290001Sglebius * @{
263181834Sroberto */
264290001Sglebius#define VALUE_OPT_IMBITS         'b'
265290001Sglebius#ifdef AUTOKEY
266290001Sglebius#define OPT_VALUE_IMBITS         (DESC(IMBITS).optArg.argInt)
267290001Sglebius#endif /* AUTOKEY */
268181834Sroberto#define VALUE_OPT_CERTIFICATE    'c'
269290001Sglebius#define VALUE_OPT_CIPHER         'C'
270181834Sroberto#define VALUE_OPT_DEBUG_LEVEL    'd'
271181834Sroberto#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
272290001Sglebius
273290001Sglebius#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'
278290001Sglebius#define VALUE_OPT_IDENT          'i'
279290001Sglebius#define VALUE_OPT_LIFETIME       'l'
280290001Sglebius#ifdef AUTOKEY
281290001Sglebius#define OPT_VALUE_LIFETIME       (DESC(LIFETIME).optArg.argInt)
282290001Sglebius#endif /* AUTOKEY */
283181834Sroberto#define VALUE_OPT_MD5KEY         'M'
284181834Sroberto#define VALUE_OPT_MODULUS        'm'
285290001Sglebius#ifdef AUTOKEY
286181834Sroberto#define OPT_VALUE_MODULUS        (DESC(MODULUS).optArg.argInt)
287290001Sglebius#endif /* AUTOKEY */
288181834Sroberto#define VALUE_OPT_PVT_CERT       'P'
289290001Sglebius#define VALUE_OPT_PASSWORD       'p'
290290001Sglebius#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'
295290001Sglebius#ifdef AUTOKEY
296181834Sroberto#define OPT_VALUE_MV_PARAMS      (DESC(MV_PARAMS).optArg.argInt)
297290001Sglebius#endif /* AUTOKEY */
298181834Sroberto#define VALUE_OPT_MV_KEYS        'v'
299290001Sglebius#ifdef AUTOKEY
300181834Sroberto#define OPT_VALUE_MV_KEYS        (DESC(MV_KEYS).optArg.argInt)
301290001Sglebius#endif /* AUTOKEY */
302290001Sglebius/** option flag (value) for help-value option */
303181834Sroberto#define VALUE_OPT_HELP          '?'
304290001Sglebius/** option flag (value) for more-help-value option */
305181834Sroberto#define VALUE_OPT_MORE_HELP     '!'
306290001Sglebius/** option flag (value) for version-value option */
307290001Sglebius#define VALUE_OPT_VERSION       0x1001
308290001Sglebius/** option flag (value) for save-opts-value option */
309181834Sroberto#define VALUE_OPT_SAVE_OPTS     '>'
310290001Sglebius/** 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; \
315290001Sglebius        DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
316181834Sroberto/*
317181834Sroberto *  Interface defines not associated with particular options
318181834Sroberto */
319290001Sglebius#define ERRSKIP_OPTERR  STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP)
320290001Sglebius#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)
325290001Sglebius#define USAGE(c)        (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c)
326181834Sroberto
327290001Sglebius#ifdef  __cplusplus
328290001Sglebiusextern "C" {
329290001Sglebius#endif
330290001Sglebius
331290001Sglebius
332181834Sroberto/* * * * * *
333181834Sroberto *
334181834Sroberto *  Declare the ntp-keygen option descriptor.
335181834Sroberto */
336290001Sglebiusextern tOptions ntp_keygenOptions;
337181834Sroberto
338290001Sglebius#if defined(ENABLE_NLS)
339290001Sglebius# ifndef _
340290001Sglebius#   include <stdio.h>
341290001Sglebius#   ifndef HAVE_GETTEXT
342290001Sglebius      extern char * gettext(char const *);
343290001Sglebius#   else
344290001Sglebius#     include <libintl.h>
345290001Sglebius#   endif
346181834Sroberto
347290001Sglebius# ifndef ATTRIBUTE_FORMAT_ARG
348290001Sglebius#   define ATTRIBUTE_FORMAT_ARG(_a)
349290001Sglebius# endif
350181834Sroberto
351290001Sglebiusstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
352290001Sglebiusstatic inline char* aoGetsText(char const* pz) {
353290001Sglebius    if (pz == NULL) return NULL;
354290001Sglebius    return (char*)gettext(pz);
355290001Sglebius}
356290001Sglebius#   define _(s)  aoGetsText(s)
357290001Sglebius# endif /* _() */
358290001Sglebius
359290001Sglebius# define OPT_NO_XLAT_CFG_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
360290001Sglebius                                    OPTPROC_NXLAT_OPT_CFG;)
361290001Sglebius# define OPT_NO_XLAT_OPT_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
362290001Sglebius                                    OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
363290001Sglebius
364290001Sglebius# define OPT_XLAT_CFG_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
365290001Sglebius                                  ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
366290001Sglebius# define OPT_XLAT_OPT_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
367290001Sglebius                                  ~OPTPROC_NXLAT_OPT;)
368290001Sglebius
369290001Sglebius#else   /* ENABLE_NLS */
370290001Sglebius# define OPT_NO_XLAT_CFG_NAMES
371290001Sglebius# define OPT_NO_XLAT_OPT_NAMES
372290001Sglebius
373290001Sglebius# define OPT_XLAT_CFG_NAMES
374290001Sglebius# define OPT_XLAT_OPT_NAMES
375290001Sglebius
376290001Sglebius# ifndef _
377290001Sglebius#   define _(_s)  _s
378290001Sglebius# endif
379290001Sglebius#endif  /* ENABLE_NLS */
380290001Sglebius
381181834Sroberto#ifdef  __cplusplus
382181834Sroberto}
383181834Sroberto#endif
384181834Sroberto#endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */
385290001Sglebius
386181834Sroberto/* ntp-keygen-opts.h ends here */
387