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.h67
1 files changed, 65 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h
index b7b89e6e6..5e452ba84 100644
--- a/src/transport/plugin_transport_http.h
+++ b/src/transport/plugin_transport_http.h
@@ -45,6 +45,7 @@
45#define DEBUG_HTTP GNUNET_YES 45#define DEBUG_HTTP GNUNET_YES
46#define VERBOSE_SERVER GNUNET_YES 46#define VERBOSE_SERVER GNUNET_YES
47#define VERBOSE_CLIENT GNUNET_YES 47#define VERBOSE_CLIENT GNUNET_YES
48#define VERBOSE_CURL GNUNET_NO
48 49
49#if BUILD_HTTPS 50#if BUILD_HTTPS
50#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init 51#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init
@@ -180,6 +181,17 @@ struct Session
180 struct Plugin *plugin; 181 struct Plugin *plugin;
181 182
182 /** 183 /**
184 * next pointer for double linked list
185 */
186 struct HTTP_Message *msg_head;
187
188 /**
189 * previous pointer for double linked list
190 */
191 struct HTTP_Message *msg_tail;
192
193
194 /**
183 * message stream tokenizer for incoming data 195 * message stream tokenizer for incoming data
184 */ 196 */
185 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk; 197 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk;
@@ -229,6 +241,7 @@ struct Session
229 241
230 void *client_put; 242 void *client_put;
231 void *client_get; 243 void *client_get;
244 int put_paused;
232 245
233 void *server_recv; 246 void *server_recv;
234 void *server_send; 247 void *server_send;
@@ -238,6 +251,49 @@ struct Session
238 251
239}; 252};
240 253
254/**
255 * Message to send using http
256 */
257struct HTTP_Message
258{
259 /**
260 * next pointer for double linked list
261 */
262 struct HTTP_Message *next;
263
264 /**
265 * previous pointer for double linked list
266 */
267 struct HTTP_Message *prev;
268
269 /**
270 * buffer containing data to send
271 */
272 char *buf;
273
274 /**
275 * amount of data already sent
276 */
277 size_t pos;
278
279 /**
280 * buffer length
281 */
282 size_t size;
283
284 /**
285 * Continuation function to call once the transmission buffer
286 * has again space available. NULL if there is no
287 * continuation to call.
288 */
289 GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
290
291 /**
292 * Closure for transmit_cont.
293 */
294 void *transmit_cont_cls;
295};
296
241void 297void
242delete_session (struct Session *s); 298delete_session (struct Session *s);
243 299
@@ -246,6 +302,13 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
246 const void *addr, size_t addrlen, 302 const void *addr, size_t addrlen,
247 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls); 303 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls);
248 304
305struct GNUNET_TIME_Relative
306http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer,
307 const struct GNUNET_MessageHeader * message,
308 struct Session * session,
309 const char *sender_address,
310 uint16_t sender_address_len);
311
249const char * 312const char *
250http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen); 313http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen);
251 314
@@ -256,7 +319,7 @@ int
256client_connect (struct Session *s); 319client_connect (struct Session *s);
257 320
258int 321int
259client_send (struct Session *s, const char *msgbuf, size_t msgbuf_size); 322client_send (struct Session *s, struct HTTP_Message *msg);
260 323
261int 324int
262client_start (struct Plugin *plugin); 325client_start (struct Plugin *plugin);
@@ -268,7 +331,7 @@ int
268server_disconnect (struct Session *s); 331server_disconnect (struct Session *s);
269 332
270int 333int
271server_send (struct Session *s, const char *msgbuf, size_t msgbuf_size); 334server_send (struct Session *s, struct HTTP_Message * msg);
272 335
273int 336int
274server_start (struct Plugin *plugin); 337server_start (struct Plugin *plugin);