]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blob - src/tlsproxy.h
Intercept TLS connections between client and server.
[tlsproxy/tlsproxy.git] / src / tlsproxy.h
1 /*
2  * Global variables/defines.
3  *
4  * Copyright (C) 2011  Simon Ruderich
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef TLSPROXY_H
21 #define TLSPROXY_H
22
23 #include <config.h>
24
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <string.h>
28
29 /* GnuTLS */
30 #include <gnutls/gnutls.h>
31
32
33 /* Log level constants. */
34 #define LOG_ERROR   0
35 #define LOG_WARNING 1
36 #define LOG_DEBUG   2
37
38
39 /* Macros for shorter error handling. */
40 #define GNUTLS_ERROR_EXIT(error, message) \
41     if (GNUTLS_E_SUCCESS != error) { \
42         fprintf(stderr, "%s: %s\n", message, gnutls_strerror(error)); \
43         exit(EXIT_FAILURE); \
44     }
45
46
47 /* Proxy hostname and port if specified on the command line. */
48 char *global_proxy_host;
49 char *global_proxy_port;
50
51 /* Log level, command line option. */
52 int global_log_level;
53
54 /* "Global" GnuTLS data used by all threads, read only. */
55 gnutls_priority_t tls_priority_cache;
56 gnutls_dh_params_t tls_dh_params;
57
58 #endif