aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c38
-rw-r--r--src/mesh/mesh_api.c27
2 files changed, 39 insertions, 26 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 94196be84..19650dcb6 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -2265,6 +2265,7 @@ send_core_path_ack (void *cls, size_t size, void *buf)
2265 * @param message message 2265 * @param message message
2266 * @param peer peer identity this notification is about 2266 * @param peer peer identity this notification is about
2267 * @param atsi performance data 2267 * @param atsi performance data
2268 * @param atsi_count number of records in 'atsi'
2268 * 2269 *
2269 * @return GNUNET_OK to keep the connection open, 2270 * @return GNUNET_OK to keep the connection open,
2270 * GNUNET_SYSERR to close it (signal serious error) 2271 * GNUNET_SYSERR to close it (signal serious error)
@@ -2272,7 +2273,8 @@ send_core_path_ack (void *cls, size_t size, void *buf)
2272static int 2273static int
2273handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, 2274handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2274 const struct GNUNET_MessageHeader *message, 2275 const struct GNUNET_MessageHeader *message,
2275 const struct GNUNET_ATS_Information *atsi) 2276 const struct GNUNET_ATS_Information *atsi,
2277 unsigned int atsi_count)
2276{ 2278{
2277 unsigned int own_pos; 2279 unsigned int own_pos;
2278 uint16_t size; 2280 uint16_t size;
@@ -2462,6 +2464,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2462 * @param message message 2464 * @param message message
2463 * @param peer peer identity this notification is about 2465 * @param peer peer identity this notification is about
2464 * @param atsi performance data 2466 * @param atsi performance data
2467 * @param atsi_count number of records in 'atsi'
2465 * 2468 *
2466 * @return GNUNET_OK to keep the connection open, 2469 * @return GNUNET_OK to keep the connection open,
2467 * GNUNET_SYSERR to close it (signal serious error) 2470 * GNUNET_SYSERR to close it (signal serious error)
@@ -2469,7 +2472,8 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2469static int 2472static int
2470handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, 2473handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
2471 const struct GNUNET_MessageHeader *message, 2474 const struct GNUNET_MessageHeader *message,
2472 const struct GNUNET_ATS_Information *atsi) 2475 const struct GNUNET_ATS_Information *atsi,
2476 unsigned int atsi_count)
2473{ 2477{
2474 struct GNUNET_MESH_ManipulatePath *msg; 2478 struct GNUNET_MESH_ManipulatePath *msg;
2475 struct GNUNET_PeerIdentity *pi; 2479 struct GNUNET_PeerIdentity *pi;
@@ -2546,6 +2550,7 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
2546 * @param message message 2550 * @param message message
2547 * @param peer peer identity this notification is about 2551 * @param peer peer identity this notification is about
2548 * @param atsi performance data 2552 * @param atsi performance data
2553 * @param atsi_count number of records in 'atsi'
2549 * 2554 *
2550 * @return GNUNET_OK to keep the connection open, 2555 * @return GNUNET_OK to keep the connection open,
2551 * GNUNET_SYSERR to close it (signal serious error) 2556 * GNUNET_SYSERR to close it (signal serious error)
@@ -2553,7 +2558,8 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
2553static int 2558static int
2554handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, 2559handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
2555 const struct GNUNET_MessageHeader *message, 2560 const struct GNUNET_MessageHeader *message,
2556 const struct GNUNET_ATS_Information *atsi) 2561 const struct GNUNET_ATS_Information *atsi,
2562 unsigned int atsi_count)
2557{ 2563{
2558 struct GNUNET_MESH_TunnelDestroy *msg; 2564 struct GNUNET_MESH_TunnelDestroy *msg;
2559 struct MeshTunnel *t; 2565 struct MeshTunnel *t;
@@ -2596,13 +2602,15 @@ handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
2596 * @param peer peer identity this notification is about 2602 * @param peer peer identity this notification is about
2597 * @param message message 2603 * @param message message
2598 * @param atsi performance data 2604 * @param atsi performance data
2605 * @param atsi_count number of records in 'atsi'
2599 * @return GNUNET_OK to keep the connection open, 2606 * @return GNUNET_OK to keep the connection open,
2600 * GNUNET_SYSERR to close it (signal serious error) 2607 * GNUNET_SYSERR to close it (signal serious error)
2601 */ 2608 */
2602static int 2609static int
2603handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, 2610handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2604 const struct GNUNET_MessageHeader *message, 2611 const struct GNUNET_MessageHeader *message,
2605 const struct GNUNET_ATS_Information *atsi) 2612 const struct GNUNET_ATS_Information *atsi,
2613 unsigned int atsi_count)
2606{ 2614{
2607 struct GNUNET_MESH_Unicast *msg; 2615 struct GNUNET_MESH_Unicast *msg;
2608 struct MeshTunnel *t; 2616 struct MeshTunnel *t;
@@ -2654,6 +2662,7 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2654 * @param message message 2662 * @param message message
2655 * @param peer peer identity this notification is about 2663 * @param peer peer identity this notification is about
2656 * @param atsi performance data 2664 * @param atsi performance data
2665 * @param atsi_count number of records in 'atsi'
2657 * @return GNUNET_OK to keep the connection open, 2666 * @return GNUNET_OK to keep the connection open,
2658 * GNUNET_SYSERR to close it (signal serious error) 2667 * GNUNET_SYSERR to close it (signal serious error)
2659 * 2668 *
@@ -2662,7 +2671,8 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2662static int 2671static int
2663handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, 2672handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2664 const struct GNUNET_MessageHeader *message, 2673 const struct GNUNET_MessageHeader *message,
2665 const struct GNUNET_ATS_Information *atsi) 2674 const struct GNUNET_ATS_Information *atsi,
2675 unsigned int atsi_count)
2666{ 2676{
2667 struct GNUNET_MESH_Multicast *msg; 2677 struct GNUNET_MESH_Multicast *msg;
2668 struct MeshTunnel *t; 2678 struct MeshTunnel *t;
@@ -2707,6 +2717,7 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2707 * @param message message 2717 * @param message message
2708 * @param peer peer identity this notification is about 2718 * @param peer peer identity this notification is about
2709 * @param atsi performance data 2719 * @param atsi performance data
2720 * @param atsi_count number of records in 'atsi'
2710 * 2721 *
2711 * @return GNUNET_OK to keep the connection open, 2722 * @return GNUNET_OK to keep the connection open,
2712 * GNUNET_SYSERR to close it (signal serious error) 2723 * GNUNET_SYSERR to close it (signal serious error)
@@ -2714,7 +2725,8 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2714static int 2725static int
2715handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, 2726handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
2716 const struct GNUNET_MessageHeader *message, 2727 const struct GNUNET_MessageHeader *message,
2717 const struct GNUNET_ATS_Information *atsi) 2728 const struct GNUNET_ATS_Information *atsi,
2729 unsigned int atsi_count)
2718{ 2730{
2719 struct GNUNET_MESH_ToOrigin *msg; 2731 struct GNUNET_MESH_ToOrigin *msg;
2720 struct GNUNET_PeerIdentity id; 2732 struct GNUNET_PeerIdentity id;
@@ -2794,6 +2806,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
2794 * @param message message 2806 * @param message message
2795 * @param peer peer identity this notification is about 2807 * @param peer peer identity this notification is about
2796 * @param atsi performance data 2808 * @param atsi performance data
2809 * @param atsi_count number of records in 'atsi'
2797 * 2810 *
2798 * @return GNUNET_OK to keep the connection open, 2811 * @return GNUNET_OK to keep the connection open,
2799 * GNUNET_SYSERR to close it (signal serious error) 2812 * GNUNET_SYSERR to close it (signal serious error)
@@ -2801,7 +2814,8 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
2801static int 2814static int
2802handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, 2815handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2803 const struct GNUNET_MessageHeader *message, 2816 const struct GNUNET_MessageHeader *message,
2804 const struct GNUNET_ATS_Information *atsi) 2817 const struct GNUNET_ATS_Information *atsi,
2818 unsigned int atsi_count)
2805{ 2819{
2806 struct GNUNET_MESH_PathACK *msg; 2820 struct GNUNET_MESH_PathACK *msg;
2807 struct GNUNET_PeerIdentity id; 2821 struct GNUNET_PeerIdentity id;
@@ -3739,7 +3753,7 @@ handle_local_unicast (void *cls, struct GNUNET_SERVER_Client *client,
3739 copy->tid = htonl (t->id.tid); 3753 copy->tid = htonl (t->id.tid);
3740 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3754 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3741 "MESH: calling generic handler...\n"); 3755 "MESH: calling generic handler...\n");
3742 handle_mesh_data_unicast (NULL, &my_full_id, &copy->header, NULL); 3756 handle_mesh_data_unicast (NULL, &my_full_id, &copy->header, NULL, 0);
3743 } 3757 }
3744 GNUNET_SERVER_receive_done (client, GNUNET_OK); 3758 GNUNET_SERVER_receive_done (client, GNUNET_OK);
3745 return; 3759 return;
@@ -3825,7 +3839,7 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client,
3825 copy->sender = my_full_id; 3839 copy->sender = my_full_id;
3826 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3840 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3827 "MESH: calling generic handler...\n"); 3841 "MESH: calling generic handler...\n");
3828 handle_mesh_data_to_orig (NULL, &my_full_id, &copy->header, NULL); 3842 handle_mesh_data_to_orig (NULL, &my_full_id, &copy->header, NULL, 0);
3829 } 3843 }
3830 GNUNET_SERVER_receive_done (client, GNUNET_OK); 3844 GNUNET_SERVER_receive_done (client, GNUNET_OK);
3831 return; 3845 return;
@@ -3896,7 +3910,7 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client,
3896 copy->tid = htonl(t->id.tid); 3910 copy->tid = htonl(t->id.tid);
3897 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3898 "MESH: calling generic handler...\n"); 3912 "MESH: calling generic handler...\n");
3899 handle_mesh_data_multicast(client, &my_full_id, &copy->header, NULL); 3913 handle_mesh_data_multicast(client, &my_full_id, &copy->header, NULL, 0);
3900 } 3914 }
3901 3915
3902 /* receive done gets called when last copy is sent to a neighbor */ 3916 /* receive done gets called when last copy is sent to a neighbor */
@@ -3961,10 +3975,12 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server,
3961 * @param cls closure 3975 * @param cls closure
3962 * @param peer peer identity this notification is about 3976 * @param peer peer identity this notification is about
3963 * @param atsi performance data for the connection 3977 * @param atsi performance data for the connection
3978 * @param atsi_count number of records in 'atsi'
3964 */ 3979 */
3965static void 3980static void
3966core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, 3981core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
3967 const struct GNUNET_ATS_Information *atsi) 3982 const struct GNUNET_ATS_Information *atsi,
3983 unsigned int atsi_count)
3968{ 3984{
3969 struct MeshPeerInfo *peer_info; 3985 struct MeshPeerInfo *peer_info;
3970 struct MeshPeerPath *path; 3986 struct MeshPeerPath *path;
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index 2067b7b6c..0f7592056 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -113,7 +113,6 @@ struct peer_list_element
113 /* list of application-types */ 113 /* list of application-types */
114 struct type_list_element *type_head, *type_tail; 114 struct type_list_element *type_head, *type_tail;
115 115
116 struct GNUNET_ATS_Information atsi;
117 struct peer_list_element *next, *prev; 116 struct peer_list_element *next, *prev;
118 117
119 /* The handle that sends the hellos to this peer */ 118 /* The handle that sends the hellos to this peer */
@@ -154,7 +153,7 @@ send_end_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
154 153
155 struct GNUNET_MESH_Tunnel *tunnel = cls; 154 struct GNUNET_MESH_Tunnel *tunnel = cls;
156 155
157 tunnel->connect_handler (tunnel->handler_cls, NULL, NULL); 156 tunnel->connect_handler (tunnel->handler_cls, NULL, NULL, 0);
158} 157}
159 158
160static void 159static void
@@ -165,7 +164,7 @@ send_self_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
165 164
166 struct GNUNET_MESH_Tunnel *tunnel = cls; 165 struct GNUNET_MESH_Tunnel *tunnel = cls;
167 166
168 tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL); 167 tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL, 0);
169 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 168 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
170} 169}
171 170
@@ -177,7 +176,7 @@ call_connect_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
177 176
178 struct GNUNET_MESH_Tunnel *tunnel = cls; 177 struct GNUNET_MESH_Tunnel *tunnel = cls;
179 178
180 tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL); 179 tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL, 0);
181 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 180 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
182} 181}
183 182
@@ -254,7 +253,8 @@ schedule_hello_message (void *cls,
254 */ 253 */
255static void 254static void
256core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, 255core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
257 const struct GNUNET_ATS_Information *atsi) 256 const struct GNUNET_ATS_Information *atsi,
257 unsigned int atsi_count)
258{ 258{
259 struct GNUNET_MESH_Handle *handle = cls; 259 struct GNUNET_MESH_Handle *handle = cls;
260 260
@@ -269,11 +269,6 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
269 269
270 /* Send a hello to this peer */ 270 /* Send a hello to this peer */
271 element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element); 271 element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element);
272
273 if (NULL != atsi)
274 memcpy (&element->atsi, atsi,
275 sizeof (struct GNUNET_ATS_Information));
276
277 GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head, 272 GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head,
278 handle->connected_peers.tail, 273 handle->connected_peers.tail,
279 handle->connected_peers.tail, element); 274 handle->connected_peers.tail, element);
@@ -294,7 +289,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
294 handle->established_tunnels.tail, 289 handle->established_tunnels.tail,
295 handle->established_tunnels.tail, 290 handle->established_tunnels.tail,
296 tunnel); 291 tunnel);
297 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi); 292 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi, atsi_count);
298 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 293 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
299 tunnel = next; 294 tunnel = next;
300 } 295 }
@@ -383,7 +378,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
383static int 378static int
384receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, 379receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
385 const struct GNUNET_MessageHeader *message, 380 const struct GNUNET_MessageHeader *message,
386 const struct GNUNET_ATS_Information *atsi) 381 const struct GNUNET_ATS_Information *atsi,
382 unsigned int atsi_count)
387{ 383{
388 struct GNUNET_MESH_Handle *handle = cls; 384 struct GNUNET_MESH_Handle *handle = cls;
389 uint16_t *num = (uint16_t *) (message + 1); 385 uint16_t *num = (uint16_t *) (message + 1);
@@ -450,7 +446,7 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
450 memcpy (&tunnel->tunnel.peer, other, 446 memcpy (&tunnel->tunnel.peer, other,
451 sizeof (struct GNUNET_PeerIdentity)); 447 sizeof (struct GNUNET_PeerIdentity));
452 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, 448 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls,
453 &tunnel->tunnel.peer, atsi); 449 &tunnel->tunnel.peer, atsi, atsi_count);
454 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 450 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
455 break; 451 break;
456 } 452 }
@@ -469,7 +465,8 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
469static int 465static int
470core_receive (void *cls, const struct GNUNET_PeerIdentity *other, 466core_receive (void *cls, const struct GNUNET_PeerIdentity *other,
471 const struct GNUNET_MessageHeader *message, 467 const struct GNUNET_MessageHeader *message,
472 const struct GNUNET_ATS_Information *atsi) 468 const struct GNUNET_ATS_Information *atsi,
469 unsigned int atsi_count)
473{ 470{
474 struct GNUNET_MESH_Handle *handle = cls; 471 struct GNUNET_MESH_Handle *handle = cls;
475 struct tunnel_message *tmessage = (struct tunnel_message *) message; 472 struct tunnel_message *tmessage = (struct tunnel_message *) message;
@@ -539,7 +536,7 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other,
539 GNUNET_i2s (other), ntohs (rmessage->type)); 536 GNUNET_i2s (other), ntohs (rmessage->type));
540 537
541 return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx, 538 return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx,
542 other, rmessage, atsi); 539 other, rmessage, atsi, atsi_count);
543} 540}
544 541
545struct GNUNET_MESH_Tunnel * 542struct GNUNET_MESH_Tunnel *