1 /* -*- buffer-read-only: t -*- vi: set ro:
3 * DO NOT EDIT THIS FILE (tpmtool-args.h)
5 * It has been AutoGen-ed
6 * From the definitions tpmtool-args.def
7 * and the template file options
9 * Generated from AutoOpts 41:1:16 templates.
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 tpmtool 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
19 * The tpmtool program is copyrighted and licensed
20 * under the following terms:
22 * Copyright (C) 2000-2017 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>
27 * tpmtool 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.
32 * tpmtool 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.
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/>.
41 * This file contains the programmatic interface to the Automated
42 * Options generated for the tpmtool program.
43 * These macros are documented in the AutoGen info file in the
44 * "AutoOpts" chapter. Please refer to that doc for usage help.
46 #ifndef AUTOOPTS_TPMTOOL_ARGS_H_GUARD
47 #define AUTOOPTS_TPMTOOL_ARGS_H_GUARD 1
49 #include <autoopts/options.h>
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.
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
66 * Enumeration of each option type for tpmtool
71 INDEX_OPT_OUTFILE = 2,
72 INDEX_OPT_GENERATE_RSA = 3,
73 INDEX_OPT_REGISTER = 4,
74 INDEX_OPT_SIGNING = 5,
80 INDEX_OPT_DELETE = 11,
81 INDEX_OPT_TEST_SIGN = 12,
82 INDEX_OPT_SEC_PARAM = 13,
85 INDEX_OPT_OUTDER = 16,
86 INDEX_OPT_VERSION = 17,
88 INDEX_OPT_MORE_HELP = 19
90 /** count of all options for tpmtool */
92 /** tpmtool version */
93 #define TPMTOOL_VERSION "3.3.27"
94 /** Full tpmtool version text */
95 #define TPMTOOL_FULL_VERSION "tpmtool 3.3.27"
98 * Interface defines for all options. Replace "n" with the UPPER_CASED
99 * option name (as in the teOptIndex enumeration above).
100 * e.g. HAVE_OPT(DEBUG)
102 #define DESC(n) (tpmtoolOptions.pOptDesc[INDEX_OPT_## n])
103 /** 'true' if an option has been specified in any way */
104 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
105 /** The string argument to an option. The argument type must be \"string\". */
106 #define OPT_ARG(n) (DESC(n).optArg.argString)
107 /** Mask the option state revealing how an option was specified.
108 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
109 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
111 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
112 /** Count of option's occurrances *on the command line*. */
113 #define COUNT_OPT(n) (DESC(n).optOccCt)
114 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
115 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
116 /** 'true' if \a HAVE_OPT would yield 'false'. */
117 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
118 /** 'true' if OPTST_DISABLED bit not set. */
119 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
120 /** number of stacked option arguments.
121 * Valid only for stacked option arguments. */
122 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
123 /** stacked argument vector.
124 * Valid only for stacked option arguments. */
125 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
126 /** Reset an option. */
127 #define CLEAR_OPT(n) STMTS( \
128 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
129 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
130 DESC(n).fOptState |= OPTST_DISABLED; \
131 DESC(n).optCookie = NULL )
132 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
134 * Enumeration of tpmtool exit codes
137 TPMTOOL_EXIT_SUCCESS = 0,
138 TPMTOOL_EXIT_FAILURE = 1,
139 TPMTOOL_EXIT_USAGE_ERROR = 64,
140 TPMTOOL_EXIT_LIBOPTS_FAILURE = 70
141 } tpmtool_exit_code_t;
143 * Interface defines for specific options.
146 #define VALUE_OPT_DEBUG 'd'
148 #define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt)
149 #define VALUE_OPT_INFILE 0x1001
150 #define VALUE_OPT_OUTFILE 0x1002
151 #define VALUE_OPT_GENERATE_RSA 0x1003
152 #define VALUE_OPT_REGISTER 0x1004
153 #define VALUE_OPT_SIGNING 0x1005
154 #define VALUE_OPT_LEGACY 0x1006
155 #define VALUE_OPT_USER 0x1007
156 #define VALUE_OPT_SYSTEM 0x1008
157 #define VALUE_OPT_PUBKEY 0x1009
158 #define VALUE_OPT_LIST 0x100A
159 #define VALUE_OPT_DELETE 0x100B
160 #define VALUE_OPT_TEST_SIGN 0x100C
161 #define VALUE_OPT_SEC_PARAM 0x100D
162 #define VALUE_OPT_BITS 0x100E
164 #define OPT_VALUE_BITS (DESC(BITS).optArg.argInt)
165 #define VALUE_OPT_INDER 0x100F
166 #define VALUE_OPT_OUTDER 0x1010
167 /** option flag (value) for help-value option */
168 #define VALUE_OPT_HELP 'h'
169 /** option flag (value) for more-help-value option */
170 #define VALUE_OPT_MORE_HELP '!'
171 /** option flag (value) for version-value option */
172 #define VALUE_OPT_VERSION 'v'
174 * Interface defines not associated with particular options
176 #define ERRSKIP_OPTERR STMTS(tpmtoolOptions.fOptSet &= ~OPTPROC_ERRSTOP)
177 #define ERRSTOP_OPTERR STMTS(tpmtoolOptions.fOptSet |= OPTPROC_ERRSTOP)
178 #define RESTART_OPT(n) STMTS( \
179 tpmtoolOptions.curOptIdx = (n); \
180 tpmtoolOptions.pzCurOpt = NULL )
181 #define START_OPT RESTART_OPT(1)
182 #define USAGE(c) (*tpmtoolOptions.pUsageProc)(&tpmtoolOptions, c)
188 * global exported definitions
195 * Declare the tpmtool option descriptor.
197 extern tOptions tpmtoolOptions;
199 #if defined(ENABLE_NLS)
202 # ifndef HAVE_GETTEXT
203 extern char * gettext(char const *);
205 # include <libintl.h>
208 # ifndef ATTRIBUTE_FORMAT_ARG
209 # define ATTRIBUTE_FORMAT_ARG(_a)
212 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
213 static inline char* aoGetsText(char const* pz) {
214 if (pz == NULL) return NULL;
215 return (char*)gettext(pz);
217 # define _(s) aoGetsText(s)
220 # define OPT_NO_XLAT_CFG_NAMES STMTS(tpmtoolOptions.fOptSet |= \
221 OPTPROC_NXLAT_OPT_CFG;)
222 # define OPT_NO_XLAT_OPT_NAMES STMTS(tpmtoolOptions.fOptSet |= \
223 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
225 # define OPT_XLAT_CFG_NAMES STMTS(tpmtoolOptions.fOptSet &= \
226 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
227 # define OPT_XLAT_OPT_NAMES STMTS(tpmtoolOptions.fOptSet &= \
230 #else /* ENABLE_NLS */
231 # define OPT_NO_XLAT_CFG_NAMES
232 # define OPT_NO_XLAT_OPT_NAMES
234 # define OPT_XLAT_CFG_NAMES
235 # define OPT_XLAT_OPT_NAMES
240 #endif /* ENABLE_NLS */
245 #endif /* AUTOOPTS_TPMTOOL_ARGS_H_GUARD */
247 /* tpmtool-args.h ends here */