aboutsummaryrefslogtreecommitdiff
path: root/src/examples/mhd2spdy_structures.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/mhd2spdy_structures.h')
-rw-r--r--src/examples/mhd2spdy_structures.h72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/examples/mhd2spdy_structures.h b/src/examples/mhd2spdy_structures.h
index 6d6d9769..88c28c64 100644
--- a/src/examples/mhd2spdy_structures.h
+++ b/src/examples/mhd2spdy_structures.h
@@ -49,23 +49,32 @@
49#include <spdylay/spdylay.h> 49#include <spdylay/spdylay.h>
50#include <getopt.h> 50#include <getopt.h>
51 51
52
53/* WANT_READ if SSL connection needs more input; or WANT_WRITE if it
54 needs more output; or IO_NONE. This is necessary because SSL/TLS
55 re-negotiation is possible at any time. Spdylay API offers
56 similar functions like spdylay_session_want_read() and
57 spdylay_session_want_write() but they do not take into account
58 SSL connection. */
59enum
60{
61 IO_NONE,
62 WANT_READ,
63 WANT_WRITE
64};
65
66
52struct Proxy; 67struct Proxy;
53 68
69
54struct SPDY_Connection { 70struct SPDY_Connection {
55 SSL *ssl; 71 SSL *ssl;
56 //SSL_CTX *ssl_ctx;
57 spdylay_session *session; 72 spdylay_session *session;
58 struct SPDY_Connection *prev; 73 struct SPDY_Connection *prev;
59 struct SPDY_Connection *next; 74 struct SPDY_Connection *next;
60 struct Proxy *proxies_head; 75 struct Proxy *proxies_head;
61 struct Proxy *proxies_tail; 76 struct Proxy *proxies_tail;
62 char *host; 77 char *host;
63 /* WANT_READ if SSL connection needs more input; or WANT_WRITE if it
64 needs more output; or IO_NONE. This is necessary because SSL/TLS
65 re-negotiation is possible at any time. Spdylay API offers
66 similar functions like spdylay_session_want_read() and
67 spdylay_session_want_write() but they do not take into account
68 SSL connection. */
69 int fd; 78 int fd;
70 int want_io; 79 int want_io;
71 uint counter; 80 uint counter;
@@ -79,7 +88,6 @@ struct URI
79 char * full_uri; 88 char * full_uri;
80 char * scheme; 89 char * scheme;
81 char * host_and_port; 90 char * host_and_port;
82 //char * host_and_port_for_connecting;
83 char * host; 91 char * host;
84 char * path; 92 char * path;
85 char * path_and_more; 93 char * path_and_more;
@@ -88,26 +96,21 @@ struct URI
88 uint16_t port; 96 uint16_t port;
89}; 97};
90 98
99
91struct HTTP_URI; 100struct HTTP_URI;
92 101
102
93struct Proxy 103struct Proxy
94{ 104{
95 struct MHD_Connection *http_connection; 105 struct MHD_Connection *http_connection;
96 struct MHD_Response *http_response; 106 struct MHD_Response *http_response;
97 struct URI *uri; 107 struct URI *uri;
98 struct HTTP_URI *http_uri; //TODO remove me 108 struct HTTP_URI *http_uri;
99 struct SPDY_Connection *spdy_connection; 109 struct SPDY_Connection *spdy_connection;
100 struct Proxy *next; 110 struct Proxy *next;
101 struct Proxy *prev; 111 struct Proxy *prev;
102 //char *path;
103 char *url; 112 char *url;
104 //struct SPDY_Request *request;
105 //struct SPDY_Response *response;
106 //CURL *curl_handle;
107 //struct curl_slist *curl_headers;
108 //struct SPDY_NameValue *headers;
109 char *version; 113 char *version;
110 //char *status_msg;
111 void *http_body; 114 void *http_body;
112 size_t http_body_size; 115 size_t http_body_size;
113 ssize_t length; 116 ssize_t length;
@@ -126,6 +129,7 @@ struct HTTP_URI
126 struct Proxy * proxy; 129 struct Proxy * proxy;
127}; 130};
128 131
132
129struct SPDY_Headers 133struct SPDY_Headers
130{ 134{
131 const char **nv; 135 const char **nv;
@@ -133,6 +137,7 @@ struct SPDY_Headers
133 int cnt; 137 int cnt;
134}; 138};
135 139
140
136struct global_options 141struct global_options
137{ 142{
138 char *spdy2http_str; 143 char *spdy2http_str;
@@ -150,24 +155,9 @@ struct global_options
150 bool verbose; 155 bool verbose;
151 bool only_proxy; 156 bool only_proxy;
152 bool spdy_data_received; 157 bool spdy_data_received;
153} glob_opt; 158}
154 159glob_opt;
155/*
156
157#define SOCK_ADDR_IN_PTR(sa) ((struct sockaddr_in *)(sa))
158#define SOCK_ADDR_IN_FAMILY(sa) SOCK_ADDR_IN_PTR(sa)->sin_family
159#define SOCK_ADDR_IN_PORT(sa) SOCK_ADDR_IN_PTR(sa)->sin_port
160#define SOCK_ADDR_IN_ADDR(sa) SOCK_ADDR_IN_PTR(sa)->sin_addr
161 160
162#ifdef HAS_IPV6
163
164#define SOCK_ADDR_IN6_PTR(sa) ((struct sockaddr_in6 *)(sa))
165#define SOCK_ADDR_IN6_FAMILY(sa) SOCK_ADDR_IN6_PTR(sa)->sin6_family
166#define SOCK_ADDR_IN6_PORT(sa) SOCK_ADDR_IN6_PTR(sa)->sin6_port
167#define SOCK_ADDR_IN6_ADDR(sa) SOCK_ADDR_IN6_PTR(sa)->sin6_addr
168
169#endif
170*/
171 161
172//forbidden headers 162//forbidden headers
173#define SPDY_HTTP_HEADER_TRANSFER_ENCODING "transfer-encoding" 163#define SPDY_HTTP_HEADER_TRANSFER_ENCODING "transfer-encoding"
@@ -177,6 +167,7 @@ struct global_options
177 167
178#define MAX_SPDY_CONNECTIONS 100 168#define MAX_SPDY_CONNECTIONS 100
179 169
170#define SPDY_MAX_OUTLEN 4096
180 171
181/** 172/**
182 * Insert an element at the head of a DLL. Assumes that head, tail and 173 * Insert an element at the head of a DLL. Assumes that head, tail and
@@ -251,18 +242,27 @@ struct global_options
251void 242void
252free_uri(struct URI * uri); 243free_uri(struct URI * uri);
253 244
245
254int 246int
255init_parse_uri(regex_t * preg); 247init_parse_uri(regex_t * preg);
256 248
249
257void 250void
258deinit_parse_uri(regex_t * preg); 251deinit_parse_uri(regex_t * preg);
259 252
253
260int 254int
261parse_uri(regex_t * preg, char * full_uri, struct URI ** uri); 255parse_uri(regex_t * preg,
256 char * full_uri,
257 struct URI ** uri);
258
262 259
263void 260void
264free_proxy(struct Proxy *proxy); 261free_proxy(struct Proxy *proxy);
265 262
266void *au_malloc(size_t size); 263
264void *
265au_malloc(size_t size);
266
267 267
268#endif 268#endif