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