_gnutls_strdatum_to_buf() will account for NULL input.
[gnutls.git] / src / serv-args.c
blob61e4221664abbd34ea3b71dc519d781c43a60619
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 November 8, 2012 at 11:35:50 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[3106] =
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 */ "Offer SRTP profiles\0"
115 /* 1274 */ "SRTP_PROFILES\0"
116 /* 1288 */ "srtp-profiles\0"
117 /* 1302 */ "Do not request a client certificate\0"
118 /* 1338 */ "DISABLE_CLIENT_CERT\0"
119 /* 1358 */ "disable-client-cert\0"
120 /* 1378 */ "Require a client certificate\0"
121 /* 1407 */ "REQUIRE_CLIENT_CERT\0"
122 /* 1427 */ "require-client-cert\0"
123 /* 1447 */ "Activate heartbeat support\0"
124 /* 1474 */ "HEARTBEAT\0"
125 /* 1484 */ "heartbeat\0"
126 /* 1494 */ "Use DER format for certificates to read from\0"
127 /* 1539 */ "X509FMTDER\0"
128 /* 1550 */ "x509fmtder\0"
129 /* 1561 */ "Priorities string\0"
130 /* 1579 */ "PRIORITY\0"
131 /* 1588 */ "priority\0"
132 /* 1597 */ "DH params file to use\0"
133 /* 1619 */ "DHPARAMS\0"
134 /* 1628 */ "dhparams\0"
135 /* 1637 */ "Certificate file or PKCS #11 URL to use\0"
136 /* 1677 */ "X509CAFILE\0"
137 /* 1688 */ "x509cafile\0"
138 /* 1699 */ "CRL file to use\0"
139 /* 1715 */ "X509CRLFILE\0"
140 /* 1727 */ "x509crlfile\0"
141 /* 1739 */ "PGP Key file to use\0"
142 /* 1759 */ "PGPKEYFILE\0"
143 /* 1770 */ "pgpkeyfile\0"
144 /* 1781 */ "PGP Key ring file to use\0"
145 /* 1806 */ "PGPKEYRING\0"
146 /* 1817 */ "pgpkeyring\0"
147 /* 1828 */ "PGP Public Key (certificate) file to use\0"
148 /* 1869 */ "PGPCERTFILE\0"
149 /* 1881 */ "pgpcertfile\0"
150 /* 1893 */ "X.509 key file or PKCS #11 URL to use\0"
151 /* 1931 */ "X509KEYFILE\0"
152 /* 1943 */ "x509keyfile\0"
153 /* 1955 */ "X.509 Certificate file or PKCS #11 URL to use\0"
154 /* 2001 */ "X509CERTFILE\0"
155 /* 2014 */ "x509certfile\0"
156 /* 2027 */ "Alternative X.509 key file or PKCS #11 URL to use\0"
157 /* 2077 */ "X509DSAKEYFILE\0"
158 /* 2092 */ "x509dsakeyfile\0"
159 /* 2107 */ "Alternative X.509 Certificate file or PKCS #11 URL to use\0"
160 /* 2165 */ "X509DSACERTFILE\0"
161 /* 2181 */ "x509dsacertfile\0"
162 /* 2197 */ "X509ECCKEYFILE\0"
163 /* 2212 */ "x509ecckeyfile\0"
164 /* 2227 */ "X509ECCCERTFILE\0"
165 /* 2243 */ "x509ecccertfile\0"
166 /* 2259 */ "PGP subkey to use (hex or auto)\0"
167 /* 2291 */ "PGPSUBKEY\0"
168 /* 2301 */ "pgpsubkey\0"
169 /* 2311 */ "SRP password file to use\0"
170 /* 2336 */ "SRPPASSWD\0"
171 /* 2346 */ "srppasswd\0"
172 /* 2356 */ "SRP password configuration file to use\0"
173 /* 2395 */ "SRPPASSWDCONF\0"
174 /* 2409 */ "srppasswdconf\0"
175 /* 2423 */ "PSK password file to use\0"
176 /* 2448 */ "PSKPASSWD\0"
177 /* 2458 */ "pskpasswd\0"
178 /* 2468 */ "PSK identity hint to use\0"
179 /* 2493 */ "PSKHINT\0"
180 /* 2501 */ "pskhint\0"
181 /* 2509 */ "The OCSP response to send to client\0"
182 /* 2545 */ "OCSP_RESPONSE\0"
183 /* 2559 */ "ocsp-response\0"
184 /* 2573 */ "The port to connect to\0"
185 /* 2596 */ "PORT\0"
186 /* 2601 */ "port\0"
187 /* 2606 */ "Print a list of the supported algorithms and modes\0"
188 /* 2657 */ "LIST\0"
189 /* 2662 */ "list\0"
190 /* 2667 */ "Display extended usage information and exit\0"
191 /* 2711 */ "help\0"
192 /* 2716 */ "Extended usage information passed thru pager\0"
193 /* 2761 */ "more-help\0"
194 /* 2771 */ "Output version information and exit\0"
195 /* 2807 */ "version\0"
196 /* 2815 */ "GNUTLS_SERV\0"
197 /* 2827 */ "gnutls-serv - GnuTLS server - Ver. @VERSION@\n"
198 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
199 /* 2930 */ "bug-gnutls@gnu.org\0"
200 /* 2949 */ "\n\n\0"
201 /* 2952 */ "\n"
202 "Server program that listens to incoming TLS connections.\n\0"
203 /* 3011 */ "gnutls-serv @VERSION@\0"
204 /* 3033 */ "Usage: gnutls-serv [options]\n"
205 "gnutls-serv --help for usage instructions.\n";
208 * debug option description:
210 #define DEBUG_DESC (gnutls_serv_opt_strs+893)
211 #define DEBUG_NAME (gnutls_serv_opt_strs+911)
212 #define DEBUG_name (gnutls_serv_opt_strs+917)
213 #define DEBUG_FLAGS (OPTST_DISABLED \
214 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
217 * noticket option description:
219 #define NOTICKET_DESC (gnutls_serv_opt_strs+923)
220 #define NOTICKET_NAME (gnutls_serv_opt_strs+952)
221 #define NOTICKET_name (gnutls_serv_opt_strs+961)
222 #define NOTICKET_FLAGS (OPTST_DISABLED)
225 * generate option description:
227 #define GENERATE_DESC (gnutls_serv_opt_strs+970)
228 #define GENERATE_NAME (gnutls_serv_opt_strs+1020)
229 #define GENERATE_name (gnutls_serv_opt_strs+1029)
230 #define GENERATE_FLAGS (OPTST_DISABLED)
233 * quiet option description:
235 #define QUIET_DESC (gnutls_serv_opt_strs+1038)
236 #define QUIET_NAME (gnutls_serv_opt_strs+1061)
237 #define QUIET_name (gnutls_serv_opt_strs+1067)
238 #define QUIET_FLAGS (OPTST_DISABLED)
241 * nodb option description:
243 #define NODB_DESC (gnutls_serv_opt_strs+1073)
244 #define NODB_NAME (gnutls_serv_opt_strs+1106)
245 #define NODB_name (gnutls_serv_opt_strs+1111)
246 #define NODB_FLAGS (OPTST_DISABLED)
249 * http option description:
251 #define HTTP_DESC (gnutls_serv_opt_strs+1116)
252 #define HTTP_NAME (gnutls_serv_opt_strs+1138)
253 #define HTTP_name (gnutls_serv_opt_strs+1143)
254 #define HTTP_FLAGS (OPTST_DISABLED)
257 * echo option description:
259 #define ECHO_DESC (gnutls_serv_opt_strs+1148)
260 #define ECHO_NAME (gnutls_serv_opt_strs+1170)
261 #define ECHO_name (gnutls_serv_opt_strs+1175)
262 #define ECHO_FLAGS (OPTST_DISABLED)
265 * udp option description:
267 #define UDP_DESC (gnutls_serv_opt_strs+1180)
268 #define UDP_NAME (gnutls_serv_opt_strs+1213)
269 #define UDP_name (gnutls_serv_opt_strs+1217)
270 #define UDP_FLAGS (OPTST_DISABLED)
273 * mtu option description:
275 #define MTU_DESC (gnutls_serv_opt_strs+1221)
276 #define MTU_NAME (gnutls_serv_opt_strs+1246)
277 #define MTU_name (gnutls_serv_opt_strs+1250)
278 #define MTU_FLAGS (OPTST_DISABLED \
279 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
282 * srtp_profiles option description:
284 #define SRTP_PROFILES_DESC (gnutls_serv_opt_strs+1254)
285 #define SRTP_PROFILES_NAME (gnutls_serv_opt_strs+1274)
286 #define SRTP_PROFILES_name (gnutls_serv_opt_strs+1288)
287 #define SRTP_PROFILES_FLAGS (OPTST_DISABLED \
288 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
291 * disable-client-cert option description:
293 #define DISABLE_CLIENT_CERT_DESC (gnutls_serv_opt_strs+1302)
294 #define DISABLE_CLIENT_CERT_NAME (gnutls_serv_opt_strs+1338)
295 #define DISABLE_CLIENT_CERT_name (gnutls_serv_opt_strs+1358)
296 #define DISABLE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
299 * require-client-cert option description:
301 #define REQUIRE_CLIENT_CERT_DESC (gnutls_serv_opt_strs+1378)
302 #define REQUIRE_CLIENT_CERT_NAME (gnutls_serv_opt_strs+1407)
303 #define REQUIRE_CLIENT_CERT_name (gnutls_serv_opt_strs+1427)
304 #define REQUIRE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
307 * heartbeat option description:
309 #define HEARTBEAT_DESC (gnutls_serv_opt_strs+1447)
310 #define HEARTBEAT_NAME (gnutls_serv_opt_strs+1474)
311 #define HEARTBEAT_name (gnutls_serv_opt_strs+1484)
312 #define HEARTBEAT_FLAGS (OPTST_DISABLED)
315 * x509fmtder option description:
317 #define X509FMTDER_DESC (gnutls_serv_opt_strs+1494)
318 #define X509FMTDER_NAME (gnutls_serv_opt_strs+1539)
319 #define X509FMTDER_name (gnutls_serv_opt_strs+1550)
320 #define X509FMTDER_FLAGS (OPTST_DISABLED)
323 * priority option description:
325 #define PRIORITY_DESC (gnutls_serv_opt_strs+1561)
326 #define PRIORITY_NAME (gnutls_serv_opt_strs+1579)
327 #define PRIORITY_name (gnutls_serv_opt_strs+1588)
328 #define PRIORITY_FLAGS (OPTST_DISABLED \
329 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
332 * dhparams option description:
334 #define DHPARAMS_DESC (gnutls_serv_opt_strs+1597)
335 #define DHPARAMS_NAME (gnutls_serv_opt_strs+1619)
336 #define DHPARAMS_name (gnutls_serv_opt_strs+1628)
337 #define DHPARAMS_FLAGS (OPTST_DISABLED \
338 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
341 * x509cafile option description:
343 #define X509CAFILE_DESC (gnutls_serv_opt_strs+1637)
344 #define X509CAFILE_NAME (gnutls_serv_opt_strs+1677)
345 #define X509CAFILE_name (gnutls_serv_opt_strs+1688)
346 #define X509CAFILE_FLAGS (OPTST_DISABLED \
347 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
350 * x509crlfile option description:
352 #define X509CRLFILE_DESC (gnutls_serv_opt_strs+1699)
353 #define X509CRLFILE_NAME (gnutls_serv_opt_strs+1715)
354 #define X509CRLFILE_name (gnutls_serv_opt_strs+1727)
355 #define X509CRLFILE_FLAGS (OPTST_DISABLED \
356 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
359 * pgpkeyfile option description:
361 #define PGPKEYFILE_DESC (gnutls_serv_opt_strs+1739)
362 #define PGPKEYFILE_NAME (gnutls_serv_opt_strs+1759)
363 #define PGPKEYFILE_name (gnutls_serv_opt_strs+1770)
364 #define PGPKEYFILE_FLAGS (OPTST_DISABLED \
365 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
368 * pgpkeyring option description:
370 #define PGPKEYRING_DESC (gnutls_serv_opt_strs+1781)
371 #define PGPKEYRING_NAME (gnutls_serv_opt_strs+1806)
372 #define PGPKEYRING_name (gnutls_serv_opt_strs+1817)
373 #define PGPKEYRING_FLAGS (OPTST_DISABLED \
374 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
377 * pgpcertfile option description:
379 #define PGPCERTFILE_DESC (gnutls_serv_opt_strs+1828)
380 #define PGPCERTFILE_NAME (gnutls_serv_opt_strs+1869)
381 #define PGPCERTFILE_name (gnutls_serv_opt_strs+1881)
382 #define PGPCERTFILE_FLAGS (OPTST_DISABLED \
383 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
386 * x509keyfile option description:
388 #define X509KEYFILE_DESC (gnutls_serv_opt_strs+1893)
389 #define X509KEYFILE_NAME (gnutls_serv_opt_strs+1931)
390 #define X509KEYFILE_name (gnutls_serv_opt_strs+1943)
391 #define X509KEYFILE_FLAGS (OPTST_DISABLED \
392 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
395 * x509certfile option description:
397 #define X509CERTFILE_DESC (gnutls_serv_opt_strs+1955)
398 #define X509CERTFILE_NAME (gnutls_serv_opt_strs+2001)
399 #define X509CERTFILE_name (gnutls_serv_opt_strs+2014)
400 #define X509CERTFILE_FLAGS (OPTST_DISABLED \
401 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
404 * x509dsakeyfile option description:
406 #define X509DSAKEYFILE_DESC (gnutls_serv_opt_strs+2027)
407 #define X509DSAKEYFILE_NAME (gnutls_serv_opt_strs+2077)
408 #define X509DSAKEYFILE_name (gnutls_serv_opt_strs+2092)
409 #define X509DSAKEYFILE_FLAGS (OPTST_DISABLED \
410 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
413 * x509dsacertfile option description:
415 #define X509DSACERTFILE_DESC (gnutls_serv_opt_strs+2107)
416 #define X509DSACERTFILE_NAME (gnutls_serv_opt_strs+2165)
417 #define X509DSACERTFILE_name (gnutls_serv_opt_strs+2181)
418 #define X509DSACERTFILE_FLAGS (OPTST_DISABLED \
419 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
422 * x509ecckeyfile option description:
424 #define X509ECCKEYFILE_DESC (gnutls_serv_opt_strs+2027)
425 #define X509ECCKEYFILE_NAME (gnutls_serv_opt_strs+2197)
426 #define X509ECCKEYFILE_name (gnutls_serv_opt_strs+2212)
427 #define X509ECCKEYFILE_FLAGS (OPTST_DISABLED \
428 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
431 * x509ecccertfile option description:
433 #define X509ECCCERTFILE_DESC (gnutls_serv_opt_strs+2107)
434 #define X509ECCCERTFILE_NAME (gnutls_serv_opt_strs+2227)
435 #define X509ECCCERTFILE_name (gnutls_serv_opt_strs+2243)
436 #define X509ECCCERTFILE_FLAGS (OPTST_DISABLED \
437 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
440 * pgpsubkey option description:
442 #define PGPSUBKEY_DESC (gnutls_serv_opt_strs+2259)
443 #define PGPSUBKEY_NAME (gnutls_serv_opt_strs+2291)
444 #define PGPSUBKEY_name (gnutls_serv_opt_strs+2301)
445 #define PGPSUBKEY_FLAGS (OPTST_DISABLED \
446 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
449 * srppasswd option description:
451 #define SRPPASSWD_DESC (gnutls_serv_opt_strs+2311)
452 #define SRPPASSWD_NAME (gnutls_serv_opt_strs+2336)
453 #define SRPPASSWD_name (gnutls_serv_opt_strs+2346)
454 #define SRPPASSWD_FLAGS (OPTST_DISABLED \
455 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
458 * srppasswdconf option description:
460 #define SRPPASSWDCONF_DESC (gnutls_serv_opt_strs+2356)
461 #define SRPPASSWDCONF_NAME (gnutls_serv_opt_strs+2395)
462 #define SRPPASSWDCONF_name (gnutls_serv_opt_strs+2409)
463 #define SRPPASSWDCONF_FLAGS (OPTST_DISABLED \
464 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
467 * pskpasswd option description:
469 #define PSKPASSWD_DESC (gnutls_serv_opt_strs+2423)
470 #define PSKPASSWD_NAME (gnutls_serv_opt_strs+2448)
471 #define PSKPASSWD_name (gnutls_serv_opt_strs+2458)
472 #define PSKPASSWD_FLAGS (OPTST_DISABLED \
473 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
476 * pskhint option description:
478 #define PSKHINT_DESC (gnutls_serv_opt_strs+2468)
479 #define PSKHINT_NAME (gnutls_serv_opt_strs+2493)
480 #define PSKHINT_name (gnutls_serv_opt_strs+2501)
481 #define PSKHINT_FLAGS (OPTST_DISABLED \
482 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
485 * ocsp-response option description:
487 #define OCSP_RESPONSE_DESC (gnutls_serv_opt_strs+2509)
488 #define OCSP_RESPONSE_NAME (gnutls_serv_opt_strs+2545)
489 #define OCSP_RESPONSE_name (gnutls_serv_opt_strs+2559)
490 #define OCSP_RESPONSE_FLAGS (OPTST_DISABLED \
491 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
494 * port option description:
496 #define PORT_DESC (gnutls_serv_opt_strs+2573)
497 #define PORT_NAME (gnutls_serv_opt_strs+2596)
498 #define PORT_name (gnutls_serv_opt_strs+2601)
499 #define PORT_FLAGS (OPTST_DISABLED \
500 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
503 * list option description:
505 #define LIST_DESC (gnutls_serv_opt_strs+2606)
506 #define LIST_NAME (gnutls_serv_opt_strs+2657)
507 #define LIST_name (gnutls_serv_opt_strs+2662)
508 #define LIST_FLAGS (OPTST_DISABLED)
511 * Help/More_Help/Version option descriptions:
513 #define HELP_DESC (gnutls_serv_opt_strs+2667)
514 #define HELP_name (gnutls_serv_opt_strs+2711)
515 #ifdef HAVE_WORKING_FORK
516 #define MORE_HELP_DESC (gnutls_serv_opt_strs+2716)
517 #define MORE_HELP_name (gnutls_serv_opt_strs+2761)
518 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
519 #else
520 #define MORE_HELP_DESC NULL
521 #define MORE_HELP_name NULL
522 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
523 #endif
524 #ifdef NO_OPTIONAL_OPT_ARGS
525 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
526 #else
527 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
528 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
529 #endif
530 #define VER_DESC (gnutls_serv_opt_strs+2771)
531 #define VER_name (gnutls_serv_opt_strs+2807)
533 * Declare option callback procedures
535 extern tOptProc
536 optionBooleanVal, optionNestedVal, optionNumericVal,
537 optionPagedUsage, optionPrintVersion, optionResetOpt,
538 optionStackArg, optionTimeDate, optionTimeVal,
539 optionUnstackArg, optionVendorOption;
540 static tOptProc
541 doOptDebug, doOptDhparams, doOptMtu,
542 doOptOcsp_Response, doOptPgpcertfile, doOptPgpkeyfile,
543 doOptPgpkeyring, doOptPskpasswd, doOptSrppasswd,
544 doOptSrppasswdconf, doOptX509crlfile, doUsageOpt;
545 #define VER_PROC optionPrintVersion
547 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
549 * Define the gnutls-serv Option Descriptions.
550 * This is an array of OPTION_CT entries, one for each
551 * option that the gnutls-serv program responds to.
553 static tOptDesc optDesc[OPTION_CT] = {
554 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
555 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
556 /* equivalenced to */ NO_EQUIVALENT,
557 /* min, max, act ct */ 0, 1, 0,
558 /* opt state flags */ DEBUG_FLAGS, 0,
559 /* last opt argumnt */ { NULL }, /* --debug */
560 /* arg list/cookie */ NULL,
561 /* must/cannot opts */ NULL, NULL,
562 /* option proc */ doOptDebug,
563 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
564 /* disablement strs */ NULL, NULL },
566 { /* entry idx, value */ 1, VALUE_OPT_NOTICKET,
567 /* equiv idx, value */ 1, VALUE_OPT_NOTICKET,
568 /* equivalenced to */ NO_EQUIVALENT,
569 /* min, max, act ct */ 0, 1, 0,
570 /* opt state flags */ NOTICKET_FLAGS, 0,
571 /* last opt argumnt */ { NULL }, /* --noticket */
572 /* arg list/cookie */ NULL,
573 /* must/cannot opts */ NULL, NULL,
574 /* option proc */ NULL,
575 /* desc, NAME, name */ NOTICKET_DESC, NOTICKET_NAME, NOTICKET_name,
576 /* disablement strs */ NULL, NULL },
578 { /* entry idx, value */ 2, VALUE_OPT_GENERATE,
579 /* equiv idx, value */ 2, VALUE_OPT_GENERATE,
580 /* equivalenced to */ NO_EQUIVALENT,
581 /* min, max, act ct */ 0, 1, 0,
582 /* opt state flags */ GENERATE_FLAGS, 0,
583 /* last opt argumnt */ { NULL }, /* --generate */
584 /* arg list/cookie */ NULL,
585 /* must/cannot opts */ NULL, NULL,
586 /* option proc */ NULL,
587 /* desc, NAME, name */ GENERATE_DESC, GENERATE_NAME, GENERATE_name,
588 /* disablement strs */ NULL, NULL },
590 { /* entry idx, value */ 3, VALUE_OPT_QUIET,
591 /* equiv idx, value */ 3, VALUE_OPT_QUIET,
592 /* equivalenced to */ NO_EQUIVALENT,
593 /* min, max, act ct */ 0, 1, 0,
594 /* opt state flags */ QUIET_FLAGS, 0,
595 /* last opt argumnt */ { NULL }, /* --quiet */
596 /* arg list/cookie */ NULL,
597 /* must/cannot opts */ NULL, NULL,
598 /* option proc */ NULL,
599 /* desc, NAME, name */ QUIET_DESC, QUIET_NAME, QUIET_name,
600 /* disablement strs */ NULL, NULL },
602 { /* entry idx, value */ 4, VALUE_OPT_NODB,
603 /* equiv idx, value */ 4, VALUE_OPT_NODB,
604 /* equivalenced to */ NO_EQUIVALENT,
605 /* min, max, act ct */ 0, 1, 0,
606 /* opt state flags */ NODB_FLAGS, 0,
607 /* last opt argumnt */ { NULL }, /* --nodb */
608 /* arg list/cookie */ NULL,
609 /* must/cannot opts */ NULL, NULL,
610 /* option proc */ NULL,
611 /* desc, NAME, name */ NODB_DESC, NODB_NAME, NODB_name,
612 /* disablement strs */ NULL, NULL },
614 { /* entry idx, value */ 5, VALUE_OPT_HTTP,
615 /* equiv idx, value */ 5, VALUE_OPT_HTTP,
616 /* equivalenced to */ NO_EQUIVALENT,
617 /* min, max, act ct */ 0, 1, 0,
618 /* opt state flags */ HTTP_FLAGS, 0,
619 /* last opt argumnt */ { NULL }, /* --http */
620 /* arg list/cookie */ NULL,
621 /* must/cannot opts */ NULL, NULL,
622 /* option proc */ NULL,
623 /* desc, NAME, name */ HTTP_DESC, HTTP_NAME, HTTP_name,
624 /* disablement strs */ NULL, NULL },
626 { /* entry idx, value */ 6, VALUE_OPT_ECHO,
627 /* equiv idx, value */ 6, VALUE_OPT_ECHO,
628 /* equivalenced to */ NO_EQUIVALENT,
629 /* min, max, act ct */ 0, 1, 0,
630 /* opt state flags */ ECHO_FLAGS, 0,
631 /* last opt argumnt */ { NULL }, /* --echo */
632 /* arg list/cookie */ NULL,
633 /* must/cannot opts */ NULL, NULL,
634 /* option proc */ NULL,
635 /* desc, NAME, name */ ECHO_DESC, ECHO_NAME, ECHO_name,
636 /* disablement strs */ NULL, NULL },
638 { /* entry idx, value */ 7, VALUE_OPT_UDP,
639 /* equiv idx, value */ 7, VALUE_OPT_UDP,
640 /* equivalenced to */ NO_EQUIVALENT,
641 /* min, max, act ct */ 0, 1, 0,
642 /* opt state flags */ UDP_FLAGS, 0,
643 /* last opt argumnt */ { NULL }, /* --udp */
644 /* arg list/cookie */ NULL,
645 /* must/cannot opts */ NULL, NULL,
646 /* option proc */ NULL,
647 /* desc, NAME, name */ UDP_DESC, UDP_NAME, UDP_name,
648 /* disablement strs */ NULL, NULL },
650 { /* entry idx, value */ 8, VALUE_OPT_MTU,
651 /* equiv idx, value */ 8, VALUE_OPT_MTU,
652 /* equivalenced to */ NO_EQUIVALENT,
653 /* min, max, act ct */ 0, 1, 0,
654 /* opt state flags */ MTU_FLAGS, 0,
655 /* last opt argumnt */ { NULL }, /* --mtu */
656 /* arg list/cookie */ NULL,
657 /* must/cannot opts */ NULL, NULL,
658 /* option proc */ doOptMtu,
659 /* desc, NAME, name */ MTU_DESC, MTU_NAME, MTU_name,
660 /* disablement strs */ NULL, NULL },
662 { /* entry idx, value */ 9, VALUE_OPT_SRTP_PROFILES,
663 /* equiv idx, value */ 9, VALUE_OPT_SRTP_PROFILES,
664 /* equivalenced to */ NO_EQUIVALENT,
665 /* min, max, act ct */ 0, 1, 0,
666 /* opt state flags */ SRTP_PROFILES_FLAGS, 0,
667 /* last opt argumnt */ { NULL }, /* --srtp_profiles */
668 /* arg list/cookie */ NULL,
669 /* must/cannot opts */ NULL, NULL,
670 /* option proc */ NULL,
671 /* desc, NAME, name */ SRTP_PROFILES_DESC, SRTP_PROFILES_NAME, SRTP_PROFILES_name,
672 /* disablement strs */ NULL, NULL },
674 { /* entry idx, value */ 10, VALUE_OPT_DISABLE_CLIENT_CERT,
675 /* equiv idx, value */ 10, VALUE_OPT_DISABLE_CLIENT_CERT,
676 /* equivalenced to */ NO_EQUIVALENT,
677 /* min, max, act ct */ 0, 1, 0,
678 /* opt state flags */ DISABLE_CLIENT_CERT_FLAGS, 0,
679 /* last opt argumnt */ { NULL }, /* --disable-client-cert */
680 /* arg list/cookie */ NULL,
681 /* must/cannot opts */ NULL, NULL,
682 /* option proc */ NULL,
683 /* desc, NAME, name */ DISABLE_CLIENT_CERT_DESC, DISABLE_CLIENT_CERT_NAME, DISABLE_CLIENT_CERT_name,
684 /* disablement strs */ NULL, NULL },
686 { /* entry idx, value */ 11, VALUE_OPT_REQUIRE_CLIENT_CERT,
687 /* equiv idx, value */ 11, VALUE_OPT_REQUIRE_CLIENT_CERT,
688 /* equivalenced to */ NO_EQUIVALENT,
689 /* min, max, act ct */ 0, 1, 0,
690 /* opt state flags */ REQUIRE_CLIENT_CERT_FLAGS, 0,
691 /* last opt argumnt */ { NULL }, /* --require-client-cert */
692 /* arg list/cookie */ NULL,
693 /* must/cannot opts */ NULL, NULL,
694 /* option proc */ NULL,
695 /* desc, NAME, name */ REQUIRE_CLIENT_CERT_DESC, REQUIRE_CLIENT_CERT_NAME, REQUIRE_CLIENT_CERT_name,
696 /* disablement strs */ NULL, NULL },
698 { /* entry idx, value */ 12, VALUE_OPT_HEARTBEAT,
699 /* equiv idx, value */ 12, VALUE_OPT_HEARTBEAT,
700 /* equivalenced to */ NO_EQUIVALENT,
701 /* min, max, act ct */ 0, 1, 0,
702 /* opt state flags */ HEARTBEAT_FLAGS, 0,
703 /* last opt argumnt */ { NULL }, /* --heartbeat */
704 /* arg list/cookie */ NULL,
705 /* must/cannot opts */ NULL, NULL,
706 /* option proc */ NULL,
707 /* desc, NAME, name */ HEARTBEAT_DESC, HEARTBEAT_NAME, HEARTBEAT_name,
708 /* disablement strs */ NULL, NULL },
710 { /* entry idx, value */ 13, VALUE_OPT_X509FMTDER,
711 /* equiv idx, value */ 13, VALUE_OPT_X509FMTDER,
712 /* equivalenced to */ NO_EQUIVALENT,
713 /* min, max, act ct */ 0, 1, 0,
714 /* opt state flags */ X509FMTDER_FLAGS, 0,
715 /* last opt argumnt */ { NULL }, /* --x509fmtder */
716 /* arg list/cookie */ NULL,
717 /* must/cannot opts */ NULL, NULL,
718 /* option proc */ NULL,
719 /* desc, NAME, name */ X509FMTDER_DESC, X509FMTDER_NAME, X509FMTDER_name,
720 /* disablement strs */ NULL, NULL },
722 { /* entry idx, value */ 14, VALUE_OPT_PRIORITY,
723 /* equiv idx, value */ 14, VALUE_OPT_PRIORITY,
724 /* equivalenced to */ NO_EQUIVALENT,
725 /* min, max, act ct */ 0, 1, 0,
726 /* opt state flags */ PRIORITY_FLAGS, 0,
727 /* last opt argumnt */ { NULL }, /* --priority */
728 /* arg list/cookie */ NULL,
729 /* must/cannot opts */ NULL, NULL,
730 /* option proc */ NULL,
731 /* desc, NAME, name */ PRIORITY_DESC, PRIORITY_NAME, PRIORITY_name,
732 /* disablement strs */ NULL, NULL },
734 { /* entry idx, value */ 15, VALUE_OPT_DHPARAMS,
735 /* equiv idx, value */ 15, VALUE_OPT_DHPARAMS,
736 /* equivalenced to */ NO_EQUIVALENT,
737 /* min, max, act ct */ 0, 1, 0,
738 /* opt state flags */ DHPARAMS_FLAGS, 0,
739 /* last opt argumnt */ { NULL }, /* --dhparams */
740 /* arg list/cookie */ NULL,
741 /* must/cannot opts */ NULL, NULL,
742 /* option proc */ doOptDhparams,
743 /* desc, NAME, name */ DHPARAMS_DESC, DHPARAMS_NAME, DHPARAMS_name,
744 /* disablement strs */ NULL, NULL },
746 { /* entry idx, value */ 16, VALUE_OPT_X509CAFILE,
747 /* equiv idx, value */ 16, VALUE_OPT_X509CAFILE,
748 /* equivalenced to */ NO_EQUIVALENT,
749 /* min, max, act ct */ 0, 1, 0,
750 /* opt state flags */ X509CAFILE_FLAGS, 0,
751 /* last opt argumnt */ { NULL }, /* --x509cafile */
752 /* arg list/cookie */ NULL,
753 /* must/cannot opts */ NULL, NULL,
754 /* option proc */ NULL,
755 /* desc, NAME, name */ X509CAFILE_DESC, X509CAFILE_NAME, X509CAFILE_name,
756 /* disablement strs */ NULL, NULL },
758 { /* entry idx, value */ 17, VALUE_OPT_X509CRLFILE,
759 /* equiv idx, value */ 17, VALUE_OPT_X509CRLFILE,
760 /* equivalenced to */ NO_EQUIVALENT,
761 /* min, max, act ct */ 0, 1, 0,
762 /* opt state flags */ X509CRLFILE_FLAGS, 0,
763 /* last opt argumnt */ { NULL }, /* --x509crlfile */
764 /* arg list/cookie */ NULL,
765 /* must/cannot opts */ NULL, NULL,
766 /* option proc */ doOptX509crlfile,
767 /* desc, NAME, name */ X509CRLFILE_DESC, X509CRLFILE_NAME, X509CRLFILE_name,
768 /* disablement strs */ NULL, NULL },
770 { /* entry idx, value */ 18, VALUE_OPT_PGPKEYFILE,
771 /* equiv idx, value */ 18, VALUE_OPT_PGPKEYFILE,
772 /* equivalenced to */ NO_EQUIVALENT,
773 /* min, max, act ct */ 0, 1, 0,
774 /* opt state flags */ PGPKEYFILE_FLAGS, 0,
775 /* last opt argumnt */ { NULL }, /* --pgpkeyfile */
776 /* arg list/cookie */ NULL,
777 /* must/cannot opts */ NULL, NULL,
778 /* option proc */ doOptPgpkeyfile,
779 /* desc, NAME, name */ PGPKEYFILE_DESC, PGPKEYFILE_NAME, PGPKEYFILE_name,
780 /* disablement strs */ NULL, NULL },
782 { /* entry idx, value */ 19, VALUE_OPT_PGPKEYRING,
783 /* equiv idx, value */ 19, VALUE_OPT_PGPKEYRING,
784 /* equivalenced to */ NO_EQUIVALENT,
785 /* min, max, act ct */ 0, 1, 0,
786 /* opt state flags */ PGPKEYRING_FLAGS, 0,
787 /* last opt argumnt */ { NULL }, /* --pgpkeyring */
788 /* arg list/cookie */ NULL,
789 /* must/cannot opts */ NULL, NULL,
790 /* option proc */ doOptPgpkeyring,
791 /* desc, NAME, name */ PGPKEYRING_DESC, PGPKEYRING_NAME, PGPKEYRING_name,
792 /* disablement strs */ NULL, NULL },
794 { /* entry idx, value */ 20, VALUE_OPT_PGPCERTFILE,
795 /* equiv idx, value */ 20, VALUE_OPT_PGPCERTFILE,
796 /* equivalenced to */ NO_EQUIVALENT,
797 /* min, max, act ct */ 0, 1, 0,
798 /* opt state flags */ PGPCERTFILE_FLAGS, 0,
799 /* last opt argumnt */ { NULL }, /* --pgpcertfile */
800 /* arg list/cookie */ NULL,
801 /* must/cannot opts */ NULL, NULL,
802 /* option proc */ doOptPgpcertfile,
803 /* desc, NAME, name */ PGPCERTFILE_DESC, PGPCERTFILE_NAME, PGPCERTFILE_name,
804 /* disablement strs */ NULL, NULL },
806 { /* entry idx, value */ 21, VALUE_OPT_X509KEYFILE,
807 /* equiv idx, value */ 21, VALUE_OPT_X509KEYFILE,
808 /* equivalenced to */ NO_EQUIVALENT,
809 /* min, max, act ct */ 0, 1, 0,
810 /* opt state flags */ X509KEYFILE_FLAGS, 0,
811 /* last opt argumnt */ { NULL }, /* --x509keyfile */
812 /* arg list/cookie */ NULL,
813 /* must/cannot opts */ NULL, NULL,
814 /* option proc */ NULL,
815 /* desc, NAME, name */ X509KEYFILE_DESC, X509KEYFILE_NAME, X509KEYFILE_name,
816 /* disablement strs */ NULL, NULL },
818 { /* entry idx, value */ 22, VALUE_OPT_X509CERTFILE,
819 /* equiv idx, value */ 22, VALUE_OPT_X509CERTFILE,
820 /* equivalenced to */ NO_EQUIVALENT,
821 /* min, max, act ct */ 0, 1, 0,
822 /* opt state flags */ X509CERTFILE_FLAGS, 0,
823 /* last opt argumnt */ { NULL }, /* --x509certfile */
824 /* arg list/cookie */ NULL,
825 /* must/cannot opts */ NULL, NULL,
826 /* option proc */ NULL,
827 /* desc, NAME, name */ X509CERTFILE_DESC, X509CERTFILE_NAME, X509CERTFILE_name,
828 /* disablement strs */ NULL, NULL },
830 { /* entry idx, value */ 23, VALUE_OPT_X509DSAKEYFILE,
831 /* equiv idx, value */ 23, VALUE_OPT_X509DSAKEYFILE,
832 /* equivalenced to */ NO_EQUIVALENT,
833 /* min, max, act ct */ 0, 1, 0,
834 /* opt state flags */ X509DSAKEYFILE_FLAGS, 0,
835 /* last opt argumnt */ { NULL }, /* --x509dsakeyfile */
836 /* arg list/cookie */ NULL,
837 /* must/cannot opts */ NULL, NULL,
838 /* option proc */ NULL,
839 /* desc, NAME, name */ X509DSAKEYFILE_DESC, X509DSAKEYFILE_NAME, X509DSAKEYFILE_name,
840 /* disablement strs */ NULL, NULL },
842 { /* entry idx, value */ 24, VALUE_OPT_X509DSACERTFILE,
843 /* equiv idx, value */ 24, VALUE_OPT_X509DSACERTFILE,
844 /* equivalenced to */ NO_EQUIVALENT,
845 /* min, max, act ct */ 0, 1, 0,
846 /* opt state flags */ X509DSACERTFILE_FLAGS, 0,
847 /* last opt argumnt */ { NULL }, /* --x509dsacertfile */
848 /* arg list/cookie */ NULL,
849 /* must/cannot opts */ NULL, NULL,
850 /* option proc */ NULL,
851 /* desc, NAME, name */ X509DSACERTFILE_DESC, X509DSACERTFILE_NAME, X509DSACERTFILE_name,
852 /* disablement strs */ NULL, NULL },
854 { /* entry idx, value */ 25, VALUE_OPT_X509ECCKEYFILE,
855 /* equiv idx, value */ 25, VALUE_OPT_X509ECCKEYFILE,
856 /* equivalenced to */ NO_EQUIVALENT,
857 /* min, max, act ct */ 0, 1, 0,
858 /* opt state flags */ X509ECCKEYFILE_FLAGS, 0,
859 /* last opt argumnt */ { NULL }, /* --x509ecckeyfile */
860 /* arg list/cookie */ NULL,
861 /* must/cannot opts */ NULL, NULL,
862 /* option proc */ NULL,
863 /* desc, NAME, name */ X509ECCKEYFILE_DESC, X509ECCKEYFILE_NAME, X509ECCKEYFILE_name,
864 /* disablement strs */ NULL, NULL },
866 { /* entry idx, value */ 26, VALUE_OPT_X509ECCCERTFILE,
867 /* equiv idx, value */ 26, VALUE_OPT_X509ECCCERTFILE,
868 /* equivalenced to */ NO_EQUIVALENT,
869 /* min, max, act ct */ 0, 1, 0,
870 /* opt state flags */ X509ECCCERTFILE_FLAGS, 0,
871 /* last opt argumnt */ { NULL }, /* --x509ecccertfile */
872 /* arg list/cookie */ NULL,
873 /* must/cannot opts */ NULL, NULL,
874 /* option proc */ NULL,
875 /* desc, NAME, name */ X509ECCCERTFILE_DESC, X509ECCCERTFILE_NAME, X509ECCCERTFILE_name,
876 /* disablement strs */ NULL, NULL },
878 { /* entry idx, value */ 27, VALUE_OPT_PGPSUBKEY,
879 /* equiv idx, value */ 27, VALUE_OPT_PGPSUBKEY,
880 /* equivalenced to */ NO_EQUIVALENT,
881 /* min, max, act ct */ 0, 1, 0,
882 /* opt state flags */ PGPSUBKEY_FLAGS, 0,
883 /* last opt argumnt */ { NULL }, /* --pgpsubkey */
884 /* arg list/cookie */ NULL,
885 /* must/cannot opts */ NULL, NULL,
886 /* option proc */ NULL,
887 /* desc, NAME, name */ PGPSUBKEY_DESC, PGPSUBKEY_NAME, PGPSUBKEY_name,
888 /* disablement strs */ NULL, NULL },
890 { /* entry idx, value */ 28, VALUE_OPT_SRPPASSWD,
891 /* equiv idx, value */ 28, VALUE_OPT_SRPPASSWD,
892 /* equivalenced to */ NO_EQUIVALENT,
893 /* min, max, act ct */ 0, 1, 0,
894 /* opt state flags */ SRPPASSWD_FLAGS, 0,
895 /* last opt argumnt */ { NULL }, /* --srppasswd */
896 /* arg list/cookie */ NULL,
897 /* must/cannot opts */ NULL, NULL,
898 /* option proc */ doOptSrppasswd,
899 /* desc, NAME, name */ SRPPASSWD_DESC, SRPPASSWD_NAME, SRPPASSWD_name,
900 /* disablement strs */ NULL, NULL },
902 { /* entry idx, value */ 29, VALUE_OPT_SRPPASSWDCONF,
903 /* equiv idx, value */ 29, VALUE_OPT_SRPPASSWDCONF,
904 /* equivalenced to */ NO_EQUIVALENT,
905 /* min, max, act ct */ 0, 1, 0,
906 /* opt state flags */ SRPPASSWDCONF_FLAGS, 0,
907 /* last opt argumnt */ { NULL }, /* --srppasswdconf */
908 /* arg list/cookie */ NULL,
909 /* must/cannot opts */ NULL, NULL,
910 /* option proc */ doOptSrppasswdconf,
911 /* desc, NAME, name */ SRPPASSWDCONF_DESC, SRPPASSWDCONF_NAME, SRPPASSWDCONF_name,
912 /* disablement strs */ NULL, NULL },
914 { /* entry idx, value */ 30, VALUE_OPT_PSKPASSWD,
915 /* equiv idx, value */ 30, VALUE_OPT_PSKPASSWD,
916 /* equivalenced to */ NO_EQUIVALENT,
917 /* min, max, act ct */ 0, 1, 0,
918 /* opt state flags */ PSKPASSWD_FLAGS, 0,
919 /* last opt argumnt */ { NULL }, /* --pskpasswd */
920 /* arg list/cookie */ NULL,
921 /* must/cannot opts */ NULL, NULL,
922 /* option proc */ doOptPskpasswd,
923 /* desc, NAME, name */ PSKPASSWD_DESC, PSKPASSWD_NAME, PSKPASSWD_name,
924 /* disablement strs */ NULL, NULL },
926 { /* entry idx, value */ 31, VALUE_OPT_PSKHINT,
927 /* equiv idx, value */ 31, VALUE_OPT_PSKHINT,
928 /* equivalenced to */ NO_EQUIVALENT,
929 /* min, max, act ct */ 0, 1, 0,
930 /* opt state flags */ PSKHINT_FLAGS, 0,
931 /* last opt argumnt */ { NULL }, /* --pskhint */
932 /* arg list/cookie */ NULL,
933 /* must/cannot opts */ NULL, NULL,
934 /* option proc */ NULL,
935 /* desc, NAME, name */ PSKHINT_DESC, PSKHINT_NAME, PSKHINT_name,
936 /* disablement strs */ NULL, NULL },
938 { /* entry idx, value */ 32, VALUE_OPT_OCSP_RESPONSE,
939 /* equiv idx, value */ 32, VALUE_OPT_OCSP_RESPONSE,
940 /* equivalenced to */ NO_EQUIVALENT,
941 /* min, max, act ct */ 0, 1, 0,
942 /* opt state flags */ OCSP_RESPONSE_FLAGS, 0,
943 /* last opt argumnt */ { NULL }, /* --ocsp-response */
944 /* arg list/cookie */ NULL,
945 /* must/cannot opts */ NULL, NULL,
946 /* option proc */ doOptOcsp_Response,
947 /* desc, NAME, name */ OCSP_RESPONSE_DESC, OCSP_RESPONSE_NAME, OCSP_RESPONSE_name,
948 /* disablement strs */ NULL, NULL },
950 { /* entry idx, value */ 33, VALUE_OPT_PORT,
951 /* equiv idx, value */ 33, VALUE_OPT_PORT,
952 /* equivalenced to */ NO_EQUIVALENT,
953 /* min, max, act ct */ 0, 1, 0,
954 /* opt state flags */ PORT_FLAGS, 0,
955 /* last opt argumnt */ { NULL }, /* --port */
956 /* arg list/cookie */ NULL,
957 /* must/cannot opts */ NULL, NULL,
958 /* option proc */ optionNumericVal,
959 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
960 /* disablement strs */ NULL, NULL },
962 { /* entry idx, value */ 34, VALUE_OPT_LIST,
963 /* equiv idx, value */ 34, VALUE_OPT_LIST,
964 /* equivalenced to */ NO_EQUIVALENT,
965 /* min, max, act ct */ 0, 1, 0,
966 /* opt state flags */ LIST_FLAGS, 0,
967 /* last opt argumnt */ { NULL }, /* --list */
968 /* arg list/cookie */ NULL,
969 /* must/cannot opts */ NULL, NULL,
970 /* option proc */ NULL,
971 /* desc, NAME, name */ LIST_DESC, LIST_NAME, LIST_name,
972 /* disablement strs */ NULL, NULL },
974 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
975 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
976 /* equivalenced to */ NO_EQUIVALENT,
977 /* min, max, act ct */ 0, 1, 0,
978 /* opt state flags */ VER_FLAGS, 0,
979 /* last opt argumnt */ { NULL },
980 /* arg list/cookie */ NULL,
981 /* must/cannot opts */ NULL, NULL,
982 /* option proc */ VER_PROC,
983 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
984 /* disablement strs */ NULL, NULL },
988 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
989 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
990 /* equivalenced to */ NO_EQUIVALENT,
991 /* min, max, act ct */ 0, 1, 0,
992 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
993 /* last opt argumnt */ { NULL },
994 /* arg list/cookie */ NULL,
995 /* must/cannot opts */ NULL, NULL,
996 /* option proc */ doUsageOpt,
997 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
998 /* disablement strs */ NULL, NULL },
1000 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
1001 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
1002 /* equivalenced to */ NO_EQUIVALENT,
1003 /* min, max, act ct */ 0, 1, 0,
1004 /* opt state flags */ MORE_HELP_FLAGS, 0,
1005 /* last opt argumnt */ { NULL },
1006 /* arg list/cookie */ NULL,
1007 /* must/cannot opts */ NULL, NULL,
1008 /* option proc */ optionPagedUsage,
1009 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
1010 /* disablement strs */ NULL, NULL }
1014 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1016 * Define the gnutls-serv Option Environment
1018 #define zPROGNAME (gnutls_serv_opt_strs+2815)
1019 #define zUsageTitle (gnutls_serv_opt_strs+2827)
1020 #define zRcName NULL
1021 #define apzHomeList NULL
1022 #define zBugsAddr (gnutls_serv_opt_strs+2930)
1023 #define zExplain (gnutls_serv_opt_strs+2949)
1024 #define zDetail (gnutls_serv_opt_strs+2952)
1025 #define zFullVersion (gnutls_serv_opt_strs+3011)
1026 /* extracted from optcode.tlib near line 350 */
1028 #if defined(ENABLE_NLS)
1029 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
1030 static tOptionXlateProc translate_option_strings;
1031 #else
1032 # define OPTPROC_BASE OPTPROC_NONE
1033 # define translate_option_strings NULL
1034 #endif /* ENABLE_NLS */
1037 #define gnutls_serv_full_usage (NULL)
1039 #define gnutls_serv_short_usage (gnutls_serv_opt_strs+3033)
1041 #endif /* not defined __doxygen__ */
1044 * Create the static procedure(s) declared above.
1047 * The callout function that invokes the optionUsage function.
1049 * @param pOptions the AutoOpts option description structure
1050 * @param pOptDesc the descriptor for the "help" (usage) option.
1051 * @noreturn
1053 static void
1054 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
1056 optionUsage(&gnutls_servOptions, GNUTLS_SERV_EXIT_SUCCESS);
1057 /* NOTREACHED */
1058 (void)pOptDesc;
1059 (void)pOptions;
1062 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1064 * Code to handle the debug option.
1066 * @param pOptions the gnutls-serv options data structure
1067 * @param pOptDesc the option descriptor for this option.
1069 static void
1070 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
1072 static struct {long rmin, rmax;} const rng[1] = {
1073 { 0 , 9999 } };
1074 int ix;
1076 if (pOptions <= OPTPROC_EMIT_LIMIT)
1077 goto emit_ranges;
1078 optionNumericVal(pOptions, pOptDesc);
1080 for (ix = 0; ix < 1; ix++) {
1081 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1082 continue; /* ranges need not be ordered. */
1083 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1084 return;
1085 if (rng[ix].rmax == LONG_MIN)
1086 continue;
1087 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1088 return;
1091 option_usage_fp = stderr;
1093 emit_ranges:
1095 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1098 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1100 * Code to handle the mtu option.
1102 * @param pOptions the gnutls-serv options data structure
1103 * @param pOptDesc the option descriptor for this option.
1105 static void
1106 doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
1108 static struct {long rmin, rmax;} const rng[1] = {
1109 { 0, 17000 } };
1110 int ix;
1112 if (pOptions <= OPTPROC_EMIT_LIMIT)
1113 goto emit_ranges;
1114 optionNumericVal(pOptions, pOptDesc);
1116 for (ix = 0; ix < 1; ix++) {
1117 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1118 continue; /* ranges need not be ordered. */
1119 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1120 return;
1121 if (rng[ix].rmax == LONG_MIN)
1122 continue;
1123 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1124 return;
1127 option_usage_fp = stderr;
1129 emit_ranges:
1131 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1134 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1136 * Code to handle the dhparams option.
1138 * @param pOptions the gnutls-serv options data structure
1139 * @param pOptDesc the option descriptor for this option.
1141 static void
1142 doOptDhparams(tOptions* pOptions, tOptDesc* pOptDesc)
1144 static teOptFileType const type =
1145 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1146 static tuFileMode mode;
1147 #ifndef O_CLOEXEC
1148 # define O_CLOEXEC 0
1149 #endif
1150 mode.file_flags = O_CLOEXEC;
1152 optionFileCheck(pOptions, pOptDesc, type, mode);
1155 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1157 * Code to handle the x509crlfile option.
1159 * @param pOptions the gnutls-serv options data structure
1160 * @param pOptDesc the option descriptor for this option.
1162 static void
1163 doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc)
1165 static teOptFileType const type =
1166 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1167 static tuFileMode mode;
1168 #ifndef O_CLOEXEC
1169 # define O_CLOEXEC 0
1170 #endif
1171 mode.file_flags = O_CLOEXEC;
1173 optionFileCheck(pOptions, pOptDesc, type, mode);
1176 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1178 * Code to handle the pgpkeyfile option.
1180 * @param pOptions the gnutls-serv options data structure
1181 * @param pOptDesc the option descriptor for this option.
1183 static void
1184 doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc)
1186 static teOptFileType const type =
1187 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1188 static tuFileMode mode;
1189 #ifndef O_CLOEXEC
1190 # define O_CLOEXEC 0
1191 #endif
1192 mode.file_flags = O_CLOEXEC;
1194 optionFileCheck(pOptions, pOptDesc, type, mode);
1197 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1199 * Code to handle the pgpkeyring option.
1201 * @param pOptions the gnutls-serv options data structure
1202 * @param pOptDesc the option descriptor for this option.
1204 static void
1205 doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc)
1207 static teOptFileType const type =
1208 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1209 static tuFileMode mode;
1210 #ifndef O_CLOEXEC
1211 # define O_CLOEXEC 0
1212 #endif
1213 mode.file_flags = O_CLOEXEC;
1215 optionFileCheck(pOptions, pOptDesc, type, mode);
1218 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1220 * Code to handle the pgpcertfile option.
1222 * @param pOptions the gnutls-serv options data structure
1223 * @param pOptDesc the option descriptor for this option.
1225 static void
1226 doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc)
1228 static teOptFileType const type =
1229 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1230 static tuFileMode mode;
1231 #ifndef O_CLOEXEC
1232 # define O_CLOEXEC 0
1233 #endif
1234 mode.file_flags = O_CLOEXEC;
1236 optionFileCheck(pOptions, pOptDesc, type, mode);
1239 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1241 * Code to handle the srppasswd option.
1243 * @param pOptions the gnutls-serv options data structure
1244 * @param pOptDesc the option descriptor for this option.
1246 static void
1247 doOptSrppasswd(tOptions* pOptions, tOptDesc* pOptDesc)
1249 static teOptFileType const type =
1250 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1251 static tuFileMode mode;
1252 #ifndef O_CLOEXEC
1253 # define O_CLOEXEC 0
1254 #endif
1255 mode.file_flags = O_CLOEXEC;
1257 optionFileCheck(pOptions, pOptDesc, type, mode);
1260 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1262 * Code to handle the srppasswdconf option.
1264 * @param pOptions the gnutls-serv options data structure
1265 * @param pOptDesc the option descriptor for this option.
1267 static void
1268 doOptSrppasswdconf(tOptions* pOptions, tOptDesc* pOptDesc)
1270 static teOptFileType const type =
1271 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1272 static tuFileMode mode;
1273 #ifndef O_CLOEXEC
1274 # define O_CLOEXEC 0
1275 #endif
1276 mode.file_flags = O_CLOEXEC;
1278 optionFileCheck(pOptions, pOptDesc, type, mode);
1281 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1283 * Code to handle the pskpasswd option.
1285 * @param pOptions the gnutls-serv options data structure
1286 * @param pOptDesc the option descriptor for this option.
1288 static void
1289 doOptPskpasswd(tOptions* pOptions, tOptDesc* pOptDesc)
1291 static teOptFileType const type =
1292 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1293 static tuFileMode mode;
1294 #ifndef O_CLOEXEC
1295 # define O_CLOEXEC 0
1296 #endif
1297 mode.file_flags = O_CLOEXEC;
1299 optionFileCheck(pOptions, pOptDesc, type, mode);
1302 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1304 * Code to handle the ocsp-response option.
1306 * @param pOptions the gnutls-serv options data structure
1307 * @param pOptDesc the option descriptor for this option.
1309 static void
1310 doOptOcsp_Response(tOptions* pOptions, tOptDesc* pOptDesc)
1312 static teOptFileType const type =
1313 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1314 static tuFileMode mode;
1315 #ifndef O_CLOEXEC
1316 # define O_CLOEXEC 0
1317 #endif
1318 mode.file_flags = O_CLOEXEC;
1320 optionFileCheck(pOptions, pOptDesc, type, mode);
1322 /* extracted from optmain.tlib near line 1113 */
1325 * The directory containing the data associated with gnutls-serv.
1327 #ifndef PKGDATADIR
1328 # define PKGDATADIR ""
1329 #endif
1332 * Information about the person or institution that packaged gnutls-serv
1333 * for the current distribution.
1335 #ifndef WITH_PACKAGER
1336 # define gnutls_serv_packager_info NULL
1337 #else
1338 static char const gnutls_serv_packager_info[] =
1339 "Packaged by " WITH_PACKAGER
1341 # ifdef WITH_PACKAGER_VERSION
1342 " ("WITH_PACKAGER_VERSION")"
1343 # endif
1345 # ifdef WITH_PACKAGER_BUG_REPORTS
1346 "\nReport gnutls_serv bugs to " WITH_PACKAGER_BUG_REPORTS
1347 # endif
1348 "\n";
1349 #endif
1350 #ifndef __doxygen__
1352 #endif /* __doxygen__ */
1354 * The option definitions for gnutls-serv. The one structure that
1355 * binds them all.
1357 tOptions gnutls_servOptions = {
1358 OPTIONS_STRUCT_VERSION,
1359 0, NULL, /* original argc + argv */
1360 ( OPTPROC_BASE
1361 + OPTPROC_ERRSTOP
1362 + OPTPROC_SHORTOPT
1363 + OPTPROC_LONGOPT
1364 + OPTPROC_NO_REQ_OPT
1365 + OPTPROC_NO_ARGS
1366 + OPTPROC_GNUUSAGE
1367 + OPTPROC_MISUSE ),
1368 0, NULL, /* current option index, current option */
1369 NULL, NULL, zPROGNAME,
1370 zRcName, zCopyright, zLicenseDescrip,
1371 zFullVersion, apzHomeList, zUsageTitle,
1372 zExplain, zDetail, optDesc,
1373 zBugsAddr, /* address to send bugs to */
1374 NULL, NULL, /* extensions/saved state */
1375 optionUsage, /* usage procedure */
1376 translate_option_strings, /* translation procedure */
1378 * Indexes to special options
1380 { INDEX_OPT_MORE_HELP, /* more-help option index */
1381 NO_EQUIVALENT, /* save option index */
1382 NO_EQUIVALENT, /* '-#' option index */
1383 NO_EQUIVALENT /* index of default opt */
1385 38 /* full option count */, 35 /* user option count */,
1386 gnutls_serv_full_usage, gnutls_serv_short_usage,
1387 NULL, NULL,
1388 PKGDATADIR, gnutls_serv_packager_info
1391 #if ENABLE_NLS
1392 #include <stdio.h>
1393 #include <stdlib.h>
1394 #include <string.h>
1395 #include <unistd.h>
1396 #include <autoopts/usage-txt.h>
1398 static char* AO_gettext(char const* pz);
1399 static void coerce_it(void** s);
1402 * AutoGen specific wrapper function for gettext.
1403 * It relies on the macro _() to convert from English to the target
1404 * language, then strdup-duplicates the result string.
1406 * @param[in] pz the input text used as a lookup key.
1407 * @returns the translated text (if there is one),
1408 * or the original text (if not).
1410 static char *
1411 AO_gettext(char const* pz)
1413 char* pzRes;
1414 if (pz == NULL)
1415 return NULL;
1416 pzRes = _(pz);
1417 if (pzRes == pz)
1418 return pzRes;
1419 pzRes = strdup(pzRes);
1420 if (pzRes == NULL) {
1421 fputs(_("No memory for duping translated strings\n"), stderr);
1422 exit(GNUTLS_SERV_EXIT_FAILURE);
1424 return pzRes;
1427 static void coerce_it(void** s) { *s = AO_gettext(*s);
1431 * Translate all the translatable strings in the gnutls_servOptions
1432 * structure defined above. This is done only once.
1434 static void
1435 translate_option_strings(void)
1437 tOptions * const pOpt = &gnutls_servOptions;
1440 * Guard against re-translation. It won't work. The strings will have
1441 * been changed by the first pass through this code. One shot only.
1443 if (option_usage_text.field_ct != 0) {
1445 * Do the translations. The first pointer follows the field count
1446 * field. The field count field is the size of a pointer.
1448 tOptDesc * pOD = pOpt->pOptDesc;
1449 char ** ppz = (char**)(void*)&(option_usage_text);
1450 int ix = option_usage_text.field_ct;
1452 do {
1453 ppz++;
1454 *ppz = AO_gettext(*ppz);
1455 } while (--ix > 0);
1457 coerce_it((void*)&(pOpt->pzCopyright));
1458 coerce_it((void*)&(pOpt->pzCopyNotice));
1459 coerce_it((void*)&(pOpt->pzFullVersion));
1460 coerce_it((void*)&(pOpt->pzUsageTitle));
1461 coerce_it((void*)&(pOpt->pzExplain));
1462 coerce_it((void*)&(pOpt->pzDetail));
1463 coerce_it((void*)&(pOpt->pzPackager));
1464 coerce_it((void*)&(pOpt->pzShortUsage));
1465 option_usage_text.field_ct = 0;
1467 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1468 coerce_it((void*)&(pOD->pzText));
1471 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1472 tOptDesc * pOD = pOpt->pOptDesc;
1473 int ix;
1475 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1476 coerce_it((void*)&(pOD->pz_Name));
1477 coerce_it((void*)&(pOD->pz_DisableName));
1478 coerce_it((void*)&(pOD->pz_DisablePfx));
1480 /* prevent re-translation */
1481 gnutls_servOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1485 #endif /* ENABLE_NLS */
1487 #ifdef __cplusplus
1489 #endif
1490 /* serv-args.c ends here */