aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-18 16:10:31 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-18 16:10:31 +0000
commit6cc556bed0898dcdb168248658574862920818da (patch)
tree1e4850a7756e0940142ff2009e0fabab1c7660bd /src
parent2bfa211933d6285ffbdc7d871e695838b5d08b9f (diff)
downloadgnunet-6cc556bed0898dcdb168248658574862920818da.tar.gz
gnunet-6cc556bed0898dcdb168248658574862920818da.zip
transport plugin api change: split of address receive and ats updates
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_transport_plugin.h50
-rw-r--r--src/transport/gnunet-service-transport.c52
-rw-r--r--src/transport/gnunet-service-transport.h3
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c16
-rw-r--r--src/transport/gnunet-service-transport_manipulation.h12
-rw-r--r--src/transport/gnunet-service-transport_plugins.c5
-rw-r--r--src/transport/gnunet-service-transport_plugins.h4
-rw-r--r--src/transport/plugin_transport_http_client.c8
-rw-r--r--src/transport/plugin_transport_http_server.c8
-rw-r--r--src/transport/plugin_transport_tcp.c10
-rw-r--r--src/transport/plugin_transport_udp.c9
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c31
-rw-r--r--src/transport/plugin_transport_unix.c9
-rw-r--r--src/transport/plugin_transport_wlan.c14
-rw-r--r--src/transport/test_plugin_transport.c15
15 files changed, 187 insertions, 59 deletions
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h
index 520c93b2c..bc635b1cc 100644
--- a/src/include/gnunet_transport_plugin.h
+++ b/src/include/gnunet_transport_plugin.h
@@ -100,24 +100,11 @@ typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
100 */ 100 */
101typedef struct 101typedef struct
102 GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, 102 GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
103 const struct 103 const struct GNUNET_PeerIdentity *peer,
104 GNUNET_PeerIdentity 104 const struct GNUNET_MessageHeader *message,
105 * peer, 105 struct Session *session,
106 const struct 106 const char *sender_address,
107 GNUNET_MessageHeader 107 uint16_t sender_address_len);
108 * message,
109 const struct
110 GNUNET_ATS_Information
111 * ats,
112 uint32_t
113 ats_count,
114 struct
115 Session *
116 session,
117 const char
118 *sender_address,
119 uint16_t
120 sender_address_len);
121 108
122 109
123/** 110/**
@@ -134,6 +121,27 @@ typedef struct GNUNET_ATS_Information
134 const struct sockaddr *addr, 121 const struct sockaddr *addr,
135 size_t addrlen); 122 size_t addrlen);
136 123
124
125/**
126 * Function called when quality properties of an address change.
127 *
128 * @param cls closure
129 * @param peer peer
130 * @param address address
131 * @param address_len length of the address
132 * @param session session
133 * @param ats ATS information
134 * @param ats_count number of ATS information contained
135 */
136typedef void
137(*GNUNET_TRANSPORT_UpdateAddressMetrics) (void *cls,
138 const struct GNUNET_PeerIdentity *peer,
139 const char *address,
140 uint16_t address_len,
141 struct Session *session,
142 struct GNUNET_ATS_Information *ats,
143 uint32_t ats_count);
144
137/** 145/**
138 * Function that will be called for each address the transport 146 * Function that will be called for each address the transport
139 * is aware that it might be reachable under. 147 * is aware that it might be reachable under.
@@ -246,6 +254,12 @@ struct GNUNET_TRANSPORT_PluginEnvironment
246 */ 254 */
247 GNUNET_TRANSPORT_AddressToType get_address_type; 255 GNUNET_TRANSPORT_AddressToType get_address_type;
248 256
257 /**
258 * Function that will be called to figure if an address is an loopback,
259 * LAN, WAN etc. address
260 */
261 GNUNET_TRANSPORT_UpdateAddressMetrics update_address_metrics;
262
249 263
250 /** 264 /**
251 * What is the maximum number of connections that this transport 265 * What is the maximum number of connections that this transport
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index b167a7d93..ff0d25326 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -233,8 +233,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
233struct GNUNET_TIME_Relative 233struct GNUNET_TIME_Relative
234GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, 234GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
235 const struct GNUNET_MessageHeader *message, 235 const struct GNUNET_MessageHeader *message,
236 const struct GNUNET_ATS_Information *ats, 236 struct Session *session,
237 uint32_t ats_count, struct Session *session,
238 const char *sender_address, 237 const char *sender_address,
239 uint16_t sender_address_len) 238 uint16_t sender_address_len)
240{ 239{
@@ -278,16 +277,13 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
278 GST_validation_handle_pong (peer, message); 277 GST_validation_handle_pong (peer, message);
279 break; 278 break;
280 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: 279 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT:
281 GST_neighbours_handle_connect (message, peer, &address, session, ats, 280 GST_neighbours_handle_connect (message, peer, &address, session, NULL, 0);
282 ats_count);
283 break; 281 break;
284 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK: 282 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK:
285 GST_neighbours_handle_connect_ack (message, peer, &address, session, ats, 283 GST_neighbours_handle_connect_ack (message, peer, &address, session, NULL, 0);
286 ats_count);
287 break; 284 break;
288 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK: 285 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK:
289 GST_neighbours_handle_session_ack (message, peer, &address, session, ats, 286 GST_neighbours_handle_session_ack (message, peer, &address, session, NULL, 0);
290 ats_count);
291 break; 287 break;
292 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: 288 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
293 GST_neighbours_handle_disconnect_message (peer, message); 289 GST_neighbours_handle_disconnect_message (peer, message);
@@ -296,7 +292,7 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
296 GST_neighbours_keepalive (peer); 292 GST_neighbours_keepalive (peer);
297 break; 293 break;
298 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE: 294 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE:
299 GST_neighbours_keepalive_response (peer, ats, ats_count); 295 GST_neighbours_keepalive_response (peer, NULL, 0);
300 break; 296 break;
301 default: 297 default:
302 /* should be payload */ 298 /* should be payload */
@@ -304,7 +300,7 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
304 gettext_noop 300 gettext_noop
305 ("# bytes payload received"), 301 ("# bytes payload received"),
306 ntohs (message->size), GNUNET_NO); 302 ntohs (message->size), GNUNET_NO);
307 ret = process_payload (peer, &address, session, message, ats, ats_count); 303 ret = process_payload (peer, &address, session, message, NULL, 0);
308 break; 304 break;
309 } 305 }
310end: 306end:
@@ -416,6 +412,39 @@ plugin_env_address_to_type (void *cls,
416 return GNUNET_ATS_address_get_type(GST_ats, addr, addrlen); 412 return GNUNET_ATS_address_get_type(GST_ats, addr, addrlen);
417} 413}
418 414
415/**
416 * Function that will be called to figure if an address is an loopback,
417 * LAN, WAN etc. address
418 *
419 * @param cls closure
420 * @param addr binary address
421 * @param addrlen length of the address
422 * @return ATS Information containing the network type
423 */
424static void
425plugin_env_update_metrics (void *cls,
426 const struct GNUNET_PeerIdentity *peer,
427 const char *address,
428 uint16_t address_len,
429 struct Session *session,
430 struct GNUNET_ATS_Information *ats,
431 uint32_t ats_count)
432{
433 struct GNUNET_HELLO_Address haddress;
434 const char *plugin_name = cls;
435
436 if ((NULL == ats) || (0 == ats_count))
437 return;
438 GNUNET_assert (NULL != GST_ats);
439
440 haddress.peer = *peer;
441 haddress.address = address;
442 haddress.address_length = address_len;
443 haddress.transport_name = plugin_name;
444
445 GNUNET_ATS_address_update (GST_ats, &haddress, session, ats, ats_count);
446}
447
419 448
420/** 449/**
421 * Function called by ATS to notify the callee that the 450 * Function called by ATS to notify the callee that the
@@ -671,7 +700,8 @@ key_generation_cb (void *cls,
671 GST_plugins_load (&GST_manipulation_recv, 700 GST_plugins_load (&GST_manipulation_recv,
672 &plugin_env_address_change_notification, 701 &plugin_env_address_change_notification,
673 &plugin_env_session_end, 702 &plugin_env_session_end,
674 &plugin_env_address_to_type); 703 &plugin_env_address_to_type,
704 &plugin_env_update_metrics);
675 GST_neighbours_start (NULL, 705 GST_neighbours_start (NULL,
676 &neighbours_connect_notification, 706 &neighbours_connect_notification,
677 &neighbours_disconnect_notification, 707 &neighbours_disconnect_notification,
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index 1cbc14c6c..4f0aa924a 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -93,8 +93,7 @@ extern struct GNUNET_ATS_SchedulingHandle *GST_ats;
93struct GNUNET_TIME_Relative 93struct GNUNET_TIME_Relative
94GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, 94GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
95 const struct GNUNET_MessageHeader *message, 95 const struct GNUNET_MessageHeader *message,
96 const struct GNUNET_ATS_Information *ats, 96 struct Session *session,
97 uint32_t ats_count, struct Session *session,
98 const char *sender_address, 97 const char *sender_address,
99 uint16_t sender_address_len); 98 uint16_t sender_address_len);
100 99
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 3d9272c53..dbfa89e12 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -342,19 +342,26 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
342} 342}
343 343
344struct GNUNET_TIME_Relative 344struct GNUNET_TIME_Relative
345GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer, 345GST_manipulation_recv (void *cls,
346 const struct GNUNET_PeerIdentity *peer,
346 const struct GNUNET_MessageHeader *message, 347 const struct GNUNET_MessageHeader *message,
347 const struct GNUNET_ATS_Information *ats, 348 struct Session *session,
348 uint32_t ats_count, struct Session *session,
349 const char *sender_address, 349 const char *sender_address,
350 uint16_t sender_address_len) 350 uint16_t sender_address_len)
351{ 351{
352 return GST_receive_callback (cls, peer, message,
353 session, sender_address, sender_address_len);
354
355/* FIXME */
356#if 0
352 struct TM_Peer *tmp; 357 struct TM_Peer *tmp;
353 int d; 358 int d;
354 struct GNUNET_ATS_Information ats_new[ats_count]; 359 struct GNUNET_ATS_Information ats_new[ats_count];
355 struct GNUNET_TIME_Relative quota_delay; 360 struct GNUNET_TIME_Relative quota_delay;
356 struct GNUNET_TIME_Relative m_delay; 361 struct GNUNET_TIME_Relative m_delay;
357 362
363
364
358 if (man_handle.delay_in.rel_value > GNUNET_TIME_UNIT_ZERO.rel_value) 365 if (man_handle.delay_in.rel_value > GNUNET_TIME_UNIT_ZERO.rel_value)
359 m_delay = man_handle.delay_in; /* Global delay */ 366 m_delay = man_handle.delay_in; /* Global delay */
360 else 367 else
@@ -385,12 +392,13 @@ GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer,
385 m_delay.rel_value = tmp->metrics[TM_RECEIVE][DELAY]; /* Peer specific delay */ 392 m_delay.rel_value = tmp->metrics[TM_RECEIVE][DELAY]; /* Peer specific delay */
386 } 393 }
387 394
388 quota_delay = GST_receive_callback (cls, peer, message, ats_new, ats_count, 395 quota_delay = GST_receive_callback (cls, peer, message,
389 session, sender_address, sender_address_len); 396 session, sender_address, sender_address_len);
390 if (quota_delay.rel_value > m_delay.rel_value) 397 if (quota_delay.rel_value > m_delay.rel_value)
391 return quota_delay; 398 return quota_delay;
392 else 399 else
393 return m_delay; 400 return m_delay;
401#endif
394} 402}
395 403
396void 404void
diff --git a/src/transport/gnunet-service-transport_manipulation.h b/src/transport/gnunet-service-transport_manipulation.h
index e1ae2921e..4a13abbdc 100644
--- a/src/transport/gnunet-service-transport_manipulation.h
+++ b/src/transport/gnunet-service-transport_manipulation.h
@@ -47,12 +47,12 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
47 GST_NeighbourSendContinuation cont, void *cont_cls); 47 GST_NeighbourSendContinuation cont, void *cont_cls);
48 48
49struct GNUNET_TIME_Relative 49struct GNUNET_TIME_Relative
50GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer, 50GST_manipulation_recv (void *cls,
51 const struct GNUNET_MessageHeader *message, 51 const struct GNUNET_PeerIdentity *peer,
52 const struct GNUNET_ATS_Information *ats, 52 const struct GNUNET_MessageHeader *message,
53 uint32_t ats_count, struct Session *session, 53 struct Session *session,
54 const char *sender_address, 54 const char *sender_address,
55 uint16_t sender_address_len); 55 uint16_t sender_address_len);
56 56
57void 57void
58GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg); 58GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg);
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index 1f3727b8e..36d030980 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -89,12 +89,14 @@ static struct TransportPlugin *plugins_tail;
89 * @param address_cb function to call when our public addresses changed 89 * @param address_cb function to call when our public addresses changed
90 * @param session_end_cb function to call when a session was terminated 90 * @param session_end_cb function to call when a session was terminated
91 * @param address_type_cb function to call when a address type is requested 91 * @param address_type_cb function to call when a address type is requested
92 * @param metric_update_cb function to call when address metrics change
92 */ 93 */
93void 94void
94GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, 95GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
95 GNUNET_TRANSPORT_AddressNotification address_cb, 96 GNUNET_TRANSPORT_AddressNotification address_cb,
96 GNUNET_TRANSPORT_SessionEnd session_end_cb, 97 GNUNET_TRANSPORT_SessionEnd session_end_cb,
97 GNUNET_TRANSPORT_AddressToType address_type_cb) 98 GNUNET_TRANSPORT_AddressToType address_type_cb,
99 GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb)
98{ 100{
99 struct TransportPlugin *plug; 101 struct TransportPlugin *plug;
100 struct TransportPlugin *next; 102 struct TransportPlugin *next;
@@ -133,6 +135,7 @@ GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
133 plug->env.notify_address = address_cb; 135 plug->env.notify_address = address_cb;
134 plug->env.session_end = session_end_cb; 136 plug->env.session_end = session_end_cb;
135 plug->env.get_address_type = address_type_cb; 137 plug->env.get_address_type = address_type_cb;
138 plug->env.update_address_metrics = metric_update_cb;
136 plug->env.max_connections = tneigh; 139 plug->env.max_connections = tneigh;
137 plug->env.stats = GST_stats; 140 plug->env.stats = GST_stats;
138 GNUNET_CONTAINER_DLL_insert (plugins_head, plugins_tail, plug); 141 GNUNET_CONTAINER_DLL_insert (plugins_head, plugins_tail, plug);
diff --git a/src/transport/gnunet-service-transport_plugins.h b/src/transport/gnunet-service-transport_plugins.h
index 97e8f4c6f..ef20e4539 100644
--- a/src/transport/gnunet-service-transport_plugins.h
+++ b/src/transport/gnunet-service-transport_plugins.h
@@ -43,12 +43,14 @@
43 * @param address_cb function to call when our public addresses changed 43 * @param address_cb function to call when our public addresses changed
44 * @param session_end_cb function to call when a session was terminated 44 * @param session_end_cb function to call when a session was terminated
45 * @param address_type_cb function to call when a address type is requested 45 * @param address_type_cb function to call when a address type is requested
46 * @param metric_update_cb function to call when address metrics change
46 */ 47 */
47void 48void
48GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, 49GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
49 GNUNET_TRANSPORT_AddressNotification address_cb, 50 GNUNET_TRANSPORT_AddressNotification address_cb,
50 GNUNET_TRANSPORT_SessionEnd session_end_cb, 51 GNUNET_TRANSPORT_SessionEnd session_end_cb,
51 GNUNET_TRANSPORT_AddressToType address_type_cb); 52 GNUNET_TRANSPORT_AddressToType address_type_cb,
53 GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb);
52 54
53/** 55/**
54 * Unload all plugins 56 * Unload all plugins
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 351687a07..062941751 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -919,9 +919,15 @@ client_receive_mst_cb (void *cls, void *client,
919 GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); 919 GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED));
920 920
921 delay = s->plugin->env->receive (plugin->env->cls, &s->target, message, 921 delay = s->plugin->env->receive (plugin->env->cls, &s->target, message,
922 (const struct GNUNET_ATS_Information *) &atsi, 2,
923 s, s->addr, s->addrlen); 922 s, s->addr, s->addrlen);
924 923
924 plugin->env->update_address_metrics (plugin->env->cls,
925 &s->target,
926 s->addr,
927 s->addrlen,
928 s,
929 (struct GNUNET_ATS_Information *) &atsi, 2);
930
925 GNUNET_asprintf (&stat_txt, "# bytes received via %s_client", plugin->protocol); 931 GNUNET_asprintf (&stat_txt, "# bytes received via %s_client", plugin->protocol);
926 GNUNET_STATISTICS_update (plugin->env->stats, 932 GNUNET_STATISTICS_update (plugin->env->stats,
927 stat_txt, ntohs(message->size), GNUNET_NO); 933 stat_txt, ntohs(message->size), GNUNET_NO);
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 97a28b694..ba07ee95e 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -1289,9 +1289,15 @@ server_receive_mst_cb (void *cls, void *client,
1289 delay = plugin->env->receive (plugin->env->cls, 1289 delay = plugin->env->receive (plugin->env->cls,
1290 &s->target, 1290 &s->target,
1291 message, 1291 message,
1292 (const struct GNUNET_ATS_Information *) &atsi, 2,
1293 s, s->addr, s->addrlen); 1292 s, s->addr, s->addrlen);
1294 1293
1294 plugin->env->update_address_metrics (plugin->env->cls,
1295 &s->target,
1296 s->addr,
1297 s->addrlen,
1298 s,
1299 (struct GNUNET_ATS_Information *) &atsi, 2);
1300
1295 GNUNET_asprintf (&stat_txt, "# bytes received via %s_server", plugin->protocol); 1301 GNUNET_asprintf (&stat_txt, "# bytes received via %s_server", plugin->protocol);
1296 GNUNET_STATISTICS_update (plugin->env->stats, 1302 GNUNET_STATISTICS_update (plugin->env->stats,
1297 stat_txt, ntohs (message->size), GNUNET_NO); 1303 stat_txt, ntohs (message->size), GNUNET_NO);
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index db3dabe11..856ec6eaf 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2050,10 +2050,16 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2050 delay = plugin->env->receive (plugin->env->cls, 2050 delay = plugin->env->receive (plugin->env->cls,
2051 &session->target, 2051 &session->target,
2052 message, 2052 message,
2053 (const struct GNUNET_ATS_Information *) &distance, 2053 session,
2054 2, session,
2055 (GNUNET_YES == session->inbound) ? NULL : session->addr, 2054 (GNUNET_YES == session->inbound) ? NULL : session->addr,
2056 (GNUNET_YES == session->inbound) ? 0 : session->addrlen); 2055 (GNUNET_YES == session->inbound) ? 0 : session->addrlen);
2056 plugin->env->update_address_metrics (plugin->env->cls,
2057 &session->target,
2058 (GNUNET_YES == session->inbound) ? NULL : session->addr,
2059 (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
2060 session,
2061 (struct GNUNET_ATS_Information *) &distance,
2062 2);
2057 2063
2058 reschedule_session_timeout (session); 2064 reschedule_session_timeout (session);
2059 2065
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index c57ec98e1..885a26b19 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1907,10 +1907,17 @@ process_inbound_tokenized_messages (void *cls, void *client,
1907 delay = plugin->env->receive (plugin->env->cls, 1907 delay = plugin->env->receive (plugin->env->cls,
1908 &si->sender, 1908 &si->sender,
1909 hdr, 1909 hdr,
1910 (const struct GNUNET_ATS_Information *) &ats, 2,
1911 si->session, 1910 si->session,
1912 si->arg, 1911 si->arg,
1913 si->args); 1912 si->args);
1913
1914 plugin->env->update_address_metrics (plugin->env->cls,
1915 &si->sender,
1916 si->arg,
1917 si->args,
1918 si->session,
1919 (struct GNUNET_ATS_Information *) &ats, 2);
1920
1914 si->session->flow_delay_for_other_peer = delay; 1921 si->session->flow_delay_for_other_peer = delay;
1915 reschedule_session_timeout(si->session); 1922 reschedule_session_timeout(si->session);
1916 return GNUNET_OK; 1923 return GNUNET_OK;
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index db6c1fe8c..102e262ae 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -119,9 +119,18 @@ broadcast_ipv6_mst_cb (void *cls, void *client,
119 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); 119 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
120 120
121 hello = (struct GNUNET_MessageHeader *) &msg[1]; 121 hello = (struct GNUNET_MessageHeader *) &msg[1];
122 plugin->env->receive (plugin->env->cls, &msg->sender, hello, 122 plugin->env->receive (plugin->env->cls,
123 (const struct GNUNET_ATS_Information *) &atsi, 2, NULL, 123 &msg->sender,
124 (const char *) &mc->addr, sizeof (mc->addr)); 124 hello,
125 NULL,
126 (const char *) &mc->addr,
127 sizeof (mc->addr));
128 plugin->env->update_address_metrics (plugin->env->cls,
129 &msg->sender,
130 (const char *) &mc->addr,
131 sizeof (mc->addr),
132 NULL,
133 (struct GNUNET_ATS_Information *) &atsi, 2);
125 134
126 GNUNET_STATISTICS_update (plugin->env->stats, 135 GNUNET_STATISTICS_update (plugin->env->stats,
127 _ 136 _
@@ -160,9 +169,19 @@ broadcast_ipv4_mst_cb (void *cls, void *client,
160 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); 169 GNUNET_break (ntohl(mc->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
161 170
162 hello = (struct GNUNET_MessageHeader *) &msg[1]; 171 hello = (struct GNUNET_MessageHeader *) &msg[1];
163 plugin->env->receive (plugin->env->cls, &msg->sender, hello, 172 plugin->env->receive (plugin->env->cls,
164 (const struct GNUNET_ATS_Information *) &atsi, 2, NULL, 173 &msg->sender,
165 (const char *) &mc->addr, sizeof (mc->addr)); 174 hello,
175 NULL,
176 (const char *) &mc->addr,
177 sizeof (mc->addr));
178
179 plugin->env->update_address_metrics (plugin->env->cls,
180 &msg->sender,
181 (const char *) &mc->addr,
182 sizeof (mc->addr),
183 NULL,
184 (struct GNUNET_ATS_Information *) &atsi, 2);
166 185
167 GNUNET_STATISTICS_update (plugin->env->stats, 186 GNUNET_STATISTICS_update (plugin->env->stats,
168 _ 187 _
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 6e9d920ba..e5b591bc4 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -823,8 +823,15 @@ unix_demultiplexer (struct Plugin *plugin, struct GNUNET_PeerIdentity *sender,
823 reschedule_session_timeout (s); 823 reschedule_session_timeout (s);
824 824
825 plugin->env->receive (plugin->env->cls, sender, currhdr, 825 plugin->env->receive (plugin->env->cls, sender, currhdr,
826 (const struct GNUNET_ATS_Information *) &ats, 2,
827 s, un->sun_path, strlen (un->sun_path) + 1); 826 s, un->sun_path, strlen (un->sun_path) + 1);
827
828 plugin->env->update_address_metrics (plugin->env->cls,
829 sender,
830 un->sun_path,
831 strlen (un->sun_path) + 1,
832 s,
833 (struct GNUNET_ATS_Information *) &ats, 2);
834
828 GNUNET_free (addr); 835 GNUNET_free (addr);
829} 836}
830 837
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 5fed7a739..e1201eb2b 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1171,10 +1171,15 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1171 plugin->env->receive (plugin->env->cls, 1171 plugin->env->receive (plugin->env->cls,
1172 &tmpsource, 1172 &tmpsource,
1173 hdr, 1173 hdr,
1174 ats, NUM_ATS,
1175 mas->session, 1174 mas->session,
1176 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1175 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1177 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1176 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1177 plugin->env->update_address_metrics (plugin->env->cls,
1178 &tmpsource,
1179 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1180 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress),
1181 mas->session,
1182 (struct GNUNET_ATS_Information *) &ats, NUM_ATS);
1178 break; 1183 break;
1179 case GNUNET_MESSAGE_TYPE_FRAGMENT: 1184 case GNUNET_MESSAGE_TYPE_FRAGMENT:
1180 if (NULL == mas->endpoint) 1185 if (NULL == mas->endpoint)
@@ -1289,10 +1294,15 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1289 plugin->env->receive (plugin->env->cls, 1294 plugin->env->receive (plugin->env->cls,
1290 &mas->session->target, 1295 &mas->session->target,
1291 hdr, 1296 hdr,
1292 ats, NUM_ATS,
1293 mas->session, 1297 mas->session,
1294 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, 1298 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1295 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1299 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1300 plugin->env->update_address_metrics (plugin->env->cls,
1301 &mas->session->target,
1302 (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr,
1303 (mas->endpoint == NULL) ? 0 : sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress),
1304 mas->session,
1305 (struct GNUNET_ATS_Information *) &ats, NUM_ATS);
1296 break; 1306 break;
1297 } 1307 }
1298 return GNUNET_OK; 1308 return GNUNET_OK;
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index 7fcbe9d63..3c4c6f624 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -292,8 +292,6 @@ static struct GNUNET_TIME_Relative
292env_receive (void *cls, 292env_receive (void *cls,
293 const struct GNUNET_PeerIdentity *peer, 293 const struct GNUNET_PeerIdentity *peer,
294 const struct GNUNET_MessageHeader *message, 294 const struct GNUNET_MessageHeader *message,
295 const struct GNUNET_ATS_Information *ats,
296 uint32_t ats_count,
297 struct Session * session, 295 struct Session * session,
298 const char *sender_address, 296 const char *sender_address,
299 uint16_t sender_address_len) 297 uint16_t sender_address_len)
@@ -485,6 +483,18 @@ env_session_end (void *cls,
485 483
486 484
487static void 485static void
486env_update_metrics (void *cls,
487 const struct GNUNET_PeerIdentity *peer,
488 const char *address,
489 uint16_t address_len,
490 struct Session *session,
491 struct GNUNET_ATS_Information *ats,
492 uint32_t ats_count)
493{
494}
495
496
497static void
488setup_plugin_environment () 498setup_plugin_environment ()
489{ 499{
490 env.cfg = cfg; 500 env.cfg = cfg;
@@ -496,6 +506,7 @@ setup_plugin_environment ()
496 env.receive = &env_receive; 506 env.receive = &env_receive;
497 env.notify_address = &env_notify_address; 507 env.notify_address = &env_notify_address;
498 env.get_address_type = &env_get_address_type; 508 env.get_address_type = &env_get_address_type;
509 env.update_address_metrics = &env_update_metrics;
499 env.get_our_hello = &env_get_our_hello; 510 env.get_our_hello = &env_get_our_hello;
500 env.session_end = &env_session_end; 511 env.session_end = &env_session_end;
501} 512}