xref: /netbsd-src/external/bsd/ntp/dist/util/ntp-keygen-opts.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: ntp-keygen-opts.h,v 1.1.1.1 2009/12/13 16:57:27 kardel Exp $	*/
2 
3 /*
4  *  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.h)
5  *
6  *  It has been AutoGen-ed  December 10, 2009 at 05:08:20 AM by AutoGen 5.10
7  *  From the definitions    ntp-keygen-opts.def
8  *  and the template file   options
9  *
10  * Generated from AutoOpts 33:0:8 templates.
11  */
12 
13 /*
14  *  This file was produced by an AutoOpts template.  AutoOpts is a
15  *  copyrighted work.  This header file is not encumbered by AutoOpts
16  *  licensing, but is provided under the licensing terms chosen by the
17  *  ntp-keygen author or copyright holder.  AutoOpts is licensed under
18  *  the terms of the LGPL.  The redistributable library (``libopts'') is
19  *  licensed under the terms of either the LGPL or, at the users discretion,
20  *  the BSD license.  See the AutoOpts and/or libopts sources for details.
21  *
22  * This source file is copyrighted and licensed under the following terms:
23  *
24  * ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved
25  *
26  * see html/copyright.html
27  */
28 /*
29  *  This file contains the programmatic interface to the Automated
30  *  Options generated for the ntp-keygen program.
31  *  These macros are documented in the AutoGen info file in the
32  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
33  */
34 #ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD
35 #define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1
36 #include "config.h"
37 #include <autoopts/options.h>
38 
39 /*
40  *  Ensure that the library used for compiling this generated header is at
41  *  least as new as the version current when the header template was released
42  *  (not counting patch version increments).  Also ensure that the oldest
43  *  tolerable version is at least as old as what was current when the header
44  *  template was released.
45  */
46 #define AO_TEMPLATE_VERSION 135168
47 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
48  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
49 # error option template version mismatches autoopts/options.h header
50   Choke Me.
51 #endif
52 
53 /*
54  *  Enumeration of each option:
55  */
56 typedef enum {
57     INDEX_OPT_CERTIFICATE      =  0,
58     INDEX_OPT_DEBUG_LEVEL      =  1,
59     INDEX_OPT_SET_DEBUG_LEVEL  =  2,
60     INDEX_OPT_ID_KEY           =  3,
61     INDEX_OPT_GQ_PARAMS        =  4,
62     INDEX_OPT_HOST_KEY         =  5,
63     INDEX_OPT_IFFKEY           =  6,
64     INDEX_OPT_ISSUER_NAME      =  7,
65     INDEX_OPT_MD5KEY           =  8,
66     INDEX_OPT_MODULUS          =  9,
67     INDEX_OPT_PVT_CERT         = 10,
68     INDEX_OPT_PVT_PASSWD       = 11,
69     INDEX_OPT_GET_PVT_PASSWD   = 12,
70     INDEX_OPT_SIGN_KEY         = 13,
71     INDEX_OPT_SUBJECT_NAME     = 14,
72     INDEX_OPT_TRUSTED_CERT     = 15,
73     INDEX_OPT_MV_PARAMS        = 16,
74     INDEX_OPT_MV_KEYS          = 17,
75     INDEX_OPT_VERSION          = 18,
76     INDEX_OPT_HELP             = 19,
77     INDEX_OPT_MORE_HELP        = 20,
78     INDEX_OPT_SAVE_OPTS        = 21,
79     INDEX_OPT_LOAD_OPTS        = 22
80 } teOptIndex;
81 
82 #define OPTION_CT    23
83 #define NTP_KEYGEN_VERSION       "4.2.6"
84 #define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.6"
85 
86 /*
87  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
88  *  option name (as in the teOptIndex enumeration above).
89  *  e.g. HAVE_OPT( CERTIFICATE )
90  */
91 #define         DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n])
92 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
93 #define      OPT_ARG(n) (DESC(n).optArg.argString)
94 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
95 #define    COUNT_OPT(n) (DESC(n).optOccCt)
96 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
97 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
98 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
99 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
100 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
101 #define    CLEAR_OPT(n) STMTS( \
102                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
103                 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
104                     DESC(n).fOptState |= OPTST_DISABLED; \
105                 DESC(n).optCookie = NULL )
106 
107 /*
108  *  Make sure there are no #define name conflicts with the option names
109  */
110 #ifndef     NO_OPTION_NAME_WARNINGS
111 # ifdef    CERTIFICATE
112 #  warning undefining CERTIFICATE due to option name conflict
113 #  undef   CERTIFICATE
114 # endif
115 # ifdef    DEBUG_LEVEL
116 #  warning undefining DEBUG_LEVEL due to option name conflict
117 #  undef   DEBUG_LEVEL
118 # endif
119 # ifdef    SET_DEBUG_LEVEL
120 #  warning undefining SET_DEBUG_LEVEL due to option name conflict
121 #  undef   SET_DEBUG_LEVEL
122 # endif
123 # ifdef    ID_KEY
124 #  warning undefining ID_KEY due to option name conflict
125 #  undef   ID_KEY
126 # endif
127 # ifdef    GQ_PARAMS
128 #  warning undefining GQ_PARAMS due to option name conflict
129 #  undef   GQ_PARAMS
130 # endif
131 # ifdef    HOST_KEY
132 #  warning undefining HOST_KEY due to option name conflict
133 #  undef   HOST_KEY
134 # endif
135 # ifdef    IFFKEY
136 #  warning undefining IFFKEY due to option name conflict
137 #  undef   IFFKEY
138 # endif
139 # ifdef    ISSUER_NAME
140 #  warning undefining ISSUER_NAME due to option name conflict
141 #  undef   ISSUER_NAME
142 # endif
143 # ifdef    MD5KEY
144 #  warning undefining MD5KEY due to option name conflict
145 #  undef   MD5KEY
146 # endif
147 # ifdef    MODULUS
148 #  warning undefining MODULUS due to option name conflict
149 #  undef   MODULUS
150 # endif
151 # ifdef    PVT_CERT
152 #  warning undefining PVT_CERT due to option name conflict
153 #  undef   PVT_CERT
154 # endif
155 # ifdef    PVT_PASSWD
156 #  warning undefining PVT_PASSWD due to option name conflict
157 #  undef   PVT_PASSWD
158 # endif
159 # ifdef    GET_PVT_PASSWD
160 #  warning undefining GET_PVT_PASSWD due to option name conflict
161 #  undef   GET_PVT_PASSWD
162 # endif
163 # ifdef    SIGN_KEY
164 #  warning undefining SIGN_KEY due to option name conflict
165 #  undef   SIGN_KEY
166 # endif
167 # ifdef    SUBJECT_NAME
168 #  warning undefining SUBJECT_NAME due to option name conflict
169 #  undef   SUBJECT_NAME
170 # endif
171 # ifdef    TRUSTED_CERT
172 #  warning undefining TRUSTED_CERT due to option name conflict
173 #  undef   TRUSTED_CERT
174 # endif
175 # ifdef    MV_PARAMS
176 #  warning undefining MV_PARAMS due to option name conflict
177 #  undef   MV_PARAMS
178 # endif
179 # ifdef    MV_KEYS
180 #  warning undefining MV_KEYS due to option name conflict
181 #  undef   MV_KEYS
182 # endif
183 #else  /* NO_OPTION_NAME_WARNINGS */
184 # undef CERTIFICATE
185 # undef DEBUG_LEVEL
186 # undef SET_DEBUG_LEVEL
187 # undef ID_KEY
188 # undef GQ_PARAMS
189 # undef HOST_KEY
190 # undef IFFKEY
191 # undef ISSUER_NAME
192 # undef MD5KEY
193 # undef MODULUS
194 # undef PVT_CERT
195 # undef PVT_PASSWD
196 # undef GET_PVT_PASSWD
197 # undef SIGN_KEY
198 # undef SUBJECT_NAME
199 # undef TRUSTED_CERT
200 # undef MV_PARAMS
201 # undef MV_KEYS
202 #endif  /*  NO_OPTION_NAME_WARNINGS */
203 
204 /* * * * * *
205  *
206  *  Interface defines for specific options.
207  */
208 #define VALUE_OPT_CERTIFICATE    'c'
209 #define VALUE_OPT_DEBUG_LEVEL    'd'
210 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
211 #define VALUE_OPT_ID_KEY         'e'
212 #define VALUE_OPT_GQ_PARAMS      'G'
213 #define VALUE_OPT_HOST_KEY       'H'
214 #define VALUE_OPT_IFFKEY         'I'
215 #define VALUE_OPT_ISSUER_NAME    'i'
216 #define VALUE_OPT_MD5KEY         'M'
217 #define VALUE_OPT_MODULUS        'm'
218 #ifdef OPENSSL
219 
220 #define OPT_VALUE_MODULUS        (DESC(MODULUS).optArg.argInt)
221 #endif /* OPENSSL */
222 #define VALUE_OPT_PVT_CERT       'P'
223 #define VALUE_OPT_PVT_PASSWD     'p'
224 #define VALUE_OPT_GET_PVT_PASSWD 'q'
225 #define VALUE_OPT_SIGN_KEY       'S'
226 #define VALUE_OPT_SUBJECT_NAME   's'
227 #define VALUE_OPT_TRUSTED_CERT   'T'
228 #define VALUE_OPT_MV_PARAMS      'V'
229 #ifdef OPENSSL
230 
231 #define OPT_VALUE_MV_PARAMS      (DESC(MV_PARAMS).optArg.argInt)
232 #endif /* OPENSSL */
233 #define VALUE_OPT_MV_KEYS        'v'
234 #ifdef OPENSSL
235 
236 #define OPT_VALUE_MV_KEYS        (DESC(MV_KEYS).optArg.argInt)
237 #endif /* OPENSSL */
238 #define VALUE_OPT_HELP          '?'
239 #define VALUE_OPT_MORE_HELP     '!'
240 #define VALUE_OPT_VERSION       INDEX_OPT_VERSION
241 #define VALUE_OPT_SAVE_OPTS     '>'
242 #define VALUE_OPT_LOAD_OPTS     '<'
243 #define SET_OPT_SAVE_OPTS(a)   STMTS( \
244         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
245         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
246         DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
247 /*
248  *  Interface defines not associated with particular options
249  */
250 #define ERRSKIP_OPTERR  STMTS( ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP )
251 #define ERRSTOP_OPTERR  STMTS( ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP )
252 #define RESTART_OPT(n)  STMTS( \
253                 ntp_keygenOptions.curOptIdx = (n); \
254                 ntp_keygenOptions.pzCurOpt  = NULL )
255 #define START_OPT       RESTART_OPT(1)
256 #define USAGE(c)        (*ntp_keygenOptions.pUsageProc)( &ntp_keygenOptions, c )
257 /* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */
258 
259 /* * * * * *
260  *
261  *  Declare the ntp-keygen option descriptor.
262  */
263 #ifdef  __cplusplus
264 extern "C" {
265 #endif
266 
267 extern tOptions   ntp_keygenOptions;
268 
269 #if defined(ENABLE_NLS)
270 # ifndef _
271 #   include <stdio.h>
272     static inline char* aoGetsText( char const* pz ) {
273         if (pz == NULL) return NULL;
274         return (char*)gettext( pz );
275     }
276 #   define _(s)  aoGetsText(s)
277 # endif /* _() */
278 
279 # define OPT_NO_XLAT_CFG_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
280                                     OPTPROC_NXLAT_OPT_CFG;)
281 # define OPT_NO_XLAT_OPT_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
282                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
283 
284 # define OPT_XLAT_CFG_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
285                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
286 # define OPT_XLAT_OPT_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
287                                   ~OPTPROC_NXLAT_OPT;)
288 
289 #else   /* ENABLE_NLS */
290 # define OPT_NO_XLAT_CFG_NAMES
291 # define OPT_NO_XLAT_OPT_NAMES
292 
293 # define OPT_XLAT_CFG_NAMES
294 # define OPT_XLAT_OPT_NAMES
295 
296 # ifndef _
297 #   define _(_s)  _s
298 # endif
299 #endif  /* ENABLE_NLS */
300 
301 #ifdef  __cplusplus
302 }
303 #endif
304 #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */
305 /* ntp-keygen-opts.h ends here */
306