aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r--src/transport/plugin_transport_http_server.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index db483098a..07137e0fb 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -63,7 +63,7 @@ struct ServerRequest
63 * The session this server request belongs to 63 * The session this server request belongs to
64 * Can be NULL, when session was disconnected and freed 64 * Can be NULL, when session was disconnected and freed
65 */ 65 */
66 struct Session *session; 66 struct GNUNET_ATS_Session *session;
67 67
68 /** 68 /**
69 * The MHD connection 69 * The MHD connection
@@ -174,7 +174,7 @@ struct HTTP_Message
174/** 174/**
175 * Session handle for connections. 175 * Session handle for connections.
176 */ 176 */
177struct Session 177struct GNUNET_ATS_Session
178{ 178{
179 179
180 /** 180 /**
@@ -466,7 +466,7 @@ struct HTTP_Server_Plugin
466 */ 466 */
467static void 467static void
468notify_session_monitor (struct HTTP_Server_Plugin *plugin, 468notify_session_monitor (struct HTTP_Server_Plugin *plugin,
469 struct Session *session, 469 struct GNUNET_ATS_Session *session,
470 enum GNUNET_TRANSPORT_SessionState state) 470 enum GNUNET_TRANSPORT_SessionState state)
471{ 471{
472 struct GNUNET_TRANSPORT_SessionInfo info; 472 struct GNUNET_TRANSPORT_SessionInfo info;
@@ -497,7 +497,7 @@ static void
497server_wake_up (void *cls, 497server_wake_up (void *cls,
498 const struct GNUNET_SCHEDULER_TaskContext *tc) 498 const struct GNUNET_SCHEDULER_TaskContext *tc)
499{ 499{
500 struct Session *s = cls; 500 struct GNUNET_ATS_Session *s = cls;
501 501
502 s->recv_wakeup_task = NULL; 502 s->recv_wakeup_task = NULL;
503 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 503 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -529,7 +529,7 @@ server_reschedule (struct HTTP_Server_Plugin *plugin,
529 * @param s the session to delete 529 * @param s the session to delete
530 */ 530 */
531static void 531static void
532server_delete_session (struct Session *s) 532server_delete_session (struct GNUNET_ATS_Session *s)
533{ 533{
534 struct HTTP_Server_Plugin *plugin = s->plugin; 534 struct HTTP_Server_Plugin *plugin = s->plugin;
535 struct HTTP_Message *msg; 535 struct HTTP_Message *msg;
@@ -630,7 +630,7 @@ server_delete_session (struct Session *s)
630 */ 630 */
631static int 631static int
632http_server_plugin_disconnect_session (void *cls, 632http_server_plugin_disconnect_session (void *cls,
633 struct Session *s) 633 struct GNUNET_ATS_Session *s)
634{ 634{
635 server_delete_session (s); 635 server_delete_session (s);
636 return GNUNET_OK; 636 return GNUNET_OK;
@@ -647,7 +647,7 @@ static void
647server_session_timeout (void *cls, 647server_session_timeout (void *cls,
648 const struct GNUNET_SCHEDULER_TaskContext *tc) 648 const struct GNUNET_SCHEDULER_TaskContext *tc)
649{ 649{
650 struct Session *s = cls; 650 struct GNUNET_ATS_Session *s = cls;
651 struct GNUNET_TIME_Relative left; 651 struct GNUNET_TIME_Relative left;
652 652
653 s->timeout_task = NULL; 653 s->timeout_task = NULL;
@@ -679,7 +679,7 @@ server_session_timeout (void *cls,
679 * @param s the session 679 * @param s the session
680 */ 680 */
681static void 681static void
682server_reschedule_session_timeout (struct Session *s) 682server_reschedule_session_timeout (struct GNUNET_ATS_Session *s)
683{ 683{
684 GNUNET_assert (NULL != s->timeout_task); 684 GNUNET_assert (NULL != s->timeout_task);
685 s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 685 s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -715,7 +715,7 @@ server_reschedule_session_timeout (struct Session *s)
715 */ 715 */
716static ssize_t 716static ssize_t
717http_server_plugin_send (void *cls, 717http_server_plugin_send (void *cls,
718 struct Session *session, 718 struct GNUNET_ATS_Session *session,
719 const char *msgbuf, 719 const char *msgbuf,
720 size_t msgbuf_size, 720 size_t msgbuf_size,
721 unsigned int priority, 721 unsigned int priority,
@@ -775,7 +775,7 @@ http_server_plugin_send (void *cls,
775 * 775 *
776 * @param cls the `struct HTTP_Server_Plugin *` 776 * @param cls the `struct HTTP_Server_Plugin *`
777 * @param peer for which this is a session 777 * @param peer for which this is a session
778 * @param value the `struct Session` to clean up 778 * @param value the `struct GNUNET_ATS_Session` to clean up
779 * @return #GNUNET_OK (continue to iterate) 779 * @return #GNUNET_OK (continue to iterate)
780 */ 780 */
781static int 781static int
@@ -783,7 +783,7 @@ destroy_session_shutdown_cb (void *cls,
783 const struct GNUNET_PeerIdentity *peer, 783 const struct GNUNET_PeerIdentity *peer,
784 void *value) 784 void *value)
785{ 785{
786 struct Session *s = value; 786 struct GNUNET_ATS_Session *s = value;
787 struct ServerRequest *sc_send; 787 struct ServerRequest *sc_send;
788 struct ServerRequest *sc_recv; 788 struct ServerRequest *sc_recv;
789 789
@@ -802,7 +802,7 @@ destroy_session_shutdown_cb (void *cls,
802 * 802 *
803 * @param cls the `struct HTTP_Server_Plugin *` 803 * @param cls the `struct HTTP_Server_Plugin *`
804 * @param peer for which this is a session 804 * @param peer for which this is a session
805 * @param value the `struct Session` to clean up 805 * @param value the `struct GNUNET_ATS_Session` to clean up
806 * @return #GNUNET_OK (continue to iterate) 806 * @return #GNUNET_OK (continue to iterate)
807 */ 807 */
808static int 808static int
@@ -810,7 +810,7 @@ destroy_session_cb (void *cls,
810 const struct GNUNET_PeerIdentity *peer, 810 const struct GNUNET_PeerIdentity *peer,
811 void *value) 811 void *value)
812{ 812{
813 struct Session *s = value; 813 struct GNUNET_ATS_Session *s = value;
814 814
815 server_delete_session (s); 815 server_delete_session (s);
816 return GNUNET_OK; 816 return GNUNET_OK;
@@ -897,7 +897,7 @@ http_server_plugin_address_suggested (void *cls,
897 * @param address the address 897 * @param address the address
898 * @return always NULL 898 * @return always NULL
899 */ 899 */
900static struct Session * 900static struct GNUNET_ATS_Session *
901http_server_plugin_get_session (void *cls, 901http_server_plugin_get_session (void *cls,
902 const struct GNUNET_HELLO_Address *address) 902 const struct GNUNET_HELLO_Address *address)
903{ 903{
@@ -1127,7 +1127,7 @@ http_server_query_keepalive_factor (void *cls)
1127static void 1127static void
1128http_server_plugin_update_session_timeout (void *cls, 1128http_server_plugin_update_session_timeout (void *cls,
1129 const struct GNUNET_PeerIdentity *peer, 1129 const struct GNUNET_PeerIdentity *peer,
1130 struct Session *session) 1130 struct GNUNET_ATS_Session *session)
1131{ 1131{
1132 server_reschedule_session_timeout (session); 1132 server_reschedule_session_timeout (session);
1133} 1133}
@@ -1142,7 +1142,7 @@ http_server_plugin_update_session_timeout (void *cls,
1142 */ 1142 */
1143static void 1143static void
1144server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, 1144server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
1145 struct Session *s, 1145 struct GNUNET_ATS_Session *s,
1146 unsigned int to) 1146 unsigned int to)
1147{ 1147{
1148 /* Setting timeouts for other connections */ 1148 /* Setting timeouts for other connections */
@@ -1305,12 +1305,12 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
1305/** 1305/**
1306 * Closure for #session_tag_it(). 1306 * Closure for #session_tag_it().
1307 */ 1307 */
1308struct SessionTagContext 1308struct GNUNET_ATS_SessionTagContext
1309{ 1309{
1310 /** 1310 /**
1311 * Set to session matching the tag. 1311 * Set to session matching the tag.
1312 */ 1312 */
1313 struct Session *res; 1313 struct GNUNET_ATS_Session *res;
1314 1314
1315 /** 1315 /**
1316 * Tag we are looking for. 1316 * Tag we are looking for.
@@ -1322,9 +1322,9 @@ struct SessionTagContext
1322/** 1322/**
1323 * Find a session with a matching tag. 1323 * Find a session with a matching tag.
1324 * 1324 *
1325 * @param cls the `struct SessionTagContext *` 1325 * @param cls the `struct GNUNET_ATS_SessionTagContext *`
1326 * @param key peer identity (unused) 1326 * @param key peer identity (unused)
1327 * @param value the `struct Session *` 1327 * @param value the `struct GNUNET_ATS_Session *`
1328 * @return #GNUNET_NO if we found the session, #GNUNET_OK if not 1328 * @return #GNUNET_NO if we found the session, #GNUNET_OK if not
1329 */ 1329 */
1330static int 1330static int
@@ -1332,8 +1332,8 @@ session_tag_it (void *cls,
1332 const struct GNUNET_PeerIdentity *key, 1332 const struct GNUNET_PeerIdentity *key,
1333 void *value) 1333 void *value)
1334{ 1334{
1335 struct SessionTagContext *stc = cls; 1335 struct GNUNET_ATS_SessionTagContext *stc = cls;
1336 struct Session *s = value; 1336 struct GNUNET_ATS_Session *s = value;
1337 1337
1338 if (s->tag == stc->tag) 1338 if (s->tag == stc->tag)
1339 { 1339 {
@@ -1359,13 +1359,13 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1359 const char *url, 1359 const char *url,
1360 const char *method) 1360 const char *method)
1361{ 1361{
1362 struct Session *s = NULL; 1362 struct GNUNET_ATS_Session *s = NULL;
1363 struct ServerRequest *sc = NULL; 1363 struct ServerRequest *sc = NULL;
1364 const union MHD_ConnectionInfo *conn_info; 1364 const union MHD_ConnectionInfo *conn_info;
1365 struct HttpAddress *addr; 1365 struct HttpAddress *addr;
1366 struct GNUNET_PeerIdentity target; 1366 struct GNUNET_PeerIdentity target;
1367 size_t addr_len; 1367 size_t addr_len;
1368 struct SessionTagContext stc; 1368 struct GNUNET_ATS_SessionTagContext stc;
1369 uint32_t options; 1369 uint32_t options;
1370 int direction = GNUNET_SYSERR; 1370 int direction = GNUNET_SYSERR;
1371 unsigned int to; 1371 unsigned int to;
@@ -1442,7 +1442,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1442 /* external host name */ 1442 /* external host name */
1443 return NULL; 1443 return NULL;
1444 } 1444 }
1445 s = GNUNET_new (struct Session); 1445 s = GNUNET_new (struct GNUNET_ATS_Session);
1446 s->target = target; 1446 s->target = target;
1447 s->plugin = plugin; 1447 s->plugin = plugin;
1448 s->scope = scope; 1448 s->scope = scope;
@@ -1548,7 +1548,7 @@ server_send_callback (void *cls,
1548 size_t max) 1548 size_t max)
1549{ 1549{
1550 struct ServerRequest *sc = cls; 1550 struct ServerRequest *sc = cls;
1551 struct Session *s = sc->session; 1551 struct GNUNET_ATS_Session *s = sc->session;
1552 ssize_t bytes_read = 0; 1552 ssize_t bytes_read = 0;
1553 struct HTTP_Message *msg; 1553 struct HTTP_Message *msg;
1554 char *stat_txt; 1554 char *stat_txt;
@@ -1638,7 +1638,7 @@ server_receive_mst_cb (void *cls,
1638 void *client, 1638 void *client,
1639 const struct GNUNET_MessageHeader *message) 1639 const struct GNUNET_MessageHeader *message)
1640{ 1640{
1641 struct Session *s = cls; 1641 struct GNUNET_ATS_Session *s = cls;
1642 struct HTTP_Server_Plugin *plugin = s->plugin; 1642 struct HTTP_Server_Plugin *plugin = s->plugin;
1643 struct GNUNET_TIME_Relative delay; 1643 struct GNUNET_TIME_Relative delay;
1644 char *stat_txt; 1644 char *stat_txt;
@@ -1727,7 +1727,7 @@ server_access_cb (void *cls,
1727{ 1727{
1728 struct HTTP_Server_Plugin *plugin = cls; 1728 struct HTTP_Server_Plugin *plugin = cls;
1729 struct ServerRequest *sc = *httpSessionCache; 1729 struct ServerRequest *sc = *httpSessionCache;
1730 struct Session *s; 1730 struct GNUNET_ATS_Session *s;
1731 struct MHD_Response *response; 1731 struct MHD_Response *response;
1732 int res = MHD_YES; 1732 int res = MHD_YES;
1733 1733
@@ -3257,7 +3257,7 @@ http_server_plugin_address_to_string (void *cls,
3257 */ 3257 */
3258static enum GNUNET_ATS_Network_Type 3258static enum GNUNET_ATS_Network_Type
3259http_server_plugin_get_network (void *cls, 3259http_server_plugin_get_network (void *cls,
3260 struct Session *session) 3260 struct GNUNET_ATS_Session *session)
3261{ 3261{
3262 return session->scope; 3262 return session->scope;
3263} 3263}
@@ -3294,7 +3294,7 @@ http_server_plugin_get_network_for_address (void *cls,
3294static void 3294static void
3295http_server_plugin_update_inbound_delay (void *cls, 3295http_server_plugin_update_inbound_delay (void *cls,
3296 const struct GNUNET_PeerIdentity *peer, 3296 const struct GNUNET_PeerIdentity *peer,
3297 struct Session *session, 3297 struct GNUNET_ATS_Session *session,
3298 struct GNUNET_TIME_Relative delay) 3298 struct GNUNET_TIME_Relative delay)
3299{ 3299{
3300 session->next_receive = GNUNET_TIME_relative_to_absolute (delay); 3300 session->next_receive = GNUNET_TIME_relative_to_absolute (delay);
@@ -3319,7 +3319,7 @@ http_server_plugin_update_inbound_delay (void *cls,
3319 * 3319 *
3320 * @param cls the `struct Plugin` with the monitor callback (`sic`) 3320 * @param cls the `struct Plugin` with the monitor callback (`sic`)
3321 * @param peer peer we send information about 3321 * @param peer peer we send information about
3322 * @param value our `struct Session` to send information about 3322 * @param value our `struct GNUNET_ATS_Session` to send information about
3323 * @return #GNUNET_OK (continue to iterate) 3323 * @return #GNUNET_OK (continue to iterate)
3324 */ 3324 */
3325static int 3325static int
@@ -3328,7 +3328,7 @@ send_session_info_iter (void *cls,
3328 void *value) 3328 void *value)
3329{ 3329{
3330 struct HTTP_Server_Plugin *plugin = cls; 3330 struct HTTP_Server_Plugin *plugin = cls;
3331 struct Session *session = value; 3331 struct GNUNET_ATS_Session *session = value;
3332 3332
3333 notify_session_monitor (plugin, 3333 notify_session_monitor (plugin,
3334 session, 3334 session,