aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_http.h')
-rw-r--r--src/transport/plugin_transport_http.h140
1 files changed, 66 insertions, 74 deletions
diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h
index ae0c784ee..d43eb9bab 100644
--- a/src/transport/plugin_transport_http.h
+++ b/src/transport/plugin_transport_http.h
@@ -69,21 +69,18 @@
69struct Plugin 69struct Plugin
70{ 70{
71 /** 71 /**
72 * General handles
73 * ---------------
74 */
75
76 /**
77 * Our environment. 72 * Our environment.
78 */ 73 */
79 struct GNUNET_TRANSPORT_PluginEnvironment *env; 74 struct GNUNET_TRANSPORT_PluginEnvironment *env;
80 75
81 /** 76 /**
82 * Linked list of open sessions. 77 * Head of linked list of open sessions.
83 */ 78 */
84
85 struct Session *head; 79 struct Session *head;
86 80
81 /**
82 * Tail of linked list of open sessions.
83 */
87 struct Session *tail; 84 struct Session *tail;
88 85
89 /** 86 /**
@@ -92,25 +89,15 @@ struct Plugin
92 struct GNUNET_NAT_Handle *nat; 89 struct GNUNET_NAT_Handle *nat;
93 90
94 /** 91 /**
95 * List of own addresses 92 * Our own IPv4 addresses DLL head
96 */
97
98 /**
99 * IPv4 addresses DLL head
100 */ 93 */
101 struct HttpAddressWrapper *addr_head; 94 struct HttpAddressWrapper *addr_head;
102 95
103 /** 96 /**
104 * IPv4 addresses DLL tail 97 * Our own IPv4 addresses DLL tail
105 */ 98 */
106 struct HttpAddressWrapper *addr_tail; 99 struct HttpAddressWrapper *addr_tail;
107 100
108
109 /**
110 * Plugin configuration
111 * --------------------
112 */
113
114 /** 101 /**
115 * External hostname the plugin can be connected to, can be different to 102 * External hostname the plugin can be connected to, can be different to
116 * the host's FQDN, used e.g. for reverse proxying 103 * the host's FQDN, used e.g. for reverse proxying
@@ -133,9 +120,8 @@ struct Plugin
133 */ 120 */
134 GNUNET_SCHEDULER_TaskIdentifier notify_ext_task; 121 GNUNET_SCHEDULER_TaskIdentifier notify_ext_task;
135 122
136
137 /** 123 /**
138 * Plugin name 124 * Plugin name.
139 * Equals configuration section: transport-http, transport-https 125 * Equals configuration section: transport-http, transport-https
140 */ 126 */
141 char *name; 127 char *name;
@@ -147,21 +133,18 @@ struct Plugin
147 char *protocol; 133 char *protocol;
148 134
149 /** 135 /**
150 * Use IPv4? 136 * Use IPv4? #GNUNET_YES or #GNUNET_NO
151 * GNUNET_YES or GNUNET_NO
152 */ 137 */
153 int ipv4; 138 int ipv4;
154 139
155 /** 140 /**
156 * Use IPv6? 141 * Use IPv6? #GNUNET_YES or #GNUNET_NO
157 * GNUNET_YES or GNUNET_NO
158 */ 142 */
159 int ipv6; 143 int ipv6;
160 144
161 /** 145 /**
162 * Does plugin just use outbound connections and not accept inbound? 146 * Does plugin just use outbound connections and not accept inbound?
163 */ 147 */
164
165 int client_only; 148 int client_only;
166 149
167 /** 150 /**
@@ -186,18 +169,12 @@ struct Plugin
186 unsigned int inbound_sessions; 169 unsigned int inbound_sessions;
187 170
188 /** 171 /**
189 * Plugin HTTPS SSL/TLS options
190 * ----------------------------
191 */
192
193 /**
194 * libCurl TLS crypto init string, can be set to enhance performance 172 * libCurl TLS crypto init string, can be set to enhance performance
195 * 173 *
196 * Example: 174 * Example:
197 * 175 *
198 * Use RC4-128 instead of AES: 176 * Use RC4-128 instead of AES:
199 * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL 177 * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
200 *
201 */ 178 */
202 char *crypto_init; 179 char *crypto_init;
203 180
@@ -212,11 +189,6 @@ struct Plugin
212 char *cert; 189 char *cert;
213 190
214 /** 191 /**
215 * Plugin values
216 * -------------
217 */
218
219 /**
220 * Current number of establishes connections 192 * Current number of establishes connections
221 */ 193 */
222 int cur_connections; 194 int cur_connections;
@@ -227,11 +199,6 @@ struct Plugin
227 uint32_t last_tag; 199 uint32_t last_tag;
228 200
229 /** 201 /**
230 * Server handles
231 * --------------
232 */
233
234 /**
235 * MHD IPv4 daemon 202 * MHD IPv4 daemon
236 */ 203 */
237 struct MHD_Daemon *server_v4; 204 struct MHD_Daemon *server_v4;
@@ -259,7 +226,6 @@ struct Plugin
259 /** 226 /**
260 * The IPv6 server is scheduled to run asap 227 * The IPv6 server is scheduled to run asap
261 */ 228 */
262
263 int server_v6_immediately; 229 int server_v6_immediately;
264 230
265 /** 231 /**
@@ -273,17 +239,18 @@ struct Plugin
273 struct sockaddr_in6 *server_addr_v6; 239 struct sockaddr_in6 *server_addr_v6;
274 240
275 /** 241 /**
276 * Server semi connections 242 * Head of server semi connections
277 * A full session consists of 2 semi-connections: send and receive 243 * A full session consists of 2 semi-connections: send and receive
278 * If not both directions are established the server keeps this sessions here 244 * If not both directions are established the server keeps this sessions here
279 */ 245 */
280 struct Session *server_semi_head; 246 struct Session *server_semi_head;
281 247
282 struct Session *server_semi_tail; 248 /**
283 249 * Tail of server semi connections
284 /* 250 * A full session consists of 2 semi-connections: send and receive
285 * Client handles 251 * If not both directions are established the server keeps this sessions here
286 */ 252 */
253 struct Session *server_semi_tail;
287 254
288 /** 255 /**
289 * cURL Multihandle 256 * cURL Multihandle
@@ -351,21 +318,28 @@ GNUNET_NETWORK_STRUCT_END
351 318
352struct ServerRequest 319struct ServerRequest
353{ 320{
354 /* _RECV or _SEND */ 321 /**
322 * _RECV or _SEND
323 */
355 int direction; 324 int direction;
356 325
357 /* Should this connection get disconnected? GNUNET_YES/NO */ 326 /**
327 * Should this connection get disconnected? #GNUNET_YES / #GNUNET_NO
328 */
358 int disconnect; 329 int disconnect;
359 330
360 /* The session this server connection belongs to */ 331 /**
332 * The session this server connection belongs to
333 */
361 struct Session *session; 334 struct Session *session;
362 335
363 /* The MHD connection */ 336 /**
337 * The MHD connection
338 */
364 struct MHD_Connection *mhd_conn; 339 struct MHD_Connection *mhd_conn;
365}; 340};
366 341
367 342
368
369/** 343/**
370 * Session handle for connections. 344 * Session handle for connections.
371 */ 345 */
@@ -416,7 +390,6 @@ struct Session
416 */ 390 */
417 struct HTTP_Message *msg_tail; 391 struct HTTP_Message *msg_tail;
418 392
419
420 /** 393 /**
421 * Message stream tokenizer for incoming data 394 * Message stream tokenizer for incoming data
422 */ 395 */
@@ -430,8 +403,8 @@ struct Session
430 403
431 /** 404 /**
432 * Inbound or outbound connection 405 * Inbound or outbound connection
433 * Outbound: GNUNET_NO (client is used to send and receive) 406 * Outbound: #GNUNET_NO (client is used to send and receive)
434 * Inbound : GNUNET_YES (server is used to send and receive) 407 * Inbound : #GNUNET_YES (server is used to send and receive)
435 */ 408 */
436 int inbound; 409 int inbound;
437 410
@@ -441,10 +414,6 @@ struct Session
441 uint32_t tag; 414 uint32_t tag;
442 415
443 /** 416 /**
444 * Client handles
445 */
446
447 /**
448 * Client send handle 417 * Client send handle
449 */ 418 */
450 void *client_put; 419 void *client_put;
@@ -466,15 +435,11 @@ struct Session
466 435
467 /** 436 /**
468 * Is client send handle paused since there are no data to send? 437 * Is client send handle paused since there are no data to send?
469 * GNUNET_YES/NO 438 * #GNUNET_YES or #GNUNET_NO
470 */ 439 */
471 int client_put_paused; 440 int client_put_paused;
472 441
473 /** 442 /**
474 * Server handles
475 */
476
477 /**
478 * Client send handle 443 * Client send handle
479 */ 444 */
480 struct ServerRequest *server_recv; 445 struct ServerRequest *server_recv;
@@ -485,6 +450,7 @@ struct Session
485 struct ServerRequest *server_send; 450 struct ServerRequest *server_send;
486}; 451};
487 452
453
488/** 454/**
489 * Message to send using http 455 * Message to send using http
490 */ 456 */
@@ -523,64 +489,90 @@ struct HTTP_Message
523 GNUNET_TRANSPORT_TransmitContinuation transmit_cont; 489 GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
524 490
525 /** 491 /**
526 * Closure for transmit_cont. 492 * Closure for @e transmit_cont.
527 */ 493 */
528 void *transmit_cont_cls; 494 void *transmit_cont_cls;
529}; 495};
530 496
497
531struct Session * 498struct Session *
532create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, 499create_session (struct Plugin *plugin,
533 const void *addr, size_t addrlen); 500 const struct GNUNET_PeerIdentity *target,
501 const void *addr,
502 size_t addrlen);
503
534 504
535int 505int
536exist_session (struct Plugin *plugin, struct Session *s); 506exist_session (struct Plugin *plugin,
507 struct Session *s);
508
537 509
538void 510void
539delete_session (struct Session *s); 511delete_session (struct Session *s);
540 512
513
541int 514int
542exist_session (struct Plugin *plugin, struct Session *s); 515exist_session (struct Plugin *plugin,
516 struct Session *s);
517
543 518
544struct GNUNET_TIME_Relative 519struct GNUNET_TIME_Relative
545http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity *peer, 520http_plugin_receive (void *cls,
521 const struct GNUNET_PeerIdentity *peer,
546 const struct GNUNET_MessageHeader *message, 522 const struct GNUNET_MessageHeader *message,
547 struct Session *session, const char *sender_address, 523 struct Session *session,
524 const char *sender_address,
548 uint16_t sender_address_len); 525 uint16_t sender_address_len);
549 526
527
550const char * 528const char *
551http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen); 529http_plugin_address_to_string (void *cls,
530 const void *addr,
531 size_t addrlen);
532
552 533
553int 534int
554client_disconnect (struct Session *s); 535client_disconnect (struct Session *s);
555 536
537
556int 538int
557client_connect (struct Session *s); 539client_connect (struct Session *s);
558 540
541
559int 542int
560client_send (struct Session *s, struct HTTP_Message *msg); 543client_send (struct Session *s, struct HTTP_Message *msg);
561 544
545
562int 546int
563client_start (struct Plugin *plugin); 547client_start (struct Plugin *plugin);
564 548
549
565void 550void
566client_stop (struct Plugin *plugin); 551client_stop (struct Plugin *plugin);
567 552
553
568int 554int
569server_disconnect (struct Session *s); 555server_disconnect (struct Session *s);
570 556
557
571int 558int
572server_send (struct Session *s, struct HTTP_Message *msg); 559server_send (struct Session *s, struct HTTP_Message *msg);
573 560
561
574int 562int
575server_start (struct Plugin *plugin); 563server_start (struct Plugin *plugin);
576 564
565
577void 566void
578server_stop (struct Plugin *plugin); 567server_stop (struct Plugin *plugin);
579 568
569
580void 570void
581notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, 571notify_session_end (void *cls,
572 const struct GNUNET_PeerIdentity *peer,
582 struct Session *s); 573 struct Session *s);
583 574
575
584/*#ifndef PLUGIN_TRANSPORT_HTTP_H*/ 576/*#ifndef PLUGIN_TRANSPORT_HTTP_H*/
585#endif 577#endif
586/* end of plugin_transport_http.h */ 578/* end of plugin_transport_http.h */