src/server/daemon/sessionhandler.h

changeset 106
b122f34ddc80
parent 78
3578977d29a3
child 114
c3a0f1275d71
equal deleted inserted replaced
105:63d9051fe35c 106:b122f34ddc80
31 31
32 #include "../util/thrpool.h" 32 #include "../util/thrpool.h"
33 #include "../public/nsapi.h" 33 #include "../public/nsapi.h"
34 #include "event.h" 34 #include "event.h"
35 35
36 #include <openssl/bio.h>
37 #include <openssl/ssl.h>
38 #include <openssl/err.h>
39
36 #ifdef __cplusplus 40 #ifdef __cplusplus
37 extern "C" { 41 extern "C" {
38 #endif 42 #endif
39 43
40 typedef struct _session_handler SessionHandler; 44 typedef struct _session_handler SessionHandler;
43 struct _connection { 47 struct _connection {
44 int fd; 48 int fd;
45 struct sockaddr_in address; 49 struct sockaddr_in address;
46 HttpListener *listener; 50 HttpListener *listener;
47 SessionHandler *session_handler; 51 SessionHandler *session_handler;
52 SSL *ssl;
53 int (*read)(Connection *conn, void *buf, int len);
54 int (*write)(Connection *conn, const void *buf, int len);
55 void (*close)(Connection *conn);
48 }; 56 };
49 57
50 typedef void(*enqueue_connection_f)(SessionHandler*, Connection*); 58 typedef void(*enqueue_connection_f)(SessionHandler*, Connection*);
51 typedef void(*keep_alive_f)(SessionHandler*, Connection*); 59 typedef void(*keep_alive_f)(SessionHandler*, Connection*);
52 struct _session_handler { 60 struct _session_handler {
91 * EventHttpIO 99 * EventHttpIO
92 * 100 *
93 * defined in sesionhandler.c 101 * defined in sesionhandler.c
94 */ 102 */
95 103
104 int connection_read(Connection *conn, void *buf, int len);
105 int connection_write(Connection *conn, const void *buf, int len);
106 void connection_close(Connection *conn);
107 int connection_ssl_read(Connection *conn, void *buf, int len);
108 int connection_ssl_write(Connection *conn, const void *buf, int len);
109 void connection_ssl_close(Connection *conn);
110
96 111
97 SessionHandler* create_basic_session_handler(); 112 SessionHandler* create_basic_session_handler();
98 113
99 void basic_enq_conn(SessionHandler *handler, Connection *conn); 114 void basic_enq_conn(SessionHandler *handler, Connection *conn);
100 115

mercurial