removed old libtasn1 requirements
[gnutls.git] / doc / printlist.c
blobde2796a774c3e8514e3d77f896363df51fb71b4b
1 /*
2 * Copyright (C) 2008-2012 Free Software Foundation, Inc.
3 * Author: Nikos Mavrogiannopoulos
5 * This file is part of GnuTLS.
7 * GnuTLS is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * GnuTLS is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <config.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <gnutls/gnutls.h>
26 #include <gnutls/x509.h>
27 #include <gnutls/openpgp.h>
28 #include "common.h"
30 static void main_texinfo (void);
31 static void main_latex(void);
33 char buffer[1024];
35 int
36 main (int argc, char *argv[])
38 if (argc > 1)
39 main_latex();
40 else
41 main_texinfo();
43 return 0;
46 static void main_texinfo (void)
49 size_t i;
50 const char *name;
51 char id[2];
52 gnutls_kx_algorithm_t kx;
53 gnutls_cipher_algorithm_t cipher;
54 gnutls_mac_algorithm_t mac;
55 gnutls_protocol_t version;
57 printf ("@heading Ciphersuites\n");
58 printf ("@multitable @columnfractions .60 .20 .20\n");
59 printf("@headitem Ciphersuite name @tab TLS ID @tab Since\n");
60 for (i = 0; (name = gnutls_cipher_suite_info
61 (i, id, &kx, &cipher, &mac, &version)); i++)
63 printf ("@item %s\n@tab 0x%02X 0x%02X\n@tab %s\n",
64 escape_texi_string(name, buffer, sizeof(buffer)),
65 (unsigned char) id[0], (unsigned char) id[1],
66 gnutls_protocol_get_name (version));
68 printf ("@end multitable\n");
73 const gnutls_certificate_type_t *p = gnutls_certificate_type_list ();
75 printf ("\n\n@heading Certificate types\n");
76 printf ("@table @code\n");
77 for (; *p; p++)
79 printf ("@item %s\n", gnutls_certificate_type_get_name (*p));
81 printf ("@end table\n");
85 const gnutls_protocol_t *p = gnutls_protocol_list ();
87 printf ("\n@heading Protocols\n@table @code\n");
88 for (; *p; p++)
90 printf ("@item %s\n", gnutls_protocol_get_name (*p));
92 printf ("@end table\n");
96 const gnutls_cipher_algorithm_t *p = gnutls_cipher_list ();
98 printf ("\n@heading Ciphers\n@table @code\n");
99 for (; *p; p++)
101 printf ("@item %s\n", gnutls_cipher_get_name (*p));
103 printf ("@end table\n");
107 const gnutls_mac_algorithm_t *p = gnutls_mac_list ();
109 printf ("\n@heading MAC algorithms\n@table @code\n");
110 for (; *p; p++)
112 printf ("@item %s\n", gnutls_mac_get_name (*p));
114 printf ("@end table\n");
118 const gnutls_kx_algorithm_t *p = gnutls_kx_list ();
120 printf ("\n@heading Key exchange methods\n@table @code\n");
121 for (; *p; p++)
123 printf ("@item %s\n", gnutls_kx_get_name (*p));
125 printf ("@end table\n");
129 const gnutls_pk_algorithm_t *p = gnutls_pk_list ();
131 printf ("\n@heading Public key algorithms\n@table @code\n");
132 for (; *p; p++)
134 printf ("@item %s\n", gnutls_pk_get_name (*p));
136 printf ("@end table\n");
140 const gnutls_sign_algorithm_t *p = gnutls_sign_list ();
142 printf ("\n@heading Public key signature algorithms\n@table @code\n");
143 for (; *p; p++)
145 printf ("@item %s\n", gnutls_sign_get_name (*p));
147 printf ("@end table\n");
151 const gnutls_ecc_curve_t *p = gnutls_ecc_curve_list ();
153 printf ("\n@heading Elliptic curves\n@table @code\n");
154 for (; *p; p++)
156 printf ("@item %s\n", gnutls_ecc_curve_get_name (*p));
158 printf ("@end table\n");
163 const gnutls_compression_method_t *p = gnutls_compression_list ();
165 printf ("\n@heading Compression methods\n@table @code\n");
166 for (; *p; p++)
168 printf ("@item %s\n", gnutls_compression_get_name (*p));
170 printf ("@end table\n");
174 static const char headers[] = "\\tablefirsthead{%\n"
175 "\\hline\n"
176 "Ciphersuite name & TLS ID & Since\\\\\n"
177 "\\hline}\n"
178 #if 0
179 "\\tablehead{%\n"
180 "\\hline\n"
181 "\\multicolumn{3}{|l|}{\\small\\sl continued from previous page}\\\\\n"
182 "\\hline}\n"
183 "\\tabletail{%\n"
184 "\\hline\n"
185 "\\multicolumn{3}{|r|}{\\small\\sl continued on next page}\\\\\n"
186 "\\hline}\n"
187 #endif
188 "\\tablelasttail{\\hline}\n"
189 "\\bottomcaption{The ciphersuites table}\n\n";
191 static void main_latex(void)
193 int i, j;
194 const char* desc;
195 const char* _name;
197 puts( headers);
199 printf("\\begin{supertabular}{|p{.64\\linewidth}|p{.12\\linewidth}|p{.09\\linewidth}|}\n");
202 size_t i;
203 const char *name;
204 char id[2];
205 gnutls_kx_algorithm_t kx;
206 gnutls_cipher_algorithm_t cipher;
207 gnutls_mac_algorithm_t mac;
208 gnutls_protocol_t version;
210 for (i = 0; (name = gnutls_cipher_suite_info
211 (i, id, &kx, &cipher, &mac, &version)); i++)
213 printf ("{\\small{%s}} & \\code{0x%02X 0x%02X} & %s",
214 escape_string(name, buffer, sizeof(buffer)),
215 (unsigned char) id[0], (unsigned char) id[1],
216 gnutls_protocol_get_name (version));
217 printf( "\\\\\n");
219 printf("\\end{supertabular}\n\n");
223 return;