Imported Upstream version 3.4.11
[platform/upstream/gnutls.git] / src / p11tool-args.h.bak
1 /*   -*- buffer-read-only: t -*- vi: set ro:
2  *
3  *  DO NOT EDIT THIS FILE   (p11tool-args.h)
4  *
5  *  It has been AutoGen-ed
6  *  From the definitions    p11tool-args.def
7  *  and the template file   options
8  *
9  * Generated from AutoOpts 41:1:16 templates.
10  *
11  *  AutoOpts is a copyrighted work.  This header file is not encumbered
12  *  by AutoOpts licensing, but is provided under the licensing terms chosen
13  *  by the p11tool author or copyright holder.  AutoOpts is
14  *  licensed under the terms of the LGPL.  The redistributable library
15  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
16  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
17  *  for details.
18  *
19  * The p11tool program is copyrighted and licensed
20  * under the following terms:
21  *
22  *  Copyright (C) 2000-2016 Free Software Foundation, and others, all rights reserved.
23  *  This is free software. It is licensed for use, modification and
24  *  redistribution under the terms of the GNU General Public License,
25  *  version 3 or later <http://gnu.org/licenses/gpl.html>
26  *
27  *  p11tool is free software: you can redistribute it and/or modify it
28  *  under the terms of the GNU General Public License as published by the
29  *  Free Software Foundation, either version 3 of the License, or
30  *  (at your option) any later version.
31  *
32  *  p11tool is distributed in the hope that it will be useful, but
33  *  WITHOUT ANY WARRANTY; without even the implied warranty of
34  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35  *  See the GNU General Public License for more details.
36  *
37  *  You should have received a copy of the GNU General Public License along
38  *  with this program.  If not, see <http://www.gnu.org/licenses/>.
39  */
40 /**
41  *  This file contains the programmatic interface to the Automated
42  *  Options generated for the p11tool program.
43  *  These macros are documented in the AutoGen info file in the
44  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
45  */
46 #ifndef AUTOOPTS_P11TOOL_ARGS_H_GUARD
47 #define AUTOOPTS_P11TOOL_ARGS_H_GUARD 1
48 #include "config.h"
49 #include <autoopts/options.h>
50
51 /**
52  *  Ensure that the library used for compiling this generated header is at
53  *  least as new as the version current when the header template was released
54  *  (not counting patch version increments).  Also ensure that the oldest
55  *  tolerable version is at least as old as what was current when the header
56  *  template was released.
57  */
58 #define AO_TEMPLATE_VERSION 167937
59 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
60  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
61 # error option template version mismatches autoopts/options.h header
62   Choke Me.
63 #endif
64
65 /**
66  *  Enumeration of each option type for p11tool
67  */
68 typedef enum {
69     INDEX_OPT_LIST_TOKENS                   =  1,
70     INDEX_OPT_LIST_TOKEN_URLS               =  2,
71     INDEX_OPT_LIST_MECHANISMS               =  3,
72     INDEX_OPT_INITIALIZE                    =  4,
73     INDEX_OPT_SET_PIN                       =  5,
74     INDEX_OPT_SET_SO_PIN                    =  6,
75     INDEX_OPT_LIST_ALL                      =  8,
76     INDEX_OPT_LIST_ALL_CERTS                =  9,
77     INDEX_OPT_LIST_CERTS                    = 10,
78     INDEX_OPT_LIST_ALL_PRIVKEYS             = 11,
79     INDEX_OPT_LIST_PRIVKEYS                 = 12,
80     INDEX_OPT_LIST_KEYS                     = 13,
81     INDEX_OPT_LIST_ALL_TRUSTED              = 14,
82     INDEX_OPT_EXPORT                        = 15,
83     INDEX_OPT_EXPORT_CHAIN                  = 16,
84     INDEX_OPT_EXPORT_PUBKEY                 = 17,
85     INDEX_OPT_INFO                          = 18,
86     INDEX_OPT_GENERATE_RSA                  = 20,
87     INDEX_OPT_GENERATE_DSA                  = 21,
88     INDEX_OPT_GENERATE_ECC                  = 22,
89     INDEX_OPT_BITS                          = 23,
90     INDEX_OPT_CURVE                         = 24,
91     INDEX_OPT_SEC_PARAM                     = 25,
92     INDEX_OPT_SET_ID                        = 27,
93     INDEX_OPT_SET_LABEL                     = 28,
94     INDEX_OPT_WRITE                         = 29,
95     INDEX_OPT_DELETE                        = 30,
96     INDEX_OPT_LABEL                         = 31,
97     INDEX_OPT_ID                            = 32,
98     INDEX_OPT_MARK_WRAP                     = 33,
99     INDEX_OPT_MARK_TRUSTED                  = 34,
100     INDEX_OPT_MARK_DECRYPT                  = 35,
101     INDEX_OPT_MARK_SIGN                     = 36,
102     INDEX_OPT_MARK_CA                       = 37,
103     INDEX_OPT_MARK_PRIVATE                  = 38,
104     INDEX_OPT_TRUSTED                       = 39,
105     INDEX_OPT_CA                            = 40,
106     INDEX_OPT_PRIVATE                       = 41,
107     INDEX_OPT_SECRET_KEY                    = 42,
108     INDEX_OPT_LOAD_PRIVKEY                  = 43,
109     INDEX_OPT_LOAD_PUBKEY                   = 44,
110     INDEX_OPT_LOAD_CERTIFICATE              = 45,
111     INDEX_OPT_DEBUG                         = 47,
112     INDEX_OPT_OUTFILE                       = 48,
113     INDEX_OPT_LOGIN                         = 49,
114     INDEX_OPT_SO_LOGIN                      = 50,
115     INDEX_OPT_ADMIN_LOGIN                   = 51,
116     INDEX_OPT_TEST_SIGN                     = 52,
117     INDEX_OPT_GENERATE_RANDOM               = 53,
118     INDEX_OPT_PKCS8                         = 54,
119     INDEX_OPT_INDER                         = 55,
120     INDEX_OPT_INRAW                         = 56,
121     INDEX_OPT_OUTDER                        = 57,
122     INDEX_OPT_OUTRAW                        = 58,
123     INDEX_OPT_PROVIDER                      = 59,
124     INDEX_OPT_DETAILED_URL                  = 60,
125     INDEX_OPT_ONLY_URLS                     = 61,
126     INDEX_OPT_BATCH                         = 62,
127     INDEX_OPT_VERSION                       = 63,
128     INDEX_OPT_HELP                          = 64,
129     INDEX_OPT_MORE_HELP                     = 65
130 } teOptIndex;
131 /** count of all options for p11tool */
132 #define OPTION_CT    66
133 /** p11tool version */
134 #define P11TOOL_VERSION       "3.4.11"
135 /** Full p11tool version text */
136 #define P11TOOL_FULL_VERSION  "p11tool 3.4.11"
137
138 /**
139  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
140  *  option name (as in the teOptIndex enumeration above).
141  *  e.g. HAVE_OPT(TOKEN_RELATED_OPTIONS)
142  */
143 #define         DESC(n) (p11toolOptions.pOptDesc[INDEX_OPT_## n])
144 /** 'true' if an option has been specified in any way */
145 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
146 /** The string argument to an option. The argument type must be \"string\". */
147 #define      OPT_ARG(n) (DESC(n).optArg.argString)
148 /** Mask the option state revealing how an option was specified.
149  *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
150  * \a OPTST_DEFINED, \a OPTST_RESET or zero.
151  */
152 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
153 /** Count of option's occurrances *on the command line*. */
154 #define    COUNT_OPT(n) (DESC(n).optOccCt)
155 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
156 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
157 /** 'true' if \a HAVE_OPT would yield 'false'. */
158 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
159 /** 'true' if OPTST_DISABLED bit not set. */
160 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
161 /** number of stacked option arguments.
162  *  Valid only for stacked option arguments. */
163 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
164 /** stacked argument vector.
165  *  Valid only for stacked option arguments. */
166 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
167 /** Reset an option. */
168 #define    CLEAR_OPT(n) STMTS( \
169                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
170                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
171                     DESC(n).fOptState |= OPTST_DISABLED; \
172                 DESC(n).optCookie = NULL )
173 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
174 /**
175  *  Enumeration of p11tool exit codes
176  */
177 typedef enum {
178     P11TOOL_EXIT_SUCCESS         = 0,
179     P11TOOL_EXIT_FAILURE         = 1,
180     P11TOOL_EXIT_USAGE_ERROR     = 64,
181     P11TOOL_EXIT_LIBOPTS_FAILURE = 70
182 }   p11tool_exit_code_t;
183 /**
184  *  Interface defines for specific options.
185  * @{
186  */
187 #define VALUE_OPT_LIST_TOKENS    0x1001
188 #define VALUE_OPT_LIST_TOKEN_URLS 0x1002
189 #define VALUE_OPT_LIST_MECHANISMS 0x1003
190 #define VALUE_OPT_INITIALIZE     0x1004
191 #define VALUE_OPT_SET_PIN        0x1005
192 #define VALUE_OPT_SET_SO_PIN     0x1006
193 #define VALUE_OPT_LIST_ALL       0x1007
194 #define VALUE_OPT_LIST_ALL_CERTS 0x1008
195 #define VALUE_OPT_LIST_CERTS     0x1009
196 #define VALUE_OPT_LIST_ALL_PRIVKEYS 0x100A
197 #define VALUE_OPT_LIST_PRIVKEYS  0x100B
198 #define VALUE_OPT_LIST_KEYS      0x100C
199 #define VALUE_OPT_LIST_ALL_TRUSTED 0x100D
200 #define VALUE_OPT_EXPORT         0x100E
201 #define VALUE_OPT_EXPORT_CHAIN   0x100F
202 #define VALUE_OPT_EXPORT_PUBKEY  0x1010
203 #define VALUE_OPT_INFO           0x1011
204 #define VALUE_OPT_GENERATE_RSA   0x1012
205 #define VALUE_OPT_GENERATE_DSA   0x1013
206 #define VALUE_OPT_GENERATE_ECC   0x1014
207 #define VALUE_OPT_BITS           0x1015
208
209 #define OPT_VALUE_BITS           (DESC(BITS).optArg.argInt)
210 #define VALUE_OPT_CURVE          0x1016
211 #define VALUE_OPT_SEC_PARAM      0x1017
212 #define VALUE_OPT_SET_ID         0x1018
213 #define VALUE_OPT_SET_LABEL      0x1019
214 #define VALUE_OPT_WRITE          0x101A
215 #define VALUE_OPT_DELETE         0x101B
216 #define VALUE_OPT_LABEL          0x101C
217 #define VALUE_OPT_ID             0x101D
218 #define VALUE_OPT_MARK_WRAP      0x101E
219 #define VALUE_OPT_MARK_TRUSTED   0x101F
220 #define VALUE_OPT_MARK_DECRYPT   0x1020
221 #define VALUE_OPT_MARK_SIGN      0x1021
222 #define VALUE_OPT_MARK_CA        0x1022
223 #define VALUE_OPT_MARK_PRIVATE   0x1023
224 #define VALUE_OPT_TRUSTED        0x1024
225 #define VALUE_OPT_CA             0x1025
226 #define VALUE_OPT_PRIVATE        0x1026
227 #define VALUE_OPT_SECRET_KEY     0x1027
228 #define VALUE_OPT_LOAD_PRIVKEY   0x1028
229 #define VALUE_OPT_LOAD_PUBKEY    0x1029
230 #define VALUE_OPT_LOAD_CERTIFICATE 0x102A
231 #define VALUE_OPT_DEBUG          'd'
232
233 #define OPT_VALUE_DEBUG          (DESC(DEBUG).optArg.argInt)
234 #define VALUE_OPT_OUTFILE        0x102B
235 #define VALUE_OPT_LOGIN          0x102C
236 #define VALUE_OPT_SO_LOGIN       0x102D
237 #define VALUE_OPT_ADMIN_LOGIN    0x102E
238 #define VALUE_OPT_TEST_SIGN      0x102F
239 #define VALUE_OPT_GENERATE_RANDOM 0x1030
240
241 #define OPT_VALUE_GENERATE_RANDOM (DESC(GENERATE_RANDOM).optArg.argInt)
242 #define VALUE_OPT_PKCS8          '8'
243 #define VALUE_OPT_INDER          0x1031
244 #define VALUE_OPT_INRAW          0x1032
245 #define VALUE_OPT_OUTDER         0x1033
246 #define VALUE_OPT_OUTRAW         0x1034
247 #define VALUE_OPT_PROVIDER       0x1035
248 #define VALUE_OPT_DETAILED_URL   0x1036
249 #define VALUE_OPT_ONLY_URLS      0x1037
250 #define VALUE_OPT_BATCH          0x1038
251 /** option flag (value) for help-value option */
252 #define VALUE_OPT_HELP          'h'
253 /** option flag (value) for more-help-value option */
254 #define VALUE_OPT_MORE_HELP     '!'
255 /** option flag (value) for version-value option */
256 #define VALUE_OPT_VERSION       'v'
257 /*
258  *  Interface defines not associated with particular options
259  */
260 #define ERRSKIP_OPTERR  STMTS(p11toolOptions.fOptSet &= ~OPTPROC_ERRSTOP)
261 #define ERRSTOP_OPTERR  STMTS(p11toolOptions.fOptSet |= OPTPROC_ERRSTOP)
262 #define RESTART_OPT(n)  STMTS( \
263                 p11toolOptions.curOptIdx = (n); \
264                 p11toolOptions.pzCurOpt  = NULL )
265 #define START_OPT       RESTART_OPT(1)
266 #define USAGE(c)        (*p11toolOptions.pUsageProc)(&p11toolOptions, c)
267
268 #ifdef  __cplusplus
269 extern "C" {
270 #endif
271 /*
272  *  global exported definitions
273  */
274 #include <gettext.h>
275
276
277 /* * * * * *
278  *
279  *  Declare the p11tool option descriptor.
280  */
281 extern tOptions p11toolOptions;
282
283 #if defined(ENABLE_NLS)
284 # ifndef _
285 #   include <stdio.h>
286 #   ifndef HAVE_GETTEXT
287       extern char * gettext(char const *);
288 #   else
289 #     include <libintl.h>
290 #   endif
291
292 # ifndef ATTRIBUTE_FORMAT_ARG
293 #   define ATTRIBUTE_FORMAT_ARG(_a)
294 # endif
295
296 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
297 static inline char* aoGetsText(char const* pz) {
298     if (pz == NULL) return NULL;
299     return (char*)gettext(pz);
300 }
301 #   define _(s)  aoGetsText(s)
302 # endif /* _() */
303
304 # define OPT_NO_XLAT_CFG_NAMES  STMTS(p11toolOptions.fOptSet |= \
305                                     OPTPROC_NXLAT_OPT_CFG;)
306 # define OPT_NO_XLAT_OPT_NAMES  STMTS(p11toolOptions.fOptSet |= \
307                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
308
309 # define OPT_XLAT_CFG_NAMES     STMTS(p11toolOptions.fOptSet &= \
310                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
311 # define OPT_XLAT_OPT_NAMES     STMTS(p11toolOptions.fOptSet &= \
312                                   ~OPTPROC_NXLAT_OPT;)
313
314 #else   /* ENABLE_NLS */
315 # define OPT_NO_XLAT_CFG_NAMES
316 # define OPT_NO_XLAT_OPT_NAMES
317
318 # define OPT_XLAT_CFG_NAMES
319 # define OPT_XLAT_OPT_NAMES
320
321 # ifndef _
322 #   define _(_s)  _s
323 # endif
324 #endif  /* ENABLE_NLS */
325
326 #ifdef  __cplusplus
327 }
328 #endif
329 #endif /* AUTOOPTS_P11TOOL_ARGS_H_GUARD */
330
331 /* p11tool-args.h ends here */