|
Packit Service |
4684c1 |
/* -*- buffer-read-only: t -*- vi: set ro:
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* DO NOT EDIT THIS FILE (tpmtool-args.h)
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* It has been AutoGen-ed
|
|
Packit Service |
4684c1 |
* From the definitions tpmtool-args.def
|
|
Packit Service |
4684c1 |
* and the template file options
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Generated from AutoOpts 42:1:17 templates.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* AutoOpts is a copyrighted work. This header file is not encumbered
|
|
Packit Service |
4684c1 |
* by AutoOpts licensing, but is provided under the licensing terms chosen
|
|
Packit Service |
4684c1 |
* by the tpmtool author or copyright holder. AutoOpts is
|
|
Packit Service |
4684c1 |
* licensed under the terms of the LGPL. The redistributable library
|
|
Packit Service |
4684c1 |
* (``libopts'') is licensed under the terms of either the LGPL or, at the
|
|
Packit Service |
4684c1 |
* users discretion, the BSD license. See the AutoOpts and/or libopts sources
|
|
Packit Service |
4684c1 |
* for details.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* The tpmtool program is copyrighted and licensed
|
|
Packit Service |
4684c1 |
* under the following terms:
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Copyright (C) 2000-2020 Free Software Foundation, and others, all rights reserved.
|
|
Packit Service |
4684c1 |
* This is free software. It is licensed for use, modification and
|
|
Packit Service |
4684c1 |
* redistribution under the terms of the GNU General Public License,
|
|
Packit Service |
4684c1 |
* version 3 or later <http://gnu.org/licenses/gpl.html>
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* tpmtool is free software: you can redistribute it and/or modify it
|
|
Packit Service |
4684c1 |
* under the terms of the GNU General Public License as published by the
|
|
Packit Service |
4684c1 |
* Free Software Foundation, either version 3 of the License, or
|
|
Packit Service |
4684c1 |
* (at your option) any later version.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* tpmtool is distributed in the hope that it will be useful, but
|
|
Packit Service |
4684c1 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit Service |
4684c1 |
* See the GNU General Public License for more details.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* You should have received a copy of the GNU General Public License along
|
|
Packit Service |
4684c1 |
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* This file contains the programmatic interface to the Automated
|
|
Packit Service |
4684c1 |
* Options generated for the tpmtool program.
|
|
Packit Service |
4684c1 |
* These macros are documented in the AutoGen info file in the
|
|
Packit Service |
4684c1 |
* "AutoOpts" chapter. Please refer to that doc for usage help.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#ifndef AUTOOPTS_TPMTOOL_ARGS_H_GUARD
|
|
Packit Service |
4684c1 |
#define AUTOOPTS_TPMTOOL_ARGS_H_GUARD 1
|
|
Packit Service |
4684c1 |
#include "config.h"
|
|
Packit Service |
4684c1 |
#include <autoopts/options.h>
|
|
Packit Service |
4684c1 |
#include <stdarg.h>
|
|
Packit Service |
4684c1 |
#include <stdnoreturn.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* Ensure that the library used for compiling this generated header is at
|
|
Packit Service |
4684c1 |
* least as new as the version current when the header template was released
|
|
Packit Service |
4684c1 |
* (not counting patch version increments). Also ensure that the oldest
|
|
Packit Service |
4684c1 |
* tolerable version is at least as old as what was current when the header
|
|
Packit Service |
4684c1 |
* template was released.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define AO_TEMPLATE_VERSION 172033
|
|
Packit Service |
4684c1 |
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|
|
Packit Service |
4684c1 |
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
|
|
Packit Service |
4684c1 |
# error option template version mismatches autoopts/options.h header
|
|
Packit Service |
4684c1 |
Choke Me.
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#if GCC_VERSION > 40400
|
|
Packit Service |
4684c1 |
#define NOT_REACHED __builtin_unreachable();
|
|
Packit Service |
4684c1 |
#else
|
|
Packit Service |
4684c1 |
#define NOT_REACHED
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* Enumeration of each option type for tpmtool
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
typedef enum {
|
|
Packit Service |
4684c1 |
INDEX_OPT_DEBUG = 0,
|
|
Packit Service |
4684c1 |
INDEX_OPT_INFILE = 1,
|
|
Packit Service |
4684c1 |
INDEX_OPT_OUTFILE = 2,
|
|
Packit Service |
4684c1 |
INDEX_OPT_GENERATE_RSA = 3,
|
|
Packit Service |
4684c1 |
INDEX_OPT_REGISTER = 4,
|
|
Packit Service |
4684c1 |
INDEX_OPT_SIGNING = 5,
|
|
Packit Service |
4684c1 |
INDEX_OPT_LEGACY = 6,
|
|
Packit Service |
4684c1 |
INDEX_OPT_USER = 7,
|
|
Packit Service |
4684c1 |
INDEX_OPT_SYSTEM = 8,
|
|
Packit Service |
4684c1 |
INDEX_OPT_PUBKEY = 9,
|
|
Packit Service |
4684c1 |
INDEX_OPT_LIST = 10,
|
|
Packit Service |
4684c1 |
INDEX_OPT_DELETE = 11,
|
|
Packit Service |
4684c1 |
INDEX_OPT_TEST_SIGN = 12,
|
|
Packit Service |
4684c1 |
INDEX_OPT_SEC_PARAM = 13,
|
|
Packit Service |
4684c1 |
INDEX_OPT_BITS = 14,
|
|
Packit Service |
4684c1 |
INDEX_OPT_INDER = 15,
|
|
Packit Service |
4684c1 |
INDEX_OPT_OUTDER = 16,
|
|
Packit Service |
4684c1 |
INDEX_OPT_SRK_WELL_KNOWN = 17,
|
|
Packit Service |
4684c1 |
INDEX_OPT_VERSION = 18,
|
|
Packit Service |
4684c1 |
INDEX_OPT_HELP = 19,
|
|
Packit Service |
4684c1 |
INDEX_OPT_MORE_HELP = 20
|
|
Packit Service |
4684c1 |
} teOptIndex;
|
|
Packit Service |
4684c1 |
/** count of all options for tpmtool */
|
|
Packit Service |
4684c1 |
#define OPTION_CT 21
|
|
Packit Service |
4684c1 |
/** tpmtool version */
|
|
Packit Service |
4684c1 |
#define TPMTOOL_VERSION "3.6.14"
|
|
Packit Service |
4684c1 |
/** Full tpmtool version text */
|
|
Packit Service |
4684c1 |
#define TPMTOOL_FULL_VERSION "tpmtool 3.6.14"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* Interface defines for all options. Replace "n" with the UPPER_CASED
|
|
Packit Service |
4684c1 |
* option name (as in the teOptIndex enumeration above).
|
|
Packit Service |
4684c1 |
* e.g. HAVE_OPT(DEBUG)
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define DESC(n) (tpmtoolOptions.pOptDesc[INDEX_OPT_## n])
|
|
Packit Service |
4684c1 |
/** 'true' if an option has been specified in any way */
|
|
Packit Service |
4684c1 |
#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
|
|
Packit Service |
4684c1 |
/** The string argument to an option. The argument type must be \"string\". */
|
|
Packit Service |
4684c1 |
#define OPT_ARG(n) (DESC(n).optArg.argString)
|
|
Packit Service |
4684c1 |
/** Mask the option state revealing how an option was specified.
|
|
Packit Service |
4684c1 |
* It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
|
|
Packit Service |
4684c1 |
* \a OPTST_DEFINED, \a OPTST_RESET or zero.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
|
|
Packit Service |
4684c1 |
/** Count of option's occurrances *on the command line*. */
|
|
Packit Service |
4684c1 |
#define COUNT_OPT(n) (DESC(n).optOccCt)
|
|
Packit Service |
4684c1 |
/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
|
|
Packit Service |
4684c1 |
#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
|
|
Packit Service |
4684c1 |
/** 'true' if \a HAVE_OPT would yield 'false'. */
|
|
Packit Service |
4684c1 |
#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
|
|
Packit Service |
4684c1 |
/** 'true' if OPTST_DISABLED bit not set. */
|
|
Packit Service |
4684c1 |
#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
|
|
Packit Service |
4684c1 |
/** number of stacked option arguments.
|
|
Packit Service |
4684c1 |
* Valid only for stacked option arguments. */
|
|
Packit Service |
4684c1 |
#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
|
|
Packit Service |
4684c1 |
/** stacked argument vector.
|
|
Packit Service |
4684c1 |
* Valid only for stacked option arguments. */
|
|
Packit Service |
4684c1 |
#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
|
|
Packit Service |
4684c1 |
/** Reset an option. */
|
|
Packit Service |
4684c1 |
#define CLEAR_OPT(n) STMTS( \
|
|
Packit Service |
4684c1 |
DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
|
|
Packit Service |
4684c1 |
if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
|
|
Packit Service |
4684c1 |
DESC(n).fOptState |= OPTST_DISABLED; \
|
|
Packit Service |
4684c1 |
DESC(n).optCookie = NULL )
|
|
Packit Service |
4684c1 |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* Enumeration of tpmtool exit codes
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
typedef enum {
|
|
Packit Service |
4684c1 |
TPMTOOL_EXIT_SUCCESS = 0,
|
|
Packit Service |
4684c1 |
TPMTOOL_EXIT_FAILURE = 1,
|
|
Packit Service |
4684c1 |
TPMTOOL_EXIT_USAGE_ERROR = 64,
|
|
Packit Service |
4684c1 |
TPMTOOL_EXIT_LIBOPTS_FAILURE = 70
|
|
Packit Service |
4684c1 |
} tpmtool_exit_code_t;
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* Interface defines for specific options.
|
|
Packit Service |
4684c1 |
* @{
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_DEBUG 'd'
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt)
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_INFILE 0x1001
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_OUTFILE 0x1002
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_GENERATE_RSA 0x1003
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_REGISTER 0x1004
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_SIGNING 0x1005
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_LEGACY 0x1006
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_USER 0x1007
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_SYSTEM 0x1008
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_PUBKEY 0x1009
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_LIST 0x100A
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_DELETE 0x100B
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_TEST_SIGN 0x100C
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_SEC_PARAM 0x100D
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_BITS 0x100E
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#define OPT_VALUE_BITS (DESC(BITS).optArg.argInt)
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_INDER 0x100F
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_OUTDER 0x1010
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_SRK_WELL_KNOWN 0x1011
|
|
Packit Service |
4684c1 |
/** option flag (value) for help-value option */
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_HELP 'h'
|
|
Packit Service |
4684c1 |
/** option flag (value) for more-help-value option */
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_MORE_HELP '!'
|
|
Packit Service |
4684c1 |
/** option flag (value) for version-value option */
|
|
Packit Service |
4684c1 |
#define VALUE_OPT_VERSION 'v'
|
|
Packit Service |
4684c1 |
/*
|
|
Packit Service |
4684c1 |
* Interface defines not associated with particular options
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define ERRSKIP_OPTERR STMTS(tpmtoolOptions.fOptSet &= ~OPTPROC_ERRSTOP)
|
|
Packit Service |
4684c1 |
#define ERRSTOP_OPTERR STMTS(tpmtoolOptions.fOptSet |= OPTPROC_ERRSTOP)
|
|
Packit Service |
4684c1 |
#define RESTART_OPT(n) STMTS( \
|
|
Packit Service |
4684c1 |
tpmtoolOptions.curOptIdx = (n); \
|
|
Packit Service |
4684c1 |
tpmtoolOptions.pzCurOpt = NULL )
|
|
Packit Service |
4684c1 |
#define START_OPT RESTART_OPT(1)
|
|
Packit Service |
4684c1 |
#define USAGE(c) (*tpmtoolOptions.pUsageProc)(&tpmtoolOptions, c)
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifdef __cplusplus
|
|
Packit Service |
4684c1 |
extern "C" {
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
/*
|
|
Packit Service |
4684c1 |
* global exported definitions
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#include <gettext.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* * * * * *
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Declare the tpmtool option descriptor.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
extern tOptions tpmtoolOptions;
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#if defined(ENABLE_NLS)
|
|
Packit Service |
4684c1 |
# ifndef _
|
|
Packit Service |
4684c1 |
# include <stdio.h>
|
|
Packit Service |
4684c1 |
# ifndef HAVE_GETTEXT
|
|
Packit Service |
4684c1 |
extern char * gettext(char const *);
|
|
Packit Service |
4684c1 |
# else
|
|
Packit Service |
4684c1 |
# include <libintl.h>
|
|
Packit Service |
4684c1 |
# endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# ifndef ATTRIBUTE_FORMAT_ARG
|
|
Packit Service |
4684c1 |
# define ATTRIBUTE_FORMAT_ARG(_a)
|
|
Packit Service |
4684c1 |
# endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
|
|
Packit Service |
4684c1 |
static inline char* aoGetsText(char const* pz) {
|
|
Packit Service |
4684c1 |
if (pz == NULL) return NULL;
|
|
Packit Service |
4684c1 |
return (char*)gettext(pz);
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
# define _(s) aoGetsText(s)
|
|
Packit Service |
4684c1 |
# endif /* _() */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# define OPT_NO_XLAT_CFG_NAMES STMTS(tpmtoolOptions.fOptSet |= \
|
|
Packit Service |
4684c1 |
OPTPROC_NXLAT_OPT_CFG;)
|
|
Packit Service |
4684c1 |
# define OPT_NO_XLAT_OPT_NAMES STMTS(tpmtoolOptions.fOptSet |= \
|
|
Packit Service |
4684c1 |
OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# define OPT_XLAT_CFG_NAMES STMTS(tpmtoolOptions.fOptSet &= \
|
|
Packit Service |
4684c1 |
~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
|
|
Packit Service |
4684c1 |
# define OPT_XLAT_OPT_NAMES STMTS(tpmtoolOptions.fOptSet &= \
|
|
Packit Service |
4684c1 |
~OPTPROC_NXLAT_OPT;)
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#else /* ENABLE_NLS */
|
|
Packit Service |
4684c1 |
# define OPT_NO_XLAT_CFG_NAMES
|
|
Packit Service |
4684c1 |
# define OPT_NO_XLAT_OPT_NAMES
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# define OPT_XLAT_CFG_NAMES
|
|
Packit Service |
4684c1 |
# define OPT_XLAT_OPT_NAMES
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# ifndef _
|
|
Packit Service |
4684c1 |
# define _(_s) _s
|
|
Packit Service |
4684c1 |
# endif
|
|
Packit Service |
4684c1 |
#endif /* ENABLE_NLS */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifdef __cplusplus
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
#endif /* AUTOOPTS_TPMTOOL_ARGS_H_GUARD */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* tpmtool-args.h ends here */
|