diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 307 |
1 files changed, 126 insertions, 181 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index de1daecb0..338def09a 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -480,11 +480,9 @@ get_peer_info (const struct GNUNET_PeerIdentity *peer) | |||
480 | peer_info = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); | 480 | peer_info = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); |
481 | if (NULL == peer_info) | 481 | if (NULL == peer_info) |
482 | { | 482 | { |
483 | peer_info = (struct MeshPeerInfo *) | 483 | peer_info = |
484 | GNUNET_malloc (sizeof (struct MeshPeerInfo)); | 484 | (struct MeshPeerInfo *) GNUNET_malloc (sizeof (struct MeshPeerInfo)); |
485 | GNUNET_CONTAINER_multihashmap_put (peers, | 485 | GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey, peer_info, |
486 | &peer->hashPubKey, | ||
487 | peer_info, | ||
488 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 486 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
489 | peer_info->id = GNUNET_PEER_intern (peer); | 487 | peer_info->id = GNUNET_PEER_intern (peer); |
490 | peer_info->state = MESH_PEER_SEARCHING; | 488 | peer_info->state = MESH_PEER_SEARCHING; |
@@ -591,8 +589,8 @@ add_path_to_peer (struct MeshPeerInfo *peer_info, struct MeshPath *path) | |||
591 | if (best_cost < new_cost) | 589 | if (best_cost < new_cost) |
592 | { | 590 | { |
593 | path->in_use = 0; | 591 | path->in_use = 0; |
594 | GNUNET_CONTAINER_DLL_insert_tail (peer_info->path, | 592 | GNUNET_CONTAINER_DLL_insert_tail (peer_info->path, peer_info->path_tail, |
595 | peer_info->path_tail, path); | 593 | path); |
596 | } | 594 | } |
597 | else | 595 | else |
598 | { | 596 | { |
@@ -820,16 +818,12 @@ announce_applications (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
820 | GNUNET_PEER_resolve (myid, &id); | 818 | GNUNET_PEER_resolve (myid, &id); |
821 | for (i = 0; i < n_applications; i++) | 819 | for (i = 0; i < n_applications; i++) |
822 | { | 820 | { |
823 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 821 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting PUT for app %d\n", |
824 | "Starting PUT for app %d\n", applications[i]); | 822 | applications[i]); |
825 | *p = htonl (applications[i]); | 823 | *p = htonl (applications[i]); |
826 | GNUNET_CRYPTO_hash (buffer, 12, &hash); | 824 | GNUNET_CRYPTO_hash (buffer, 12, &hash); |
827 | GNUNET_DHT_put (dht_handle, | 825 | GNUNET_DHT_put (dht_handle, &hash, 10U, GNUNET_DHT_RO_RECORD_ROUTE, |
828 | &hash, | 826 | GNUNET_BLOCK_TYPE_ANY, sizeof (struct GNUNET_PeerIdentity), |
829 | 10U, | ||
830 | GNUNET_DHT_RO_RECORD_ROUTE, | ||
831 | GNUNET_BLOCK_TYPE_ANY, | ||
832 | sizeof (struct GNUNET_PeerIdentity), | ||
833 | (const char *) &id, | 827 | (const char *) &id, |
834 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 828 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
835 | APP_ANNOUNCE_TIME), | 829 | APP_ANNOUNCE_TIME), |
@@ -840,9 +834,9 @@ announce_applications (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
840 | NULL, NULL); | 834 | NULL, NULL); |
841 | #endif | 835 | #endif |
842 | } | 836 | } |
843 | announce_applications_task = GNUNET_SCHEDULER_add_delayed (APP_ANNOUNCE_TIME, | 837 | announce_applications_task = |
844 | &announce_applications, | 838 | GNUNET_SCHEDULER_add_delayed (APP_ANNOUNCE_TIME, &announce_applications, |
845 | cls); | 839 | cls); |
846 | return; | 840 | return; |
847 | } | 841 | } |
848 | 842 | ||
@@ -883,8 +877,8 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
883 | NULL, /* Continuation */ | 877 | NULL, /* Continuation */ |
884 | NULL); /* Continuation closure */ | 878 | NULL); /* Continuation closure */ |
885 | #endif | 879 | #endif |
886 | announce_id_task = GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, | 880 | announce_id_task = |
887 | &announce_id, cls); | 881 | GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, &announce_id, cls); |
888 | } | 882 | } |
889 | 883 | ||
890 | /******************************************************************************/ | 884 | /******************************************************************************/ |
@@ -917,11 +911,8 @@ send_core_create_path_for_peer (void *cls, size_t size, void *buf) | |||
917 | { | 911 | { |
918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Retransmitting create path\n"); | 912 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Retransmitting create path\n"); |
919 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); | 913 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); |
920 | GNUNET_CORE_notify_transmit_ready (core_handle, | 914 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
921 | 0, | 915 | GNUNET_TIME_UNIT_FOREVER_REL, &id, |
922 | 0, | ||
923 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
924 | &id, | ||
925 | sizeof (struct | 916 | sizeof (struct |
926 | GNUNET_MESH_ManipulatePath) + | 917 | GNUNET_MESH_ManipulatePath) + |
927 | (peer_info->path->length * | 918 | (peer_info->path->length * |
@@ -942,8 +933,9 @@ send_core_create_path_for_peer (void *cls, size_t size, void *buf) | |||
942 | if (p == NULL) | 933 | if (p == NULL) |
943 | return 0; // TODO Notify ERROR Path not found | 934 | return 0; // TODO Notify ERROR Path not found |
944 | 935 | ||
945 | size_needed = sizeof (struct GNUNET_MESH_ManipulatePath) | 936 | size_needed = |
946 | + p->length * sizeof (struct GNUNET_PeerIdentity); | 937 | sizeof (struct GNUNET_MESH_ManipulatePath) + |
938 | p->length * sizeof (struct GNUNET_PeerIdentity); | ||
947 | if (size < size_needed) | 939 | if (size < size_needed) |
948 | { | 940 | { |
949 | // TODO retry? cancel? | 941 | // TODO retry? cancel? |
@@ -1194,8 +1186,8 @@ send_p2p_tunnel_destroy (void *cls, size_t size, void *buf) | |||
1194 | c = t->client; | 1186 | c = t->client; |
1195 | msg = buf; | 1187 | msg = buf; |
1196 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); | 1188 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); |
1197 | /*FIXME*/ | 1189 | /*FIXME*/ msg->header.size = |
1198 | msg->header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage)); | 1190 | htons (sizeof (struct GNUNET_MESH_TunnelMessage)); |
1199 | msg->tunnel_id = htonl (t->id.tid); | 1191 | msg->tunnel_id = htonl (t->id.tid); |
1200 | 1192 | ||
1201 | destroy_tunnel (c, t); | 1193 | destroy_tunnel (c, t); |
@@ -1223,8 +1215,8 @@ send_subscribed_clients (struct GNUNET_MessageHeader *msg) | |||
1223 | if (is_client_subscribed (type, c)) | 1215 | if (is_client_subscribed (type, c)) |
1224 | { | 1216 | { |
1225 | count++; | 1217 | count++; |
1226 | GNUNET_SERVER_notification_context_unicast (nc, | 1218 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, msg, |
1227 | c->handle, msg, GNUNET_YES); | 1219 | GNUNET_YES); |
1228 | } | 1220 | } |
1229 | } | 1221 | } |
1230 | return count; | 1222 | return count; |
@@ -1284,8 +1276,7 @@ iterate_collect_neighbors (void *cls, const GNUNET_HashCode * key, void *value) | |||
1284 | * | 1276 | * |
1285 | */ | 1277 | */ |
1286 | static int | 1278 | static int |
1287 | handle_mesh_path_create (void *cls, | 1279 | handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, |
1288 | const struct GNUNET_PeerIdentity *peer, | ||
1289 | const struct GNUNET_MessageHeader *message, | 1280 | const struct GNUNET_MessageHeader *message, |
1290 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 1281 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1291 | { | 1282 | { |
@@ -1341,9 +1332,7 @@ handle_mesh_path_create (void *cls, | |||
1341 | 1332 | ||
1342 | GNUNET_CRYPTO_hash (&t->id, sizeof (struct MESH_TunnelID), &hash); | 1333 | GNUNET_CRYPTO_hash (&t->id, sizeof (struct MESH_TunnelID), &hash); |
1343 | if (GNUNET_OK != | 1334 | if (GNUNET_OK != |
1344 | GNUNET_CONTAINER_multihashmap_put (tunnels, | 1335 | GNUNET_CONTAINER_multihashmap_put (tunnels, &hash, t, |
1345 | &hash, | ||
1346 | t, | ||
1347 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 1336 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
1348 | { | 1337 | { |
1349 | GNUNET_break (0); | 1338 | GNUNET_break (0); |
@@ -1351,15 +1340,14 @@ handle_mesh_path_create (void *cls, | |||
1351 | } | 1340 | } |
1352 | 1341 | ||
1353 | } | 1342 | } |
1354 | dest_peer_info = GNUNET_CONTAINER_multihashmap_get (peers, | 1343 | dest_peer_info = |
1355 | &pi[size - 1].hashPubKey); | 1344 | GNUNET_CONTAINER_multihashmap_get (peers, &pi[size - 1].hashPubKey); |
1356 | if (NULL == dest_peer_info) | 1345 | if (NULL == dest_peer_info) |
1357 | { | 1346 | { |
1358 | dest_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); | 1347 | dest_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); |
1359 | dest_peer_info->id = GNUNET_PEER_intern (&pi[size - 1]); | 1348 | dest_peer_info->id = GNUNET_PEER_intern (&pi[size - 1]); |
1360 | dest_peer_info->state = MESH_PEER_WAITING; | 1349 | dest_peer_info->state = MESH_PEER_WAITING; |
1361 | GNUNET_CONTAINER_multihashmap_put (peers, | 1350 | GNUNET_CONTAINER_multihashmap_put (peers, &pi[size - 1].hashPubKey, |
1362 | &pi[size - 1].hashPubKey, | ||
1363 | dest_peer_info, | 1351 | dest_peer_info, |
1364 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1352 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1365 | } | 1353 | } |
@@ -1369,9 +1357,7 @@ handle_mesh_path_create (void *cls, | |||
1369 | orig_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); | 1357 | orig_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); |
1370 | orig_peer_info->id = GNUNET_PEER_intern (pi); | 1358 | orig_peer_info->id = GNUNET_PEER_intern (pi); |
1371 | orig_peer_info->state = MESH_PEER_WAITING; | 1359 | orig_peer_info->state = MESH_PEER_WAITING; |
1372 | GNUNET_CONTAINER_multihashmap_put (peers, | 1360 | GNUNET_CONTAINER_multihashmap_put (peers, &pi->hashPubKey, orig_peer_info, |
1373 | &pi->hashPubKey, | ||
1374 | orig_peer_info, | ||
1375 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1361 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1376 | } | 1362 | } |
1377 | 1363 | ||
@@ -1424,11 +1410,8 @@ handle_mesh_path_create (void *cls, | |||
1424 | { | 1410 | { |
1425 | add_path_to_peer (dest_peer_info, path); | 1411 | add_path_to_peer (dest_peer_info, path); |
1426 | GNUNET_PEER_resolve (get_first_hop (path), &id); | 1412 | GNUNET_PEER_resolve (get_first_hop (path), &id); |
1427 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1413 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1428 | 0, | 1414 | GNUNET_TIME_UNIT_FOREVER_REL, &id, |
1429 | 0, | ||
1430 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1431 | &id, | ||
1432 | sizeof (struct GNUNET_MessageHeader), | 1415 | sizeof (struct GNUNET_MessageHeader), |
1433 | &send_core_create_path_for_peer, | 1416 | &send_core_create_path_for_peer, |
1434 | dest_peer_info); | 1417 | dest_peer_info); |
@@ -1448,8 +1431,7 @@ handle_mesh_path_create (void *cls, | |||
1448 | * GNUNET_SYSERR to close it (signal serious error) | 1431 | * GNUNET_SYSERR to close it (signal serious error) |
1449 | */ | 1432 | */ |
1450 | static int | 1433 | static int |
1451 | handle_mesh_data_unicast (void *cls, | 1434 | handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer, |
1452 | const struct GNUNET_PeerIdentity *peer, | ||
1453 | const struct GNUNET_MessageHeader *message, | 1435 | const struct GNUNET_MessageHeader *message, |
1454 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 1436 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1455 | { | 1437 | { |
@@ -1460,8 +1442,9 @@ handle_mesh_data_unicast (void *cls, | |||
1460 | size_t size; | 1442 | size_t size; |
1461 | 1443 | ||
1462 | size = ntohs (message->size); | 1444 | size = ntohs (message->size); |
1463 | if (size < sizeof (struct GNUNET_MESH_Unicast) | 1445 | if (size < |
1464 | + sizeof (struct GNUNET_MessageHeader)) | 1446 | sizeof (struct GNUNET_MESH_Unicast) + |
1447 | sizeof (struct GNUNET_MessageHeader)) | ||
1465 | { | 1448 | { |
1466 | GNUNET_break (0); | 1449 | GNUNET_break (0); |
1467 | return GNUNET_OK; | 1450 | return GNUNET_OK; |
@@ -1488,11 +1471,9 @@ handle_mesh_data_unicast (void *cls, | |||
1488 | GNUNET_PEER_resolve (get_first_hop (pi->path), &id); | 1471 | GNUNET_PEER_resolve (get_first_hop (pi->path), &id); |
1489 | msg = GNUNET_malloc (size); | 1472 | msg = GNUNET_malloc (size); |
1490 | memcpy (msg, message, size); | 1473 | memcpy (msg, message, size); |
1491 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1474 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1492 | 0, | 1475 | GNUNET_TIME_UNIT_FOREVER_REL, &id, size, |
1493 | 0, | 1476 | &send_core_data_raw, msg); |
1494 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1495 | &id, size, &send_core_data_raw, msg); | ||
1496 | return GNUNET_OK; | 1477 | return GNUNET_OK; |
1497 | } | 1478 | } |
1498 | 1479 | ||
@@ -1508,8 +1489,7 @@ handle_mesh_data_unicast (void *cls, | |||
1508 | * GNUNET_SYSERR to close it (signal serious error) | 1489 | * GNUNET_SYSERR to close it (signal serious error) |
1509 | */ | 1490 | */ |
1510 | static int | 1491 | static int |
1511 | handle_mesh_data_multicast (void *cls, | 1492 | handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, |
1512 | const struct GNUNET_PeerIdentity *peer, | ||
1513 | const struct GNUNET_MessageHeader *message, | 1493 | const struct GNUNET_MessageHeader *message, |
1514 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 1494 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1515 | { | 1495 | { |
@@ -1524,8 +1504,9 @@ handle_mesh_data_multicast (void *cls, | |||
1524 | 1504 | ||
1525 | 1505 | ||
1526 | size = ntohs (message->size); | 1506 | size = ntohs (message->size); |
1527 | if (size < sizeof (struct GNUNET_MESH_Multicast) | 1507 | if (size < |
1528 | + sizeof (struct GNUNET_MessageHeader)) | 1508 | sizeof (struct GNUNET_MESH_Multicast) + |
1509 | sizeof (struct GNUNET_MessageHeader)) | ||
1529 | { | 1510 | { |
1530 | GNUNET_break_op (0); | 1511 | GNUNET_break_op (0); |
1531 | return GNUNET_OK; | 1512 | return GNUNET_OK; |
@@ -1549,8 +1530,7 @@ handle_mesh_data_multicast (void *cls, | |||
1549 | /* Retransmit to other peers */ | 1530 | /* Retransmit to other peers */ |
1550 | neighbors = GNUNET_malloc (sizeof (GNUNET_PEER_Id)); | 1531 | neighbors = GNUNET_malloc (sizeof (GNUNET_PEER_Id)); |
1551 | neighbors[0] = 0; | 1532 | neighbors[0] = 0; |
1552 | GNUNET_CONTAINER_multihashmap_iterate (t->peers, | 1533 | GNUNET_CONTAINER_multihashmap_iterate (t->peers, &iterate_collect_neighbors, |
1553 | &iterate_collect_neighbors, | ||
1554 | &neighbors); | 1534 | &neighbors); |
1555 | if (!neighbors[0]) | 1535 | if (!neighbors[0]) |
1556 | { | 1536 | { |
@@ -1598,8 +1578,7 @@ handle_mesh_data_multicast (void *cls, | |||
1598 | * GNUNET_SYSERR to close it (signal serious error) | 1578 | * GNUNET_SYSERR to close it (signal serious error) |
1599 | */ | 1579 | */ |
1600 | static int | 1580 | static int |
1601 | handle_mesh_data_to_orig (void *cls, | 1581 | handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, |
1602 | const struct GNUNET_PeerIdentity *peer, | ||
1603 | const struct GNUNET_MessageHeader *message, | 1582 | const struct GNUNET_MessageHeader *message, |
1604 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 1583 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1605 | { | 1584 | { |
@@ -1610,8 +1589,9 @@ handle_mesh_data_to_orig (void *cls, | |||
1610 | size_t size; | 1589 | size_t size; |
1611 | 1590 | ||
1612 | size = ntohs (message->size); | 1591 | size = ntohs (message->size); |
1613 | if (size < sizeof (struct GNUNET_MESH_ToOrigin) | 1592 | if (size < |
1614 | + sizeof (struct GNUNET_MessageHeader)) | 1593 | sizeof (struct GNUNET_MESH_ToOrigin) + |
1594 | sizeof (struct GNUNET_MessageHeader)) | ||
1615 | { | 1595 | { |
1616 | GNUNET_break_op (0); | 1596 | GNUNET_break_op (0); |
1617 | return GNUNET_OK; | 1597 | return GNUNET_OK; |
@@ -1633,9 +1613,8 @@ handle_mesh_data_to_orig (void *cls, | |||
1633 | GNUNET_break_op (0); | 1613 | GNUNET_break_op (0); |
1634 | return GNUNET_OK; | 1614 | return GNUNET_OK; |
1635 | } | 1615 | } |
1636 | GNUNET_SERVER_notification_context_unicast (nc, | 1616 | GNUNET_SERVER_notification_context_unicast (nc, t->client->handle, message, |
1637 | t->client->handle, | 1617 | GNUNET_YES); |
1638 | message, GNUNET_YES); | ||
1639 | return GNUNET_OK; | 1618 | return GNUNET_OK; |
1640 | } | 1619 | } |
1641 | peer_info = get_peer_info (&msg->oid); | 1620 | peer_info = get_peer_info (&msg->oid); |
@@ -1648,11 +1627,9 @@ handle_mesh_data_to_orig (void *cls, | |||
1648 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); | 1627 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); |
1649 | msg = GNUNET_malloc (size); | 1628 | msg = GNUNET_malloc (size); |
1650 | memcpy (msg, message, size); | 1629 | memcpy (msg, message, size); |
1651 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1630 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1652 | 0, | 1631 | GNUNET_TIME_UNIT_FOREVER_REL, &id, size, |
1653 | 0, | 1632 | &send_core_data_raw, msg); |
1654 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1655 | &id, size, &send_core_data_raw, msg); | ||
1656 | 1633 | ||
1657 | return GNUNET_OK; | 1634 | return GNUNET_OK; |
1658 | } | 1635 | } |
@@ -1669,8 +1646,7 @@ handle_mesh_data_to_orig (void *cls, | |||
1669 | * GNUNET_SYSERR to close it (signal serious error) | 1646 | * GNUNET_SYSERR to close it (signal serious error) |
1670 | */ | 1647 | */ |
1671 | static int | 1648 | static int |
1672 | handle_mesh_path_ack (void *cls, | 1649 | handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, |
1673 | const struct GNUNET_PeerIdentity *peer, | ||
1674 | const struct GNUNET_MessageHeader *message, | 1650 | const struct GNUNET_MessageHeader *message, |
1675 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 1651 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1676 | { | 1652 | { |
@@ -1708,8 +1684,7 @@ handle_mesh_path_ack (void *cls, | |||
1708 | pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); | 1684 | pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); |
1709 | pc.tunnel_id = htonl (t->local_tid); | 1685 | pc.tunnel_id = htonl (t->local_tid); |
1710 | GNUNET_PEER_resolve (peer_info->id, &pc.peer); | 1686 | GNUNET_PEER_resolve (peer_info->id, &pc.peer); |
1711 | GNUNET_SERVER_notification_context_unicast (nc, | 1687 | GNUNET_SERVER_notification_context_unicast (nc, t->client->handle, |
1712 | t->client->handle, | ||
1713 | &pc.header, GNUNET_NO); | 1688 | &pc.header, GNUNET_NO); |
1714 | return GNUNET_OK; | 1689 | return GNUNET_OK; |
1715 | } | 1690 | } |
@@ -1724,11 +1699,8 @@ handle_mesh_path_ack (void *cls, | |||
1724 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); | 1699 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); |
1725 | msg = GNUNET_malloc (sizeof (struct GNUNET_MESH_PathACK)); | 1700 | msg = GNUNET_malloc (sizeof (struct GNUNET_MESH_PathACK)); |
1726 | memcpy (msg, message, sizeof (struct GNUNET_MESH_PathACK)); | 1701 | memcpy (msg, message, sizeof (struct GNUNET_MESH_PathACK)); |
1727 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1702 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1728 | 0, | 1703 | GNUNET_TIME_UNIT_FOREVER_REL, &id, |
1729 | 0, | ||
1730 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1731 | &id, | ||
1732 | sizeof (struct GNUNET_MESH_PathACK), | 1704 | sizeof (struct GNUNET_MESH_PathACK), |
1733 | &send_core_data_raw, msg); | 1705 | &send_core_data_raw, msg); |
1734 | return GNUNET_OK; | 1706 | return GNUNET_OK; |
@@ -1826,14 +1798,12 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1826 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 1798 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
1827 | return; | 1799 | return; |
1828 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); | 1800 | GNUNET_PEER_resolve (get_first_hop (peer_info->path), &id); |
1829 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1801 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1830 | 0, | 1802 | GNUNET_TIME_UNIT_FOREVER_REL, &id, |
1831 | 0, | ||
1832 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1833 | &id, | ||
1834 | sizeof (struct GNUNET_MESH_ManipulatePath) | 1803 | sizeof (struct GNUNET_MESH_ManipulatePath) |
1835 | + (peer_info->path->length | 1804 | + |
1836 | * sizeof (struct GNUNET_PeerIdentity)), | 1805 | (peer_info->path->length * |
1806 | sizeof (struct GNUNET_PeerIdentity)), | ||
1837 | &send_core_create_path_for_peer, | 1807 | &send_core_create_path_for_peer, |
1838 | peer_info); | 1808 | peer_info); |
1839 | peer_info->path_refresh_task = | 1809 | peer_info->path_refresh_task = |
@@ -1860,8 +1830,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1860 | * @param data pointer to the result data | 1830 | * @param data pointer to the result data |
1861 | */ | 1831 | */ |
1862 | static void | 1832 | static void |
1863 | dht_get_id_handler (void *cls, | 1833 | dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, |
1864 | struct GNUNET_TIME_Absolute exp, | ||
1865 | const GNUNET_HashCode * key, | 1834 | const GNUNET_HashCode * key, |
1866 | const struct GNUNET_PeerIdentity *const *get_path, | 1835 | const struct GNUNET_PeerIdentity *const *get_path, |
1867 | const struct GNUNET_PeerIdentity *const *put_path, | 1836 | const struct GNUNET_PeerIdentity *const *put_path, |
@@ -1890,28 +1859,26 @@ dht_get_id_handler (void *cls, | |||
1890 | for (i = 0; get_path[i] != NULL; i++) ; | 1859 | for (i = 0; get_path[i] != NULL; i++) ; |
1891 | for (i--; i >= 0; i--) | 1860 | for (i--; i >= 0; i--) |
1892 | { | 1861 | { |
1893 | p->peers = GNUNET_realloc (p->peers, | 1862 | p->peers = |
1894 | sizeof (GNUNET_PEER_Id) * (p->length + 1)); | 1863 | GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * (p->length + 1)); |
1895 | p->peers[p->length] = GNUNET_PEER_intern (get_path[i]); | 1864 | p->peers[p->length] = GNUNET_PEER_intern (get_path[i]); |
1896 | p->length++; | 1865 | p->length++; |
1897 | } | 1866 | } |
1898 | for (i = 0; put_path[i] != NULL; i++) ; | 1867 | for (i = 0; put_path[i] != NULL; i++) ; |
1899 | for (i--; i >= 0; i--) | 1868 | for (i--; i >= 0; i--) |
1900 | { | 1869 | { |
1901 | p->peers = GNUNET_realloc (p->peers, | 1870 | p->peers = |
1902 | sizeof (GNUNET_PEER_Id) * (p->length + 1)); | 1871 | GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * (p->length + 1)); |
1903 | p->peers[p->length] = GNUNET_PEER_intern (put_path[i]); | 1872 | p->peers[p->length] = GNUNET_PEER_intern (put_path[i]); |
1904 | p->length++; | 1873 | p->length++; |
1905 | } | 1874 | } |
1906 | add_path_to_peer (peer_info, p); | 1875 | add_path_to_peer (peer_info, p); |
1907 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1876 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
1908 | 0, | 1877 | GNUNET_TIME_UNIT_FOREVER_REL, get_path[1], |
1909 | 0, | ||
1910 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1911 | get_path[1], | ||
1912 | sizeof (struct GNUNET_MESH_ManipulatePath) | 1878 | sizeof (struct GNUNET_MESH_ManipulatePath) |
1913 | + (p->length | 1879 | + |
1914 | * sizeof (struct GNUNET_PeerIdentity)), | 1880 | (p->length * |
1881 | sizeof (struct GNUNET_PeerIdentity)), | ||
1915 | &send_core_create_path_for_peer, | 1882 | &send_core_create_path_for_peer, |
1916 | peer_info); | 1883 | peer_info); |
1917 | if (0 == peer_info->path_refresh_task) | 1884 | if (0 == peer_info->path_refresh_task) |
@@ -1941,13 +1908,12 @@ dht_get_id_handler (void *cls, | |||
1941 | * @param data pointer to the result data | 1908 | * @param data pointer to the result data |
1942 | */ | 1909 | */ |
1943 | static void | 1910 | static void |
1944 | dht_get_type_handler (void *cls, | 1911 | dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp, |
1945 | struct GNUNET_TIME_Absolute exp, | ||
1946 | const GNUNET_HashCode * key, | 1912 | const GNUNET_HashCode * key, |
1947 | const struct GNUNET_PeerIdentity *const *get_path, | 1913 | const struct GNUNET_PeerIdentity *const *get_path, |
1948 | const struct GNUNET_PeerIdentity *const *put_path, | 1914 | const struct GNUNET_PeerIdentity *const *put_path, |
1949 | enum GNUNET_BLOCK_Type type, | 1915 | enum GNUNET_BLOCK_Type type, size_t size, |
1950 | size_t size, const void *data) | 1916 | const void *data) |
1951 | { | 1917 | { |
1952 | const struct GNUNET_PeerIdentity *pi = data; | 1918 | const struct GNUNET_PeerIdentity *pi = data; |
1953 | struct MeshTunnel *t = cls; | 1919 | struct MeshTunnel *t = cls; |
@@ -1962,9 +1928,7 @@ dht_get_type_handler (void *cls, | |||
1962 | return; | 1928 | return; |
1963 | } | 1929 | } |
1964 | peer_info = get_peer_info (pi); | 1930 | peer_info = get_peer_info (pi); |
1965 | GNUNET_CONTAINER_multihashmap_put (t->peers, | 1931 | GNUNET_CONTAINER_multihashmap_put (t->peers, &pi->hashPubKey, peer_info, |
1966 | &pi->hashPubKey, | ||
1967 | peer_info, | ||
1968 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1932 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1969 | if ((NULL == get_path || NULL == put_path) && NULL == peer_info->path) | 1933 | if ((NULL == get_path || NULL == put_path) && NULL == peer_info->path) |
1970 | { | 1934 | { |
@@ -1984,28 +1948,26 @@ dht_get_type_handler (void *cls, | |||
1984 | for (i = 0; get_path[i] != NULL; i++) ; | 1948 | for (i = 0; get_path[i] != NULL; i++) ; |
1985 | for (i--; i >= 0; i--) | 1949 | for (i--; i >= 0; i--) |
1986 | { | 1950 | { |
1987 | p->peers = GNUNET_realloc (p->peers, | 1951 | p->peers = |
1988 | sizeof (GNUNET_PEER_Id) * (p->length + 1)); | 1952 | GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * (p->length + 1)); |
1989 | p->peers[p->length] = GNUNET_PEER_intern (get_path[i]); | 1953 | p->peers[p->length] = GNUNET_PEER_intern (get_path[i]); |
1990 | p->length++; | 1954 | p->length++; |
1991 | } | 1955 | } |
1992 | for (i = 0; put_path[i] != NULL; i++) ; | 1956 | for (i = 0; put_path[i] != NULL; i++) ; |
1993 | for (i--; i >= 0; i--) | 1957 | for (i--; i >= 0; i--) |
1994 | { | 1958 | { |
1995 | p->peers = GNUNET_realloc (p->peers, | 1959 | p->peers = |
1996 | sizeof (GNUNET_PEER_Id) * (p->length + 1)); | 1960 | GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * (p->length + 1)); |
1997 | p->peers[p->length] = GNUNET_PEER_intern (put_path[i]); | 1961 | p->peers[p->length] = GNUNET_PEER_intern (put_path[i]); |
1998 | p->length++; | 1962 | p->length++; |
1999 | } | 1963 | } |
2000 | add_path_to_peer (peer_info, p); | 1964 | add_path_to_peer (peer_info, p); |
2001 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1965 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
2002 | 0, | 1966 | GNUNET_TIME_UNIT_FOREVER_REL, get_path[1], |
2003 | 0, | ||
2004 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2005 | get_path[1], | ||
2006 | sizeof (struct GNUNET_MESH_ManipulatePath) | 1967 | sizeof (struct GNUNET_MESH_ManipulatePath) |
2007 | + (p->length | 1968 | + |
2008 | * sizeof (struct GNUNET_PeerIdentity)), | 1969 | (p->length * |
1970 | sizeof (struct GNUNET_PeerIdentity)), | ||
2009 | &send_core_create_path_for_peer, | 1971 | &send_core_create_path_for_peer, |
2010 | peer_info); | 1972 | peer_info); |
2011 | 1973 | ||
@@ -2039,8 +2001,8 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
2039 | { | 2001 | { |
2040 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2002 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2041 | " matching client found, cleaning\n"); | 2003 | " matching client found, cleaning\n"); |
2042 | GNUNET_CONTAINER_multihashmap_iterate (c->tunnels, | 2004 | GNUNET_CONTAINER_multihashmap_iterate (c->tunnels, &delete_tunnel_entry, |
2043 | &delete_tunnel_entry, c); | 2005 | c); |
2044 | GNUNET_CONTAINER_multihashmap_destroy (c->tunnels); | 2006 | GNUNET_CONTAINER_multihashmap_destroy (c->tunnels); |
2045 | if (0 != c->app_counter) | 2007 | if (0 != c->app_counter) |
2046 | { /* deregister clients applications */ | 2008 | { /* deregister clients applications */ |
@@ -2055,10 +2017,10 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
2055 | applications[j] = applications[n_applications - 1]; | 2017 | applications[j] = applications[n_applications - 1]; |
2056 | applications_rc[j] = applications_rc[n_applications - 1]; | 2018 | applications_rc[j] = applications_rc[n_applications - 1]; |
2057 | n_applications--; | 2019 | n_applications--; |
2058 | applications = GNUNET_realloc (applications, | 2020 | applications = |
2059 | n_applications * | 2021 | GNUNET_realloc (applications, |
2060 | sizeof | 2022 | n_applications * |
2061 | (GNUNET_MESH_ApplicationType)); | 2023 | sizeof (GNUNET_MESH_ApplicationType)); |
2062 | applications_rc = | 2024 | applications_rc = |
2063 | GNUNET_realloc (applications_rc, | 2025 | GNUNET_realloc (applications_rc, |
2064 | n_applications * sizeof (unsigned int)); | 2026 | n_applications * sizeof (unsigned int)); |
@@ -2100,8 +2062,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
2100 | * @param message the actual message, which includes messages the client wants | 2062 | * @param message the actual message, which includes messages the client wants |
2101 | */ | 2063 | */ |
2102 | static void | 2064 | static void |
2103 | handle_local_new_client (void *cls, | 2065 | handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client, |
2104 | struct GNUNET_SERVER_Client *client, | ||
2105 | const struct GNUNET_MessageHeader *message) | 2066 | const struct GNUNET_MessageHeader *message) |
2106 | { | 2067 | { |
2107 | struct GNUNET_MESH_ClientConnect *cc_msg; | 2068 | struct GNUNET_MESH_ClientConnect *cc_msg; |
@@ -2140,8 +2101,7 @@ handle_local_new_client (void *cls, | |||
2140 | { | 2101 | { |
2141 | c->app_counter = apps; | 2102 | c->app_counter = apps; |
2142 | c->apps = GNUNET_malloc (apps * sizeof (GNUNET_MESH_ApplicationType)); | 2103 | c->apps = GNUNET_malloc (apps * sizeof (GNUNET_MESH_ApplicationType)); |
2143 | memcpy (c->apps, | 2104 | memcpy (c->apps, &message[1] + types * sizeof (uint16_t), |
2144 | &message[1] + types * sizeof (uint16_t), | ||
2145 | apps * sizeof (GNUNET_MESH_ApplicationType)); | 2105 | apps * sizeof (GNUNET_MESH_ApplicationType)); |
2146 | } | 2106 | } |
2147 | for (i = 0; i < apps; i++) | 2107 | for (i = 0; i < apps; i++) |
@@ -2159,11 +2119,13 @@ handle_local_new_client (void *cls, | |||
2159 | if (!known) | 2119 | if (!known) |
2160 | { /* Register previously unknown application */ | 2120 | { /* Register previously unknown application */ |
2161 | n_applications++; | 2121 | n_applications++; |
2162 | applications = GNUNET_realloc (applications, | 2122 | applications = |
2163 | n_applications * | 2123 | GNUNET_realloc (applications, |
2164 | sizeof (GNUNET_MESH_ApplicationType)); | 2124 | n_applications * |
2165 | applications_rc = GNUNET_realloc (applications_rc, | 2125 | sizeof (GNUNET_MESH_ApplicationType)); |
2166 | n_applications * sizeof (unsigned int)); | 2126 | applications_rc = |
2127 | GNUNET_realloc (applications_rc, | ||
2128 | n_applications * sizeof (unsigned int)); | ||
2167 | applications[n_applications - 1] = c->apps[i]; | 2129 | applications[n_applications - 1] = c->apps[i]; |
2168 | applications_rc[n_applications - 1] = 1; | 2130 | applications_rc[n_applications - 1] = 1; |
2169 | if (0 == announce_applications_task) | 2131 | if (0 == announce_applications_task) |
@@ -2174,8 +2136,7 @@ handle_local_new_client (void *cls, | |||
2174 | } | 2136 | } |
2175 | } | 2137 | } |
2176 | } | 2138 | } |
2177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2139 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client has %u+%u subscriptions\n", |
2178 | " client has %u+%u subscriptions\n", | ||
2179 | c->type_counter, c->app_counter); | 2140 | c->type_counter, c->app_counter); |
2180 | 2141 | ||
2181 | GNUNET_CONTAINER_DLL_insert (clients, clients_tail, c); | 2142 | GNUNET_CONTAINER_DLL_insert (clients, clients_tail, c); |
@@ -2195,8 +2156,7 @@ handle_local_new_client (void *cls, | |||
2195 | * @param message the actual message | 2156 | * @param message the actual message |
2196 | */ | 2157 | */ |
2197 | static void | 2158 | static void |
2198 | handle_local_tunnel_create (void *cls, | 2159 | handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, |
2199 | struct GNUNET_SERVER_Client *client, | ||
2200 | const struct GNUNET_MessageHeader *message) | 2160 | const struct GNUNET_MessageHeader *message) |
2201 | { | 2161 | { |
2202 | struct GNUNET_MESH_TunnelMessage *t_msg; | 2162 | struct GNUNET_MESH_TunnelMessage *t_msg; |
@@ -2278,8 +2238,7 @@ handle_local_tunnel_create (void *cls, | |||
2278 | * @param message the actual message | 2238 | * @param message the actual message |
2279 | */ | 2239 | */ |
2280 | static void | 2240 | static void |
2281 | handle_local_tunnel_destroy (void *cls, | 2241 | handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client, |
2282 | struct GNUNET_SERVER_Client *client, | ||
2283 | const struct GNUNET_MessageHeader *message) | 2242 | const struct GNUNET_MessageHeader *message) |
2284 | { | 2243 | { |
2285 | struct GNUNET_MESH_TunnelMessage *tunnel_msg; | 2244 | struct GNUNET_MESH_TunnelMessage *tunnel_msg; |
@@ -2332,8 +2291,7 @@ handle_local_tunnel_destroy (void *cls, | |||
2332 | * @param message the actual message (PeerControl) | 2291 | * @param message the actual message (PeerControl) |
2333 | */ | 2292 | */ |
2334 | static void | 2293 | static void |
2335 | handle_local_connect_add (void *cls, | 2294 | handle_local_connect_add (void *cls, struct GNUNET_SERVER_Client *client, |
2336 | struct GNUNET_SERVER_Client *client, | ||
2337 | const struct GNUNET_MessageHeader *message) | 2295 | const struct GNUNET_MessageHeader *message) |
2338 | { | 2296 | { |
2339 | struct GNUNET_MESH_PeerControl *peer_msg; | 2297 | struct GNUNET_MESH_PeerControl *peer_msg; |
@@ -2406,8 +2364,7 @@ handle_local_connect_add (void *cls, | |||
2406 | * @param message the actual message (PeerControl) | 2364 | * @param message the actual message (PeerControl) |
2407 | */ | 2365 | */ |
2408 | static void | 2366 | static void |
2409 | handle_local_connect_del (void *cls, | 2367 | handle_local_connect_del (void *cls, struct GNUNET_SERVER_Client *client, |
2410 | struct GNUNET_SERVER_Client *client, | ||
2411 | const struct GNUNET_MessageHeader *message) | 2368 | const struct GNUNET_MessageHeader *message) |
2412 | { | 2369 | { |
2413 | struct GNUNET_MESH_PeerControl *peer_msg; | 2370 | struct GNUNET_MESH_PeerControl *peer_msg; |
@@ -2466,8 +2423,7 @@ handle_local_connect_del (void *cls, | |||
2466 | * @param message the actual message (ConnectPeerByType) | 2423 | * @param message the actual message (ConnectPeerByType) |
2467 | */ | 2424 | */ |
2468 | static void | 2425 | static void |
2469 | handle_local_connect_by_type (void *cls, | 2426 | handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client, |
2470 | struct GNUNET_SERVER_Client *client, | ||
2471 | const struct GNUNET_MessageHeader *message) | 2427 | const struct GNUNET_MessageHeader *message) |
2472 | { | 2428 | { |
2473 | struct GNUNET_MESH_ConnectPeerByType *connect_msg; | 2429 | struct GNUNET_MESH_ConnectPeerByType *connect_msg; |
@@ -2528,8 +2484,7 @@ handle_local_connect_by_type (void *cls, | |||
2528 | struct GNUNET_MESH_PeerControl pc; | 2484 | struct GNUNET_MESH_PeerControl pc; |
2529 | 2485 | ||
2530 | GNUNET_PEER_resolve (myid, &pc.peer); | 2486 | GNUNET_PEER_resolve (myid, &pc.peer); |
2531 | GNUNET_CONTAINER_multihashmap_put (t->peers, | 2487 | GNUNET_CONTAINER_multihashmap_put (t->peers, &pc.peer.hashPubKey, |
2532 | &pc.peer.hashPubKey, | ||
2533 | get_peer_info (&pc.peer), | 2488 | get_peer_info (&pc.peer), |
2534 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 2489 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
2535 | pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); | 2490 | pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); |
@@ -2546,14 +2501,11 @@ handle_local_connect_by_type (void *cls, | |||
2546 | { | 2501 | { |
2547 | GNUNET_DHT_get_stop (c->dht_get_type); | 2502 | GNUNET_DHT_get_stop (c->dht_get_type); |
2548 | } | 2503 | } |
2549 | c->dht_get_type = GNUNET_DHT_get_start (dht_handle, | 2504 | c->dht_get_type = |
2550 | GNUNET_TIME_UNIT_FOREVER_REL, | 2505 | GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL, |
2551 | GNUNET_BLOCK_TYPE_ANY, | 2506 | GNUNET_BLOCK_TYPE_ANY, &hash, 10U, |
2552 | &hash, | 2507 | GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0, NULL, 0, |
2553 | 10U, | 2508 | &dht_get_type_handler, t); |
2554 | GNUNET_DHT_RO_RECORD_ROUTE, | ||
2555 | NULL, | ||
2556 | 0, NULL, 0, &dht_get_type_handler, t); | ||
2557 | 2509 | ||
2558 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2510 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2559 | return; | 2511 | return; |
@@ -2568,8 +2520,7 @@ handle_local_connect_by_type (void *cls, | |||
2568 | * @param message the actual message | 2520 | * @param message the actual message |
2569 | */ | 2521 | */ |
2570 | static void | 2522 | static void |
2571 | handle_local_unicast (void *cls, | 2523 | handle_local_unicast (void *cls, struct GNUNET_SERVER_Client *client, |
2572 | struct GNUNET_SERVER_Client *client, | ||
2573 | const struct GNUNET_MessageHeader *message) | 2524 | const struct GNUNET_MessageHeader *message) |
2574 | { | 2525 | { |
2575 | struct MeshClient *c; | 2526 | struct MeshClient *c; |
@@ -2590,8 +2541,8 @@ handle_local_unicast (void *cls, | |||
2590 | } | 2541 | } |
2591 | data_msg = (struct GNUNET_MESH_Unicast *) message; | 2542 | data_msg = (struct GNUNET_MESH_Unicast *) message; |
2592 | /* Sanity check for message size */ | 2543 | /* Sanity check for message size */ |
2593 | if (sizeof (struct GNUNET_MESH_Unicast) + sizeof (struct GNUNET_MessageHeader) | 2544 | if (sizeof (struct GNUNET_MESH_Unicast) + |
2594 | > ntohs (data_msg->header.size)) | 2545 | sizeof (struct GNUNET_MessageHeader) > ntohs (data_msg->header.size)) |
2595 | { | 2546 | { |
2596 | GNUNET_break (0); | 2547 | GNUNET_break (0); |
2597 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2548 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
@@ -2645,9 +2596,8 @@ handle_local_unicast (void *cls, | |||
2645 | info->origin = &t->id; | 2596 | info->origin = &t->id; |
2646 | info->size = data_size; | 2597 | info->size = data_size; |
2647 | info->client = client; | 2598 | info->client = client; |
2648 | GNUNET_CORE_notify_transmit_ready (core_handle, | 2599 | GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, |
2649 | 0, | 2600 | GNUNET_TIME_UNIT_FOREVER_REL, &next_hop, |
2650 | 0, GNUNET_TIME_UNIT_FOREVER_REL, &next_hop, | ||
2651 | /* FIXME re-check types */ | 2601 | /* FIXME re-check types */ |
2652 | data_size + | 2602 | data_size + |
2653 | sizeof (struct GNUNET_MESH_Unicast), | 2603 | sizeof (struct GNUNET_MESH_Unicast), |
@@ -2663,8 +2613,7 @@ handle_local_unicast (void *cls, | |||
2663 | * @param message the actual message | 2613 | * @param message the actual message |
2664 | */ | 2614 | */ |
2665 | static void | 2615 | static void |
2666 | handle_local_multicast (void *cls, | 2616 | handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, |
2667 | struct GNUNET_SERVER_Client *client, | ||
2668 | const struct GNUNET_MessageHeader *message) | 2617 | const struct GNUNET_MessageHeader *message) |
2669 | { | 2618 | { |
2670 | struct MeshClient *c; | 2619 | struct MeshClient *c; |
@@ -2751,8 +2700,7 @@ static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { | |||
2751 | * @param publicKey the public key of this peer | 2700 | * @param publicKey the public key of this peer |
2752 | */ | 2701 | */ |
2753 | static void | 2702 | static void |
2754 | core_init (void *cls, | 2703 | core_init (void *cls, struct GNUNET_CORE_Handle *server, |
2755 | struct GNUNET_CORE_Handle *server, | ||
2756 | const struct GNUNET_PeerIdentity *identity, | 2704 | const struct GNUNET_PeerIdentity *identity, |
2757 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 2705 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
2758 | { | 2706 | { |
@@ -2771,8 +2719,7 @@ core_init (void *cls, | |||
2771 | * @param atsi performance data for the connection | 2719 | * @param atsi performance data for the connection |
2772 | */ | 2720 | */ |
2773 | static void | 2721 | static void |
2774 | core_connect (void *cls, | 2722 | core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, |
2775 | const struct GNUNET_PeerIdentity *peer, | ||
2776 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 2723 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
2777 | { | 2724 | { |
2778 | // GNUNET_PEER_Id pid; | 2725 | // GNUNET_PEER_Id pid; |
@@ -2870,8 +2817,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2870 | * @param c configuration to use | 2817 | * @param c configuration to use |
2871 | */ | 2818 | */ |
2872 | static void | 2819 | static void |
2873 | run (void *cls, | 2820 | run (void *cls, struct GNUNET_SERVER_Handle *server, |
2874 | struct GNUNET_SERVER_Handle *server, | ||
2875 | const struct GNUNET_CONFIGURATION_Handle *c) | 2821 | const struct GNUNET_CONFIGURATION_Handle *c) |
2876 | { | 2822 | { |
2877 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); | 2823 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); |
@@ -2919,8 +2865,8 @@ run (void *cls, | |||
2919 | announce_applications_task = 0; | 2865 | announce_applications_task = 0; |
2920 | 2866 | ||
2921 | /* Scheduled the task to clean up when shutdown is called */ | 2867 | /* Scheduled the task to clean up when shutdown is called */ |
2922 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 2868 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, |
2923 | &shutdown_task, NULL); | 2869 | NULL); |
2924 | 2870 | ||
2925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "end of run()\n"); | 2871 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "end of run()\n"); |
2926 | } | 2872 | } |
@@ -2937,11 +2883,10 @@ main (int argc, char *const *argv) | |||
2937 | { | 2883 | { |
2938 | int ret; | 2884 | int ret; |
2939 | 2885 | ||
2940 | ret = (GNUNET_OK == | 2886 | ret = |
2941 | GNUNET_SERVICE_run (argc, | 2887 | (GNUNET_OK == |
2942 | argv, | 2888 | GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run, |
2943 | "mesh", | 2889 | NULL)) ? 0 : 1; |
2944 | GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; | ||
2945 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "end of main()\n"); | 2890 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "end of main()\n"); |
2946 | return ret; | 2891 | return ret; |
2947 | } | 2892 | } |