30 #define HTTPLISTENER_H |
30 #define HTTPLISTENER_H |
31 |
31 |
32 #include "sessionhandler.h" |
32 #include "sessionhandler.h" |
33 #include "threadpools.h" |
33 #include "threadpools.h" |
34 #include "config.h" |
34 #include "config.h" |
|
35 #include "../util/systems.h" |
|
36 |
|
37 #include <openssl/bio.h> |
|
38 #include <openssl/ssl.h> |
|
39 #include <openssl/err.h> |
35 |
40 |
36 #ifdef __cplusplus |
41 #ifdef __cplusplus |
37 extern "C" { |
42 extern "C" { |
38 #endif |
43 #endif |
39 |
44 |
40 /* HttpListener typedef in nsapi.h */ |
45 /* HttpListener typedef in nsapi.h */ |
41 typedef struct _acceptor Acceptor; |
46 typedef struct _acceptor Acceptor; |
42 typedef struct _listener_config ListenerConfig; |
47 typedef struct _listener_config ListenerConfig; |
|
48 typedef struct _http_ssl HttpSSL; |
|
49 |
|
50 |
43 |
51 |
44 |
52 |
45 union vs { |
53 union vs { |
46 VirtualServer *vs; |
54 VirtualServer *vs; |
47 char *vs_name; |
55 char *vs_name; |
71 threadpool_t *threadpool; |
83 threadpool_t *threadpool; |
72 HttpListener *next; |
84 HttpListener *next; |
73 Acceptor **acceptors; |
85 Acceptor **acceptors; |
74 int nacceptors; |
86 int nacceptors; |
75 int running; |
87 int running; |
|
88 HttpSSL *ssl; |
76 uint32_t ref; // reference counter |
89 uint32_t ref; // reference counter |
|
90 }; |
|
91 |
|
92 struct _http_ssl { |
|
93 unsigned char *cert; |
|
94 size_t certlen; |
|
95 unsigned char *privkey; |
|
96 size_t privkeylen; |
|
97 unsigned char *chain; |
|
98 size_t chainlen; |
|
99 |
|
100 SSL_CTX *sslctx; |
|
101 |
|
102 // TODO: ssl/tls cipher, ... config |
77 }; |
103 }; |
78 |
104 |
79 int start_all_listener(); |
105 int start_all_listener(); |
80 |
106 |
81 HttpListener* http_listener_create(ListenerConfig *conf); |
107 HttpListener* http_listener_create(ListenerConfig *conf); |