benchmark time was increased.
[gnutls.git] / src / serv-args.c
blobf27ed0893b412b11a8fb17d966b76c59fc23e2a2
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (serv-args.c)
4 *
5 * It has been AutoGen-ed August 30, 2012 at 09:58:05 PM by AutoGen 5.16
6 * From the definitions serv-args.def
7 * and the template file options
9 * Generated from AutoOpts 36:4:11 templates.
11 * AutoOpts is a copyrighted work. This source 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
17 * for details.
19 * The gnutls-serv program is copyrighted and licensed
20 * under the following terms:
22 * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
23 * This is free software. It is licensed for use, modification and
24 * redistribution under the terms of the
25 * GNU General Public License, version 3 or later
26 * <http://gnu.org/licenses/gpl.html>
28 * gnutls-serv is free software: you can redistribute it and/or modify it
29 * under the terms of the GNU General Public License as published by the
30 * Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
33 * gnutls-serv is distributed in the hope that it will be useful, but
34 * WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 * See the GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License along
39 * with this program. If not, see <http://www.gnu.org/licenses/>.
42 #ifndef __doxygen__
43 #define OPTION_CODE_COMPILE 1
44 #include "serv-args.h"
45 #include <sys/types.h>
47 #include <limits.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <errno.h>
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 extern FILE * option_usage_fp;
57 /* TRANSLATORS: choose the translation for option names wisely because you
58 cannot ever change your mind. */
59 #define zCopyright (gnutls_serv_opt_strs+0)
60 #define zLicenseDescrip (gnutls_serv_opt_strs+282)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * gnutls-serv option static const strings
70 static char const gnutls_serv_opt_strs[2994] =
71 /* 0 */ "gnutls-serv @VERSION@\n"
72 "Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n"
73 "This is free software. It is licensed for use, modification and\n"
74 "redistribution under the terms of the\n"
75 "GNU General Public License, version 3 or later\n"
76 " <http://gnu.org/licenses/gpl.html>\n\0"
77 /* 282 */ "gnutls-serv is free software: you can redistribute it and/or modify it\n"
78 "under the terms of the GNU General Public License as published by the Free\n"
79 "Software Foundation, either version 3 of the License, or (at your option)\n"
80 "any later version.\n\n"
81 "gnutls-serv is distributed in the hope that it will be useful, but WITHOUT\n"
82 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
83 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n"
84 "more details.\n\n"
85 "You should have received a copy of the GNU General Public License along\n"
86 "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
87 /* 893 */ "Enable debugging.\0"
88 /* 911 */ "DEBUG\0"
89 /* 917 */ "debug\0"
90 /* 923 */ "Don't accept session tickets\0"
91 /* 952 */ "NOTICKET\0"
92 /* 961 */ "noticket\0"
93 /* 970 */ "Generate Diffie-Hellman and RSA-export parameters\0"
94 /* 1020 */ "GENERATE\0"
95 /* 1029 */ "generate\0"
96 /* 1038 */ "Suppress some messages\0"
97 /* 1061 */ "QUIET\0"
98 /* 1067 */ "quiet\0"
99 /* 1073 */ "Do not use a resumption database\0"
100 /* 1106 */ "NODB\0"
101 /* 1111 */ "nodb\0"
102 /* 1116 */ "Act as an HTTP server\0"
103 /* 1138 */ "HTTP\0"
104 /* 1143 */ "http\0"
105 /* 1148 */ "Act as an Echo server\0"
106 /* 1170 */ "ECHO\0"
107 /* 1175 */ "echo\0"
108 /* 1180 */ "Use DTLS (datagram TLS) over UDP\0"
109 /* 1213 */ "UDP\0"
110 /* 1217 */ "udp\0"
111 /* 1221 */ "Set MTU for datagram TLS\0"
112 /* 1246 */ "MTU\0"
113 /* 1250 */ "mtu\0"
114 /* 1254 */ "Do not request a client certificate\0"
115 /* 1290 */ "DISABLE_CLIENT_CERT\0"
116 /* 1310 */ "disable-client-cert\0"
117 /* 1330 */ "Require a client certificate\0"
118 /* 1359 */ "REQUIRE_CLIENT_CERT\0"
119 /* 1379 */ "require-client-cert\0"
120 /* 1399 */ "Activate heartbeat support\0"
121 /* 1426 */ "HEARTBEAT\0"
122 /* 1436 */ "heartbeat\0"
123 /* 1446 */ "Use DER format for certificates to read from\0"
124 /* 1491 */ "X509FMTDER\0"
125 /* 1502 */ "x509fmtder\0"
126 /* 1513 */ "Priorities string\0"
127 /* 1531 */ "PRIORITY\0"
128 /* 1540 */ "priority\0"
129 /* 1549 */ "DH params file to use\0"
130 /* 1571 */ "DHPARAMS\0"
131 /* 1580 */ "dhparams\0"
132 /* 1589 */ "Certificate file or PKCS #11 URL to use\0"
133 /* 1629 */ "X509CAFILE\0"
134 /* 1640 */ "x509cafile\0"
135 /* 1651 */ "CRL file to use\0"
136 /* 1667 */ "X509CRLFILE\0"
137 /* 1679 */ "x509crlfile\0"
138 /* 1691 */ "PGP Key file to use\0"
139 /* 1711 */ "PGPKEYFILE\0"
140 /* 1722 */ "pgpkeyfile\0"
141 /* 1733 */ "PGP Key ring file to use\0"
142 /* 1758 */ "PGPKEYRING\0"
143 /* 1769 */ "pgpkeyring\0"
144 /* 1780 */ "PGP Public Key (certificate) file to use\0"
145 /* 1821 */ "PGPCERTFILE\0"
146 /* 1833 */ "pgpcertfile\0"
147 /* 1845 */ "X.509 key file or PKCS #11 URL to use\0"
148 /* 1883 */ "X509KEYFILE\0"
149 /* 1895 */ "x509keyfile\0"
150 /* 1907 */ "X.509 Certificate file or PKCS #11 URL to use\0"
151 /* 1953 */ "X509CERTFILE\0"
152 /* 1966 */ "x509certfile\0"
153 /* 1979 */ "Alternative X.509 key file or PKCS #11 URL to use\0"
154 /* 2029 */ "X509DSAKEYFILE\0"
155 /* 2044 */ "x509dsakeyfile\0"
156 /* 2059 */ "Alternative X.509 Certificate file or PKCS #11 URL to use\0"
157 /* 2117 */ "X509DSACERTFILE\0"
158 /* 2133 */ "x509dsacertfile\0"
159 /* 2149 */ "X509ECCKEYFILE\0"
160 /* 2164 */ "x509ecckeyfile\0"
161 /* 2179 */ "X509ECCCERTFILE\0"
162 /* 2195 */ "x509ecccertfile\0"
163 /* 2211 */ "PGP subkey to use (hex or auto)\0"
164 /* 2243 */ "PGPSUBKEY\0"
165 /* 2253 */ "pgpsubkey\0"
166 /* 2263 */ "SRP password file to use\0"
167 /* 2288 */ "SRPPASSWD\0"
168 /* 2298 */ "srppasswd\0"
169 /* 2308 */ "SRP password configuration file to use\0"
170 /* 2347 */ "SRPPASSWDCONF\0"
171 /* 2361 */ "srppasswdconf\0"
172 /* 2375 */ "PSK password file to use\0"
173 /* 2400 */ "PSKPASSWD\0"
174 /* 2410 */ "pskpasswd\0"
175 /* 2420 */ "PSK identity hint to use\0"
176 /* 2445 */ "PSKHINT\0"
177 /* 2453 */ "pskhint\0"
178 /* 2461 */ "The port to connect to\0"
179 /* 2484 */ "PORT\0"
180 /* 2489 */ "port\0"
181 /* 2494 */ "Print a list of the supported algorithms and modes\0"
182 /* 2545 */ "LIST\0"
183 /* 2550 */ "list\0"
184 /* 2555 */ "Display extended usage information and exit\0"
185 /* 2599 */ "help\0"
186 /* 2604 */ "Extended usage information passed thru pager\0"
187 /* 2649 */ "more-help\0"
188 /* 2659 */ "Output version information and exit\0"
189 /* 2695 */ "version\0"
190 /* 2703 */ "GNUTLS_SERV\0"
191 /* 2715 */ "gnutls-serv - GnuTLS server - Ver. @VERSION@\n"
192 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
193 /* 2818 */ "bug-gnutls@gnu.org\0"
194 /* 2837 */ "\n\n\0"
195 /* 2840 */ "\n"
196 "Server program that listens to incoming TLS connections.\n\0"
197 /* 2899 */ "gnutls-serv @VERSION@\0"
198 /* 2921 */ "Usage: gnutls-serv [options]\n"
199 "gnutls-serv --help for usage instructions.\n";
202 * debug option description:
204 #define DEBUG_DESC (gnutls_serv_opt_strs+893)
205 #define DEBUG_NAME (gnutls_serv_opt_strs+911)
206 #define DEBUG_name (gnutls_serv_opt_strs+917)
207 #define DEBUG_FLAGS (OPTST_DISABLED \
208 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
211 * noticket option description:
213 #define NOTICKET_DESC (gnutls_serv_opt_strs+923)
214 #define NOTICKET_NAME (gnutls_serv_opt_strs+952)
215 #define NOTICKET_name (gnutls_serv_opt_strs+961)
216 #define NOTICKET_FLAGS (OPTST_DISABLED)
219 * generate option description:
221 #define GENERATE_DESC (gnutls_serv_opt_strs+970)
222 #define GENERATE_NAME (gnutls_serv_opt_strs+1020)
223 #define GENERATE_name (gnutls_serv_opt_strs+1029)
224 #define GENERATE_FLAGS (OPTST_DISABLED)
227 * quiet option description:
229 #define QUIET_DESC (gnutls_serv_opt_strs+1038)
230 #define QUIET_NAME (gnutls_serv_opt_strs+1061)
231 #define QUIET_name (gnutls_serv_opt_strs+1067)
232 #define QUIET_FLAGS (OPTST_DISABLED)
235 * nodb option description:
237 #define NODB_DESC (gnutls_serv_opt_strs+1073)
238 #define NODB_NAME (gnutls_serv_opt_strs+1106)
239 #define NODB_name (gnutls_serv_opt_strs+1111)
240 #define NODB_FLAGS (OPTST_DISABLED)
243 * http option description:
245 #define HTTP_DESC (gnutls_serv_opt_strs+1116)
246 #define HTTP_NAME (gnutls_serv_opt_strs+1138)
247 #define HTTP_name (gnutls_serv_opt_strs+1143)
248 #define HTTP_FLAGS (OPTST_DISABLED)
251 * echo option description:
253 #define ECHO_DESC (gnutls_serv_opt_strs+1148)
254 #define ECHO_NAME (gnutls_serv_opt_strs+1170)
255 #define ECHO_name (gnutls_serv_opt_strs+1175)
256 #define ECHO_FLAGS (OPTST_DISABLED)
259 * udp option description:
261 #define UDP_DESC (gnutls_serv_opt_strs+1180)
262 #define UDP_NAME (gnutls_serv_opt_strs+1213)
263 #define UDP_name (gnutls_serv_opt_strs+1217)
264 #define UDP_FLAGS (OPTST_DISABLED)
267 * mtu option description:
269 #define MTU_DESC (gnutls_serv_opt_strs+1221)
270 #define MTU_NAME (gnutls_serv_opt_strs+1246)
271 #define MTU_name (gnutls_serv_opt_strs+1250)
272 #define MTU_FLAGS (OPTST_DISABLED \
273 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
276 * disable-client-cert option description:
278 #define DISABLE_CLIENT_CERT_DESC (gnutls_serv_opt_strs+1254)
279 #define DISABLE_CLIENT_CERT_NAME (gnutls_serv_opt_strs+1290)
280 #define DISABLE_CLIENT_CERT_name (gnutls_serv_opt_strs+1310)
281 #define DISABLE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
284 * require-client-cert option description:
286 #define REQUIRE_CLIENT_CERT_DESC (gnutls_serv_opt_strs+1330)
287 #define REQUIRE_CLIENT_CERT_NAME (gnutls_serv_opt_strs+1359)
288 #define REQUIRE_CLIENT_CERT_name (gnutls_serv_opt_strs+1379)
289 #define REQUIRE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
292 * heartbeat option description:
294 #define HEARTBEAT_DESC (gnutls_serv_opt_strs+1399)
295 #define HEARTBEAT_NAME (gnutls_serv_opt_strs+1426)
296 #define HEARTBEAT_name (gnutls_serv_opt_strs+1436)
297 #define HEARTBEAT_FLAGS (OPTST_DISABLED)
300 * x509fmtder option description:
302 #define X509FMTDER_DESC (gnutls_serv_opt_strs+1446)
303 #define X509FMTDER_NAME (gnutls_serv_opt_strs+1491)
304 #define X509FMTDER_name (gnutls_serv_opt_strs+1502)
305 #define X509FMTDER_FLAGS (OPTST_DISABLED)
308 * priority option description:
310 #define PRIORITY_DESC (gnutls_serv_opt_strs+1513)
311 #define PRIORITY_NAME (gnutls_serv_opt_strs+1531)
312 #define PRIORITY_name (gnutls_serv_opt_strs+1540)
313 #define PRIORITY_FLAGS (OPTST_DISABLED \
314 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
317 * dhparams option description:
319 #define DHPARAMS_DESC (gnutls_serv_opt_strs+1549)
320 #define DHPARAMS_NAME (gnutls_serv_opt_strs+1571)
321 #define DHPARAMS_name (gnutls_serv_opt_strs+1580)
322 #define DHPARAMS_FLAGS (OPTST_DISABLED \
323 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
326 * x509cafile option description:
328 #define X509CAFILE_DESC (gnutls_serv_opt_strs+1589)
329 #define X509CAFILE_NAME (gnutls_serv_opt_strs+1629)
330 #define X509CAFILE_name (gnutls_serv_opt_strs+1640)
331 #define X509CAFILE_FLAGS (OPTST_DISABLED \
332 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
335 * x509crlfile option description:
337 #define X509CRLFILE_DESC (gnutls_serv_opt_strs+1651)
338 #define X509CRLFILE_NAME (gnutls_serv_opt_strs+1667)
339 #define X509CRLFILE_name (gnutls_serv_opt_strs+1679)
340 #define X509CRLFILE_FLAGS (OPTST_DISABLED \
341 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
344 * pgpkeyfile option description:
346 #define PGPKEYFILE_DESC (gnutls_serv_opt_strs+1691)
347 #define PGPKEYFILE_NAME (gnutls_serv_opt_strs+1711)
348 #define PGPKEYFILE_name (gnutls_serv_opt_strs+1722)
349 #define PGPKEYFILE_FLAGS (OPTST_DISABLED \
350 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
353 * pgpkeyring option description:
355 #define PGPKEYRING_DESC (gnutls_serv_opt_strs+1733)
356 #define PGPKEYRING_NAME (gnutls_serv_opt_strs+1758)
357 #define PGPKEYRING_name (gnutls_serv_opt_strs+1769)
358 #define PGPKEYRING_FLAGS (OPTST_DISABLED \
359 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
362 * pgpcertfile option description:
364 #define PGPCERTFILE_DESC (gnutls_serv_opt_strs+1780)
365 #define PGPCERTFILE_NAME (gnutls_serv_opt_strs+1821)
366 #define PGPCERTFILE_name (gnutls_serv_opt_strs+1833)
367 #define PGPCERTFILE_FLAGS (OPTST_DISABLED \
368 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
371 * x509keyfile option description:
373 #define X509KEYFILE_DESC (gnutls_serv_opt_strs+1845)
374 #define X509KEYFILE_NAME (gnutls_serv_opt_strs+1883)
375 #define X509KEYFILE_name (gnutls_serv_opt_strs+1895)
376 #define X509KEYFILE_FLAGS (OPTST_DISABLED \
377 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
380 * x509certfile option description:
382 #define X509CERTFILE_DESC (gnutls_serv_opt_strs+1907)
383 #define X509CERTFILE_NAME (gnutls_serv_opt_strs+1953)
384 #define X509CERTFILE_name (gnutls_serv_opt_strs+1966)
385 #define X509CERTFILE_FLAGS (OPTST_DISABLED \
386 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
389 * x509dsakeyfile option description:
391 #define X509DSAKEYFILE_DESC (gnutls_serv_opt_strs+1979)
392 #define X509DSAKEYFILE_NAME (gnutls_serv_opt_strs+2029)
393 #define X509DSAKEYFILE_name (gnutls_serv_opt_strs+2044)
394 #define X509DSAKEYFILE_FLAGS (OPTST_DISABLED \
395 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
398 * x509dsacertfile option description:
400 #define X509DSACERTFILE_DESC (gnutls_serv_opt_strs+2059)
401 #define X509DSACERTFILE_NAME (gnutls_serv_opt_strs+2117)
402 #define X509DSACERTFILE_name (gnutls_serv_opt_strs+2133)
403 #define X509DSACERTFILE_FLAGS (OPTST_DISABLED \
404 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
407 * x509ecckeyfile option description:
409 #define X509ECCKEYFILE_DESC (gnutls_serv_opt_strs+1979)
410 #define X509ECCKEYFILE_NAME (gnutls_serv_opt_strs+2149)
411 #define X509ECCKEYFILE_name (gnutls_serv_opt_strs+2164)
412 #define X509ECCKEYFILE_FLAGS (OPTST_DISABLED \
413 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
416 * x509ecccertfile option description:
418 #define X509ECCCERTFILE_DESC (gnutls_serv_opt_strs+2059)
419 #define X509ECCCERTFILE_NAME (gnutls_serv_opt_strs+2179)
420 #define X509ECCCERTFILE_name (gnutls_serv_opt_strs+2195)
421 #define X509ECCCERTFILE_FLAGS (OPTST_DISABLED \
422 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
425 * pgpsubkey option description:
427 #define PGPSUBKEY_DESC (gnutls_serv_opt_strs+2211)
428 #define PGPSUBKEY_NAME (gnutls_serv_opt_strs+2243)
429 #define PGPSUBKEY_name (gnutls_serv_opt_strs+2253)
430 #define PGPSUBKEY_FLAGS (OPTST_DISABLED \
431 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
434 * srppasswd option description:
436 #define SRPPASSWD_DESC (gnutls_serv_opt_strs+2263)
437 #define SRPPASSWD_NAME (gnutls_serv_opt_strs+2288)
438 #define SRPPASSWD_name (gnutls_serv_opt_strs+2298)
439 #define SRPPASSWD_FLAGS (OPTST_DISABLED \
440 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
443 * srppasswdconf option description:
445 #define SRPPASSWDCONF_DESC (gnutls_serv_opt_strs+2308)
446 #define SRPPASSWDCONF_NAME (gnutls_serv_opt_strs+2347)
447 #define SRPPASSWDCONF_name (gnutls_serv_opt_strs+2361)
448 #define SRPPASSWDCONF_FLAGS (OPTST_DISABLED \
449 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
452 * pskpasswd option description:
454 #define PSKPASSWD_DESC (gnutls_serv_opt_strs+2375)
455 #define PSKPASSWD_NAME (gnutls_serv_opt_strs+2400)
456 #define PSKPASSWD_name (gnutls_serv_opt_strs+2410)
457 #define PSKPASSWD_FLAGS (OPTST_DISABLED \
458 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
461 * pskhint option description:
463 #define PSKHINT_DESC (gnutls_serv_opt_strs+2420)
464 #define PSKHINT_NAME (gnutls_serv_opt_strs+2445)
465 #define PSKHINT_name (gnutls_serv_opt_strs+2453)
466 #define PSKHINT_FLAGS (OPTST_DISABLED \
467 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
470 * port option description:
472 #define PORT_DESC (gnutls_serv_opt_strs+2461)
473 #define PORT_NAME (gnutls_serv_opt_strs+2484)
474 #define PORT_name (gnutls_serv_opt_strs+2489)
475 #define PORT_FLAGS (OPTST_DISABLED \
476 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
479 * list option description:
481 #define LIST_DESC (gnutls_serv_opt_strs+2494)
482 #define LIST_NAME (gnutls_serv_opt_strs+2545)
483 #define LIST_name (gnutls_serv_opt_strs+2550)
484 #define LIST_FLAGS (OPTST_DISABLED)
487 * Help/More_Help/Version option descriptions:
489 #define HELP_DESC (gnutls_serv_opt_strs+2555)
490 #define HELP_name (gnutls_serv_opt_strs+2599)
491 #ifdef HAVE_WORKING_FORK
492 #define MORE_HELP_DESC (gnutls_serv_opt_strs+2604)
493 #define MORE_HELP_name (gnutls_serv_opt_strs+2649)
494 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
495 #else
496 #define MORE_HELP_DESC NULL
497 #define MORE_HELP_name NULL
498 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
499 #endif
500 #ifdef NO_OPTIONAL_OPT_ARGS
501 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
502 #else
503 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
504 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
505 #endif
506 #define VER_DESC (gnutls_serv_opt_strs+2659)
507 #define VER_name (gnutls_serv_opt_strs+2695)
509 * Declare option callback procedures
511 extern tOptProc
512 optionBooleanVal, optionNestedVal, optionNumericVal,
513 optionPagedUsage, optionPrintVersion, optionResetOpt,
514 optionStackArg, optionTimeDate, optionTimeVal,
515 optionUnstackArg, optionVendorOption;
516 static tOptProc
517 doOptDebug, doOptDhparams, doOptMtu,
518 doOptPgpcertfile, doOptPgpkeyfile, doOptPgpkeyring,
519 doOptPskpasswd, doOptSrppasswd, doOptSrppasswdconf,
520 doOptX509crlfile, doUsageOpt;
521 #define VER_PROC optionPrintVersion
523 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
525 * Define the gnutls-serv Option Descriptions.
526 * This is an array of OPTION_CT entries, one for each
527 * option that the gnutls-serv program responds to.
529 static tOptDesc optDesc[OPTION_CT] = {
530 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
531 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
532 /* equivalenced to */ NO_EQUIVALENT,
533 /* min, max, act ct */ 0, 1, 0,
534 /* opt state flags */ DEBUG_FLAGS, 0,
535 /* last opt argumnt */ { NULL }, /* --debug */
536 /* arg list/cookie */ NULL,
537 /* must/cannot opts */ NULL, NULL,
538 /* option proc */ doOptDebug,
539 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
540 /* disablement strs */ NULL, NULL },
542 { /* entry idx, value */ 1, VALUE_OPT_NOTICKET,
543 /* equiv idx, value */ 1, VALUE_OPT_NOTICKET,
544 /* equivalenced to */ NO_EQUIVALENT,
545 /* min, max, act ct */ 0, 1, 0,
546 /* opt state flags */ NOTICKET_FLAGS, 0,
547 /* last opt argumnt */ { NULL }, /* --noticket */
548 /* arg list/cookie */ NULL,
549 /* must/cannot opts */ NULL, NULL,
550 /* option proc */ NULL,
551 /* desc, NAME, name */ NOTICKET_DESC, NOTICKET_NAME, NOTICKET_name,
552 /* disablement strs */ NULL, NULL },
554 { /* entry idx, value */ 2, VALUE_OPT_GENERATE,
555 /* equiv idx, value */ 2, VALUE_OPT_GENERATE,
556 /* equivalenced to */ NO_EQUIVALENT,
557 /* min, max, act ct */ 0, 1, 0,
558 /* opt state flags */ GENERATE_FLAGS, 0,
559 /* last opt argumnt */ { NULL }, /* --generate */
560 /* arg list/cookie */ NULL,
561 /* must/cannot opts */ NULL, NULL,
562 /* option proc */ NULL,
563 /* desc, NAME, name */ GENERATE_DESC, GENERATE_NAME, GENERATE_name,
564 /* disablement strs */ NULL, NULL },
566 { /* entry idx, value */ 3, VALUE_OPT_QUIET,
567 /* equiv idx, value */ 3, VALUE_OPT_QUIET,
568 /* equivalenced to */ NO_EQUIVALENT,
569 /* min, max, act ct */ 0, 1, 0,
570 /* opt state flags */ QUIET_FLAGS, 0,
571 /* last opt argumnt */ { NULL }, /* --quiet */
572 /* arg list/cookie */ NULL,
573 /* must/cannot opts */ NULL, NULL,
574 /* option proc */ NULL,
575 /* desc, NAME, name */ QUIET_DESC, QUIET_NAME, QUIET_name,
576 /* disablement strs */ NULL, NULL },
578 { /* entry idx, value */ 4, VALUE_OPT_NODB,
579 /* equiv idx, value */ 4, VALUE_OPT_NODB,
580 /* equivalenced to */ NO_EQUIVALENT,
581 /* min, max, act ct */ 0, 1, 0,
582 /* opt state flags */ NODB_FLAGS, 0,
583 /* last opt argumnt */ { NULL }, /* --nodb */
584 /* arg list/cookie */ NULL,
585 /* must/cannot opts */ NULL, NULL,
586 /* option proc */ NULL,
587 /* desc, NAME, name */ NODB_DESC, NODB_NAME, NODB_name,
588 /* disablement strs */ NULL, NULL },
590 { /* entry idx, value */ 5, VALUE_OPT_HTTP,
591 /* equiv idx, value */ 5, VALUE_OPT_HTTP,
592 /* equivalenced to */ NO_EQUIVALENT,
593 /* min, max, act ct */ 0, 1, 0,
594 /* opt state flags */ HTTP_FLAGS, 0,
595 /* last opt argumnt */ { NULL }, /* --http */
596 /* arg list/cookie */ NULL,
597 /* must/cannot opts */ NULL, NULL,
598 /* option proc */ NULL,
599 /* desc, NAME, name */ HTTP_DESC, HTTP_NAME, HTTP_name,
600 /* disablement strs */ NULL, NULL },
602 { /* entry idx, value */ 6, VALUE_OPT_ECHO,
603 /* equiv idx, value */ 6, VALUE_OPT_ECHO,
604 /* equivalenced to */ NO_EQUIVALENT,
605 /* min, max, act ct */ 0, 1, 0,
606 /* opt state flags */ ECHO_FLAGS, 0,
607 /* last opt argumnt */ { NULL }, /* --echo */
608 /* arg list/cookie */ NULL,
609 /* must/cannot opts */ NULL, NULL,
610 /* option proc */ NULL,
611 /* desc, NAME, name */ ECHO_DESC, ECHO_NAME, ECHO_name,
612 /* disablement strs */ NULL, NULL },
614 { /* entry idx, value */ 7, VALUE_OPT_UDP,
615 /* equiv idx, value */ 7, VALUE_OPT_UDP,
616 /* equivalenced to */ NO_EQUIVALENT,
617 /* min, max, act ct */ 0, 1, 0,
618 /* opt state flags */ UDP_FLAGS, 0,
619 /* last opt argumnt */ { NULL }, /* --udp */
620 /* arg list/cookie */ NULL,
621 /* must/cannot opts */ NULL, NULL,
622 /* option proc */ NULL,
623 /* desc, NAME, name */ UDP_DESC, UDP_NAME, UDP_name,
624 /* disablement strs */ NULL, NULL },
626 { /* entry idx, value */ 8, VALUE_OPT_MTU,
627 /* equiv idx, value */ 8, VALUE_OPT_MTU,
628 /* equivalenced to */ NO_EQUIVALENT,
629 /* min, max, act ct */ 0, 1, 0,
630 /* opt state flags */ MTU_FLAGS, 0,
631 /* last opt argumnt */ { NULL }, /* --mtu */
632 /* arg list/cookie */ NULL,
633 /* must/cannot opts */ NULL, NULL,
634 /* option proc */ doOptMtu,
635 /* desc, NAME, name */ MTU_DESC, MTU_NAME, MTU_name,
636 /* disablement strs */ NULL, NULL },
638 { /* entry idx, value */ 9, VALUE_OPT_DISABLE_CLIENT_CERT,
639 /* equiv idx, value */ 9, VALUE_OPT_DISABLE_CLIENT_CERT,
640 /* equivalenced to */ NO_EQUIVALENT,
641 /* min, max, act ct */ 0, 1, 0,
642 /* opt state flags */ DISABLE_CLIENT_CERT_FLAGS, 0,
643 /* last opt argumnt */ { NULL }, /* --disable-client-cert */
644 /* arg list/cookie */ NULL,
645 /* must/cannot opts */ NULL, NULL,
646 /* option proc */ NULL,
647 /* desc, NAME, name */ DISABLE_CLIENT_CERT_DESC, DISABLE_CLIENT_CERT_NAME, DISABLE_CLIENT_CERT_name,
648 /* disablement strs */ NULL, NULL },
650 { /* entry idx, value */ 10, VALUE_OPT_REQUIRE_CLIENT_CERT,
651 /* equiv idx, value */ 10, VALUE_OPT_REQUIRE_CLIENT_CERT,
652 /* equivalenced to */ NO_EQUIVALENT,
653 /* min, max, act ct */ 0, 1, 0,
654 /* opt state flags */ REQUIRE_CLIENT_CERT_FLAGS, 0,
655 /* last opt argumnt */ { NULL }, /* --require-client-cert */
656 /* arg list/cookie */ NULL,
657 /* must/cannot opts */ NULL, NULL,
658 /* option proc */ NULL,
659 /* desc, NAME, name */ REQUIRE_CLIENT_CERT_DESC, REQUIRE_CLIENT_CERT_NAME, REQUIRE_CLIENT_CERT_name,
660 /* disablement strs */ NULL, NULL },
662 { /* entry idx, value */ 11, VALUE_OPT_HEARTBEAT,
663 /* equiv idx, value */ 11, VALUE_OPT_HEARTBEAT,
664 /* equivalenced to */ NO_EQUIVALENT,
665 /* min, max, act ct */ 0, 1, 0,
666 /* opt state flags */ HEARTBEAT_FLAGS, 0,
667 /* last opt argumnt */ { NULL }, /* --heartbeat */
668 /* arg list/cookie */ NULL,
669 /* must/cannot opts */ NULL, NULL,
670 /* option proc */ NULL,
671 /* desc, NAME, name */ HEARTBEAT_DESC, HEARTBEAT_NAME, HEARTBEAT_name,
672 /* disablement strs */ NULL, NULL },
674 { /* entry idx, value */ 12, VALUE_OPT_X509FMTDER,
675 /* equiv idx, value */ 12, VALUE_OPT_X509FMTDER,
676 /* equivalenced to */ NO_EQUIVALENT,
677 /* min, max, act ct */ 0, 1, 0,
678 /* opt state flags */ X509FMTDER_FLAGS, 0,
679 /* last opt argumnt */ { NULL }, /* --x509fmtder */
680 /* arg list/cookie */ NULL,
681 /* must/cannot opts */ NULL, NULL,
682 /* option proc */ NULL,
683 /* desc, NAME, name */ X509FMTDER_DESC, X509FMTDER_NAME, X509FMTDER_name,
684 /* disablement strs */ NULL, NULL },
686 { /* entry idx, value */ 13, VALUE_OPT_PRIORITY,
687 /* equiv idx, value */ 13, VALUE_OPT_PRIORITY,
688 /* equivalenced to */ NO_EQUIVALENT,
689 /* min, max, act ct */ 0, 1, 0,
690 /* opt state flags */ PRIORITY_FLAGS, 0,
691 /* last opt argumnt */ { NULL }, /* --priority */
692 /* arg list/cookie */ NULL,
693 /* must/cannot opts */ NULL, NULL,
694 /* option proc */ NULL,
695 /* desc, NAME, name */ PRIORITY_DESC, PRIORITY_NAME, PRIORITY_name,
696 /* disablement strs */ NULL, NULL },
698 { /* entry idx, value */ 14, VALUE_OPT_DHPARAMS,
699 /* equiv idx, value */ 14, VALUE_OPT_DHPARAMS,
700 /* equivalenced to */ NO_EQUIVALENT,
701 /* min, max, act ct */ 0, 1, 0,
702 /* opt state flags */ DHPARAMS_FLAGS, 0,
703 /* last opt argumnt */ { NULL }, /* --dhparams */
704 /* arg list/cookie */ NULL,
705 /* must/cannot opts */ NULL, NULL,
706 /* option proc */ doOptDhparams,
707 /* desc, NAME, name */ DHPARAMS_DESC, DHPARAMS_NAME, DHPARAMS_name,
708 /* disablement strs */ NULL, NULL },
710 { /* entry idx, value */ 15, VALUE_OPT_X509CAFILE,
711 /* equiv idx, value */ 15, VALUE_OPT_X509CAFILE,
712 /* equivalenced to */ NO_EQUIVALENT,
713 /* min, max, act ct */ 0, 1, 0,
714 /* opt state flags */ X509CAFILE_FLAGS, 0,
715 /* last opt argumnt */ { NULL }, /* --x509cafile */
716 /* arg list/cookie */ NULL,
717 /* must/cannot opts */ NULL, NULL,
718 /* option proc */ NULL,
719 /* desc, NAME, name */ X509CAFILE_DESC, X509CAFILE_NAME, X509CAFILE_name,
720 /* disablement strs */ NULL, NULL },
722 { /* entry idx, value */ 16, VALUE_OPT_X509CRLFILE,
723 /* equiv idx, value */ 16, VALUE_OPT_X509CRLFILE,
724 /* equivalenced to */ NO_EQUIVALENT,
725 /* min, max, act ct */ 0, 1, 0,
726 /* opt state flags */ X509CRLFILE_FLAGS, 0,
727 /* last opt argumnt */ { NULL }, /* --x509crlfile */
728 /* arg list/cookie */ NULL,
729 /* must/cannot opts */ NULL, NULL,
730 /* option proc */ doOptX509crlfile,
731 /* desc, NAME, name */ X509CRLFILE_DESC, X509CRLFILE_NAME, X509CRLFILE_name,
732 /* disablement strs */ NULL, NULL },
734 { /* entry idx, value */ 17, VALUE_OPT_PGPKEYFILE,
735 /* equiv idx, value */ 17, VALUE_OPT_PGPKEYFILE,
736 /* equivalenced to */ NO_EQUIVALENT,
737 /* min, max, act ct */ 0, 1, 0,
738 /* opt state flags */ PGPKEYFILE_FLAGS, 0,
739 /* last opt argumnt */ { NULL }, /* --pgpkeyfile */
740 /* arg list/cookie */ NULL,
741 /* must/cannot opts */ NULL, NULL,
742 /* option proc */ doOptPgpkeyfile,
743 /* desc, NAME, name */ PGPKEYFILE_DESC, PGPKEYFILE_NAME, PGPKEYFILE_name,
744 /* disablement strs */ NULL, NULL },
746 { /* entry idx, value */ 18, VALUE_OPT_PGPKEYRING,
747 /* equiv idx, value */ 18, VALUE_OPT_PGPKEYRING,
748 /* equivalenced to */ NO_EQUIVALENT,
749 /* min, max, act ct */ 0, 1, 0,
750 /* opt state flags */ PGPKEYRING_FLAGS, 0,
751 /* last opt argumnt */ { NULL }, /* --pgpkeyring */
752 /* arg list/cookie */ NULL,
753 /* must/cannot opts */ NULL, NULL,
754 /* option proc */ doOptPgpkeyring,
755 /* desc, NAME, name */ PGPKEYRING_DESC, PGPKEYRING_NAME, PGPKEYRING_name,
756 /* disablement strs */ NULL, NULL },
758 { /* entry idx, value */ 19, VALUE_OPT_PGPCERTFILE,
759 /* equiv idx, value */ 19, VALUE_OPT_PGPCERTFILE,
760 /* equivalenced to */ NO_EQUIVALENT,
761 /* min, max, act ct */ 0, 1, 0,
762 /* opt state flags */ PGPCERTFILE_FLAGS, 0,
763 /* last opt argumnt */ { NULL }, /* --pgpcertfile */
764 /* arg list/cookie */ NULL,
765 /* must/cannot opts */ NULL, NULL,
766 /* option proc */ doOptPgpcertfile,
767 /* desc, NAME, name */ PGPCERTFILE_DESC, PGPCERTFILE_NAME, PGPCERTFILE_name,
768 /* disablement strs */ NULL, NULL },
770 { /* entry idx, value */ 20, VALUE_OPT_X509KEYFILE,
771 /* equiv idx, value */ 20, VALUE_OPT_X509KEYFILE,
772 /* equivalenced to */ NO_EQUIVALENT,
773 /* min, max, act ct */ 0, 1, 0,
774 /* opt state flags */ X509KEYFILE_FLAGS, 0,
775 /* last opt argumnt */ { NULL }, /* --x509keyfile */
776 /* arg list/cookie */ NULL,
777 /* must/cannot opts */ NULL, NULL,
778 /* option proc */ NULL,
779 /* desc, NAME, name */ X509KEYFILE_DESC, X509KEYFILE_NAME, X509KEYFILE_name,
780 /* disablement strs */ NULL, NULL },
782 { /* entry idx, value */ 21, VALUE_OPT_X509CERTFILE,
783 /* equiv idx, value */ 21, VALUE_OPT_X509CERTFILE,
784 /* equivalenced to */ NO_EQUIVALENT,
785 /* min, max, act ct */ 0, 1, 0,
786 /* opt state flags */ X509CERTFILE_FLAGS, 0,
787 /* last opt argumnt */ { NULL }, /* --x509certfile */
788 /* arg list/cookie */ NULL,
789 /* must/cannot opts */ NULL, NULL,
790 /* option proc */ NULL,
791 /* desc, NAME, name */ X509CERTFILE_DESC, X509CERTFILE_NAME, X509CERTFILE_name,
792 /* disablement strs */ NULL, NULL },
794 { /* entry idx, value */ 22, VALUE_OPT_X509DSAKEYFILE,
795 /* equiv idx, value */ 22, VALUE_OPT_X509DSAKEYFILE,
796 /* equivalenced to */ NO_EQUIVALENT,
797 /* min, max, act ct */ 0, 1, 0,
798 /* opt state flags */ X509DSAKEYFILE_FLAGS, 0,
799 /* last opt argumnt */ { NULL }, /* --x509dsakeyfile */
800 /* arg list/cookie */ NULL,
801 /* must/cannot opts */ NULL, NULL,
802 /* option proc */ NULL,
803 /* desc, NAME, name */ X509DSAKEYFILE_DESC, X509DSAKEYFILE_NAME, X509DSAKEYFILE_name,
804 /* disablement strs */ NULL, NULL },
806 { /* entry idx, value */ 23, VALUE_OPT_X509DSACERTFILE,
807 /* equiv idx, value */ 23, VALUE_OPT_X509DSACERTFILE,
808 /* equivalenced to */ NO_EQUIVALENT,
809 /* min, max, act ct */ 0, 1, 0,
810 /* opt state flags */ X509DSACERTFILE_FLAGS, 0,
811 /* last opt argumnt */ { NULL }, /* --x509dsacertfile */
812 /* arg list/cookie */ NULL,
813 /* must/cannot opts */ NULL, NULL,
814 /* option proc */ NULL,
815 /* desc, NAME, name */ X509DSACERTFILE_DESC, X509DSACERTFILE_NAME, X509DSACERTFILE_name,
816 /* disablement strs */ NULL, NULL },
818 { /* entry idx, value */ 24, VALUE_OPT_X509ECCKEYFILE,
819 /* equiv idx, value */ 24, VALUE_OPT_X509ECCKEYFILE,
820 /* equivalenced to */ NO_EQUIVALENT,
821 /* min, max, act ct */ 0, 1, 0,
822 /* opt state flags */ X509ECCKEYFILE_FLAGS, 0,
823 /* last opt argumnt */ { NULL }, /* --x509ecckeyfile */
824 /* arg list/cookie */ NULL,
825 /* must/cannot opts */ NULL, NULL,
826 /* option proc */ NULL,
827 /* desc, NAME, name */ X509ECCKEYFILE_DESC, X509ECCKEYFILE_NAME, X509ECCKEYFILE_name,
828 /* disablement strs */ NULL, NULL },
830 { /* entry idx, value */ 25, VALUE_OPT_X509ECCCERTFILE,
831 /* equiv idx, value */ 25, VALUE_OPT_X509ECCCERTFILE,
832 /* equivalenced to */ NO_EQUIVALENT,
833 /* min, max, act ct */ 0, 1, 0,
834 /* opt state flags */ X509ECCCERTFILE_FLAGS, 0,
835 /* last opt argumnt */ { NULL }, /* --x509ecccertfile */
836 /* arg list/cookie */ NULL,
837 /* must/cannot opts */ NULL, NULL,
838 /* option proc */ NULL,
839 /* desc, NAME, name */ X509ECCCERTFILE_DESC, X509ECCCERTFILE_NAME, X509ECCCERTFILE_name,
840 /* disablement strs */ NULL, NULL },
842 { /* entry idx, value */ 26, VALUE_OPT_PGPSUBKEY,
843 /* equiv idx, value */ 26, VALUE_OPT_PGPSUBKEY,
844 /* equivalenced to */ NO_EQUIVALENT,
845 /* min, max, act ct */ 0, 1, 0,
846 /* opt state flags */ PGPSUBKEY_FLAGS, 0,
847 /* last opt argumnt */ { NULL }, /* --pgpsubkey */
848 /* arg list/cookie */ NULL,
849 /* must/cannot opts */ NULL, NULL,
850 /* option proc */ NULL,
851 /* desc, NAME, name */ PGPSUBKEY_DESC, PGPSUBKEY_NAME, PGPSUBKEY_name,
852 /* disablement strs */ NULL, NULL },
854 { /* entry idx, value */ 27, VALUE_OPT_SRPPASSWD,
855 /* equiv idx, value */ 27, VALUE_OPT_SRPPASSWD,
856 /* equivalenced to */ NO_EQUIVALENT,
857 /* min, max, act ct */ 0, 1, 0,
858 /* opt state flags */ SRPPASSWD_FLAGS, 0,
859 /* last opt argumnt */ { NULL }, /* --srppasswd */
860 /* arg list/cookie */ NULL,
861 /* must/cannot opts */ NULL, NULL,
862 /* option proc */ doOptSrppasswd,
863 /* desc, NAME, name */ SRPPASSWD_DESC, SRPPASSWD_NAME, SRPPASSWD_name,
864 /* disablement strs */ NULL, NULL },
866 { /* entry idx, value */ 28, VALUE_OPT_SRPPASSWDCONF,
867 /* equiv idx, value */ 28, VALUE_OPT_SRPPASSWDCONF,
868 /* equivalenced to */ NO_EQUIVALENT,
869 /* min, max, act ct */ 0, 1, 0,
870 /* opt state flags */ SRPPASSWDCONF_FLAGS, 0,
871 /* last opt argumnt */ { NULL }, /* --srppasswdconf */
872 /* arg list/cookie */ NULL,
873 /* must/cannot opts */ NULL, NULL,
874 /* option proc */ doOptSrppasswdconf,
875 /* desc, NAME, name */ SRPPASSWDCONF_DESC, SRPPASSWDCONF_NAME, SRPPASSWDCONF_name,
876 /* disablement strs */ NULL, NULL },
878 { /* entry idx, value */ 29, VALUE_OPT_PSKPASSWD,
879 /* equiv idx, value */ 29, VALUE_OPT_PSKPASSWD,
880 /* equivalenced to */ NO_EQUIVALENT,
881 /* min, max, act ct */ 0, 1, 0,
882 /* opt state flags */ PSKPASSWD_FLAGS, 0,
883 /* last opt argumnt */ { NULL }, /* --pskpasswd */
884 /* arg list/cookie */ NULL,
885 /* must/cannot opts */ NULL, NULL,
886 /* option proc */ doOptPskpasswd,
887 /* desc, NAME, name */ PSKPASSWD_DESC, PSKPASSWD_NAME, PSKPASSWD_name,
888 /* disablement strs */ NULL, NULL },
890 { /* entry idx, value */ 30, VALUE_OPT_PSKHINT,
891 /* equiv idx, value */ 30, VALUE_OPT_PSKHINT,
892 /* equivalenced to */ NO_EQUIVALENT,
893 /* min, max, act ct */ 0, 1, 0,
894 /* opt state flags */ PSKHINT_FLAGS, 0,
895 /* last opt argumnt */ { NULL }, /* --pskhint */
896 /* arg list/cookie */ NULL,
897 /* must/cannot opts */ NULL, NULL,
898 /* option proc */ NULL,
899 /* desc, NAME, name */ PSKHINT_DESC, PSKHINT_NAME, PSKHINT_name,
900 /* disablement strs */ NULL, NULL },
902 { /* entry idx, value */ 31, VALUE_OPT_PORT,
903 /* equiv idx, value */ 31, VALUE_OPT_PORT,
904 /* equivalenced to */ NO_EQUIVALENT,
905 /* min, max, act ct */ 0, 1, 0,
906 /* opt state flags */ PORT_FLAGS, 0,
907 /* last opt argumnt */ { NULL }, /* --port */
908 /* arg list/cookie */ NULL,
909 /* must/cannot opts */ NULL, NULL,
910 /* option proc */ optionNumericVal,
911 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
912 /* disablement strs */ NULL, NULL },
914 { /* entry idx, value */ 32, VALUE_OPT_LIST,
915 /* equiv idx, value */ 32, VALUE_OPT_LIST,
916 /* equivalenced to */ NO_EQUIVALENT,
917 /* min, max, act ct */ 0, 1, 0,
918 /* opt state flags */ LIST_FLAGS, 0,
919 /* last opt argumnt */ { NULL }, /* --list */
920 /* arg list/cookie */ NULL,
921 /* must/cannot opts */ NULL, NULL,
922 /* option proc */ NULL,
923 /* desc, NAME, name */ LIST_DESC, LIST_NAME, LIST_name,
924 /* disablement strs */ NULL, NULL },
926 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
927 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
928 /* equivalenced to */ NO_EQUIVALENT,
929 /* min, max, act ct */ 0, 1, 0,
930 /* opt state flags */ VER_FLAGS, 0,
931 /* last opt argumnt */ { NULL },
932 /* arg list/cookie */ NULL,
933 /* must/cannot opts */ NULL, NULL,
934 /* option proc */ VER_PROC,
935 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
936 /* disablement strs */ NULL, NULL },
940 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
941 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
942 /* equivalenced to */ NO_EQUIVALENT,
943 /* min, max, act ct */ 0, 1, 0,
944 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
945 /* last opt argumnt */ { NULL },
946 /* arg list/cookie */ NULL,
947 /* must/cannot opts */ NULL, NULL,
948 /* option proc */ doUsageOpt,
949 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
950 /* disablement strs */ NULL, NULL },
952 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
953 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
954 /* equivalenced to */ NO_EQUIVALENT,
955 /* min, max, act ct */ 0, 1, 0,
956 /* opt state flags */ MORE_HELP_FLAGS, 0,
957 /* last opt argumnt */ { NULL },
958 /* arg list/cookie */ NULL,
959 /* must/cannot opts */ NULL, NULL,
960 /* option proc */ optionPagedUsage,
961 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
962 /* disablement strs */ NULL, NULL }
966 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
968 * Define the gnutls-serv Option Environment
970 #define zPROGNAME (gnutls_serv_opt_strs+2703)
971 #define zUsageTitle (gnutls_serv_opt_strs+2715)
972 #define zRcName NULL
973 #define apzHomeList NULL
974 #define zBugsAddr (gnutls_serv_opt_strs+2818)
975 #define zExplain (gnutls_serv_opt_strs+2837)
976 #define zDetail (gnutls_serv_opt_strs+2840)
977 #define zFullVersion (gnutls_serv_opt_strs+2899)
978 /* extracted from optcode.tlib near line 350 */
980 #if defined(ENABLE_NLS)
981 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
982 static tOptionXlateProc translate_option_strings;
983 #else
984 # define OPTPROC_BASE OPTPROC_NONE
985 # define translate_option_strings NULL
986 #endif /* ENABLE_NLS */
989 #define gnutls_serv_full_usage (NULL)
991 #define gnutls_serv_short_usage (gnutls_serv_opt_strs+2921)
993 #endif /* not defined __doxygen__ */
996 * Create the static procedure(s) declared above.
999 * The callout function that invokes the optionUsage function.
1001 * @param pOptions the AutoOpts option description structure
1002 * @param pOptDesc the descriptor for the "help" (usage) option.
1003 * @noreturn
1005 static void
1006 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
1008 optionUsage(&gnutls_servOptions, GNUTLS_SERV_EXIT_SUCCESS);
1009 /* NOTREACHED */
1010 (void)pOptDesc;
1011 (void)pOptions;
1014 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1016 * Code to handle the debug option.
1018 * @param pOptions the gnutls-serv options data structure
1019 * @param pOptDesc the option descriptor for this option.
1021 static void
1022 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
1024 static struct {long rmin, rmax;} const rng[1] = {
1025 { 0 , 9999 } };
1026 int ix;
1028 if (pOptions <= OPTPROC_EMIT_LIMIT)
1029 goto emit_ranges;
1030 optionNumericVal(pOptions, pOptDesc);
1032 for (ix = 0; ix < 1; ix++) {
1033 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1034 continue; /* ranges need not be ordered. */
1035 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1036 return;
1037 if (rng[ix].rmax == LONG_MIN)
1038 continue;
1039 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1040 return;
1043 option_usage_fp = stderr;
1045 emit_ranges:
1047 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1050 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1052 * Code to handle the mtu option.
1054 * @param pOptions the gnutls-serv options data structure
1055 * @param pOptDesc the option descriptor for this option.
1057 static void
1058 doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
1060 static struct {long rmin, rmax;} const rng[1] = {
1061 { 0, 17000 } };
1062 int ix;
1064 if (pOptions <= OPTPROC_EMIT_LIMIT)
1065 goto emit_ranges;
1066 optionNumericVal(pOptions, pOptDesc);
1068 for (ix = 0; ix < 1; ix++) {
1069 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1070 continue; /* ranges need not be ordered. */
1071 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1072 return;
1073 if (rng[ix].rmax == LONG_MIN)
1074 continue;
1075 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1076 return;
1079 option_usage_fp = stderr;
1081 emit_ranges:
1083 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1086 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1088 * Code to handle the dhparams option.
1090 * @param pOptions the gnutls-serv options data structure
1091 * @param pOptDesc the option descriptor for this option.
1093 static void
1094 doOptDhparams(tOptions* pOptions, tOptDesc* pOptDesc)
1096 static teOptFileType const type =
1097 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1098 static tuFileMode mode;
1099 #ifndef O_CLOEXEC
1100 # define O_CLOEXEC 0
1101 #endif
1102 mode.file_flags = O_CLOEXEC;
1104 optionFileCheck(pOptions, pOptDesc, type, mode);
1107 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1109 * Code to handle the x509crlfile option.
1111 * @param pOptions the gnutls-serv options data structure
1112 * @param pOptDesc the option descriptor for this option.
1114 static void
1115 doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc)
1117 static teOptFileType const type =
1118 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1119 static tuFileMode mode;
1120 #ifndef O_CLOEXEC
1121 # define O_CLOEXEC 0
1122 #endif
1123 mode.file_flags = O_CLOEXEC;
1125 optionFileCheck(pOptions, pOptDesc, type, mode);
1128 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1130 * Code to handle the pgpkeyfile option.
1132 * @param pOptions the gnutls-serv options data structure
1133 * @param pOptDesc the option descriptor for this option.
1135 static void
1136 doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc)
1138 static teOptFileType const type =
1139 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1140 static tuFileMode mode;
1141 #ifndef O_CLOEXEC
1142 # define O_CLOEXEC 0
1143 #endif
1144 mode.file_flags = O_CLOEXEC;
1146 optionFileCheck(pOptions, pOptDesc, type, mode);
1149 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1151 * Code to handle the pgpkeyring option.
1153 * @param pOptions the gnutls-serv options data structure
1154 * @param pOptDesc the option descriptor for this option.
1156 static void
1157 doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc)
1159 static teOptFileType const type =
1160 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1161 static tuFileMode mode;
1162 #ifndef O_CLOEXEC
1163 # define O_CLOEXEC 0
1164 #endif
1165 mode.file_flags = O_CLOEXEC;
1167 optionFileCheck(pOptions, pOptDesc, type, mode);
1170 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1172 * Code to handle the pgpcertfile option.
1174 * @param pOptions the gnutls-serv options data structure
1175 * @param pOptDesc the option descriptor for this option.
1177 static void
1178 doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc)
1180 static teOptFileType const type =
1181 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1182 static tuFileMode mode;
1183 #ifndef O_CLOEXEC
1184 # define O_CLOEXEC 0
1185 #endif
1186 mode.file_flags = O_CLOEXEC;
1188 optionFileCheck(pOptions, pOptDesc, type, mode);
1191 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1193 * Code to handle the srppasswd option.
1195 * @param pOptions the gnutls-serv options data structure
1196 * @param pOptDesc the option descriptor for this option.
1198 static void
1199 doOptSrppasswd(tOptions* pOptions, tOptDesc* pOptDesc)
1201 static teOptFileType const type =
1202 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1203 static tuFileMode mode;
1204 #ifndef O_CLOEXEC
1205 # define O_CLOEXEC 0
1206 #endif
1207 mode.file_flags = O_CLOEXEC;
1209 optionFileCheck(pOptions, pOptDesc, type, mode);
1212 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1214 * Code to handle the srppasswdconf option.
1216 * @param pOptions the gnutls-serv options data structure
1217 * @param pOptDesc the option descriptor for this option.
1219 static void
1220 doOptSrppasswdconf(tOptions* pOptions, tOptDesc* pOptDesc)
1222 static teOptFileType const type =
1223 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1224 static tuFileMode mode;
1225 #ifndef O_CLOEXEC
1226 # define O_CLOEXEC 0
1227 #endif
1228 mode.file_flags = O_CLOEXEC;
1230 optionFileCheck(pOptions, pOptDesc, type, mode);
1233 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1235 * Code to handle the pskpasswd option.
1237 * @param pOptions the gnutls-serv options data structure
1238 * @param pOptDesc the option descriptor for this option.
1240 static void
1241 doOptPskpasswd(tOptions* pOptions, tOptDesc* pOptDesc)
1243 static teOptFileType const type =
1244 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1245 static tuFileMode mode;
1246 #ifndef O_CLOEXEC
1247 # define O_CLOEXEC 0
1248 #endif
1249 mode.file_flags = O_CLOEXEC;
1251 optionFileCheck(pOptions, pOptDesc, type, mode);
1253 /* extracted from optmain.tlib near line 1113 */
1256 * The directory containing the data associated with gnutls-serv.
1258 #ifndef PKGDATADIR
1259 # define PKGDATADIR ""
1260 #endif
1263 * Information about the person or institution that packaged gnutls-serv
1264 * for the current distribution.
1266 #ifndef WITH_PACKAGER
1267 # define gnutls_serv_packager_info NULL
1268 #else
1269 static char const gnutls_serv_packager_info[] =
1270 "Packaged by " WITH_PACKAGER
1272 # ifdef WITH_PACKAGER_VERSION
1273 " ("WITH_PACKAGER_VERSION")"
1274 # endif
1276 # ifdef WITH_PACKAGER_BUG_REPORTS
1277 "\nReport gnutls_serv bugs to " WITH_PACKAGER_BUG_REPORTS
1278 # endif
1279 "\n";
1280 #endif
1281 #ifndef __doxygen__
1283 #endif /* __doxygen__ */
1285 * The option definitions for gnutls-serv. The one structure that
1286 * binds them all.
1288 tOptions gnutls_servOptions = {
1289 OPTIONS_STRUCT_VERSION,
1290 0, NULL, /* original argc + argv */
1291 ( OPTPROC_BASE
1292 + OPTPROC_ERRSTOP
1293 + OPTPROC_SHORTOPT
1294 + OPTPROC_LONGOPT
1295 + OPTPROC_NO_REQ_OPT
1296 + OPTPROC_NO_ARGS
1297 + OPTPROC_GNUUSAGE
1298 + OPTPROC_MISUSE ),
1299 0, NULL, /* current option index, current option */
1300 NULL, NULL, zPROGNAME,
1301 zRcName, zCopyright, zLicenseDescrip,
1302 zFullVersion, apzHomeList, zUsageTitle,
1303 zExplain, zDetail, optDesc,
1304 zBugsAddr, /* address to send bugs to */
1305 NULL, NULL, /* extensions/saved state */
1306 optionUsage, /* usage procedure */
1307 translate_option_strings, /* translation procedure */
1309 * Indexes to special options
1311 { INDEX_OPT_MORE_HELP, /* more-help option index */
1312 NO_EQUIVALENT, /* save option index */
1313 NO_EQUIVALENT, /* '-#' option index */
1314 NO_EQUIVALENT /* index of default opt */
1316 36 /* full option count */, 33 /* user option count */,
1317 gnutls_serv_full_usage, gnutls_serv_short_usage,
1318 NULL, NULL,
1319 PKGDATADIR, gnutls_serv_packager_info
1322 #if ENABLE_NLS
1323 #include <stdio.h>
1324 #include <stdlib.h>
1325 #include <string.h>
1326 #include <unistd.h>
1327 #include <autoopts/usage-txt.h>
1329 static char* AO_gettext(char const* pz);
1330 static void coerce_it(void** s);
1333 * AutoGen specific wrapper function for gettext.
1334 * It relies on the macro _() to convert from English to the target
1335 * language, then strdup-duplicates the result string.
1337 * @param[in] pz the input text used as a lookup key.
1338 * @returns the translated text (if there is one),
1339 * or the original text (if not).
1341 static char *
1342 AO_gettext(char const* pz)
1344 char* pzRes;
1345 if (pz == NULL)
1346 return NULL;
1347 pzRes = _(pz);
1348 if (pzRes == pz)
1349 return pzRes;
1350 pzRes = strdup(pzRes);
1351 if (pzRes == NULL) {
1352 fputs(_("No memory for duping translated strings\n"), stderr);
1353 exit(GNUTLS_SERV_EXIT_FAILURE);
1355 return pzRes;
1358 static void coerce_it(void** s) { *s = AO_gettext(*s);
1362 * Translate all the translatable strings in the gnutls_servOptions
1363 * structure defined above. This is done only once.
1365 static void
1366 translate_option_strings(void)
1368 tOptions * const pOpt = &gnutls_servOptions;
1371 * Guard against re-translation. It won't work. The strings will have
1372 * been changed by the first pass through this code. One shot only.
1374 if (option_usage_text.field_ct != 0) {
1376 * Do the translations. The first pointer follows the field count
1377 * field. The field count field is the size of a pointer.
1379 tOptDesc * pOD = pOpt->pOptDesc;
1380 char ** ppz = (char**)(void*)&(option_usage_text);
1381 int ix = option_usage_text.field_ct;
1383 do {
1384 ppz++;
1385 *ppz = AO_gettext(*ppz);
1386 } while (--ix > 0);
1388 coerce_it((void*)&(pOpt->pzCopyright));
1389 coerce_it((void*)&(pOpt->pzCopyNotice));
1390 coerce_it((void*)&(pOpt->pzFullVersion));
1391 coerce_it((void*)&(pOpt->pzUsageTitle));
1392 coerce_it((void*)&(pOpt->pzExplain));
1393 coerce_it((void*)&(pOpt->pzDetail));
1394 coerce_it((void*)&(pOpt->pzPackager));
1395 coerce_it((void*)&(pOpt->pzShortUsage));
1396 option_usage_text.field_ct = 0;
1398 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1399 coerce_it((void*)&(pOD->pzText));
1402 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1403 tOptDesc * pOD = pOpt->pOptDesc;
1404 int ix;
1406 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1407 coerce_it((void*)&(pOD->pz_Name));
1408 coerce_it((void*)&(pOD->pz_DisableName));
1409 coerce_it((void*)&(pOD->pz_DisablePfx));
1411 /* prevent re-translation */
1412 gnutls_servOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1416 #endif /* ENABLE_NLS */
1418 #ifdef __cplusplus
1420 #endif
1421 /* serv-args.c ends here */