src/sock_gnutls.h
changeset 2 a834f0559939
child 3 cc94ae754e2a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sock_gnutls.h	Sun Feb 22 05:27:29 2009 +0200
@@ -0,0 +1,44 @@
+#ifndef SOCK_GNUTLS_H
+#define SOCK_GNUTLS_H
+
+/*
+ * A sock_stream implementation using GnuTLS
+ */
+
+#include "sock_internal.h"
+#include "sock_tcp.h"
+
+#include <gnutls/gnutls.h>
+
+/*
+ * Additional gnutls configuration for client sockets.
+ *
+ * XXX: currently, we just have one global instance, set up by sock_gnutls_init, used for all sockets
+ */
+struct sock_gnutls_client_ctx {
+    gnutls_certificate_credentials_t xcred;
+};
+
+/*
+ * Per-sock state, this includes the sock_tcp connection
+ */
+struct sock_gnutls {
+    /* SSL connections use TCP connections */
+    struct sock_tcp base_tcp;
+    
+    /* Additional SSL info XXX: do we need to keep a ref to this? */
+    struct sock_gnutls_ctx *ctx;
+
+    /* The GnuTLS session for this connection */
+    gnutls_session_t session;
+};
+
+#define SOCK_GNUTLS_BASE(sock_ptr) (&(sock_ptr)->base_tcp.base)
+#define SOCK_GNUTLS_TCP(sock_ptr) (&(sock_ptr)->base_tcp)
+
+/*
+ * Initialize the global gnutls state
+ */
+void sock_gnutls_init (void);
+
+#endif /* SOCK_GNUTLS_H */