]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/tlsproxy.h
Intercept TLS connections between client and server.
[tlsproxy/tlsproxy.git] / src / tlsproxy.h
index 8b6f4fc5d5e71ac4c1d0967dd8a08bdace086c4f..b2d690e92c5a8206bdb9e82fd666833584802761 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Global variables.
+ * Global variables/defines.
  *
  * Copyright (C) 2011  Simon Ruderich
  *
@@ -26,6 +26,9 @@
 #include <stdio.h>
 #include <string.h>
 
+/* GnuTLS */
+#include <gnutls/gnutls.h>
+
 
 /* Log level constants. */
 #define LOG_ERROR   0
 #define LOG_DEBUG   2
 
 
+/* Macros for shorter error handling. */
+#define GNUTLS_ERROR_EXIT(error, message) \
+    if (GNUTLS_E_SUCCESS != error) { \
+        fprintf(stderr, "%s: %s\n", message, gnutls_strerror(error)); \
+        exit(EXIT_FAILURE); \
+    }
+
+
 /* Proxy hostname and port if specified on the command line. */
 char *global_proxy_host;
 char *global_proxy_port;
@@ -40,4 +51,8 @@ char *global_proxy_port;
 /* Log level, command line option. */
 int global_log_level;
 
+/* "Global" GnuTLS data used by all threads, read only. */
+gnutls_priority_t tls_priority_cache;
+gnutls_dh_params_t tls_dh_params;
+
 #endif