From 74b34ed9b400f74a7977e268626b85b51acfedd4 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 16 Sep 2011 16:15:52 +0000 Subject: transmitting data --- src/transport/plugin_transport_http.h | 67 +++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) (limited to 'src/transport/plugin_transport_http.h') 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 @@ #define DEBUG_HTTP GNUNET_YES #define VERBOSE_SERVER GNUNET_YES #define VERBOSE_CLIENT GNUNET_YES +#define VERBOSE_CURL GNUNET_NO #if BUILD_HTTPS #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init @@ -179,6 +180,17 @@ struct Session */ struct Plugin *plugin; + /** + * next pointer for double linked list + */ + struct HTTP_Message *msg_head; + + /** + * previous pointer for double linked list + */ + struct HTTP_Message *msg_tail; + + /** * message stream tokenizer for incoming data */ @@ -229,6 +241,7 @@ struct Session void *client_put; void *client_get; + int put_paused; void *server_recv; void *server_send; @@ -238,6 +251,49 @@ struct Session }; +/** + * Message to send using http + */ +struct HTTP_Message +{ + /** + * next pointer for double linked list + */ + struct HTTP_Message *next; + + /** + * previous pointer for double linked list + */ + struct HTTP_Message *prev; + + /** + * buffer containing data to send + */ + char *buf; + + /** + * amount of data already sent + */ + size_t pos; + + /** + * buffer length + */ + size_t size; + + /** + * Continuation function to call once the transmission buffer + * has again space available. NULL if there is no + * continuation to call. + */ + GNUNET_TRANSPORT_TransmitContinuation transmit_cont; + + /** + * Closure for transmit_cont. + */ + void *transmit_cont_cls; +}; + void delete_session (struct Session *s); @@ -246,6 +302,13 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, const void *addr, size_t addrlen, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls); +struct GNUNET_TIME_Relative +http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, + const struct GNUNET_MessageHeader * message, + struct Session * session, + const char *sender_address, + uint16_t sender_address_len); + const char * http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen); @@ -256,7 +319,7 @@ int client_connect (struct Session *s); int -client_send (struct Session *s, const char *msgbuf, size_t msgbuf_size); +client_send (struct Session *s, struct HTTP_Message *msg); int client_start (struct Plugin *plugin); @@ -268,7 +331,7 @@ int server_disconnect (struct Session *s); int -server_send (struct Session *s, const char *msgbuf, size_t msgbuf_size); +server_send (struct Session *s, struct HTTP_Message * msg); int server_start (struct Plugin *plugin); -- cgit v1.2.3