]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blob - src/tlsproxy.h
Rename *_FILE constants to *_PATH.
[tlsproxy/tlsproxy.git] / src / tlsproxy.h
1 /*
2  * Global variables/defines.
3  *
4  * Copyright (C) 2011-2013  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 <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28
29 #include <gnutls/gnutls.h>
30
31 #include "log.h"
32
33 /* Length for path arrays. */
34 #define TLSPROXY_MAX_PATH_LENGTH 1024
35
36 /* Paths to necessary TLS files: the CA and the server key. */
37 #define PROXY_CA_PATH  "proxy-ca.pem"
38 #define PROXY_KEY_PATH "proxy-key.pem"
39 /* Path to special "invalid" certificate send to the client when an error
40  * occurs. */
41 #define PROXY_INVALID_CERT_PATH "proxy-invalid.pem"
42 /* The server certificate for the given hostname is stored in
43  * "./certificate-hostname-proxy.pem" - we use this for the connection to the
44  * client. */
45 #define PROXY_SERVER_CERT_FORMAT "./certificate-%s-proxy.pem"
46 /* The remote server certificate for the given hostname is stored in
47  * "./certificate-hostname-proxy.pem" - we make sure the server sends this
48  * certificate. */
49 #define STORED_SERVER_CERT_FORMAT "./certificate-%s-server.pem"
50
51
52 /* Proxy hostname and port if specified on the command line. */
53 char *global_proxy_host;
54 char *global_proxy_port;
55
56 /* Passphrase for authentication of this proxy. Used with the -a option. */
57 char *http_digest_authorization;
58
59 /* Log level, command line option. */
60 int global_log_level;
61
62 /* Passthrough connections if no certificate is stored for this hostname?
63  * Specified on the command line. */
64 int global_passthrough_unknown;
65
66 /* "Global" GnuTLS data used by all threads, read only. */
67 gnutls_priority_t global_tls_priority_cache;
68 gnutls_dh_params_t global_tls_dh_params;
69
70 /* Very simple compile time asserts. No good error message though. */
71 #define ct_assert(x) { \
72     int unused[(x) ? 1 : -1]; \
73     (void)unused; \
74 }
75
76 #endif