aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/plugin_transport_http.h202
1 files changed, 156 insertions, 46 deletions
diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h
index fd4364b8f..11584553a 100644
--- a/src/transport/plugin_transport_http.h
+++ b/src/transport/plugin_transport_http.h
@@ -67,13 +67,19 @@
67struct Plugin 67struct Plugin
68{ 68{
69 /** 69 /**
70 * General handles
71 * ---------------
72 */
73
74 /**
70 * Our environment. 75 * Our environment.
71 */ 76 */
72 struct GNUNET_TRANSPORT_PluginEnvironment *env; 77 struct GNUNET_TRANSPORT_PluginEnvironment *env;
73 78
74 /** 79 /**
75 * List of open sessions. 80 * Linked list of open sessions.
76 */ 81 */
82
77 struct Session *head; 83 struct Session *head;
78 84
79 struct Session *tail; 85 struct Session *tail;
@@ -83,72 +89,155 @@ struct Plugin
83 */ 89 */
84 struct GNUNET_NAT_Handle *nat; 90 struct GNUNET_NAT_Handle *nat;
85 91
92 /**
93 * List of own addresses
94 */
86 95
87 /** 96 /**
88 * ipv4 DLL head 97 * IPv4 addresses DLL head
89 */ 98 */
90 struct IPv4HttpAddressWrapper *ipv4_addr_head; 99 struct IPv4HttpAddressWrapper *ipv4_addr_head;
91 100
92 /** 101 /**
93 * ipv4 DLL tail 102 * IPv4 addresses DLL tail
94 */ 103 */
95 struct IPv4HttpAddressWrapper *ipv4_addr_tail; 104 struct IPv4HttpAddressWrapper *ipv4_addr_tail;
96 105
97 /** 106 /**
98 * ipv6 DLL head 107 * IPv6 addresses DLL head
99 */ 108 */
100 struct IPv6HttpAddressWrapper *ipv6_addr_head; 109 struct IPv6HttpAddressWrapper *ipv6_addr_head;
101 110
102 /** 111 /**
103 * ipv6 DLL tail 112 * IPv6 addresses DLL tail
104 */ 113 */
105 struct IPv6HttpAddressWrapper *ipv6_addr_tail; 114 struct IPv6HttpAddressWrapper *ipv6_addr_tail;
106 115
116 /**
117 * Plugin configuration
118 * --------------------
119 */
107 120
108 /* Plugin configuration */ 121 /**
109 122 * Plugin name
123 * Equals configuration section: transport-http, transport-https
124 */
110 char *name; 125 char *name;
111 126
127 /**
128 * Plugin protocol
129 * http, https
130 */
112 char *protocol; 131 char *protocol;
113 132
133 /**
134 * Use IPv4?
135 * GNUNET_YES or GNUNET_NO
136 */
114 int ipv4; 137 int ipv4;
115 138
139 /**
140 * Use IPv6?
141 * GNUNET_YES or GNUNET_NO
142 */
116 int ipv6; 143 int ipv6;
117 144
145 /**
146 * Port used
147 */
118 uint16_t port; 148 uint16_t port;
119 149
150 /**
151 * Maximum number of sockets the plugin can use
152 * Each http inbound /outbound connections are two connections
153 */
120 int max_connections; 154 int max_connections;
121 155
156 /**
157 * Plugin HTTPS SSL/TLS options
158 * ----------------------------
159 */
122 160
161 /**
162 * libCurl TLS crypto init string, can be set to enhance performance
163 *
164 * Example:
165 *
166 * Use RC4-128 instead of AES:
167 * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
168 *
169 */
170 char *crypto_init;
171
172 /**
173 * TLS key
174 */
175 char *key;
123 176
124 /* Plugin values */ 177 /**
178 * TLS certificate
179 */
180 char *cert;
125 181
182 /**
183 * Plugin values
184 * -------------
185 */
126 186
187 /**
188 * Current number of establishes connections
189 */
127 int cur_connections; 190 int cur_connections;
191
192 /**
193 * Last used unique HTTP connection tag
194 */
128 uint32_t last_tag; 195 uint32_t last_tag;
129 /* 196
197 /**
130 * Server handles 198 * Server handles
199 * --------------
131 */ 200 */
132 201
202 /**
203 * MHD IPv4 daemon
204 */
133 struct MHD_Daemon *server_v4; 205 struct MHD_Daemon *server_v4;
206
207 /**
208 * MHD IPv4 task
209 */
134 GNUNET_SCHEDULER_TaskIdentifier server_v4_task; 210 GNUNET_SCHEDULER_TaskIdentifier server_v4_task;
135 211
212 /**
213 * MHD IPv6 daemon
214 */
136 struct MHD_Daemon *server_v6; 215 struct MHD_Daemon *server_v6;
216
217 /**
218 * MHD IPv4 task
219 */
137 GNUNET_SCHEDULER_TaskIdentifier server_v6_task; 220 GNUNET_SCHEDULER_TaskIdentifier server_v6_task;
138 221
222 /**
223 * IPv4 server socket to bind to
224 */
139 struct sockaddr_in * server_addr_v4; 225 struct sockaddr_in * server_addr_v4;
140 struct sockaddr_in6 * server_addr_v6;
141 226
142 char *crypto_init; 227 /**
143 char *key; 228 * IPv6 server socket to bind to
144 char *cert; 229 */
230 struct sockaddr_in6 * server_addr_v6;
145 231
232 /**
233 * Server semi connections
234 * A full session consists of 2 semi-connections: send and receive
235 * If not both directions are established the server keeps this sessions here
236 */
146 struct Session *server_semi_head; 237 struct Session *server_semi_head;
147 238
148 struct Session *server_semi_tail; 239 struct Session *server_semi_tail;
149 240
150
151
152 /* 241 /*
153 * Client handles 242 * Client handles
154 */ 243 */
@@ -158,6 +247,9 @@ struct Plugin
158 */ 247 */
159 CURLM *client_mh; 248 CURLM *client_mh;
160 249
250 /**
251 * curl perform task
252 */
161 GNUNET_SCHEDULER_TaskIdentifier client_perform_task; 253 GNUNET_SCHEDULER_TaskIdentifier client_perform_task;
162 254
163}; 255};
@@ -184,6 +276,21 @@ struct Session
184 struct Plugin *plugin; 276 struct Plugin *plugin;
185 277
186 /** 278 /**
279 * Address
280 */
281 void *addr;
282
283 /**
284 * Address length
285 */
286 size_t addrlen;
287
288 /**
289 * To whom are we talking to
290 */
291 struct GNUNET_PeerIdentity target;
292
293 /**
187 * next pointer for double linked list 294 * next pointer for double linked list
188 */ 295 */
189 struct HTTP_Message *msg_head; 296 struct HTTP_Message *msg_head;
@@ -195,63 +302,66 @@ struct Session
195 302
196 303
197 /** 304 /**
198 * message stream tokenizer for incoming data 305 * Message stream tokenizer for incoming data
199 */ 306 */
200 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk; 307 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk;
201 308
202 /** 309 /**
203 * Continuation function to call once the transmission buffer 310 * Absolute time when to receive data again
204 * has again space available. NULL if there is no 311 * Used for receive throttling
205 * continuation to call.
206 */ 312 */
207 GNUNET_TRANSPORT_TransmitContinuation transmit_cont; 313 struct GNUNET_TIME_Absolute next_receive;
208
209
210 void *addr;
211
212 size_t addrlen;
213 314
214 /** 315 /**
215 * Closure for transmit_cont. 316 * Inbound or outbound connection
317 * Outbound: GNUNET_NO (client is used to send and receive)
318 * Inbound : GNUNET_YES (server is used to send and receive)
216 */ 319 */
217 void *transmit_cont_cls; 320 int inbound;
218 321
219 /** 322 /**
220 * To whom are we talking to (set to our identity 323 * Unique HTTP/S connection tag for this connection
221 * if we are still waiting for the welcome message)
222 */ 324 */
223 struct GNUNET_PeerIdentity target; 325 uint32_t tag;
224 326
225 /** 327 /**
226 * At what time did we reset last_received last? 328 * Client handles
227 */ 329 */
228 //struct GNUNET_TIME_Absolute last_quota_update;
229 330
230 /** 331 /**
231 * How many bytes have we received since the "last_quota_update" 332 * Client send handle
232 * timestamp?
233 */ 333 */
234 //uint64_t last_received; 334 void *client_put;
235 335
236 /** 336 /**
237 * Number of bytes per ms that this peer is allowed 337 * Client receive handle
238 * to send to us.
239 */ 338 */
240 //uint32_t quota; 339 void *client_get;
241
242 340
243 int inbound; 341 /**
342 * Task to wake up client receive handle when receiving is allowed again
343 */
344 GNUNET_SCHEDULER_TaskIdentifier recv_wakeup_task;
244 345
245 void *client_put; 346 /**
246 void *client_get; 347 * Is client send handle paused since there are no data to send?
348 * GNUNET_YES/NO
349 */
247 int client_put_paused; 350 int client_put_paused;
248 351
352 /**
353 * Server handles
354 */
355
356 /**
357 * Client send handle
358 */
249 void *server_recv; 359 void *server_recv;
250 void *server_send;
251 struct GNUNET_TIME_Absolute next_receive;
252 GNUNET_SCHEDULER_TaskIdentifier recv_wakeup_task;
253 uint32_t tag;
254 360
361 /**
362 * Client send handle
363 */
364 void *server_send;
255}; 365};
256 366
257/** 367/**