Verify callback is run in either side.
[gnutls.git] / src / cli-args.c
blob703b13cc030a666bd1d8041878a38ae2ee3f5bd7
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (cli-args.c)
4 *
5 * It has been AutoGen-ed September 28, 2012 at 01:15:40 PM by AutoGen 5.12
6 * From the definitions cli-args.def
7 * and the template file options
9 * Generated from AutoOpts 35:0:10 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-cli 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 * This source file is copyrighted and licensed under the following terms:
21 * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
22 * This is free software. It is licensed for use, modification and
23 * redistribution under the terms of the
24 * GNU General Public License, version 3 or later
25 * <http://gnu.org/licenses/gpl.html>
27 PFX>gnutls-cli is free software: you can redistribute it and/or modify it
28 * under the terms of the GNU General Public License as published by the
29 * Free Software Foundation, either version 3 of the License, or
30 * (at your option) any later version.
32 * gnutls-cli is distributed in the hope that it will be useful, but
33 * WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35 * See the GNU General Public License for more details.
37 * You should have received a copy of the GNU General Public License along
38 * with this program. If not, see <http://www.gnu.org/licenses/>.
41 #include <sys/types.h>
43 #include <limits.h>
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <errno.h>
47 #define OPTION_CODE_COMPILE 1
48 #include "cli-args.h"
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 extern FILE * option_usage_fp;
55 /* TRANSLATORS: choose the translation for option names wisely because you
56 cannot ever change your mind. */
57 static char const zCopyright[281] =
58 "gnutls-cli @VERSION@\n\
59 Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n\
60 This is free software. It is licensed for use, modification and\n\
61 redistribution under the terms of the\n\
62 GNU General Public License, version 3 or later\n\
63 <http://gnu.org/licenses/gpl.html>\n";
64 static char const zLicenseDescrip[609] =
65 "gnutls-cli is free software: you can redistribute it and/or modify it\n\
66 under the terms of the GNU General Public License as published by the\n\
67 Free Software Foundation, either version 3 of the License, or (at your\n\
68 option) any later version.\n\n\
69 gnutls-cli is distributed in the hope that it will be useful, but WITHOUT\n\
70 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\
71 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n\
72 for more details.\n\n\
73 You should have received a copy of the GNU General Public License along\n\
74 with this program. If not, see <http://www.gnu.org/licenses/>.\n";
76 extern tUsageProc optionUsage;
78 #ifndef NULL
79 # define NULL 0
80 #endif
83 * Debug option description:
85 static char const zDebugText[] =
86 "Enable debugging.";
87 static char const zDebug_NAME[] = "DEBUG";
88 static char const zDebug_Name[] = "debug";
89 #define DEBUG_FLAGS (OPTST_DISABLED \
90 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
93 * Verbose option description:
95 static char const zVerboseText[] =
96 "More verbose output";
97 static char const zVerbose_NAME[] = "VERBOSE";
98 static char const zVerbose_Name[] = "verbose";
99 #define VERBOSE_FLAGS (OPTST_DISABLED)
102 * Tofu option description:
104 static char const zTofuText[] =
105 "Enable trust on first use authentication";
106 static char const zTofu_NAME[] = "TOFU";
107 static char const zNotTofu_Name[] = "no-tofu";
108 static char const zNotTofu_Pfx[] = "no";
109 #define zTofu_Name (zNotTofu_Name + 3)
110 #define TOFU_FLAGS (OPTST_DISABLED)
113 * Ocsp option description:
115 static char const zOcspText[] =
116 "Enable OCSP certificate verification";
117 static char const zOcsp_NAME[] = "OCSP";
118 static char const zNotOcsp_Name[] = "no-ocsp";
119 static char const zNotOcsp_Pfx[] = "no";
120 #define zOcsp_Name (zNotOcsp_Name + 3)
121 #define OCSP_FLAGS (OPTST_DISABLED)
124 * Resume option description:
126 static char const zResumeText[] =
127 "Establish a session and resume";
128 static char const zResume_NAME[] = "RESUME";
129 static char const zResume_Name[] = "resume";
130 #define RESUME_FLAGS (OPTST_DISABLED)
133 * Heartbeat option description:
135 static char const zHeartbeatText[] =
136 "Activate heartbeat support";
137 static char const zHeartbeat_NAME[] = "HEARTBEAT";
138 static char const zHeartbeat_Name[] = "heartbeat";
139 #define HEARTBEAT_FLAGS (OPTST_DISABLED)
142 * Rehandshake option description:
144 static char const zRehandshakeText[] =
145 "Establish a session and rehandshake";
146 static char const zRehandshake_NAME[] = "REHANDSHAKE";
147 static char const zRehandshake_Name[] = "rehandshake";
148 #define REHANDSHAKE_FLAGS (OPTST_DISABLED)
151 * Noticket option description:
153 static char const zNoticketText[] =
154 "Don't accept session tickets";
155 static char const zNoticket_NAME[] = "NOTICKET";
156 static char const zNoticket_Name[] = "noticket";
157 #define NOTICKET_FLAGS (OPTST_DISABLED)
160 * Status_Request_Ocsp option description:
162 static char const zStatus_Request_OcspText[] =
163 "Request OCSP status request";
164 static char const zStatus_Request_Ocsp_NAME[] = "STATUS_REQUEST_OCSP";
165 static char const zStatus_Request_Ocsp_Name[]= "status-request-ocsp";
166 #define STATUS_REQUEST_OCSP_FLAGS (OPTST_DISABLED)
169 * Starttls option description:
171 static char const zStarttlsText[] =
172 "Connect, establish a plain session and start TLS.";
173 static char const zStarttls_NAME[] = "STARTTLS";
174 static char const zStarttls_Name[] = "starttls";
175 #define STARTTLS_FLAGS (OPTST_DISABLED)
178 * Udp option description:
180 static char const zUdpText[] =
181 "Use DTLS (datagram TLS) over UDP";
182 static char const zUdp_NAME[] = "UDP";
183 static char const zUdp_Name[] = "udp";
184 #define UDP_FLAGS (OPTST_DISABLED)
187 * Mtu option description:
189 static char const zMtuText[] =
190 "Set MTU for datagram TLS";
191 static char const zMtu_NAME[] = "MTU";
192 static char const zMtu_Name[] = "mtu";
193 #define MTU_FLAGS (OPTST_DISABLED \
194 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
197 * Crlf option description:
199 static char const zCrlfText[] =
200 "Send CR LF instead of LF";
201 static char const zCrlf_NAME[] = "CRLF";
202 static char const zCrlf_Name[] = "crlf";
203 #define CRLF_FLAGS (OPTST_DISABLED)
206 * X509fmtder option description:
208 static char const zX509fmtderText[] =
209 "Use DER format for certificates to read from";
210 static char const zX509fmtder_NAME[] = "X509FMTDER";
211 static char const zX509fmtder_Name[] = "x509fmtder";
212 #define X509FMTDER_FLAGS (OPTST_DISABLED)
215 * Fingerprint option description:
217 static char const zFingerprintText[] =
218 "Send the openpgp fingerprint, instead of the key";
219 static char const zFingerprint_NAME[] = "FINGERPRINT";
220 static char const zFingerprint_Name[] = "fingerprint";
221 #define FINGERPRINT_FLAGS (OPTST_DISABLED)
224 * Disable_Extensions option description:
226 static char const zDisable_ExtensionsText[] =
227 "Disable all the TLS extensions";
228 static char const zDisable_Extensions_NAME[] = "DISABLE_EXTENSIONS";
229 static char const zDisable_Extensions_Name[] = "disable-extensions";
230 #define DISABLE_EXTENSIONS_FLAGS (OPTST_DISABLED)
233 * Print_Cert option description:
235 static char const zPrint_CertText[] =
236 "Print peer's certificate in PEM format";
237 static char const zPrint_Cert_NAME[] = "PRINT_CERT";
238 static char const zPrint_Cert_Name[] = "print-cert";
239 #define PRINT_CERT_FLAGS (OPTST_DISABLED)
242 * Recordsize option description:
244 static char const zRecordsizeText[] =
245 "The maximum record size to advertize";
246 static char const zRecordsize_NAME[] = "RECORDSIZE";
247 static char const zRecordsize_Name[] = "recordsize";
248 #define RECORDSIZE_FLAGS (OPTST_DISABLED \
249 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
252 * Dh_Bits option description:
254 static char const zDh_BitsText[] =
255 "The minimum number of bits allowed for DH";
256 static char const zDh_Bits_NAME[] = "DH_BITS";
257 static char const zDh_Bits_Name[] = "dh-bits";
258 #define DH_BITS_FLAGS (OPTST_DISABLED \
259 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
262 * Priority option description:
264 static char const zPriorityText[] =
265 "Priorities string";
266 static char const zPriority_NAME[] = "PRIORITY";
267 static char const zPriority_Name[] = "priority";
268 #define PRIORITY_FLAGS (OPTST_DISABLED \
269 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
272 * X509cafile option description:
274 static char const zX509cafileText[] =
275 "Certificate file or PKCS #11 URL to use";
276 static char const zX509cafile_NAME[] = "X509CAFILE";
277 static char const zX509cafile_Name[] = "x509cafile";
278 #define X509CAFILE_FLAGS (OPTST_DISABLED \
279 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
282 * X509crlfile option description:
284 static char const zX509crlfileText[] =
285 "CRL file to use";
286 static char const zX509crlfile_NAME[] = "X509CRLFILE";
287 static char const zX509crlfile_Name[] = "x509crlfile";
288 #define X509CRLFILE_FLAGS (OPTST_DISABLED \
289 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
292 * Pgpkeyfile option description:
294 static char const zPgpkeyfileText[] =
295 "PGP Key file to use";
296 static char const zPgpkeyfile_NAME[] = "PGPKEYFILE";
297 static char const zPgpkeyfile_Name[] = "pgpkeyfile";
298 #define PGPKEYFILE_FLAGS (OPTST_DISABLED \
299 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
302 * Pgpkeyring option description:
304 static char const zPgpkeyringText[] =
305 "PGP Key ring file to use";
306 static char const zPgpkeyring_NAME[] = "PGPKEYRING";
307 static char const zPgpkeyring_Name[] = "pgpkeyring";
308 #define PGPKEYRING_FLAGS (OPTST_DISABLED \
309 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
312 * Pgpcertfile option description:
314 static char const zPgpcertfileText[] =
315 "PGP Public Key (certificate) file to use";
316 static char const zPgpcertfile_NAME[] = "PGPCERTFILE";
317 static char const zPgpcertfile_Name[] = "pgpcertfile";
318 #define PGPCERTFILE_FLAGS (OPTST_DISABLED \
319 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
322 * X509keyfile option description:
324 static char const zX509keyfileText[] =
325 "X.509 key file or PKCS #11 URL to use";
326 static char const zX509keyfile_NAME[] = "X509KEYFILE";
327 static char const zX509keyfile_Name[] = "x509keyfile";
328 #define X509KEYFILE_FLAGS (OPTST_DISABLED \
329 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
332 * X509certfile option description:
334 static char const zX509certfileText[] =
335 "X.509 Certificate file or PKCS #11 URL to use";
336 static char const zX509certfile_NAME[] = "X509CERTFILE";
337 static char const zX509certfile_Name[] = "x509certfile";
338 #define X509CERTFILE_FLAGS (OPTST_DISABLED \
339 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
342 * Pgpsubkey option description:
344 static char const zPgpsubkeyText[] =
345 "PGP subkey to use (hex or auto)";
346 static char const zPgpsubkey_NAME[] = "PGPSUBKEY";
347 static char const zPgpsubkey_Name[] = "pgpsubkey";
348 #define PGPSUBKEY_FLAGS (OPTST_DISABLED \
349 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
352 * Srpusername option description:
354 static char const zSrpusernameText[] =
355 "SRP username to use";
356 static char const zSrpusername_NAME[] = "SRPUSERNAME";
357 static char const zSrpusername_Name[] = "srpusername";
358 #define SRPUSERNAME_FLAGS (OPTST_DISABLED \
359 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
362 * Srppasswd option description:
364 static char const zSrppasswdText[] =
365 "SRP password to use";
366 static char const zSrppasswd_NAME[] = "SRPPASSWD";
367 static char const zSrppasswd_Name[] = "srppasswd";
368 #define SRPPASSWD_FLAGS (OPTST_DISABLED \
369 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
372 * Pskusername option description:
374 static char const zPskusernameText[] =
375 "PSK username to use";
376 static char const zPskusername_NAME[] = "PSKUSERNAME";
377 static char const zPskusername_Name[] = "pskusername";
378 #define PSKUSERNAME_FLAGS (OPTST_DISABLED \
379 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
382 * Pskkey option description:
384 static char const zPskkeyText[] =
385 "PSK key (in hex) to use";
386 static char const zPskkey_NAME[] = "PSKKEY";
387 static char const zPskkey_Name[] = "pskkey";
388 #define PSKKEY_FLAGS (OPTST_DISABLED \
389 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
392 * Port option description:
394 static char const zPortText[] =
395 "The port or service to connect to";
396 static char const zPort_NAME[] = "PORT";
397 static char const zPort_Name[] = "port";
398 #define PORT_FLAGS (OPTST_DISABLED \
399 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
402 * Insecure option description:
404 static char const zInsecureText[] =
405 "Don't abort program if server certificate can't be validated";
406 static char const zInsecure_NAME[] = "INSECURE";
407 static char const zInsecure_Name[] = "insecure";
408 #define INSECURE_FLAGS (OPTST_DISABLED)
411 * Benchmark_Ciphers option description:
413 static char const zBenchmark_CiphersText[] =
414 "Benchmark individual ciphers";
415 static char const zBenchmark_Ciphers_NAME[] = "BENCHMARK_CIPHERS";
416 static char const zBenchmark_Ciphers_Name[] = "benchmark-ciphers";
417 #define BENCHMARK_CIPHERS_FLAGS (OPTST_DISABLED)
420 * Benchmark_Soft_Ciphers option description:
422 static char const zBenchmark_Soft_CiphersText[] =
423 "Benchmark individual software ciphers (no hw acceleration)";
424 static char const zBenchmark_Soft_Ciphers_NAME[] = "BENCHMARK_SOFT_CIPHERS";
425 static char const zBenchmark_Soft_Ciphers_Name[]= "benchmark-soft-ciphers";
426 #define BENCHMARK_SOFT_CIPHERS_FLAGS (OPTST_DISABLED)
429 * Benchmark_Tls_Kx option description:
431 static char const zBenchmark_Tls_KxText[] =
432 "Benchmark TLS key exchange methods";
433 static char const zBenchmark_Tls_Kx_NAME[] = "BENCHMARK_TLS_KX";
434 static char const zBenchmark_Tls_Kx_Name[] = "benchmark-tls-kx";
435 #define BENCHMARK_TLS_KX_FLAGS (OPTST_DISABLED)
438 * Benchmark_Tls_Ciphers option description:
440 static char const zBenchmark_Tls_CiphersText[] =
441 "Benchmark TLS ciphers";
442 static char const zBenchmark_Tls_Ciphers_NAME[] = "BENCHMARK_TLS_CIPHERS";
443 static char const zBenchmark_Tls_Ciphers_Name[]= "benchmark-tls-ciphers";
444 #define BENCHMARK_TLS_CIPHERS_FLAGS (OPTST_DISABLED)
447 * List option description:
449 static char const zListText[] =
450 "Print a list of the supported algorithms and modes";
451 static char const zList_NAME[] = "LIST";
452 static char const zList_Name[] = "list";
453 #define LIST_FLAGS (OPTST_DISABLED)
456 * Help/More_Help/Version option descriptions:
458 static char const zHelpText[] = "Display extended usage information and exit";
459 static char const zHelp_Name[] = "help";
460 #ifdef HAVE_WORKING_FORK
461 #define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
462 static char const zMore_Help_Name[] = "more-help";
463 static char const zMore_HelpText[] = "Extended usage information passed thru pager";
464 #else
465 #define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
466 #define zMore_Help_Name NULL
467 #define zMore_HelpText NULL
468 #endif
469 #ifdef NO_OPTIONAL_OPT_ARGS
470 # define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT
471 #else
472 # define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
473 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
474 #endif
476 static char const zVersionText[] = "Output version information and exit";
477 static char const zVersion_Name[] = "version";
479 * Declare option callback procedures
481 extern tOptProc
482 optionBooleanVal, optionNestedVal, optionNumericVal,
483 optionPagedUsage, optionPrintVersion, optionResetOpt,
484 optionStackArg, optionTimeDate, optionTimeVal,
485 optionUnstackArg, optionVersionStderr;
486 static tOptProc
487 doOptDebug, doOptMtu, doOptPgpcertfile, doOptPgpkeyfile,
488 doOptPgpkeyring, doOptRecordsize, doOptX509crlfile, doUsageOpt;
490 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
492 * Define the Gnutls_Cli Option Descriptions.
494 static tOptDesc optDesc[OPTION_CT] = {
495 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
496 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
497 /* equivalenced to */ NO_EQUIVALENT,
498 /* min, max, act ct */ 0, 1, 0,
499 /* opt state flags */ DEBUG_FLAGS, 0,
500 /* last opt argumnt */ { NULL },
501 /* arg list/cookie */ NULL,
502 /* must/cannot opts */ NULL, NULL,
503 /* option proc */ doOptDebug,
504 /* desc, NAME, name */ zDebugText, zDebug_NAME, zDebug_Name,
505 /* disablement strs */ NULL, NULL },
507 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
508 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
509 /* equivalenced to */ NO_EQUIVALENT,
510 /* min, max, act ct */ 0, NOLIMIT, 0,
511 /* opt state flags */ VERBOSE_FLAGS, 0,
512 /* last opt argumnt */ { NULL },
513 /* arg list/cookie */ NULL,
514 /* must/cannot opts */ NULL, NULL,
515 /* option proc */ NULL,
516 /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name,
517 /* disablement strs */ NULL, NULL },
519 { /* entry idx, value */ 2, VALUE_OPT_TOFU,
520 /* equiv idx, value */ 2, VALUE_OPT_TOFU,
521 /* equivalenced to */ NO_EQUIVALENT,
522 /* min, max, act ct */ 0, 1, 0,
523 /* opt state flags */ TOFU_FLAGS, 0,
524 /* last opt argumnt */ { NULL },
525 /* arg list/cookie */ NULL,
526 /* must/cannot opts */ NULL, NULL,
527 /* option proc */ NULL,
528 /* desc, NAME, name */ zTofuText, zTofu_NAME, zTofu_Name,
529 /* disablement strs */ zNotTofu_Name, zNotTofu_Pfx },
531 { /* entry idx, value */ 3, VALUE_OPT_OCSP,
532 /* equiv idx, value */ 3, VALUE_OPT_OCSP,
533 /* equivalenced to */ NO_EQUIVALENT,
534 /* min, max, act ct */ 0, 1, 0,
535 /* opt state flags */ OCSP_FLAGS, 0,
536 /* last opt argumnt */ { NULL },
537 /* arg list/cookie */ NULL,
538 /* must/cannot opts */ NULL, NULL,
539 /* option proc */ NULL,
540 /* desc, NAME, name */ zOcspText, zOcsp_NAME, zOcsp_Name,
541 /* disablement strs */ zNotOcsp_Name, zNotOcsp_Pfx },
543 { /* entry idx, value */ 4, VALUE_OPT_RESUME,
544 /* equiv idx, value */ 4, VALUE_OPT_RESUME,
545 /* equivalenced to */ NO_EQUIVALENT,
546 /* min, max, act ct */ 0, 1, 0,
547 /* opt state flags */ RESUME_FLAGS, 0,
548 /* last opt argumnt */ { NULL },
549 /* arg list/cookie */ NULL,
550 /* must/cannot opts */ NULL, NULL,
551 /* option proc */ NULL,
552 /* desc, NAME, name */ zResumeText, zResume_NAME, zResume_Name,
553 /* disablement strs */ NULL, NULL },
555 { /* entry idx, value */ 5, VALUE_OPT_HEARTBEAT,
556 /* equiv idx, value */ 5, VALUE_OPT_HEARTBEAT,
557 /* equivalenced to */ NO_EQUIVALENT,
558 /* min, max, act ct */ 0, 1, 0,
559 /* opt state flags */ HEARTBEAT_FLAGS, 0,
560 /* last opt argumnt */ { NULL },
561 /* arg list/cookie */ NULL,
562 /* must/cannot opts */ NULL, NULL,
563 /* option proc */ NULL,
564 /* desc, NAME, name */ zHeartbeatText, zHeartbeat_NAME, zHeartbeat_Name,
565 /* disablement strs */ NULL, NULL },
567 { /* entry idx, value */ 6, VALUE_OPT_REHANDSHAKE,
568 /* equiv idx, value */ 6, VALUE_OPT_REHANDSHAKE,
569 /* equivalenced to */ NO_EQUIVALENT,
570 /* min, max, act ct */ 0, 1, 0,
571 /* opt state flags */ REHANDSHAKE_FLAGS, 0,
572 /* last opt argumnt */ { NULL },
573 /* arg list/cookie */ NULL,
574 /* must/cannot opts */ NULL, NULL,
575 /* option proc */ NULL,
576 /* desc, NAME, name */ zRehandshakeText, zRehandshake_NAME, zRehandshake_Name,
577 /* disablement strs */ NULL, NULL },
579 { /* entry idx, value */ 7, VALUE_OPT_NOTICKET,
580 /* equiv idx, value */ 7, VALUE_OPT_NOTICKET,
581 /* equivalenced to */ NO_EQUIVALENT,
582 /* min, max, act ct */ 0, 1, 0,
583 /* opt state flags */ NOTICKET_FLAGS, 0,
584 /* last opt argumnt */ { NULL },
585 /* arg list/cookie */ NULL,
586 /* must/cannot opts */ NULL, NULL,
587 /* option proc */ NULL,
588 /* desc, NAME, name */ zNoticketText, zNoticket_NAME, zNoticket_Name,
589 /* disablement strs */ NULL, NULL },
591 { /* entry idx, value */ 8, VALUE_OPT_STATUS_REQUEST_OCSP,
592 /* equiv idx, value */ 8, VALUE_OPT_STATUS_REQUEST_OCSP,
593 /* equivalenced to */ NO_EQUIVALENT,
594 /* min, max, act ct */ 0, 1, 0,
595 /* opt state flags */ STATUS_REQUEST_OCSP_FLAGS, 0,
596 /* last opt argumnt */ { NULL },
597 /* arg list/cookie */ NULL,
598 /* must/cannot opts */ NULL, NULL,
599 /* option proc */ NULL,
600 /* desc, NAME, name */ zStatus_Request_OcspText, zStatus_Request_Ocsp_NAME, zStatus_Request_Ocsp_Name,
601 /* disablement strs */ NULL, NULL },
603 { /* entry idx, value */ 9, VALUE_OPT_STARTTLS,
604 /* equiv idx, value */ 9, VALUE_OPT_STARTTLS,
605 /* equivalenced to */ NO_EQUIVALENT,
606 /* min, max, act ct */ 0, 1, 0,
607 /* opt state flags */ STARTTLS_FLAGS, 0,
608 /* last opt argumnt */ { NULL },
609 /* arg list/cookie */ NULL,
610 /* must/cannot opts */ NULL, NULL,
611 /* option proc */ NULL,
612 /* desc, NAME, name */ zStarttlsText, zStarttls_NAME, zStarttls_Name,
613 /* disablement strs */ NULL, NULL },
615 { /* entry idx, value */ 10, VALUE_OPT_UDP,
616 /* equiv idx, value */ 10, VALUE_OPT_UDP,
617 /* equivalenced to */ NO_EQUIVALENT,
618 /* min, max, act ct */ 0, 1, 0,
619 /* opt state flags */ UDP_FLAGS, 0,
620 /* last opt argumnt */ { NULL },
621 /* arg list/cookie */ NULL,
622 /* must/cannot opts */ NULL, NULL,
623 /* option proc */ NULL,
624 /* desc, NAME, name */ zUdpText, zUdp_NAME, zUdp_Name,
625 /* disablement strs */ NULL, NULL },
627 { /* entry idx, value */ 11, VALUE_OPT_MTU,
628 /* equiv idx, value */ 11, VALUE_OPT_MTU,
629 /* equivalenced to */ NO_EQUIVALENT,
630 /* min, max, act ct */ 0, 1, 0,
631 /* opt state flags */ MTU_FLAGS, 0,
632 /* last opt argumnt */ { NULL },
633 /* arg list/cookie */ NULL,
634 /* must/cannot opts */ NULL, NULL,
635 /* option proc */ doOptMtu,
636 /* desc, NAME, name */ zMtuText, zMtu_NAME, zMtu_Name,
637 /* disablement strs */ NULL, NULL },
639 { /* entry idx, value */ 12, VALUE_OPT_CRLF,
640 /* equiv idx, value */ 12, VALUE_OPT_CRLF,
641 /* equivalenced to */ NO_EQUIVALENT,
642 /* min, max, act ct */ 0, 1, 0,
643 /* opt state flags */ CRLF_FLAGS, 0,
644 /* last opt argumnt */ { NULL },
645 /* arg list/cookie */ NULL,
646 /* must/cannot opts */ NULL, NULL,
647 /* option proc */ NULL,
648 /* desc, NAME, name */ zCrlfText, zCrlf_NAME, zCrlf_Name,
649 /* disablement strs */ NULL, NULL },
651 { /* entry idx, value */ 13, VALUE_OPT_X509FMTDER,
652 /* equiv idx, value */ 13, VALUE_OPT_X509FMTDER,
653 /* equivalenced to */ NO_EQUIVALENT,
654 /* min, max, act ct */ 0, 1, 0,
655 /* opt state flags */ X509FMTDER_FLAGS, 0,
656 /* last opt argumnt */ { NULL },
657 /* arg list/cookie */ NULL,
658 /* must/cannot opts */ NULL, NULL,
659 /* option proc */ NULL,
660 /* desc, NAME, name */ zX509fmtderText, zX509fmtder_NAME, zX509fmtder_Name,
661 /* disablement strs */ NULL, NULL },
663 { /* entry idx, value */ 14, VALUE_OPT_FINGERPRINT,
664 /* equiv idx, value */ 14, VALUE_OPT_FINGERPRINT,
665 /* equivalenced to */ NO_EQUIVALENT,
666 /* min, max, act ct */ 0, 1, 0,
667 /* opt state flags */ FINGERPRINT_FLAGS, 0,
668 /* last opt argumnt */ { NULL },
669 /* arg list/cookie */ NULL,
670 /* must/cannot opts */ NULL, NULL,
671 /* option proc */ NULL,
672 /* desc, NAME, name */ zFingerprintText, zFingerprint_NAME, zFingerprint_Name,
673 /* disablement strs */ NULL, NULL },
675 { /* entry idx, value */ 15, VALUE_OPT_DISABLE_EXTENSIONS,
676 /* equiv idx, value */ 15, VALUE_OPT_DISABLE_EXTENSIONS,
677 /* equivalenced to */ NO_EQUIVALENT,
678 /* min, max, act ct */ 0, 1, 0,
679 /* opt state flags */ DISABLE_EXTENSIONS_FLAGS, 0,
680 /* last opt argumnt */ { NULL },
681 /* arg list/cookie */ NULL,
682 /* must/cannot opts */ NULL, NULL,
683 /* option proc */ NULL,
684 /* desc, NAME, name */ zDisable_ExtensionsText, zDisable_Extensions_NAME, zDisable_Extensions_Name,
685 /* disablement strs */ NULL, NULL },
687 { /* entry idx, value */ 16, VALUE_OPT_PRINT_CERT,
688 /* equiv idx, value */ 16, VALUE_OPT_PRINT_CERT,
689 /* equivalenced to */ NO_EQUIVALENT,
690 /* min, max, act ct */ 0, 1, 0,
691 /* opt state flags */ PRINT_CERT_FLAGS, 0,
692 /* last opt argumnt */ { NULL },
693 /* arg list/cookie */ NULL,
694 /* must/cannot opts */ NULL, NULL,
695 /* option proc */ NULL,
696 /* desc, NAME, name */ zPrint_CertText, zPrint_Cert_NAME, zPrint_Cert_Name,
697 /* disablement strs */ NULL, NULL },
699 { /* entry idx, value */ 17, VALUE_OPT_RECORDSIZE,
700 /* equiv idx, value */ 17, VALUE_OPT_RECORDSIZE,
701 /* equivalenced to */ NO_EQUIVALENT,
702 /* min, max, act ct */ 0, 1, 0,
703 /* opt state flags */ RECORDSIZE_FLAGS, 0,
704 /* last opt argumnt */ { NULL },
705 /* arg list/cookie */ NULL,
706 /* must/cannot opts */ NULL, NULL,
707 /* option proc */ doOptRecordsize,
708 /* desc, NAME, name */ zRecordsizeText, zRecordsize_NAME, zRecordsize_Name,
709 /* disablement strs */ NULL, NULL },
711 { /* entry idx, value */ 18, VALUE_OPT_DH_BITS,
712 /* equiv idx, value */ 18, VALUE_OPT_DH_BITS,
713 /* equivalenced to */ NO_EQUIVALENT,
714 /* min, max, act ct */ 0, 1, 0,
715 /* opt state flags */ DH_BITS_FLAGS, 0,
716 /* last opt argumnt */ { NULL },
717 /* arg list/cookie */ NULL,
718 /* must/cannot opts */ NULL, NULL,
719 /* option proc */ optionNumericVal,
720 /* desc, NAME, name */ zDh_BitsText, zDh_Bits_NAME, zDh_Bits_Name,
721 /* disablement strs */ NULL, NULL },
723 { /* entry idx, value */ 19, VALUE_OPT_PRIORITY,
724 /* equiv idx, value */ 19, VALUE_OPT_PRIORITY,
725 /* equivalenced to */ NO_EQUIVALENT,
726 /* min, max, act ct */ 0, 1, 0,
727 /* opt state flags */ PRIORITY_FLAGS, 0,
728 /* last opt argumnt */ { NULL },
729 /* arg list/cookie */ NULL,
730 /* must/cannot opts */ NULL, NULL,
731 /* option proc */ NULL,
732 /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
733 /* disablement strs */ NULL, NULL },
735 { /* entry idx, value */ 20, VALUE_OPT_X509CAFILE,
736 /* equiv idx, value */ 20, VALUE_OPT_X509CAFILE,
737 /* equivalenced to */ NO_EQUIVALENT,
738 /* min, max, act ct */ 0, 1, 0,
739 /* opt state flags */ X509CAFILE_FLAGS, 0,
740 /* last opt argumnt */ { NULL },
741 /* arg list/cookie */ NULL,
742 /* must/cannot opts */ NULL, NULL,
743 /* option proc */ NULL,
744 /* desc, NAME, name */ zX509cafileText, zX509cafile_NAME, zX509cafile_Name,
745 /* disablement strs */ NULL, NULL },
747 { /* entry idx, value */ 21, VALUE_OPT_X509CRLFILE,
748 /* equiv idx, value */ 21, VALUE_OPT_X509CRLFILE,
749 /* equivalenced to */ NO_EQUIVALENT,
750 /* min, max, act ct */ 0, 1, 0,
751 /* opt state flags */ X509CRLFILE_FLAGS, 0,
752 /* last opt argumnt */ { NULL },
753 /* arg list/cookie */ NULL,
754 /* must/cannot opts */ NULL, NULL,
755 /* option proc */ doOptX509crlfile,
756 /* desc, NAME, name */ zX509crlfileText, zX509crlfile_NAME, zX509crlfile_Name,
757 /* disablement strs */ NULL, NULL },
759 { /* entry idx, value */ 22, VALUE_OPT_PGPKEYFILE,
760 /* equiv idx, value */ 22, VALUE_OPT_PGPKEYFILE,
761 /* equivalenced to */ NO_EQUIVALENT,
762 /* min, max, act ct */ 0, 1, 0,
763 /* opt state flags */ PGPKEYFILE_FLAGS, 0,
764 /* last opt argumnt */ { NULL },
765 /* arg list/cookie */ NULL,
766 /* must/cannot opts */ NULL, NULL,
767 /* option proc */ doOptPgpkeyfile,
768 /* desc, NAME, name */ zPgpkeyfileText, zPgpkeyfile_NAME, zPgpkeyfile_Name,
769 /* disablement strs */ NULL, NULL },
771 { /* entry idx, value */ 23, VALUE_OPT_PGPKEYRING,
772 /* equiv idx, value */ 23, VALUE_OPT_PGPKEYRING,
773 /* equivalenced to */ NO_EQUIVALENT,
774 /* min, max, act ct */ 0, 1, 0,
775 /* opt state flags */ PGPKEYRING_FLAGS, 0,
776 /* last opt argumnt */ { NULL },
777 /* arg list/cookie */ NULL,
778 /* must/cannot opts */ NULL, NULL,
779 /* option proc */ doOptPgpkeyring,
780 /* desc, NAME, name */ zPgpkeyringText, zPgpkeyring_NAME, zPgpkeyring_Name,
781 /* disablement strs */ NULL, NULL },
783 { /* entry idx, value */ 24, VALUE_OPT_PGPCERTFILE,
784 /* equiv idx, value */ 24, VALUE_OPT_PGPCERTFILE,
785 /* equivalenced to */ NO_EQUIVALENT,
786 /* min, max, act ct */ 0, 1, 0,
787 /* opt state flags */ PGPCERTFILE_FLAGS, 0,
788 /* last opt argumnt */ { NULL },
789 /* arg list/cookie */ NULL,
790 /* must/cannot opts */ NULL, NULL,
791 /* option proc */ doOptPgpcertfile,
792 /* desc, NAME, name */ zPgpcertfileText, zPgpcertfile_NAME, zPgpcertfile_Name,
793 /* disablement strs */ NULL, NULL },
795 { /* entry idx, value */ 25, VALUE_OPT_X509KEYFILE,
796 /* equiv idx, value */ 25, VALUE_OPT_X509KEYFILE,
797 /* equivalenced to */ NO_EQUIVALENT,
798 /* min, max, act ct */ 0, 1, 0,
799 /* opt state flags */ X509KEYFILE_FLAGS, 0,
800 /* last opt argumnt */ { NULL },
801 /* arg list/cookie */ NULL,
802 /* must/cannot opts */ NULL, NULL,
803 /* option proc */ NULL,
804 /* desc, NAME, name */ zX509keyfileText, zX509keyfile_NAME, zX509keyfile_Name,
805 /* disablement strs */ NULL, NULL },
807 { /* entry idx, value */ 26, VALUE_OPT_X509CERTFILE,
808 /* equiv idx, value */ 26, VALUE_OPT_X509CERTFILE,
809 /* equivalenced to */ NO_EQUIVALENT,
810 /* min, max, act ct */ 0, 1, 0,
811 /* opt state flags */ X509CERTFILE_FLAGS, 0,
812 /* last opt argumnt */ { NULL },
813 /* arg list/cookie */ NULL,
814 /* must/cannot opts */ NULL, NULL,
815 /* option proc */ NULL,
816 /* desc, NAME, name */ zX509certfileText, zX509certfile_NAME, zX509certfile_Name,
817 /* disablement strs */ NULL, NULL },
819 { /* entry idx, value */ 27, VALUE_OPT_PGPSUBKEY,
820 /* equiv idx, value */ 27, VALUE_OPT_PGPSUBKEY,
821 /* equivalenced to */ NO_EQUIVALENT,
822 /* min, max, act ct */ 0, 1, 0,
823 /* opt state flags */ PGPSUBKEY_FLAGS, 0,
824 /* last opt argumnt */ { NULL },
825 /* arg list/cookie */ NULL,
826 /* must/cannot opts */ NULL, NULL,
827 /* option proc */ NULL,
828 /* desc, NAME, name */ zPgpsubkeyText, zPgpsubkey_NAME, zPgpsubkey_Name,
829 /* disablement strs */ NULL, NULL },
831 { /* entry idx, value */ 28, VALUE_OPT_SRPUSERNAME,
832 /* equiv idx, value */ 28, VALUE_OPT_SRPUSERNAME,
833 /* equivalenced to */ NO_EQUIVALENT,
834 /* min, max, act ct */ 0, 1, 0,
835 /* opt state flags */ SRPUSERNAME_FLAGS, 0,
836 /* last opt argumnt */ { NULL },
837 /* arg list/cookie */ NULL,
838 /* must/cannot opts */ NULL, NULL,
839 /* option proc */ NULL,
840 /* desc, NAME, name */ zSrpusernameText, zSrpusername_NAME, zSrpusername_Name,
841 /* disablement strs */ NULL, NULL },
843 { /* entry idx, value */ 29, VALUE_OPT_SRPPASSWD,
844 /* equiv idx, value */ 29, VALUE_OPT_SRPPASSWD,
845 /* equivalenced to */ NO_EQUIVALENT,
846 /* min, max, act ct */ 0, 1, 0,
847 /* opt state flags */ SRPPASSWD_FLAGS, 0,
848 /* last opt argumnt */ { NULL },
849 /* arg list/cookie */ NULL,
850 /* must/cannot opts */ NULL, NULL,
851 /* option proc */ NULL,
852 /* desc, NAME, name */ zSrppasswdText, zSrppasswd_NAME, zSrppasswd_Name,
853 /* disablement strs */ NULL, NULL },
855 { /* entry idx, value */ 30, VALUE_OPT_PSKUSERNAME,
856 /* equiv idx, value */ 30, VALUE_OPT_PSKUSERNAME,
857 /* equivalenced to */ NO_EQUIVALENT,
858 /* min, max, act ct */ 0, 1, 0,
859 /* opt state flags */ PSKUSERNAME_FLAGS, 0,
860 /* last opt argumnt */ { NULL },
861 /* arg list/cookie */ NULL,
862 /* must/cannot opts */ NULL, NULL,
863 /* option proc */ NULL,
864 /* desc, NAME, name */ zPskusernameText, zPskusername_NAME, zPskusername_Name,
865 /* disablement strs */ NULL, NULL },
867 { /* entry idx, value */ 31, VALUE_OPT_PSKKEY,
868 /* equiv idx, value */ 31, VALUE_OPT_PSKKEY,
869 /* equivalenced to */ NO_EQUIVALENT,
870 /* min, max, act ct */ 0, 1, 0,
871 /* opt state flags */ PSKKEY_FLAGS, 0,
872 /* last opt argumnt */ { NULL },
873 /* arg list/cookie */ NULL,
874 /* must/cannot opts */ NULL, NULL,
875 /* option proc */ NULL,
876 /* desc, NAME, name */ zPskkeyText, zPskkey_NAME, zPskkey_Name,
877 /* disablement strs */ NULL, NULL },
879 { /* entry idx, value */ 32, VALUE_OPT_PORT,
880 /* equiv idx, value */ 32, VALUE_OPT_PORT,
881 /* equivalenced to */ NO_EQUIVALENT,
882 /* min, max, act ct */ 0, 1, 0,
883 /* opt state flags */ PORT_FLAGS, 0,
884 /* last opt argumnt */ { NULL },
885 /* arg list/cookie */ NULL,
886 /* must/cannot opts */ NULL, NULL,
887 /* option proc */ NULL,
888 /* desc, NAME, name */ zPortText, zPort_NAME, zPort_Name,
889 /* disablement strs */ NULL, NULL },
891 { /* entry idx, value */ 33, VALUE_OPT_INSECURE,
892 /* equiv idx, value */ 33, VALUE_OPT_INSECURE,
893 /* equivalenced to */ NO_EQUIVALENT,
894 /* min, max, act ct */ 0, 1, 0,
895 /* opt state flags */ INSECURE_FLAGS, 0,
896 /* last opt argumnt */ { NULL },
897 /* arg list/cookie */ NULL,
898 /* must/cannot opts */ NULL, NULL,
899 /* option proc */ NULL,
900 /* desc, NAME, name */ zInsecureText, zInsecure_NAME, zInsecure_Name,
901 /* disablement strs */ NULL, NULL },
903 { /* entry idx, value */ 34, VALUE_OPT_BENCHMARK_CIPHERS,
904 /* equiv idx, value */ 34, VALUE_OPT_BENCHMARK_CIPHERS,
905 /* equivalenced to */ NO_EQUIVALENT,
906 /* min, max, act ct */ 0, 1, 0,
907 /* opt state flags */ BENCHMARK_CIPHERS_FLAGS, 0,
908 /* last opt argumnt */ { NULL },
909 /* arg list/cookie */ NULL,
910 /* must/cannot opts */ NULL, NULL,
911 /* option proc */ NULL,
912 /* desc, NAME, name */ zBenchmark_CiphersText, zBenchmark_Ciphers_NAME, zBenchmark_Ciphers_Name,
913 /* disablement strs */ NULL, NULL },
915 { /* entry idx, value */ 35, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
916 /* equiv idx, value */ 35, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
917 /* equivalenced to */ NO_EQUIVALENT,
918 /* min, max, act ct */ 0, 1, 0,
919 /* opt state flags */ BENCHMARK_SOFT_CIPHERS_FLAGS, 0,
920 /* last opt argumnt */ { NULL },
921 /* arg list/cookie */ NULL,
922 /* must/cannot opts */ NULL, NULL,
923 /* option proc */ NULL,
924 /* desc, NAME, name */ zBenchmark_Soft_CiphersText, zBenchmark_Soft_Ciphers_NAME, zBenchmark_Soft_Ciphers_Name,
925 /* disablement strs */ NULL, NULL },
927 { /* entry idx, value */ 36, VALUE_OPT_BENCHMARK_TLS_KX,
928 /* equiv idx, value */ 36, VALUE_OPT_BENCHMARK_TLS_KX,
929 /* equivalenced to */ NO_EQUIVALENT,
930 /* min, max, act ct */ 0, 1, 0,
931 /* opt state flags */ BENCHMARK_TLS_KX_FLAGS, 0,
932 /* last opt argumnt */ { NULL },
933 /* arg list/cookie */ NULL,
934 /* must/cannot opts */ NULL, NULL,
935 /* option proc */ NULL,
936 /* desc, NAME, name */ zBenchmark_Tls_KxText, zBenchmark_Tls_Kx_NAME, zBenchmark_Tls_Kx_Name,
937 /* disablement strs */ NULL, NULL },
939 { /* entry idx, value */ 37, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
940 /* equiv idx, value */ 37, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
941 /* equivalenced to */ NO_EQUIVALENT,
942 /* min, max, act ct */ 0, 1, 0,
943 /* opt state flags */ BENCHMARK_TLS_CIPHERS_FLAGS, 0,
944 /* last opt argumnt */ { NULL },
945 /* arg list/cookie */ NULL,
946 /* must/cannot opts */ NULL, NULL,
947 /* option proc */ NULL,
948 /* desc, NAME, name */ zBenchmark_Tls_CiphersText, zBenchmark_Tls_Ciphers_NAME, zBenchmark_Tls_Ciphers_Name,
949 /* disablement strs */ NULL, NULL },
951 { /* entry idx, value */ 38, VALUE_OPT_LIST,
952 /* equiv idx, value */ 38, VALUE_OPT_LIST,
953 /* equivalenced to */ NO_EQUIVALENT,
954 /* min, max, act ct */ 0, 1, 0,
955 /* opt state flags */ LIST_FLAGS, 0,
956 /* last opt argumnt */ { NULL },
957 /* arg list/cookie */ NULL,
958 /* must/cannot opts */ NULL, NULL,
959 /* option proc */ NULL,
960 /* desc, NAME, name */ zListText, zList_NAME, zList_Name,
961 /* disablement strs */ NULL, NULL },
963 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
964 /* equiv idx value */ NO_EQUIVALENT, 0,
965 /* equivalenced to */ NO_EQUIVALENT,
966 /* min, max, act ct */ 0, 1, 0,
967 /* opt state flags */ OPTST_VERSION_FLAGS, 0,
968 /* last opt argumnt */ { NULL },
969 /* arg list/cookie */ NULL,
970 /* must/cannot opts */ NULL, NULL,
971 /* option proc */ optionPrintVersion,
972 /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
973 /* disablement strs */ NULL, NULL },
977 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
978 /* equiv idx value */ NO_EQUIVALENT, 0,
979 /* equivalenced to */ NO_EQUIVALENT,
980 /* min, max, act ct */ 0, 1, 0,
981 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
982 /* last opt argumnt */ { NULL },
983 /* arg list/cookie */ NULL,
984 /* must/cannot opts */ NULL, NULL,
985 /* option proc */ doUsageOpt,
986 /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
987 /* disablement strs */ NULL, NULL },
989 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
990 /* equiv idx value */ NO_EQUIVALENT, 0,
991 /* equivalenced to */ NO_EQUIVALENT,
992 /* min, max, act ct */ 0, 1, 0,
993 /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0,
994 /* last opt argumnt */ { NULL },
995 /* arg list/cookie */ NULL,
996 /* must/cannot opts */ NULL, NULL,
997 /* option proc */ optionPagedUsage,
998 /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
999 /* disablement strs */ NULL, NULL }
1002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1004 * Define the Gnutls_Cli Option Environment
1006 static char const zPROGNAME[11] = "GNUTLS_CLI";
1007 static char const zUsageTitle[113] =
1008 "gnutls-cli - GnuTLS client - Ver. @VERSION@\n\
1009 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]\n";
1010 #define zRcName NULL
1011 #define apzHomeList NULL
1013 static char const zBugsAddr[19] = "bug-gnutls@gnu.org";
1014 static char const zExplain[] = "\n\n";
1015 static char const zDetail[195] = "\n\
1016 Simple client program to set up a TLS connection to some other computer.\n\
1017 It sets up a TLS connection and forwards data from the standard input\n\
1018 to the secured socket and vice versa.\n";
1019 static char const zFullVersion[] = GNUTLS_CLI_FULL_VERSION;
1020 /* extracted from optcode.tlib near line 515 */
1022 #if defined(ENABLE_NLS)
1023 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
1024 static tOptionXlateProc translate_option_strings;
1025 #else
1026 # define OPTPROC_BASE OPTPROC_NONE
1027 # define translate_option_strings NULL
1028 #endif /* ENABLE_NLS */
1031 #define gnutls_cli_full_usage NULL
1032 static char const gnutls_cli_short_usage[] =
1033 "Usage: gnutls-cli [options] hostname\n\
1034 gnutls-cli --help for usage instructions.\n";
1036 #ifndef PKGDATADIR
1037 # define PKGDATADIR ""
1038 #endif
1040 #ifndef WITH_PACKAGER
1041 # define gnutls_cli_packager_info NULL
1042 #else
1043 static char const gnutls_cli_packager_info[] =
1044 "Packaged by " WITH_PACKAGER
1046 # ifdef WITH_PACKAGER_VERSION
1047 " ("WITH_PACKAGER_VERSION")"
1048 # endif
1050 # ifdef WITH_PACKAGER_BUG_REPORTS
1051 "\nReport gnutls_cli bugs to " WITH_PACKAGER_BUG_REPORTS
1052 # endif
1053 "\n";
1054 #endif
1056 tOptions gnutls_cliOptions = {
1057 OPTIONS_STRUCT_VERSION,
1058 0, NULL, /* original argc + argv */
1059 ( OPTPROC_BASE
1060 + OPTPROC_ERRSTOP
1061 + OPTPROC_SHORTOPT
1062 + OPTPROC_LONGOPT
1063 + OPTPROC_NO_REQ_OPT
1064 + OPTPROC_NEGATIONS
1065 + OPTPROC_REORDER
1066 + OPTPROC_GNUUSAGE
1067 + OPTPROC_MISUSE ),
1068 0, NULL, /* current option index, current option */
1069 NULL, NULL, zPROGNAME,
1070 zRcName, zCopyright, zLicenseDescrip,
1071 zFullVersion, apzHomeList, zUsageTitle,
1072 zExplain, zDetail, optDesc,
1073 zBugsAddr, /* address to send bugs to */
1074 NULL, NULL, /* extensions/saved state */
1075 optionUsage, /* usage procedure */
1076 translate_option_strings, /* translation procedure */
1078 * Indexes to special options
1080 { INDEX_OPT_MORE_HELP, /* more-help option index */
1081 NO_EQUIVALENT, /* save option index */
1082 NO_EQUIVALENT, /* '-#' option index */
1083 NO_EQUIVALENT /* index of default opt */
1085 42 /* full option count */, 39 /* user option count */,
1086 gnutls_cli_full_usage, gnutls_cli_short_usage,
1087 NULL, NULL,
1088 PKGDATADIR, gnutls_cli_packager_info
1092 * Create the static procedure(s) declared above.
1094 static void
1095 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
1097 (void)pOptions;
1098 USAGE(GNUTLS_CLI_EXIT_SUCCESS);
1101 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1103 * For the debug option.
1105 static void
1106 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
1108 static const struct {long const rmin, rmax;} rng[1] = {
1109 { 0 , 9999 } };
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 * For the mtu option.
1138 static void
1139 doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
1141 static const struct {long const rmin, rmax;} rng[1] = {
1142 { 0, 17000 } };
1143 int ix;
1145 if (pOptions <= OPTPROC_EMIT_LIMIT)
1146 goto emit_ranges;
1147 optionNumericVal(pOptions, pOptDesc);
1149 for (ix = 0; ix < 1; ix++) {
1150 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1151 continue; /* ranges need not be ordered. */
1152 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1153 return;
1154 if (rng[ix].rmax == LONG_MIN)
1155 continue;
1156 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1157 return;
1160 option_usage_fp = stderr;
1162 emit_ranges:
1164 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1167 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1169 * For the recordsize option.
1171 static void
1172 doOptRecordsize(tOptions* pOptions, tOptDesc* pOptDesc)
1174 static const struct {long const rmin, rmax;} rng[1] = {
1175 { 0, 4096 } };
1176 int ix;
1178 if (pOptions <= OPTPROC_EMIT_LIMIT)
1179 goto emit_ranges;
1180 optionNumericVal(pOptions, pOptDesc);
1182 for (ix = 0; ix < 1; ix++) {
1183 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1184 continue; /* ranges need not be ordered. */
1185 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1186 return;
1187 if (rng[ix].rmax == LONG_MIN)
1188 continue;
1189 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1190 return;
1193 option_usage_fp = stderr;
1195 emit_ranges:
1197 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1200 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1202 * For the x509crlfile option.
1204 static void
1205 doOptX509crlfile(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 * For the pgpkeyfile option.
1222 static void
1223 doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc)
1225 static teOptFileType const type =
1226 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1227 static tuFileMode mode;
1228 #ifndef O_CLOEXEC
1229 # define O_CLOEXEC 0
1230 #endif
1231 mode.file_flags = O_CLOEXEC;
1233 optionFileCheck(pOptions, pOptDesc, type, mode);
1236 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1238 * For the pgpkeyring option.
1240 static void
1241 doOptPgpkeyring(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);
1254 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1256 * For the pgpcertfile option.
1258 static void
1259 doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc)
1261 static teOptFileType const type =
1262 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1263 static tuFileMode mode;
1264 #ifndef O_CLOEXEC
1265 # define O_CLOEXEC 0
1266 #endif
1267 mode.file_flags = O_CLOEXEC;
1269 optionFileCheck(pOptions, pOptDesc, type, mode);
1271 /* extracted from optcode.tlib near line 666 */
1273 #if ENABLE_NLS
1274 #include <stdio.h>
1275 #include <stdlib.h>
1276 #include <string.h>
1277 #include <unistd.h>
1278 #include <autoopts/usage-txt.h>
1280 static char* AO_gettext(char const* pz);
1281 static void coerce_it(void** s);
1283 static char*
1284 AO_gettext(char const* pz)
1286 char* pzRes;
1287 if (pz == NULL)
1288 return NULL;
1289 pzRes = _(pz);
1290 if (pzRes == pz)
1291 return pzRes;
1292 pzRes = strdup(pzRes);
1293 if (pzRes == NULL) {
1294 fputs(_("No memory for duping translated strings\n"), stderr);
1295 exit(GNUTLS_CLI_EXIT_FAILURE);
1297 return pzRes;
1300 static void coerce_it(void** s) { *s = AO_gettext(*s);
1304 * This invokes the translation code (e.g. gettext(3)).
1306 static void
1307 translate_option_strings(void)
1309 tOptions * const pOpt = &gnutls_cliOptions;
1312 * Guard against re-translation. It won't work. The strings will have
1313 * been changed by the first pass through this code. One shot only.
1315 if (option_usage_text.field_ct != 0) {
1317 * Do the translations. The first pointer follows the field count
1318 * field. The field count field is the size of a pointer.
1320 tOptDesc * pOD = pOpt->pOptDesc;
1321 char ** ppz = (char**)(void*)&(option_usage_text);
1322 int ix = option_usage_text.field_ct;
1324 do {
1325 ppz++;
1326 *ppz = AO_gettext(*ppz);
1327 } while (--ix > 0);
1329 coerce_it((void*)&(pOpt->pzCopyright));
1330 coerce_it((void*)&(pOpt->pzCopyNotice));
1331 coerce_it((void*)&(pOpt->pzFullVersion));
1332 coerce_it((void*)&(pOpt->pzUsageTitle));
1333 coerce_it((void*)&(pOpt->pzExplain));
1334 coerce_it((void*)&(pOpt->pzDetail));
1335 coerce_it((void*)&(pOpt->pzPackager));
1336 coerce_it((void*)&(pOpt->pzShortUsage));
1337 option_usage_text.field_ct = 0;
1339 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1340 coerce_it((void*)&(pOD->pzText));
1343 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1344 tOptDesc * pOD = pOpt->pOptDesc;
1345 int ix;
1347 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1348 coerce_it((void*)&(pOD->pz_Name));
1349 coerce_it((void*)&(pOD->pz_DisableName));
1350 coerce_it((void*)&(pOD->pz_DisablePfx));
1352 /* prevent re-translation */
1353 gnutls_cliOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1357 #endif /* ENABLE_NLS */
1359 #ifdef __cplusplus
1361 #endif
1362 /* cli-args.c ends here */