added SSL backend for IOMultiplexer
[TransparentIRC.git] / src / IOHandler_SSL.h
diff --git a/src/IOHandler_SSL.h b/src/IOHandler_SSL.h
new file mode 100644 (file)
index 0000000..8affca2
--- /dev/null
@@ -0,0 +1,45 @@
+/* IOHandler_SSL.h - TransparentIRC 0.1
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
+ * 
+ * This program 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.
+ * 
+ * This program 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/>. 
+ */
+#ifndef _IOHandler_SSL_h
+#define _IOHandler_SSL_h
+#include "overall.h"
+
+struct IODescriptor;
+
+#ifdef HAVE_SSL
+#include <openssl/rand.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
+struct IOSSLNode {
+    SSL *sslHandle;
+    SSL_CTX *sslContext;
+};
+#else
+struct IOSSLNode {
+    //just unused
+};
+#endif
+
+void iohandler_ssl_init();
+void iohandler_ssl_connect(struct IODescriptor *iofd);
+void iohandler_ssl_client_handshake(struct IODescriptor *iofd);
+void iohandler_ssl_disconnect(struct IODescriptor *iofd);
+int iohandler_ssl_read(struct IODescriptor *iofd, char *buffer, int len);
+int iohandler_ssl_write(struct IODescriptor *iofd, char *buffer, int len);
+
+#endif