summaryrefslogtreecommitdiff
path: root/doc/alert-printlist.c
blob: ab746aa2f2b27c8bb256d90ebc04ea96e853240c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * Copyright (C) 2008-2012 Free Software Foundation, Inc.
 * Author: Nikos Mavrogiannopoulos
 *
 * This file is part of GnuTLS.
 *
 * GnuTLS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * GnuTLS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gnutls/openpgp.h>
#include "common.h"

static void main_texinfo(void);
static void main_latex(void);

char buffer[1024];

int main(int argc, char *argv[])
{
	if (argc > 1)
		main_latex();
	else
		main_texinfo();

	return 0;
}

static void main_texinfo(void)
{
	{
		size_t i;
		const char *name;
		gnutls_kx_algorithm_t kx;
		gnutls_cipher_algorithm_t cipher;
		gnutls_mac_algorithm_t mac;
		gnutls_protocol_t version;

		printf
		    ("@multitable @columnfractions .55 .10 .30\n@anchor{tab:alerts}\n");
		printf("@headitem Alert @tab ID @tab Description\n");
		for (i = 0; i < 256; i++) {
			if (gnutls_alert_get_strname(i) == NULL)
				continue;
			printf("@item %s\n@tab %d\n@tab %s\n",
			       escape_texi_string(gnutls_alert_get_strname
						  (i), buffer,
						  sizeof(buffer)),
			       (unsigned int) i, gnutls_alert_get_name(i));
		}
		printf("@end multitable\n");

	}
}

static const char headers[] = "\\tablefirsthead{%\n"
    "\\hline\n" "Alert & ID & Description\\\\\n" "\\hline}\n"
#if 0
    "\\tablehead{%\n"
    "\\hline\n"
    "\\multicolumn{3}{|l|}{\\small\\sl continued from previous page}\\\\\n"
    "\\hline}\n"
    "\\tabletail{%\n"
    "\\hline\n"
    "\\multicolumn{3}{|r|}{\\small\\sl continued on next page}\\\\\n"
    "\\hline}\n"
#endif
    "\\tablelasttail{\\hline}\n"
    "\\bottomcaption{The TLS alert table}\n\n";

static void main_latex(void)
{
	int i, j;
	const char *desc;
	const char *_name;

	puts(headers);

	printf
	    ("\\begin{supertabular}{|p{.50\\linewidth}|p{.07\\linewidth}|p{.34\\linewidth}|}\n\\label{tab:alerts}\n");

	{
		size_t i;
		const char *name;
		gnutls_kx_algorithm_t kx;
		gnutls_cipher_algorithm_t cipher;
		gnutls_mac_algorithm_t mac;
		gnutls_protocol_t version;

		for (i = 0; i < 256; i++) {
			if (gnutls_alert_get_strname(i) == NULL)
				continue;
			printf("{\\small{%s}} & \\code{%d} & %s",
			       escape_string(gnutls_alert_get_strname(i),
					     buffer, sizeof(buffer)),
			       (unsigned int) i, gnutls_alert_get_name(i));
			printf("\\\\\n");
		}

		printf("\\end{supertabular}\n\n");

	}

	return;

}