1 /* -*- buffer-read-only: t -*- vi: set ro:
3 * DO NOT EDIT THIS FILE (serv-args.h)
5 * It has been AutoGen-ed
6 * From the definitions serv-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 gnutls-serv 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 gnutls-serv 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 * gnutls-serv 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 * gnutls-serv 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 gnutls-serv 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_SERV_ARGS_H_GUARD
47 #define AUTOOPTS_SERV_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 gnutls-serv
70 INDEX_OPT_NOTICKET = 1,
71 INDEX_OPT_GENERATE = 2,
78 INDEX_OPT_SRTP_PROFILES = 9,
79 INDEX_OPT_DISABLE_CLIENT_CERT = 10,
80 INDEX_OPT_REQUIRE_CLIENT_CERT = 11,
81 INDEX_OPT_VERIFY_CLIENT_CERT = 12,
82 INDEX_OPT_HEARTBEAT = 13,
83 INDEX_OPT_X509FMTDER = 14,
84 INDEX_OPT_PRIORITY = 15,
85 INDEX_OPT_DHPARAMS = 16,
86 INDEX_OPT_X509CAFILE = 17,
87 INDEX_OPT_X509CRLFILE = 18,
88 INDEX_OPT_PGPKEYFILE = 19,
89 INDEX_OPT_PGPKEYRING = 20,
90 INDEX_OPT_PGPCERTFILE = 21,
91 INDEX_OPT_X509KEYFILE = 22,
92 INDEX_OPT_X509CERTFILE = 23,
93 INDEX_OPT_X509DSAKEYFILE = 24,
94 INDEX_OPT_X509DSACERTFILE = 25,
95 INDEX_OPT_X509ECCKEYFILE = 26,
96 INDEX_OPT_X509ECCCERTFILE = 27,
97 INDEX_OPT_PGPSUBKEY = 28,
98 INDEX_OPT_SRPPASSWD = 29,
99 INDEX_OPT_SRPPASSWDCONF = 30,
100 INDEX_OPT_PSKPASSWD = 31,
101 INDEX_OPT_PSKHINT = 32,
102 INDEX_OPT_OCSP_RESPONSE = 33,
105 INDEX_OPT_PROVIDER = 36,
106 INDEX_OPT_VERSION = 37,
108 INDEX_OPT_MORE_HELP = 39
110 /** count of all options for gnutls-serv */
112 /** gnutls-serv version */
113 #define GNUTLS_SERV_VERSION "3.3.27"
114 /** Full gnutls-serv version text */
115 #define GNUTLS_SERV_FULL_VERSION "gnutls-serv 3.3.27"
118 * Interface defines for all options. Replace "n" with the UPPER_CASED
119 * option name (as in the teOptIndex enumeration above).
120 * e.g. HAVE_OPT(DEBUG)
122 #define DESC(n) (gnutls_servOptions.pOptDesc[INDEX_OPT_## n])
123 /** 'true' if an option has been specified in any way */
124 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
125 /** The string argument to an option. The argument type must be \"string\". */
126 #define OPT_ARG(n) (DESC(n).optArg.argString)
127 /** Mask the option state revealing how an option was specified.
128 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
129 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
131 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
132 /** Count of option's occurrances *on the command line*. */
133 #define COUNT_OPT(n) (DESC(n).optOccCt)
134 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
135 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
136 /** 'true' if \a HAVE_OPT would yield 'false'. */
137 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
138 /** 'true' if OPTST_DISABLED bit not set. */
139 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
140 /** number of stacked option arguments.
141 * Valid only for stacked option arguments. */
142 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
143 /** stacked argument vector.
144 * Valid only for stacked option arguments. */
145 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
146 /** Reset an option. */
147 #define CLEAR_OPT(n) STMTS( \
148 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
149 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
150 DESC(n).fOptState |= OPTST_DISABLED; \
151 DESC(n).optCookie = NULL )
152 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
154 * Enumeration of gnutls-serv exit codes
157 GNUTLS_SERV_EXIT_SUCCESS = 0,
158 GNUTLS_SERV_EXIT_FAILURE = 1,
159 GNUTLS_SERV_EXIT_USAGE_ERROR = 64,
160 GNUTLS_SERV_EXIT_LIBOPTS_FAILURE = 70
161 } gnutls_serv_exit_code_t;
163 * Interface defines for specific options.
166 #define VALUE_OPT_DEBUG 'd'
168 #define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt)
169 #define VALUE_OPT_NOTICKET 0x1001
170 #define VALUE_OPT_GENERATE 'g'
171 #define VALUE_OPT_QUIET 'q'
172 #define VALUE_OPT_NODB 0x1002
173 #define VALUE_OPT_HTTP 0x1003
174 #define VALUE_OPT_ECHO 0x1004
175 #define VALUE_OPT_UDP 'u'
176 #define VALUE_OPT_MTU 0x1005
178 #define OPT_VALUE_MTU (DESC(MTU).optArg.argInt)
179 #define VALUE_OPT_SRTP_PROFILES 0x1006
180 #define VALUE_OPT_DISABLE_CLIENT_CERT 'a'
181 #define VALUE_OPT_REQUIRE_CLIENT_CERT 'r'
182 #define VALUE_OPT_VERIFY_CLIENT_CERT 0x1007
183 #define VALUE_OPT_HEARTBEAT 'b'
184 #define VALUE_OPT_X509FMTDER 0x1008
185 #define VALUE_OPT_PRIORITY 0x1009
186 #define VALUE_OPT_DHPARAMS 0x100A
187 #define VALUE_OPT_X509CAFILE 0x100B
188 #define VALUE_OPT_X509CRLFILE 0x100C
189 #define VALUE_OPT_PGPKEYFILE 0x100D
190 #define VALUE_OPT_PGPKEYRING 0x100E
191 #define VALUE_OPT_PGPCERTFILE 0x100F
192 #define VALUE_OPT_X509KEYFILE 0x1010
193 #define VALUE_OPT_X509CERTFILE 0x1011
194 #define VALUE_OPT_X509DSAKEYFILE 0x1012
195 #define VALUE_OPT_X509DSACERTFILE 0x1013
196 #define VALUE_OPT_X509ECCKEYFILE 0x1014
197 #define VALUE_OPT_X509ECCCERTFILE 0x1015
198 #define VALUE_OPT_PGPSUBKEY 0x1016
199 #define VALUE_OPT_SRPPASSWD 0x1017
200 #define VALUE_OPT_SRPPASSWDCONF 0x1018
201 #define VALUE_OPT_PSKPASSWD 0x1019
202 #define VALUE_OPT_PSKHINT 0x101A
203 #define VALUE_OPT_OCSP_RESPONSE 0x101B
204 #define VALUE_OPT_PORT 'p'
206 #define OPT_VALUE_PORT (DESC(PORT).optArg.argInt)
207 #define VALUE_OPT_LIST 'l'
208 #define VALUE_OPT_PROVIDER 0x101C
209 /** option flag (value) for help-value option */
210 #define VALUE_OPT_HELP 'h'
211 /** option flag (value) for more-help-value option */
212 #define VALUE_OPT_MORE_HELP '!'
213 /** option flag (value) for version-value option */
214 #define VALUE_OPT_VERSION 'v'
216 * Interface defines not associated with particular options
218 #define ERRSKIP_OPTERR STMTS(gnutls_servOptions.fOptSet &= ~OPTPROC_ERRSTOP)
219 #define ERRSTOP_OPTERR STMTS(gnutls_servOptions.fOptSet |= OPTPROC_ERRSTOP)
220 #define RESTART_OPT(n) STMTS( \
221 gnutls_servOptions.curOptIdx = (n); \
222 gnutls_servOptions.pzCurOpt = NULL )
223 #define START_OPT RESTART_OPT(1)
224 #define USAGE(c) (*gnutls_servOptions.pUsageProc)(&gnutls_servOptions, c)
230 * global exported definitions
237 * Declare the gnutls-serv option descriptor.
239 extern tOptions gnutls_servOptions;
241 #if defined(ENABLE_NLS)
244 # ifndef HAVE_GETTEXT
245 extern char * gettext(char const *);
247 # include <libintl.h>
250 # ifndef ATTRIBUTE_FORMAT_ARG
251 # define ATTRIBUTE_FORMAT_ARG(_a)
254 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
255 static inline char* aoGetsText(char const* pz) {
256 if (pz == NULL) return NULL;
257 return (char*)gettext(pz);
259 # define _(s) aoGetsText(s)
262 # define OPT_NO_XLAT_CFG_NAMES STMTS(gnutls_servOptions.fOptSet |= \
263 OPTPROC_NXLAT_OPT_CFG;)
264 # define OPT_NO_XLAT_OPT_NAMES STMTS(gnutls_servOptions.fOptSet |= \
265 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
267 # define OPT_XLAT_CFG_NAMES STMTS(gnutls_servOptions.fOptSet &= \
268 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
269 # define OPT_XLAT_OPT_NAMES STMTS(gnutls_servOptions.fOptSet &= \
272 #else /* ENABLE_NLS */
273 # define OPT_NO_XLAT_CFG_NAMES
274 # define OPT_NO_XLAT_OPT_NAMES
276 # define OPT_XLAT_CFG_NAMES
277 # define OPT_XLAT_OPT_NAMES
282 #endif /* ENABLE_NLS */
287 #endif /* AUTOOPTS_SERV_ARGS_H_GUARD */
289 /* serv-args.h ends here */