[IOMultiplexerV2] added more socket examples
authorpk910 <philipp@zoelle1.de>
Sun, 16 Mar 2014 15:29:25 +0000 (16:29 +0100)
committerpk910 <philipp@zoelle1.de>
Sun, 16 Mar 2014 15:37:56 +0000 (16:37 +0100)
23 files changed:
configure.ac
src/IOHandler/IOSSLBackend.c
src/IOHandler_test/Makefile.am
src/IOHandler_test/client++/.gitignore [new file with mode: 0644]
src/IOHandler_test/client++/Makefile.am [new file with mode: 0644]
src/IOHandler_test/client++/iotest.cpp [new file with mode: 0644]
src/IOHandler_test/client/.gitignore [new file with mode: 0644]
src/IOHandler_test/client/Makefile.am [new file with mode: 0644]
src/IOHandler_test/client/iotest.c [new file with mode: 0644]
src/IOHandler_test/client_ssl/.gitignore [new file with mode: 0644]
src/IOHandler_test/client_ssl/Makefile.am [new file with mode: 0644]
src/IOHandler_test/client_ssl/iotest.c [new file with mode: 0644]
src/IOHandler_test/server_ssl/.gitignore [new file with mode: 0644]
src/IOHandler_test/server_ssl/Makefile.am [new file with mode: 0644]
src/IOHandler_test/server_ssl/cert.pem [new file with mode: 0644]
src/IOHandler_test/server_ssl/iotest.c [new file with mode: 0644]
src/IOHandler_test/server_ssl/key.pem [new file with mode: 0644]
src/IOHandler_test/socket++/.gitignore [deleted file]
src/IOHandler_test/socket++/Makefile.am [deleted file]
src/IOHandler_test/socket++/iotest.cpp [deleted file]
src/IOHandler_test/socket/.gitignore [deleted file]
src/IOHandler_test/socket/Makefile.am [deleted file]
src/IOHandler_test/socket/iotest.c [deleted file]

index fb64def438c9dc92db995917c48d955f1163fe95..318b98b476dc710695024b0d2f19d7dfe7377e82 100644 (file)
@@ -63,5 +63,17 @@ AC_CHECK_LIB(cares, ares_init, [
   ])
 ])
 
-AC_CONFIG_FILES([Makefile src/Makefile src/IOHandler/Makefile src/IOHandler++/Makefile src/IOHandler_test/Makefile src/IOHandler_test/socket/Makefile src/IOHandler_test/socket++/Makefile src/IOHandler_test/timer/Makefile src/IOHandler_test/resolv/Makefile])
+AC_CONFIG_FILES([
+  Makefile
+  src/Makefile
+  src/IOHandler/Makefile
+  src/IOHandler++/Makefile
+  src/IOHandler_test/Makefile
+  src/IOHandler_test/client/Makefile
+  src/IOHandler_test/client++/Makefile
+  src/IOHandler_test/client_ssl/Makefile
+  src/IOHandler_test/server_ssl/Makefile
+  src/IOHandler_test/timer/Makefile
+  src/IOHandler_test/resolv/Makefile
+])
 AC_OUTPUT
index ab0f26ebb4726596f9427ddddfdbc1a48a5e7252..786c65c8f84dcb5eabf7a0409bbcb60d4acb94af 100644 (file)
@@ -109,7 +109,7 @@ void iossl_listen(struct _IOSocket *iosock, const char *certfile, const char *ke
        gnutls_certificate_allocate_credentials(&sslnode->ssl.server.credentials);
        int ret = gnutls_certificate_set_x509_key_file(sslnode->ssl.server.credentials, certfile, keyfile, GNUTLS_X509_FMT_PEM);
     if (ret < 0) {
-               iolog_trigger(IOLOG_ERROR, "SSL: could not load server certificate/key (%s %s)", certfile, keyfile);
+               iolog_trigger(IOLOG_ERROR, "SSL: could not load server certificate/key (%s %s): %d - %s", certfile, keyfile, ret, gnutls_strerror(ret));
                goto ssl_listen_err;
        }
        
index 90d56feff6a30b86850d7bddfc9442965d952730..e8c6698e216cf56e6cc32c6a2516b617e1d4e9bd 100644 (file)
@@ -1,3 +1,3 @@
 ##Process this file with automake to create Makefile.in
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = socket socket++ timer resolv
+SUBDIRS = client client++ client_ssl server_ssl timer resolv
diff --git a/src/IOHandler_test/client++/.gitignore b/src/IOHandler_test/client++/.gitignore
new file mode 100644 (file)
index 0000000..7af2f69
--- /dev/null
@@ -0,0 +1,7 @@
+.deps
+.libs
+*.o
+*.exe
+iotest
+Makefile
+Makefile.in
diff --git a/src/IOHandler_test/client++/Makefile.am b/src/IOHandler_test/client++/Makefile.am
new file mode 100644 (file)
index 0000000..0591fea
--- /dev/null
@@ -0,0 +1,7 @@
+##Process this file with automake to create Makefile.in
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_PROGRAMS = iotest
+
+iotest_LDADD = ../../IOHandler++/libiohandler.cpp.la
+iotest_SOURCES = iotest.cpp
diff --git a/src/IOHandler_test/client++/iotest.cpp b/src/IOHandler_test/client++/iotest.cpp
new file mode 100644 (file)
index 0000000..151ce0d
--- /dev/null
@@ -0,0 +1,57 @@
+/* main.c - IOMultiplexer
+ * Copyright (C) 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/>. 
+ */
+
+#include <stdio.h>
+#include "../../IOHandler++/IOHandler.h"
+#include "../../IOHandler++/IOSocket.h"
+
+class IOTestSocket : public CIOSocket {
+protected:
+       virtual void connectedEvent() {
+               printf("[connect]\n");
+               this->writef("GET / HTTP/1.1\r\n");
+               this->writef("Host: test.pk910.de\r\n");
+               this->writef("\r\n");
+       };
+       virtual void notConnectedEvent(int errid) {
+               printf("[not connected]\n");
+       };
+       virtual void closedEvent(int errid) {
+               printf("[disconnect]\n");
+       };
+       virtual void acceptedEvent(CIOSocket *client) {
+               client->close(); 
+       };
+       virtual void dnsErrEvent(std::string *errormsg) {
+       
+       };
+       virtual int recvEvent(const char *data, int len) {
+               int i;
+               for(i = 0; i < len; i++)
+                       putchar(data[i]);
+               return len;
+       };
+};
+
+
+int main(int argc, char *argv[]) {
+       CIOHandler *iohandler = new CIOHandler();
+       IOTestSocket *sock = new IOTestSocket();
+       sock->connect("test.pk910.de", 443, 1, NULL);
+       
+       iohandler->start();
+}
diff --git a/src/IOHandler_test/client/.gitignore b/src/IOHandler_test/client/.gitignore
new file mode 100644 (file)
index 0000000..7af2f69
--- /dev/null
@@ -0,0 +1,7 @@
+.deps
+.libs
+*.o
+*.exe
+iotest
+Makefile
+Makefile.in
diff --git a/src/IOHandler_test/client/Makefile.am b/src/IOHandler_test/client/Makefile.am
new file mode 100644 (file)
index 0000000..feda450
--- /dev/null
@@ -0,0 +1,8 @@
+##Process this file with automake to create Makefile.in
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_PROGRAMS = iotest
+iotest_LDADD = ../../IOHandler/libiohandler.la
+
+iotest_SOURCES = iotest.c
+
diff --git a/src/IOHandler_test/client/iotest.c b/src/IOHandler_test/client/iotest.c
new file mode 100644 (file)
index 0000000..2826c4e
--- /dev/null
@@ -0,0 +1,69 @@
+/* main.c - IOMultiplexer
+ * Copyright (C) 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/>. 
+ */
+
+#include <stdio.h>
+#include "../../IOHandler/IOHandler.h"
+#include "../../IOHandler/IOSockets.h"
+#include "../../IOHandler/IOLog.h"
+
+static IOSOCKET_CALLBACK(io_callback);
+static IOLOG_CALLBACK(io_log);
+
+static struct IOSocket *irc_iofd = NULL;
+
+int main(int argc, char *argv[]) {
+       iohandler_init();
+       
+    iolog_register_callback(io_log);
+    
+    irc_iofd = iosocket_connect("test.pk910.de", 80, 0, NULL, io_callback);
+       
+       iohandler_run();
+       
+       return 0;
+}
+
+static IOSOCKET_CALLBACK(io_callback) {
+    switch(event->type) {
+        case IOSOCKETEVENT_CONNECTED:
+            printf("[connect]\n");
+            iosocket_printf(event->socket, "GET / HTTP/1.1\r\n");
+            iosocket_printf(event->socket, "Host: test.pk910.de\r\n");
+            iosocket_printf(event->socket, "\r\n");
+            break;
+        case IOSOCKETEVENT_CLOSED:
+            printf("[disconnect]\n");
+            break;
+        case IOSOCKETEVENT_RECV:
+                       {
+                               struct IOSocketBuffer *recv_buf = event->data.recv_buf;
+                               int i;
+                               for(i = 0; i < recv_buf->bufpos; i++)
+                                       putchar(recv_buf->buffer[i]);
+                               recv_buf->bufpos = 0;
+                               printf("\n");
+            }
+            break;
+        
+        default:
+            break;
+    }
+}
+
+static IOLOG_CALLBACK(io_log) {
+       printf("%s", message);
+}
diff --git a/src/IOHandler_test/client_ssl/.gitignore b/src/IOHandler_test/client_ssl/.gitignore
new file mode 100644 (file)
index 0000000..7af2f69
--- /dev/null
@@ -0,0 +1,7 @@
+.deps
+.libs
+*.o
+*.exe
+iotest
+Makefile
+Makefile.in
diff --git a/src/IOHandler_test/client_ssl/Makefile.am b/src/IOHandler_test/client_ssl/Makefile.am
new file mode 100644 (file)
index 0000000..feda450
--- /dev/null
@@ -0,0 +1,8 @@
+##Process this file with automake to create Makefile.in
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_PROGRAMS = iotest
+iotest_LDADD = ../../IOHandler/libiohandler.la
+
+iotest_SOURCES = iotest.c
+
diff --git a/src/IOHandler_test/client_ssl/iotest.c b/src/IOHandler_test/client_ssl/iotest.c
new file mode 100644 (file)
index 0000000..867ca44
--- /dev/null
@@ -0,0 +1,69 @@
+/* main.c - IOMultiplexer
+ * Copyright (C) 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/>. 
+ */
+
+#include <stdio.h>
+#include "../../IOHandler/IOHandler.h"
+#include "../../IOHandler/IOSockets.h"
+#include "../../IOHandler/IOLog.h"
+
+static IOSOCKET_CALLBACK(io_callback);
+static IOLOG_CALLBACK(io_log);
+
+static struct IOSocket *irc_iofd = NULL;
+
+int main(int argc, char *argv[]) {
+       iohandler_init();
+       
+    iolog_register_callback(io_log);
+    
+    irc_iofd = iosocket_connect("test.pk910.de", 443, 1, NULL, io_callback);
+       
+       iohandler_run();
+       
+       return 0;
+}
+
+static IOSOCKET_CALLBACK(io_callback) {
+    switch(event->type) {
+        case IOSOCKETEVENT_CONNECTED:
+            printf("[connect]\n");
+            iosocket_printf(event->socket, "GET / HTTP/1.1\r\n");
+            iosocket_printf(event->socket, "Host: test.pk910.de\r\n");
+            iosocket_printf(event->socket, "\r\n");
+            break;
+        case IOSOCKETEVENT_CLOSED:
+            printf("[disconnect]\n");
+            break;
+        case IOSOCKETEVENT_RECV:
+                       {
+                               struct IOSocketBuffer *recv_buf = event->data.recv_buf;
+                               int i;
+                               for(i = 0; i < recv_buf->bufpos; i++)
+                                       putchar(recv_buf->buffer[i]);
+                               recv_buf->bufpos = 0;
+                               printf("\n");
+            }
+            break;
+        
+        default:
+            break;
+    }
+}
+
+static IOLOG_CALLBACK(io_log) {
+       printf("%s", message);
+}
diff --git a/src/IOHandler_test/server_ssl/.gitignore b/src/IOHandler_test/server_ssl/.gitignore
new file mode 100644 (file)
index 0000000..7af2f69
--- /dev/null
@@ -0,0 +1,7 @@
+.deps
+.libs
+*.o
+*.exe
+iotest
+Makefile
+Makefile.in
diff --git a/src/IOHandler_test/server_ssl/Makefile.am b/src/IOHandler_test/server_ssl/Makefile.am
new file mode 100644 (file)
index 0000000..feda450
--- /dev/null
@@ -0,0 +1,8 @@
+##Process this file with automake to create Makefile.in
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_PROGRAMS = iotest
+iotest_LDADD = ../../IOHandler/libiohandler.la
+
+iotest_SOURCES = iotest.c
+
diff --git a/src/IOHandler_test/server_ssl/cert.pem b/src/IOHandler_test/server_ssl/cert.pem
new file mode 100644 (file)
index 0000000..1880073
--- /dev/null
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDRTCCAi2gAwIBAgIJAI5TbbwUS+BqMA0GCSqGSIb3DQEBBQUAMDkxCzAJBgNV
+BAYTAkRFMRAwDgYDVQQIEwdHZXJtYW55MRgwFgYDVQQKEw9wazkxMCB0ZXN0IGNv
+ZGUwHhcNMTQwMzE2MTUyNzI3WhcNMjQwMzEzMTUyNzI3WjA5MQswCQYDVQQGEwJE
+RTEQMA4GA1UECBMHR2VybWFueTEYMBYGA1UEChMPcGs5MTAgdGVzdCBjb2RlMIIB
+IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2OrxJhpfcJKkXDWeCSdF5KS
+zOeCNg/kehycUjhvVhwmzTC72Jk4OlRxadANhKaMooyfkqqymwhZ8+7qCL76N6e3
+Yefr0EThaG09UerwFrnGQtwoM/F2F7CnZh8+FonvsI2/4BBWCpmWisixF7uCj+e9
+rQlbsmtzQVg7Vbvv99FdBehiWEb2HoxXnC3ve2+fy7tBRvQ19qBXsTGnjZbmv6MU
++ige+9Iv/4P8ojag6Njr1cuLTbUgL5s1VVSTbSS+7hW+xmG6S5IuPz3y1IXIRsmy
+sf2+vS2CcwxkwNxSvwrFqsJYsEq/N+sQ8rV9Onlna9k4vDYjMPzBwW/xSkph8wID
+AQABo1AwTjAdBgNVHQ4EFgQUhWrijLfZ4XTPHczZ2PveFqiUp3QwHwYDVR0jBBgw
+FoAUhWrijLfZ4XTPHczZ2PveFqiUp3QwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B
+AQUFAAOCAQEAINpTUpUOH/AMEEDAUa4mZ8tRK+30PT3WEc+pcLSmaD5BsdbOJ4yL
+mNmdzmfu1yek42GNe5ASmIZH9DK8WqT9CDJxWi1PzUpYhGmm3el683biK+/CHOJf
+iYry7VSvYJJkpzCNJPpL6gr0PCTlBRJrgTs4qAliJvXJ394YPd/EtUN3VaqC+4WY
+FWlZaVhf+GV3U38F16mmX5K3vNAZEEKLWQhApOjvvAeJRVAcONI025KUp19IZjw3
+sXKMN1PuCvuWz8Wlff4xgO3VgnshXn51KhGfasK4KVD6yWFfG6noBZ9lH5EuaqJr
+VjrOdMP0cUP2vKv3bswfV4rVy1fJz3g+Sw==
+-----END CERTIFICATE-----
diff --git a/src/IOHandler_test/server_ssl/iotest.c b/src/IOHandler_test/server_ssl/iotest.c
new file mode 100644 (file)
index 0000000..37b5dc1
--- /dev/null
@@ -0,0 +1,84 @@
+/* main.c - IOMultiplexer
+ * Copyright (C) 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/>. 
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "../../IOHandler/IOHandler.h"
+#include "../../IOHandler/IOSockets.h"
+#include "../../IOHandler/IOLog.h"
+
+#define CERTFILE "cert.pem"
+#define KEYFILE "key.pen"
+
+static IOSOCKET_CALLBACK(io_callback);
+static IOLOG_CALLBACK(io_log);
+
+static struct IOSocket *irc_iofd = NULL;
+
+int main(int argc, char *argv[]) {
+       iohandler_init();
+       
+    iolog_register_callback(io_log);
+    
+    irc_iofd = iosocket_listen_ssl("0.0.0.0", 12345, CERTFILE, KEYFILE, io_callback);
+       
+       iohandler_run();
+       
+       return 0;
+}
+
+static IOSOCKET_CALLBACK(io_callback) {
+    switch(event->type) {
+        case IOSOCKETEVENT_ACCEPT:
+            printf("[client accepted]\n");
+                       struct IOSocket *client = event->data.accept_socket;
+                       client->callback = io_callback;
+                       
+                       char *html = "<html><head><title>Test Page</title></head><body><h1>IOHandler SSL Test</h1></body></html>";
+            iosocket_printf(client, "HTTP/1.1 200 OK\r\n");
+                       iosocket_printf(client, "Server: Apache\r\n");
+                       iosocket_printf(client, "Content-Length: %d\r\n", strlen(html));
+                       iosocket_printf(client, "Content-Type: text/html\r\n");
+                       iosocket_printf(client, "\r\n");
+                       iosocket_printf(client, "%s", html);
+                       
+            break;
+        case IOSOCKETEVENT_CLOSED:
+                       if(event->socket->listening)
+                               printf("[server closed]\n");
+                       else
+                               printf("[client disconnect]\n");
+            break;
+        case IOSOCKETEVENT_RECV:
+                       {
+                               struct IOSocketBuffer *recv_buf = event->data.recv_buf;
+                               int i;
+                               for(i = 0; i < recv_buf->bufpos; i++)
+                                       putchar(recv_buf->buffer[i]);
+                               recv_buf->bufpos = 0;
+                               printf("\n");
+            }
+            break;
+        
+        default:
+            break;
+    }
+}
+
+static IOLOG_CALLBACK(io_log) {
+       printf("%s", message);
+}
diff --git a/src/IOHandler_test/server_ssl/key.pem b/src/IOHandler_test/server_ssl/key.pem
new file mode 100644 (file)
index 0000000..59572e4
--- /dev/null
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCbY6vEmGl9wkqR
+cNZ4JJ0XkpLM54I2D+R6HJxSOG9WHCbNMLvYmTg6VHFp0A2EpoyijJ+SqrKbCFnz
+7uoIvvo3p7dh5+vQROFobT1R6vAWucZC3Cgz8XYXsKdmHz4Wie+wjb/gEFYKmZaK
+yLEXu4KP572tCVuya3NBWDtVu+/30V0F6GJYRvYejFecLe97b5/Lu0FG9DX2oFex
+MaeNlua/oxT6KB770i//g/yiNqDo2OvVy4tNtSAvmzVVVJNtJL7uFb7GYbpLki4/
+PfLUhchGybKx/b69LYJzDGTA3FK/CsWqwliwSr836xDytX06eWdr2Ti8NiMw/MHB
+b/FKSmHzAgMBAAECggEAHHHxdqqj3QadGeS7DgE91JvbTbEvj+/21je4kgCMuQms
+PLGoIW1i8qKUpFcWsmq+od72MyYWTfUIanQY2YMEUP3dvwlyjIyfartcl0tXqgFV
+/tVIcsHH6WxIKJSdjAiyHPLF5iF3brdQ7JTyfjKwIuG8QhnNdGrhDVw2eGpP8mBT
+DRL8qX1KrAvZLGzDq19kX4o49oPfq+eXXZVB+xgAmyT+YtD4tVi0fvDW5J6nET3s
+/qxvx5No35HD3f1V9Xjth4DRIr2eUDqTVVqZ2sTMGF4kbDcdxZl4iOORJO2VhcQC
+UUXxt038NkHAom0vT6GFJQbPLb6b8obBxz2KyYp7AQKBgQDJ3O9kEOGtaymojkq1
+y1MEyYLyk0FCdjCTMcbK8A3455ZyhQiNKNiDcZy9WUaZBppDpSJ1RjCaUL+4QX51
+BbK18W1YO2INR/DMhyZEmLnPbqubqoVLIGz/LBW44BPwz8jjvZT13yiFL0Afa4xi
+vRvdYAju+f28rmpswtvG3Im3gQKBgQDFEAxaY0PSTnwzPdDJZqQyYvpkqj/eJXxP
+FrH+LHC3Ug0SRrQ/C223kpc1m9OivaCz/7jCozjNws4Dus6hRzn6d6r4ChjatBqC
+Y97EE5SvvAJrDaA6J0GQ8paaoDe9TJ+/4qFiG4FdYwmrCuNU5cdypbWGaaXlTTBG
+OmfSyf5zcwKBgBwWeNzkmHJH6fkBK5YWH4wX+feE09zKk0G3+GA+fMM4fi+bITB7
+EX1grp2OMYuTZp2o+Z110cd3GuYpfs4Lp+03Fa7kPGV6sB/VYlbDJX+ed5Rmaruk
+XGY5HSCnVT75uost0u9PSNUXWQXGMjd+9sSb20JdWJgLcNWHW4tVHniBAoGBAJh0
+l/n9veSgT7oc4sBNpk5NAMaMaCjm+0r8leu8Wd+ZnP88sAnuP4273TveOFc5OXDI
+MBp0yGd3hIaiKWXggtxhZGXM+fmJSNEDjr5HH8rtOzmzKviSkkkfRKCPv0+2TgjX
+vl72RJkJG9u16rYtpqXtyYgZh/zkQKq0WMpc93w9AoGALWfwrj5eSDi5EDWbjgBF
+zm87FoDcIvMDpTsw4xA/o9JpDLLVdsJYf/uwLPDUkMHWy0w2dioQu+VoLu480l1K
+27a3jvIIWClV3xVulm9abLY//79eARDG+bwXC30e7z6wduw8LtJsOfWD9nFd9ggt
+rT1g4c/bHYflEb2MieXZ4UQ=
+-----END PRIVATE KEY-----
diff --git a/src/IOHandler_test/socket++/.gitignore b/src/IOHandler_test/socket++/.gitignore
deleted file mode 100644 (file)
index 7af2f69..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-*.o
-*.exe
-iotest
-Makefile
-Makefile.in
diff --git a/src/IOHandler_test/socket++/Makefile.am b/src/IOHandler_test/socket++/Makefile.am
deleted file mode 100644 (file)
index 0591fea..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-##Process this file with automake to create Makefile.in
-ACLOCAL_AMFLAGS = -I m4
-
-noinst_PROGRAMS = iotest
-
-iotest_LDADD = ../../IOHandler++/libiohandler.cpp.la
-iotest_SOURCES = iotest.cpp
diff --git a/src/IOHandler_test/socket++/iotest.cpp b/src/IOHandler_test/socket++/iotest.cpp
deleted file mode 100644 (file)
index 151ce0d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* main.c - IOMultiplexer
- * Copyright (C) 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/>. 
- */
-
-#include <stdio.h>
-#include "../../IOHandler++/IOHandler.h"
-#include "../../IOHandler++/IOSocket.h"
-
-class IOTestSocket : public CIOSocket {
-protected:
-       virtual void connectedEvent() {
-               printf("[connect]\n");
-               this->writef("GET / HTTP/1.1\r\n");
-               this->writef("Host: test.pk910.de\r\n");
-               this->writef("\r\n");
-       };
-       virtual void notConnectedEvent(int errid) {
-               printf("[not connected]\n");
-       };
-       virtual void closedEvent(int errid) {
-               printf("[disconnect]\n");
-       };
-       virtual void acceptedEvent(CIOSocket *client) {
-               client->close(); 
-       };
-       virtual void dnsErrEvent(std::string *errormsg) {
-       
-       };
-       virtual int recvEvent(const char *data, int len) {
-               int i;
-               for(i = 0; i < len; i++)
-                       putchar(data[i]);
-               return len;
-       };
-};
-
-
-int main(int argc, char *argv[]) {
-       CIOHandler *iohandler = new CIOHandler();
-       IOTestSocket *sock = new IOTestSocket();
-       sock->connect("test.pk910.de", 443, 1, NULL);
-       
-       iohandler->start();
-}
diff --git a/src/IOHandler_test/socket/.gitignore b/src/IOHandler_test/socket/.gitignore
deleted file mode 100644 (file)
index 7af2f69..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-*.o
-*.exe
-iotest
-Makefile
-Makefile.in
diff --git a/src/IOHandler_test/socket/Makefile.am b/src/IOHandler_test/socket/Makefile.am
deleted file mode 100644 (file)
index feda450..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-##Process this file with automake to create Makefile.in
-ACLOCAL_AMFLAGS = -I m4
-
-noinst_PROGRAMS = iotest
-iotest_LDADD = ../../IOHandler/libiohandler.la
-
-iotest_SOURCES = iotest.c
-
diff --git a/src/IOHandler_test/socket/iotest.c b/src/IOHandler_test/socket/iotest.c
deleted file mode 100644 (file)
index 867ca44..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* main.c - IOMultiplexer
- * Copyright (C) 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/>. 
- */
-
-#include <stdio.h>
-#include "../../IOHandler/IOHandler.h"
-#include "../../IOHandler/IOSockets.h"
-#include "../../IOHandler/IOLog.h"
-
-static IOSOCKET_CALLBACK(io_callback);
-static IOLOG_CALLBACK(io_log);
-
-static struct IOSocket *irc_iofd = NULL;
-
-int main(int argc, char *argv[]) {
-       iohandler_init();
-       
-    iolog_register_callback(io_log);
-    
-    irc_iofd = iosocket_connect("test.pk910.de", 443, 1, NULL, io_callback);
-       
-       iohandler_run();
-       
-       return 0;
-}
-
-static IOSOCKET_CALLBACK(io_callback) {
-    switch(event->type) {
-        case IOSOCKETEVENT_CONNECTED:
-            printf("[connect]\n");
-            iosocket_printf(event->socket, "GET / HTTP/1.1\r\n");
-            iosocket_printf(event->socket, "Host: test.pk910.de\r\n");
-            iosocket_printf(event->socket, "\r\n");
-            break;
-        case IOSOCKETEVENT_CLOSED:
-            printf("[disconnect]\n");
-            break;
-        case IOSOCKETEVENT_RECV:
-                       {
-                               struct IOSocketBuffer *recv_buf = event->data.recv_buf;
-                               int i;
-                               for(i = 0; i < recv_buf->bufpos; i++)
-                                       putchar(recv_buf->buffer[i]);
-                               recv_buf->bufpos = 0;
-                               printf("\n");
-            }
-            break;
-        
-        default:
-            break;
-    }
-}
-
-static IOLOG_CALLBACK(io_log) {
-       printf("%s", message);
-}