aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-10-18 12:33:21 +0000
committerChristian Grothoff <christian@grothoff.org>2015-10-18 12:33:21 +0000
commit9cd0d5068f3341fe8451a61872894f28a5ac9047 (patch)
tree390b09e837978c1dbef176950b04f42ecf39e140 /src/transport/plugin_transport_tcp.c
parent38d26a302cba9de8362960186b645e8f2133a538 (diff)
downloadgnunet-9cd0d5068f3341fe8451a61872894f28a5ac9047.tar.gz
gnunet-9cd0d5068f3341fe8451a61872894f28a5ac9047.zip
rename 'struct Session' to 'struct GNUNET_ATS_Session' to satisfy naming conventions
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 453a0095f..38ba2c3ce 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -248,7 +248,7 @@ struct PendingMessage
248/** 248/**
249 * Session handle for TCP connections. 249 * Session handle for TCP connections.
250 */ 250 */
251struct Session 251struct GNUNET_ATS_Session
252{ 252{
253 /** 253 /**
254 * To whom are we talking to (set to our identity 254 * To whom are we talking to (set to our identity
@@ -536,7 +536,7 @@ struct Plugin
536 */ 536 */
537static void 537static void
538notify_session_monitor (struct Plugin *plugin, 538notify_session_monitor (struct Plugin *plugin,
539 struct Session *session, 539 struct GNUNET_ATS_Session *session,
540 enum GNUNET_TRANSPORT_SessionState state) 540 enum GNUNET_TRANSPORT_SessionState state)
541{ 541{
542 struct GNUNET_TRANSPORT_SessionInfo info; 542 struct GNUNET_TRANSPORT_SessionInfo info;
@@ -807,12 +807,12 @@ tcp_plugin_string_to_address (void *cls,
807 * @param client which client to find the session handle for 807 * @param client which client to find the session handle for
808 * @return NULL if no matching session exists 808 * @return NULL if no matching session exists
809 */ 809 */
810static struct Session * 810static struct GNUNET_ATS_Session *
811lookup_session_by_client (struct Plugin *plugin, 811lookup_session_by_client (struct Plugin *plugin,
812 struct GNUNET_SERVER_Client *client) 812 struct GNUNET_SERVER_Client *client)
813{ 813{
814 return GNUNET_SERVER_client_get_user_context (client, 814 return GNUNET_SERVER_client_get_user_context (client,
815 struct Session); 815 struct GNUNET_ATS_Session);
816} 816}
817 817
818 818
@@ -827,7 +827,7 @@ lookup_session_by_client (struct Plugin *plugin,
827 */ 827 */
828static int 828static int
829tcp_plugin_disconnect_session (void *cls, 829tcp_plugin_disconnect_session (void *cls,
830 struct Session *session) 830 struct GNUNET_ATS_Session *session)
831{ 831{
832 struct Plugin *plugin = cls; 832 struct Plugin *plugin = cls;
833 struct PendingMessage *pm; 833 struct PendingMessage *pm;
@@ -956,14 +956,14 @@ tcp_plugin_query_keepalive_factor (void *cls)
956/** 956/**
957 * Session was idle for too long, so disconnect it 957 * Session was idle for too long, so disconnect it
958 * 958 *
959 * @param cls the `struct Session` of the idle session 959 * @param cls the `struct GNUNET_ATS_Session` of the idle session
960 * @param tc scheduler context 960 * @param tc scheduler context
961 */ 961 */
962static void 962static void
963session_timeout (void *cls, 963session_timeout (void *cls,
964 const struct GNUNET_SCHEDULER_TaskContext *tc) 964 const struct GNUNET_SCHEDULER_TaskContext *tc)
965{ 965{
966 struct Session *s = cls; 966 struct GNUNET_ATS_Session *s = cls;
967 struct GNUNET_TIME_Relative left; 967 struct GNUNET_TIME_Relative left;
968 968
969 s->timeout_task = NULL; 969 s->timeout_task = NULL;
@@ -997,7 +997,7 @@ session_timeout (void *cls,
997 * @param s session to increment timeout for 997 * @param s session to increment timeout for
998 */ 998 */
999static void 999static void
1000reschedule_session_timeout (struct Session *s) 1000reschedule_session_timeout (struct GNUNET_ATS_Session *s)
1001{ 1001{
1002 GNUNET_assert (NULL != s->timeout_task); 1002 GNUNET_assert (NULL != s->timeout_task);
1003 s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1003 s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -1016,14 +1016,14 @@ reschedule_session_timeout (struct Session *s)
1016 * the session 1016 * the session
1017 * @return new session object 1017 * @return new session object
1018 */ 1018 */
1019static struct Session * 1019static struct GNUNET_ATS_Session *
1020create_session (struct Plugin *plugin, 1020create_session (struct Plugin *plugin,
1021 const struct GNUNET_HELLO_Address *address, 1021 const struct GNUNET_HELLO_Address *address,
1022 enum GNUNET_ATS_Network_Type scope, 1022 enum GNUNET_ATS_Network_Type scope,
1023 struct GNUNET_SERVER_Client *client, 1023 struct GNUNET_SERVER_Client *client,
1024 int is_nat) 1024 int is_nat)
1025{ 1025{
1026 struct Session *session; 1026 struct GNUNET_ATS_Session *session;
1027 struct PendingMessage *pm; 1027 struct PendingMessage *pm;
1028 1028
1029 if (GNUNET_YES != is_nat) 1029 if (GNUNET_YES != is_nat)
@@ -1037,7 +1037,7 @@ create_session (struct Plugin *plugin,
1037 tcp_plugin_address_to_string (plugin, 1037 tcp_plugin_address_to_string (plugin,
1038 address->address, 1038 address->address,
1039 address->address_length)); 1039 address->address_length));
1040 session = GNUNET_new (struct Session); 1040 session = GNUNET_new (struct GNUNET_ATS_Session);
1041 session->last_activity = GNUNET_TIME_absolute_get (); 1041 session->last_activity = GNUNET_TIME_absolute_get ();
1042 session->plugin = plugin; 1042 session->plugin = plugin;
1043 session->is_nat = is_nat; 1043 session->is_nat = is_nat;
@@ -1102,7 +1102,7 @@ create_session (struct Plugin *plugin,
1102 * @param session for which session should we do this 1102 * @param session for which session should we do this
1103 */ 1103 */
1104static void 1104static void
1105process_pending_messages (struct Session *session); 1105process_pending_messages (struct GNUNET_ATS_Session *session);
1106 1106
1107 1107
1108/** 1108/**
@@ -1121,7 +1121,7 @@ do_transmit (void *cls,
1121 size_t size, 1121 size_t size,
1122 void *buf) 1122 void *buf)
1123{ 1123{
1124 struct Session *session = cls; 1124 struct GNUNET_ATS_Session *session = cls;
1125 struct GNUNET_PeerIdentity pid; 1125 struct GNUNET_PeerIdentity pid;
1126 struct Plugin *plugin; 1126 struct Plugin *plugin;
1127 struct PendingMessage *pos; 1127 struct PendingMessage *pos;
@@ -1275,7 +1275,7 @@ do_transmit (void *cls,
1275 * @param session for which session should we do this 1275 * @param session for which session should we do this
1276 */ 1276 */
1277static void 1277static void
1278process_pending_messages (struct Session *session) 1278process_pending_messages (struct GNUNET_ATS_Session *session)
1279{ 1279{
1280 struct PendingMessage *pm; 1280 struct PendingMessage *pm;
1281 1281
@@ -1323,7 +1323,7 @@ process_pending_messages (struct Session *session)
1323 */ 1323 */
1324static ssize_t 1324static ssize_t
1325tcp_plugin_send (void *cls, 1325tcp_plugin_send (void *cls,
1326 struct Session *session, 1326 struct GNUNET_ATS_Session *session,
1327 const char *msgbuf, 1327 const char *msgbuf,
1328 size_t msgbuf_size, 1328 size_t msgbuf_size,
1329 unsigned int priority, 1329 unsigned int priority,
@@ -1413,7 +1413,7 @@ tcp_plugin_send (void *cls,
1413/** 1413/**
1414 * Closure for #session_lookup_it(). 1414 * Closure for #session_lookup_it().
1415 */ 1415 */
1416struct SessionItCtx 1416struct GNUNET_ATS_SessionItCtx
1417{ 1417{
1418 /** 1418 /**
1419 * Address we are looking for. 1419 * Address we are looking for.
@@ -1423,7 +1423,7 @@ struct SessionItCtx
1423 /** 1423 /**
1424 * Where to store the session (if we found it). 1424 * Where to store the session (if we found it).
1425 */ 1425 */
1426 struct Session *result; 1426 struct GNUNET_ATS_Session *result;
1427 1427
1428}; 1428};
1429 1429
@@ -1431,9 +1431,9 @@ struct SessionItCtx
1431/** 1431/**
1432 * Look for a session by address. 1432 * Look for a session by address.
1433 * 1433 *
1434 * @param cls the `struct SessionItCtx` 1434 * @param cls the `struct GNUNET_ATS_SessionItCtx`
1435 * @param key unused 1435 * @param key unused
1436 * @param value a `struct Session` 1436 * @param value a `struct GNUNET_ATS_Session`
1437 * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session 1437 * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session
1438 */ 1438 */
1439static int 1439static int
@@ -1441,8 +1441,8 @@ session_lookup_it (void *cls,
1441 const struct GNUNET_PeerIdentity *key, 1441 const struct GNUNET_PeerIdentity *key,
1442 void *value) 1442 void *value)
1443{ 1443{
1444 struct SessionItCtx *si_ctx = cls; 1444 struct GNUNET_ATS_SessionItCtx *si_ctx = cls;
1445 struct Session *session = value; 1445 struct GNUNET_ATS_Session *session = value;
1446 1446
1447 if (0 != 1447 if (0 !=
1448 GNUNET_HELLO_address_cmp (si_ctx->address, 1448 GNUNET_HELLO_address_cmp (si_ctx->address,
@@ -1456,14 +1456,14 @@ session_lookup_it (void *cls,
1456/** 1456/**
1457 * Task cleaning up a NAT connection attempt after timeout 1457 * Task cleaning up a NAT connection attempt after timeout
1458 * 1458 *
1459 * @param cls the `struct Session` 1459 * @param cls the `struct GNUNET_ATS_Session`
1460 * @param tc scheduler context (unused) 1460 * @param tc scheduler context (unused)
1461 */ 1461 */
1462static void 1462static void
1463nat_connect_timeout (void *cls, 1463nat_connect_timeout (void *cls,
1464 const struct GNUNET_SCHEDULER_TaskContext *tc) 1464 const struct GNUNET_SCHEDULER_TaskContext *tc)
1465{ 1465{
1466 struct Session *session = cls; 1466 struct GNUNET_ATS_Session *session = cls;
1467 1467
1468 session->nat_connection_timeout = NULL; 1468 session->nat_connection_timeout = NULL;
1469 LOG (GNUNET_ERROR_TYPE_DEBUG, 1469 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1489,7 +1489,7 @@ nat_connect_timeout (void *cls,
1489static void 1489static void
1490tcp_plugin_update_session_timeout (void *cls, 1490tcp_plugin_update_session_timeout (void *cls,
1491 const struct GNUNET_PeerIdentity *peer, 1491 const struct GNUNET_PeerIdentity *peer,
1492 struct Session *session) 1492 struct GNUNET_ATS_Session *session)
1493{ 1493{
1494 reschedule_session_timeout (session); 1494 reschedule_session_timeout (session);
1495} 1495}
@@ -1499,14 +1499,14 @@ tcp_plugin_update_session_timeout (void *cls,
1499 * Task to signal the server that we can continue 1499 * Task to signal the server that we can continue
1500 * receiving from the TCP client now. 1500 * receiving from the TCP client now.
1501 * 1501 *
1502 * @param cls the `struct Session *` 1502 * @param cls the `struct GNUNET_ATS_Session *`
1503 * @param tc task context (unused) 1503 * @param tc task context (unused)
1504 */ 1504 */
1505static void 1505static void
1506delayed_done (void *cls, 1506delayed_done (void *cls,
1507 const struct GNUNET_SCHEDULER_TaskContext *tc) 1507 const struct GNUNET_SCHEDULER_TaskContext *tc)
1508{ 1508{
1509 struct Session *session = cls; 1509 struct GNUNET_ATS_Session *session = cls;
1510 1510
1511 session->receive_delay_task = NULL; 1511 session->receive_delay_task = NULL;
1512 reschedule_session_timeout (session); 1512 reschedule_session_timeout (session);
@@ -1528,7 +1528,7 @@ delayed_done (void *cls,
1528static void 1528static void
1529tcp_plugin_update_inbound_delay (void *cls, 1529tcp_plugin_update_inbound_delay (void *cls,
1530 const struct GNUNET_PeerIdentity *peer, 1530 const struct GNUNET_PeerIdentity *peer,
1531 struct Session *session, 1531 struct GNUNET_ATS_Session *session,
1532 struct GNUNET_TIME_Relative delay) 1532 struct GNUNET_TIME_Relative delay)
1533{ 1533{
1534 if (NULL == session->receive_delay_task) 1534 if (NULL == session->receive_delay_task)
@@ -1554,12 +1554,12 @@ tcp_plugin_update_inbound_delay (void *cls,
1554 * @param address the address to use 1554 * @param address the address to use
1555 * @return the session if the address is valid, NULL otherwise 1555 * @return the session if the address is valid, NULL otherwise
1556 */ 1556 */
1557static struct Session * 1557static struct GNUNET_ATS_Session *
1558tcp_plugin_get_session (void *cls, 1558tcp_plugin_get_session (void *cls,
1559 const struct GNUNET_HELLO_Address *address) 1559 const struct GNUNET_HELLO_Address *address)
1560{ 1560{
1561 struct Plugin *plugin = cls; 1561 struct Plugin *plugin = cls;
1562 struct Session *session = NULL; 1562 struct GNUNET_ATS_Session *session = NULL;
1563 int af; 1563 int af;
1564 const void *sb; 1564 const void *sb;
1565 size_t sbs; 1565 size_t sbs;
@@ -1596,7 +1596,7 @@ tcp_plugin_get_session (void *cls,
1596 GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, 1596 GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap,
1597 &address->peer)) 1597 &address->peer))
1598 { 1598 {
1599 struct SessionItCtx si_ctx; 1599 struct GNUNET_ATS_SessionItCtx si_ctx;
1600 1600
1601 si_ctx.address = address; 1601 si_ctx.address = address;
1602 si_ctx.result = NULL; 1602 si_ctx.result = NULL;
@@ -1812,7 +1812,7 @@ tcp_plugin_get_session (void *cls,
1812 * 1812 *
1813 * @param cls the `struct Plugin *` 1813 * @param cls the `struct Plugin *`
1814 * @param key the peer which the session belongs to (unused) 1814 * @param key the peer which the session belongs to (unused)
1815 * @param value the `struct Session` 1815 * @param value the `struct GNUNET_ATS_Session`
1816 * @return #GNUNET_YES (continue to iterate) 1816 * @return #GNUNET_YES (continue to iterate)
1817 */ 1817 */
1818static int 1818static int
@@ -1821,7 +1821,7 @@ session_disconnect_it (void *cls,
1821 void *value) 1821 void *value)
1822{ 1822{
1823 struct Plugin *plugin = cls; 1823 struct Plugin *plugin = cls;
1824 struct Session *session = value; 1824 struct GNUNET_ATS_Session *session = value;
1825 1825
1826 GNUNET_STATISTICS_update (session->plugin->env->stats, 1826 GNUNET_STATISTICS_update (session->plugin->env->stats,
1827 gettext_noop ("# transport-service disconnect requests for TCP"), 1827 gettext_noop ("# transport-service disconnect requests for TCP"),
@@ -2135,7 +2135,7 @@ handle_tcp_nat_probe (void *cls,
2135 const struct GNUNET_MessageHeader *message) 2135 const struct GNUNET_MessageHeader *message)
2136{ 2136{
2137 struct Plugin *plugin = cls; 2137 struct Plugin *plugin = cls;
2138 struct Session *session; 2138 struct GNUNET_ATS_Session *session;
2139 const struct TCP_NAT_ProbeMessage *tcp_nat_probe; 2139 const struct TCP_NAT_ProbeMessage *tcp_nat_probe;
2140 size_t alen; 2140 size_t alen;
2141 void *vaddr; 2141 void *vaddr;
@@ -2281,7 +2281,7 @@ handle_tcp_welcome (void *cls,
2281 struct Plugin *plugin = cls; 2281 struct Plugin *plugin = cls;
2282 const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message; 2282 const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message;
2283 struct GNUNET_HELLO_Address *address; 2283 struct GNUNET_HELLO_Address *address;
2284 struct Session *session; 2284 struct GNUNET_ATS_Session *session;
2285 size_t alen; 2285 size_t alen;
2286 void *vaddr; 2286 void *vaddr;
2287 struct IPv4TcpAddress t4; 2287 struct IPv4TcpAddress t4;
@@ -2444,7 +2444,7 @@ handle_tcp_data (void *cls,
2444 const struct GNUNET_MessageHeader *message) 2444 const struct GNUNET_MessageHeader *message)
2445{ 2445{
2446 struct Plugin *plugin = cls; 2446 struct Plugin *plugin = cls;
2447 struct Session *session; 2447 struct GNUNET_ATS_Session *session;
2448 struct GNUNET_TIME_Relative delay; 2448 struct GNUNET_TIME_Relative delay;
2449 uint16_t type; 2449 uint16_t type;
2450 2450
@@ -2589,7 +2589,7 @@ disconnect_notify (void *cls,
2589 struct GNUNET_SERVER_Client *client) 2589 struct GNUNET_SERVER_Client *client)
2590{ 2590{
2591 struct Plugin *plugin = cls; 2591 struct Plugin *plugin = cls;
2592 struct Session *session; 2592 struct GNUNET_ATS_Session *session;
2593 2593
2594 if (NULL == client) 2594 if (NULL == client)
2595 return; 2595 return;
@@ -2727,7 +2727,7 @@ try_connection_reversal (void *cls,
2727 */ 2727 */
2728static enum GNUNET_ATS_Network_Type 2728static enum GNUNET_ATS_Network_Type
2729tcp_plugin_get_network (void *cls, 2729tcp_plugin_get_network (void *cls,
2730 struct Session *session) 2730 struct GNUNET_ATS_Session *session)
2731{ 2731{
2732 return session->scope; 2732 return session->scope;
2733} 2733}
@@ -2799,7 +2799,7 @@ tcp_plugin_get_network_for_address (void *cls,
2799 * 2799 *
2800 * @param cls the `struct Plugin` with the monitor callback (`sic`) 2800 * @param cls the `struct Plugin` with the monitor callback (`sic`)
2801 * @param peer peer we send information about 2801 * @param peer peer we send information about
2802 * @param value our `struct Session` to send information about 2802 * @param value our `struct GNUNET_ATS_Session` to send information about
2803 * @return #GNUNET_OK (continue to iterate) 2803 * @return #GNUNET_OK (continue to iterate)
2804 */ 2804 */
2805static int 2805static int
@@ -2808,7 +2808,7 @@ send_session_info_iter (void *cls,
2808 void *value) 2808 void *value)
2809{ 2809{
2810 struct Plugin *plugin = cls; 2810 struct Plugin *plugin = cls;
2811 struct Session *session = value; 2811 struct GNUNET_ATS_Session *session = value;
2812 2812
2813 notify_session_monitor (plugin, 2813 notify_session_monitor (plugin,
2814 session, 2814 session,