diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-30 20:35:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-30 20:35:10 +0000 |
commit | a0ba5b741b56036bd35bd9ba88164324b2ff7ada (patch) | |
tree | 3fd10a0fc15f9a9e7cf5415b2bec86d97d7fe825 | |
parent | 427dd6f998fb1fde515a3b5c800f9f6d308197b2 (diff) | |
download | gnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.tar.gz gnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.zip |
-getting ATS and transport to compile again (part of #3047)
40 files changed, 590 insertions, 515 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index f921c1b1f..f36a3808e 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -177,7 +177,9 @@ mlp_term_hook (void *info, const char *s) | |||
177 | * @return GNUNET_OK | 177 | * @return GNUNET_OK |
178 | */ | 178 | */ |
179 | static int | 179 | static int |
180 | reset_peers (void *cls, const struct GNUNET_HashCode * key, void *value) | 180 | reset_peers (void *cls, |
181 | const struct GNUNET_PeerIdentity *key, | ||
182 | void *value) | ||
181 | { | 183 | { |
182 | struct ATS_Peer *peer = value; | 184 | struct ATS_Peer *peer = value; |
183 | peer->processed = GNUNET_NO; | 185 | peer->processed = GNUNET_NO; |
@@ -237,7 +239,8 @@ mlp_delete_problem (struct GAS_MLP_Handle *mlp) | |||
237 | mlp->p.ci = MLP_UNDEFINED; | 239 | mlp->p.ci = MLP_UNDEFINED; |
238 | 240 | ||
239 | 241 | ||
240 | GNUNET_CONTAINER_multihashmap_iterate (mlp->requested_peers, &reset_peers, NULL); | 242 | GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, |
243 | &reset_peers, NULL); | ||
241 | } | 244 | } |
242 | 245 | ||
243 | 246 | ||
@@ -385,28 +388,34 @@ get_performance_info (struct ATS_Address *address, uint32_t type) | |||
385 | 388 | ||
386 | struct CountContext | 389 | struct CountContext |
387 | { | 390 | { |
388 | struct GNUNET_CONTAINER_MultiHashMap * peers; | 391 | const struct GNUNET_CONTAINER_MultiPeerMap *peers; |
389 | int result; | 392 | int result; |
390 | }; | 393 | }; |
391 | 394 | ||
392 | static int | 395 | static int |
393 | mlp_create_problem_count_addresses_it (void *cls, const struct GNUNET_HashCode *key, void *value) | 396 | mlp_create_problem_count_addresses_it (void *cls, |
397 | const struct GNUNET_PeerIdentity *key, | ||
398 | void *value) | ||
394 | { | 399 | { |
395 | struct CountContext *cctx = cls; | 400 | struct CountContext *cctx = cls; |
401 | |||
396 | /* Check if we have to add this peer due to a pending request */ | 402 | /* Check if we have to add this peer due to a pending request */ |
397 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(cctx->peers, key)) | 403 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (cctx->peers, key)) |
398 | cctx->result++; | 404 | cctx->result++; |
399 | return GNUNET_OK; | 405 | return GNUNET_OK; |
400 | } | 406 | } |
401 | 407 | ||
402 | static int mlp_create_problem_count_addresses ( | 408 | |
403 | struct GNUNET_CONTAINER_MultiHashMap * peers, | 409 | static int |
404 | const struct GNUNET_CONTAINER_MultiHashMap * addresses) | 410 | mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers, |
411 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses) | ||
405 | { | 412 | { |
406 | struct CountContext cctx; | 413 | struct CountContext cctx; |
414 | |||
407 | cctx.peers = peers; | 415 | cctx.peers = peers; |
408 | cctx.result = 0; | 416 | cctx.result = 0; |
409 | GNUNET_CONTAINER_multihashmap_iterate (addresses, &mlp_create_problem_count_addresses_it, &cctx); | 417 | GNUNET_CONTAINER_multipeermap_iterate (addresses, |
418 | &mlp_create_problem_count_addresses_it, &cctx); | ||
410 | return cctx.result; | 419 | return cctx.result; |
411 | } | 420 | } |
412 | 421 | ||
@@ -591,7 +600,9 @@ mlp_create_problem_create_constraint (struct MLP_Problem *p, char *name, | |||
591 | * - Set address dependent entries in problem matrix as well | 600 | * - Set address dependent entries in problem matrix as well |
592 | */ | 601 | */ |
593 | static int | 602 | static int |
594 | mlp_create_problem_add_address_information (void *cls, const struct GNUNET_HashCode *key, void *value) | 603 | mlp_create_problem_add_address_information (void *cls, |
604 | const struct GNUNET_PeerIdentity *key, | ||
605 | void *value) | ||
595 | { | 606 | { |
596 | struct GAS_MLP_Handle *mlp = cls; | 607 | struct GAS_MLP_Handle *mlp = cls; |
597 | struct MLP_Problem *p = &mlp->p; | 608 | struct MLP_Problem *p = &mlp->p; |
@@ -604,7 +615,7 @@ mlp_create_problem_add_address_information (void *cls, const struct GNUNET_HashC | |||
604 | int c; | 615 | int c; |
605 | 616 | ||
606 | /* Check if we have to add this peer due to a pending request */ | 617 | /* Check if we have to add this peer due to a pending request */ |
607 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->requested_peers, key)) | 618 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains(mlp->requested_peers, key)) |
608 | return GNUNET_OK; | 619 | return GNUNET_OK; |
609 | 620 | ||
610 | mlpi = address->solver_information; | 621 | mlpi = address->solver_information; |
@@ -616,7 +627,7 @@ mlp_create_problem_add_address_information (void *cls, const struct GNUNET_HashC | |||
616 | } | 627 | } |
617 | 628 | ||
618 | /* Get peer */ | 629 | /* Get peer */ |
619 | peer = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, key); | 630 | peer = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, key); |
620 | if (peer->processed == GNUNET_NO) | 631 | if (peer->processed == GNUNET_NO) |
621 | { | 632 | { |
622 | /* Add peer dependent constraints */ | 633 | /* Add peer dependent constraints */ |
@@ -822,14 +833,18 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp) | |||
822 | /* create the glpk problem */ | 833 | /* create the glpk problem */ |
823 | p->prob = glp_create_prob (); | 834 | p->prob = glp_create_prob (); |
824 | GNUNET_assert (NULL != p->prob); | 835 | GNUNET_assert (NULL != p->prob); |
825 | p->num_peers = GNUNET_CONTAINER_multihashmap_size (mlp->requested_peers); | 836 | p->num_peers = GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers); |
826 | p->num_addresses = mlp_create_problem_count_addresses (mlp->requested_peers, mlp->addresses); | 837 | p->num_addresses = mlp_create_problem_count_addresses (mlp->requested_peers, mlp->addresses); |
827 | 838 | ||
828 | /* Create problem matrix: 10 * #addresses + #q * #addresses + #q, + #peer + 2 + 1 */ | 839 | /* Create problem matrix: 10 * #addresses + #q * #addresses + #q, + #peer + 2 + 1 */ |
829 | p->num_elements = (10 * p->num_addresses + mlp->pv.m_q * p->num_addresses + | 840 | p->num_elements = (10 * p->num_addresses + mlp->pv.m_q * p->num_addresses + |
830 | mlp->pv.m_q + p->num_peers + 2 + 1); | 841 | mlp->pv.m_q + p->num_peers + 2 + 1); |
831 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n", | 842 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
832 | p->num_peers, p->num_addresses, mlp->pv.m_q, p->num_elements); | 843 | "Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n", |
844 | p->num_peers, | ||
845 | p->num_addresses, | ||
846 | mlp->pv.m_q, | ||
847 | p->num_elements); | ||
833 | 848 | ||
834 | /* Set a problem name */ | 849 | /* Set a problem name */ |
835 | glp_set_prob_name (p->prob, "GNUnet ATS bandwidth distribution"); | 850 | glp_set_prob_name (p->prob, "GNUnet ATS bandwidth distribution"); |
@@ -859,7 +874,9 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp) | |||
859 | mlp_create_problem_add_invariant_rows (mlp, p); | 874 | mlp_create_problem_add_invariant_rows (mlp, p); |
860 | 875 | ||
861 | /* Adding address dependent columns constraint rows */ | 876 | /* Adding address dependent columns constraint rows */ |
862 | GNUNET_CONTAINER_multihashmap_iterate (mlp->addresses, &mlp_create_problem_add_address_information, mlp); | 877 | GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses, |
878 | &mlp_create_problem_add_address_information, | ||
879 | mlp); | ||
863 | 880 | ||
864 | /* Load the matrix */ | 881 | /* Load the matrix */ |
865 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Loading matrix\n"); | 882 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Loading matrix\n"); |
@@ -941,10 +958,12 @@ mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp) | |||
941 | * @param cls the MLP handle | 958 | * @param cls the MLP handle |
942 | * @param key the peer identity | 959 | * @param key the peer identity |
943 | * @param value the address | 960 | * @param value the address |
944 | * @return GNUNET_OK to continue | 961 | * @return #GNUNET_OK to continue |
945 | */ | 962 | */ |
946 | int | 963 | int |
947 | mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value) | 964 | mlp_propagate_results (void *cls, |
965 | const struct GNUNET_PeerIdentity *key, | ||
966 | void *value) | ||
948 | { | 967 | { |
949 | struct GAS_MLP_Handle *mlp = cls; | 968 | struct GAS_MLP_Handle *mlp = cls; |
950 | struct ATS_Address *address; | 969 | struct ATS_Address *address; |
@@ -954,7 +973,8 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value | |||
954 | double mlp_use = MLP_NaN; | 973 | double mlp_use = MLP_NaN; |
955 | 974 | ||
956 | /* Check if we have to add this peer due to a pending request */ | 975 | /* Check if we have to add this peer due to a pending request */ |
957 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->requested_peers, key)) | 976 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers, |
977 | key)) | ||
958 | { | 978 | { |
959 | return GNUNET_OK; | 979 | return GNUNET_OK; |
960 | } | 980 | } |
@@ -1082,9 +1102,9 @@ GAS_mlp_solve_problem (void *solver) | |||
1082 | return GNUNET_NO; | 1102 | return GNUNET_NO; |
1083 | } | 1103 | } |
1084 | 1104 | ||
1085 | if (0 == GNUNET_CONTAINER_multihashmap_size(mlp->requested_peers)) | 1105 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers)) |
1086 | return GNUNET_OK; /* No pending requests */ | 1106 | return GNUNET_OK; /* No pending requests */ |
1087 | if (0 == GNUNET_CONTAINER_multihashmap_size(mlp->addresses)) | 1107 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->addresses)) |
1088 | return GNUNET_OK; /* No addresses available */ | 1108 | return GNUNET_OK; /* No addresses available */ |
1089 | 1109 | ||
1090 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) | 1110 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) |
@@ -1149,7 +1169,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1149 | /* Propagate result*/ | 1169 | /* Propagate result*/ |
1150 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) | 1170 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
1151 | { | 1171 | { |
1152 | GNUNET_CONTAINER_multihashmap_iterate (mlp->addresses, &mlp_propagate_results, mlp); | 1172 | GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses, &mlp_propagate_results, mlp); |
1153 | } | 1173 | } |
1154 | 1174 | ||
1155 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); | 1175 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); |
@@ -1201,13 +1221,16 @@ GAS_mlp_address_add (void *solver, | |||
1201 | 1221 | ||
1202 | if (NULL == address->solver_information) | 1222 | if (NULL == address->solver_information) |
1203 | { | 1223 | { |
1204 | address->solver_information = GNUNET_malloc (sizeof (struct MLP_information)); | 1224 | address->solver_information = GNUNET_new (struct MLP_information); |
1205 | } | 1225 | } |
1206 | else | 1226 | else |
1207 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding address for peer `%s' multiple times\n"), GNUNET_i2s(&address->peer)); | 1227 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1228 | _("Adding address for peer `%s' multiple times\n"), | ||
1229 | GNUNET_i2s(&address->peer)); | ||
1208 | 1230 | ||
1209 | /* Is this peer included in the problem? */ | 1231 | /* Is this peer included in the problem? */ |
1210 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) | 1232 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
1233 | &address->peer))) | ||
1211 | { | 1234 | { |
1212 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); | 1235 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); |
1213 | return; | 1236 | return; |
@@ -1257,8 +1280,8 @@ GAS_mlp_address_property_changed (void *solver, | |||
1257 | return; | 1280 | return; |
1258 | } | 1281 | } |
1259 | 1282 | ||
1260 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, | 1283 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
1261 | &address->peer.hashPubKey))) | 1284 | &address->peer))) |
1262 | { | 1285 | { |
1263 | /* Peer is not requested, so no need to update problem */ | 1286 | /* Peer is not requested, so no need to update problem */ |
1264 | return; | 1287 | return; |
@@ -1368,8 +1391,8 @@ GAS_mlp_address_change_network (void *solver, | |||
1368 | if (mlpi->c_b == MLP_UNDEFINED) | 1391 | if (mlpi->c_b == MLP_UNDEFINED) |
1369 | return; /* This address is not yet in the matrix*/ | 1392 | return; /* This address is not yet in the matrix*/ |
1370 | 1393 | ||
1371 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, | 1394 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
1372 | &address->peer.hashPubKey))) | 1395 | &address->peer))) |
1373 | { | 1396 | { |
1374 | /* Peer is not requested, so no need to update problem */ | 1397 | /* Peer is not requested, so no need to update problem */ |
1375 | GNUNET_break (0); | 1398 | GNUNET_break (0); |
@@ -1467,7 +1490,8 @@ GAS_mlp_address_delete (void *solver, | |||
1467 | address->assigned_bw_out = BANDWIDTH_ZERO; | 1490 | address->assigned_bw_out = BANDWIDTH_ZERO; |
1468 | 1491 | ||
1469 | /* Is this peer included in the problem? */ | 1492 | /* Is this peer included in the problem? */ |
1470 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) | 1493 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
1494 | &address->peer))) | ||
1471 | { | 1495 | { |
1472 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' without address request \n", | 1496 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' without address request \n", |
1473 | (session_only == GNUNET_YES) ? "session" : "address", | 1497 | (session_only == GNUNET_YES) ? "session" : "address", |
@@ -1505,12 +1529,15 @@ GAS_mlp_address_delete (void *solver, | |||
1505 | * @return GNUNET_OK | 1529 | * @return GNUNET_OK |
1506 | */ | 1530 | */ |
1507 | static int | 1531 | static int |
1508 | mlp_get_preferred_address_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 1532 | mlp_get_preferred_address_it (void *cls, |
1533 | const struct GNUNET_PeerIdentity *key, | ||
1534 | void *value) | ||
1509 | { | 1535 | { |
1510 | static int counter = 0; | 1536 | static int counter = 0; |
1511 | struct ATS_Address **aa = (struct ATS_Address **) cls; | 1537 | struct ATS_Address **aa = cls; |
1512 | struct ATS_Address *addr = value; | 1538 | struct ATS_Address *addr = value; |
1513 | struct MLP_information *mlpi = addr->solver_information; | 1539 | struct MLP_information *mlpi = addr->solver_information; |
1540 | |||
1514 | if (mlpi == NULL) | 1541 | if (mlpi == NULL) |
1515 | return GNUNET_YES; | 1542 | return GNUNET_YES; |
1516 | 1543 | ||
@@ -1536,7 +1563,8 @@ mlp_get_preferred_address_it (void *cls, const struct GNUNET_HashCode * key, voi | |||
1536 | } | 1563 | } |
1537 | 1564 | ||
1538 | 1565 | ||
1539 | static double get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer) | 1566 | static double |
1567 | get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer) | ||
1540 | { | 1568 | { |
1541 | double res; | 1569 | double res; |
1542 | const double *preferences = NULL; | 1570 | const double *preferences = NULL; |
@@ -1579,22 +1607,25 @@ GAS_mlp_get_preferred_address (void *solver, | |||
1579 | GNUNET_i2s (peer)); | 1607 | GNUNET_i2s (peer)); |
1580 | 1608 | ||
1581 | /* Is this peer included in the problem? */ | 1609 | /* Is this peer included in the problem? */ |
1582 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) | 1610 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
1583 | { | 1611 | peer))) |
1612 | { | ||
1584 | LOG (GNUNET_ERROR_TYPE_INFO, "Adding peer `%s' to list of requested_peers with requests\n", | 1613 | LOG (GNUNET_ERROR_TYPE_INFO, "Adding peer `%s' to list of requested_peers with requests\n", |
1585 | GNUNET_i2s (peer)); | 1614 | GNUNET_i2s (peer)); |
1586 | 1615 | ||
1587 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); | 1616 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); |
1588 | p->id = (*peer); | 1617 | p->id = (*peer); |
1589 | p->f = get_peer_pref_value (mlp, peer); | 1618 | p->f = get_peer_pref_value (mlp, peer); |
1590 | GNUNET_CONTAINER_multihashmap_put (mlp->requested_peers, &peer->hashPubKey, p, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1619 | GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers, |
1620 | peer, p, | ||
1621 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
1591 | 1622 | ||
1592 | /* Added new peer, we have to rebuild problem before solving */ | 1623 | /* Added new peer, we have to rebuild problem before solving */ |
1593 | mlp->mlp_prob_changed = GNUNET_YES; | 1624 | mlp->mlp_prob_changed = GNUNET_YES; |
1594 | 1625 | ||
1595 | if ((GNUNET_YES == mlp->mlp_auto_solve)&& | 1626 | if ((GNUNET_YES == mlp->mlp_auto_solve)&& |
1596 | (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(mlp->addresses, | 1627 | (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(mlp->addresses, |
1597 | &peer->hashPubKey))) | 1628 | peer))) |
1598 | { | 1629 | { |
1599 | mlp->exclude_peer = peer; | 1630 | mlp->exclude_peer = peer; |
1600 | GAS_mlp_solve_problem (mlp); | 1631 | GAS_mlp_solve_problem (mlp); |
@@ -1603,7 +1634,7 @@ GAS_mlp_get_preferred_address (void *solver, | |||
1603 | } | 1634 | } |
1604 | /* Get prefered address */ | 1635 | /* Get prefered address */ |
1605 | res = NULL; | 1636 | res = NULL; |
1606 | GNUNET_CONTAINER_multihashmap_get_multiple (mlp->addresses, &peer->hashPubKey, | 1637 | GNUNET_CONTAINER_multipeermap_get_multiple (mlp->addresses, peer, |
1607 | mlp_get_preferred_address_it, &res); | 1638 | mlp_get_preferred_address_it, &res); |
1608 | return res; | 1639 | return res; |
1609 | } | 1640 | } |
@@ -1664,9 +1695,9 @@ GAS_mlp_stop_get_preferred_address (void *solver, | |||
1664 | 1695 | ||
1665 | GNUNET_assert (NULL != solver); | 1696 | GNUNET_assert (NULL != solver); |
1666 | GNUNET_assert (NULL != peer); | 1697 | GNUNET_assert (NULL != peer); |
1667 | if (NULL != (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) | 1698 | if (NULL != (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, peer))) |
1668 | { | 1699 | { |
1669 | GNUNET_CONTAINER_multihashmap_remove (mlp->requested_peers, &peer->hashPubKey, p); | 1700 | GNUNET_CONTAINER_multipeermap_remove (mlp->requested_peers, peer, p); |
1670 | GNUNET_free (p); | 1701 | GNUNET_free (p); |
1671 | 1702 | ||
1672 | mlp->mlp_prob_changed = GNUNET_YES; | 1703 | mlp->mlp_prob_changed = GNUNET_YES; |
@@ -1704,7 +1735,7 @@ GAS_mlp_address_change_preference (void *solver, | |||
1704 | /* Update quality constraint c7 */ | 1735 | /* Update quality constraint c7 */ |
1705 | 1736 | ||
1706 | /* Update relativity constraint c9 */ | 1737 | /* Update relativity constraint c9 */ |
1707 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) | 1738 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, peer))) |
1708 | { | 1739 | { |
1709 | LOG (GNUNET_ERROR_TYPE_ERROR, "Updating preference for unknown peer `%s'\n", GNUNET_i2s(peer)); | 1740 | LOG (GNUNET_ERROR_TYPE_ERROR, "Updating preference for unknown peer `%s'\n", GNUNET_i2s(peer)); |
1710 | return; | 1741 | return; |
@@ -1749,12 +1780,13 @@ GAS_mlp_address_preference_feedback (void *solver, | |||
1749 | 1780 | ||
1750 | 1781 | ||
1751 | static int | 1782 | static int |
1752 | mlp_free_peers (void *cls, const struct GNUNET_HashCode *key, void *value) | 1783 | mlp_free_peers (void *cls, |
1784 | const struct GNUNET_PeerIdentity *key, void *value) | ||
1753 | { | 1785 | { |
1754 | struct GNUNET_CONTAINER_MultiHashMap *map = cls; | 1786 | struct GNUNET_CONTAINER_MultiPeerMap *map = cls; |
1755 | struct ATS_Peer *p = value; | 1787 | struct ATS_Peer *p = value; |
1756 | 1788 | ||
1757 | GNUNET_CONTAINER_multihashmap_remove (map, key, value); | 1789 | GNUNET_CONTAINER_multipeermap_remove (map, key, value); |
1758 | GNUNET_free (p); | 1790 | GNUNET_free (p); |
1759 | 1791 | ||
1760 | return GNUNET_OK; | 1792 | return GNUNET_OK; |
@@ -1775,8 +1807,10 @@ GAS_mlp_done (void *solver) | |||
1775 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); | 1807 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); |
1776 | mlp_delete_problem (mlp); | 1808 | mlp_delete_problem (mlp); |
1777 | 1809 | ||
1778 | GNUNET_CONTAINER_multihashmap_iterate (mlp->requested_peers, &mlp_free_peers, mlp->requested_peers); | 1810 | GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers, |
1779 | GNUNET_CONTAINER_multihashmap_destroy (mlp->requested_peers); | 1811 | &mlp_free_peers, |
1812 | mlp->requested_peers); | ||
1813 | GNUNET_CONTAINER_multipeermap_destroy (mlp->requested_peers); | ||
1780 | mlp->requested_peers = NULL; | 1814 | mlp->requested_peers = NULL; |
1781 | 1815 | ||
1782 | /* Clean up GLPK environment */ | 1816 | /* Clean up GLPK environment */ |
@@ -1808,7 +1842,7 @@ GAS_mlp_done (void *solver) | |||
1808 | void * | 1842 | void * |
1809 | GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1843 | GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1810 | const struct GNUNET_STATISTICS_Handle *stats, | 1844 | const struct GNUNET_STATISTICS_Handle *stats, |
1811 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, | 1845 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
1812 | int *network, | 1846 | int *network, |
1813 | unsigned long long *out_dest, | 1847 | unsigned long long *out_dest, |
1814 | unsigned long long *in_dest, | 1848 | unsigned long long *in_dest, |
@@ -2052,7 +2086,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2052 | mlp->mlp_prob_changed = GNUNET_NO; | 2086 | mlp->mlp_prob_changed = GNUNET_NO; |
2053 | mlp->mlp_prob_updated = GNUNET_NO; | 2087 | mlp->mlp_prob_updated = GNUNET_NO; |
2054 | mlp->mlp_auto_solve = GNUNET_YES; | 2088 | mlp->mlp_auto_solve = GNUNET_YES; |
2055 | mlp->requested_peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 2089 | mlp->requested_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
2056 | mlp->bulk_request = 0; | 2090 | mlp->bulk_request = 0; |
2057 | mlp->bulk_lock = 0; | 2091 | mlp->bulk_lock = 0; |
2058 | 2092 | ||
diff --git a/src/ats/gnunet-service-ats-solver_mlp.h b/src/ats/gnunet-service-ats-solver_mlp.h index c31d44b5e..1f4f0ec8c 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.h +++ b/src/ats/gnunet-service-ats-solver_mlp.h | |||
@@ -212,7 +212,7 @@ struct GAS_MLP_Handle | |||
212 | /** | 212 | /** |
213 | * Address hashmap for lookups | 213 | * Address hashmap for lookups |
214 | */ | 214 | */ |
215 | const struct GNUNET_CONTAINER_MultiHashMap *addresses; | 215 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses; |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Addresses' bandwidth changed callback | 218 | * Addresses' bandwidth changed callback |
@@ -296,7 +296,7 @@ struct GAS_MLP_Handle | |||
296 | /** | 296 | /** |
297 | * Peers with pending address requests | 297 | * Peers with pending address requests |
298 | */ | 298 | */ |
299 | struct GNUNET_CONTAINER_MultiHashMap *requested_peers; | 299 | struct GNUNET_CONTAINER_MultiPeerMap *requested_peers; |
300 | 300 | ||
301 | /** | 301 | /** |
302 | * Was the problem updated since last solution | 302 | * Was the problem updated since last solution |
@@ -355,15 +355,17 @@ struct MLP_information | |||
355 | unsigned int r_c3; | 355 | unsigned int r_c3; |
356 | }; | 356 | }; |
357 | 357 | ||
358 | |||
358 | /** | 359 | /** |
359 | * Solves the MLP problem | 360 | * Solves the MLP problem |
360 | * | 361 | * |
361 | * @param solver the MLP Handle | 362 | * @param solver the MLP Handle |
362 | * @return GNUNET_OK if could be solved, GNUNET_SYSERR on failure | 363 | * @return #GNUNET_OK if could be solved, GNUNET_SYSERR on failure |
363 | */ | 364 | */ |
364 | int | 365 | int |
365 | GAS_mlp_solve_problem (void *solver); | 366 | GAS_mlp_solve_problem (void *solver); |
366 | 367 | ||
368 | |||
367 | /** | 369 | /** |
368 | * Init the MLP problem solving component | 370 | * Init the MLP problem solving component |
369 | * | 371 | * |
@@ -383,13 +385,14 @@ GAS_mlp_solve_problem (void *solver); | |||
383 | */ | 385 | */ |
384 | void * | 386 | void * |
385 | GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 387 | GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
386 | const struct GNUNET_STATISTICS_Handle *stats, | 388 | const struct GNUNET_STATISTICS_Handle *stats, |
387 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, int *network, | 389 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, int *network, |
388 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length, | 390 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length, |
389 | GAS_bandwidth_changed_cb bw_changed_cb, void *bw_changed_cb_cls, | 391 | GAS_bandwidth_changed_cb bw_changed_cb, void *bw_changed_cb_cls, |
390 | GAS_get_preferences get_preference, void *get_preference_cls, | 392 | GAS_get_preferences get_preference, void *get_preference_cls, |
391 | GAS_get_properties get_properties, void *get_properties_cls); | 393 | GAS_get_properties get_properties, void *get_properties_cls); |
392 | 394 | ||
395 | |||
393 | /** | 396 | /** |
394 | * Add a single address within a network to the solver | 397 | * Add a single address within a network to the solver |
395 | * | 398 | * |
@@ -401,6 +404,7 @@ void | |||
401 | GAS_mlp_address_add (void *solver, struct ATS_Address *address, | 404 | GAS_mlp_address_add (void *solver, struct ATS_Address *address, |
402 | uint32_t network); | 405 | uint32_t network); |
403 | 406 | ||
407 | |||
404 | /** | 408 | /** |
405 | * Transport properties for this address have changed | 409 | * Transport properties for this address have changed |
406 | * | 410 | * |
@@ -414,6 +418,7 @@ void | |||
414 | GAS_mlp_address_property_changed (void *solver, struct ATS_Address *address, | 418 | GAS_mlp_address_property_changed (void *solver, struct ATS_Address *address, |
415 | uint32_t type, uint32_t abs_value, double rel_value); | 419 | uint32_t type, uint32_t abs_value, double rel_value); |
416 | 420 | ||
421 | |||
417 | /** | 422 | /** |
418 | * Transport session for this address has changed | 423 | * Transport session for this address has changed |
419 | * | 424 | * |
@@ -426,7 +431,8 @@ GAS_mlp_address_property_changed (void *solver, struct ATS_Address *address, | |||
426 | */ | 431 | */ |
427 | void | 432 | void |
428 | GAS_mlp_address_session_changed (void *solver, struct ATS_Address *address, | 433 | GAS_mlp_address_session_changed (void *solver, struct ATS_Address *address, |
429 | uint32_t cur_session, uint32_t new_session); | 434 | uint32_t cur_session, uint32_t new_session); |
435 | |||
430 | 436 | ||
431 | /** | 437 | /** |
432 | * Usage for this address has changed | 438 | * Usage for this address has changed |
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index 31d27fd2a..e9a553ad6 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -225,12 +225,12 @@ struct GAS_PROPORTIONAL_Handle | |||
225 | /** | 225 | /** |
226 | * Hashmap containing all valid addresses | 226 | * Hashmap containing all valid addresses |
227 | */ | 227 | */ |
228 | const struct GNUNET_CONTAINER_MultiHashMap *addresses; | 228 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses; |
229 | 229 | ||
230 | /** | 230 | /** |
231 | * Pending address requests | 231 | * Pending address requests |
232 | */ | 232 | */ |
233 | struct GNUNET_CONTAINER_MultiHashMap *requests; | 233 | struct GNUNET_CONTAINER_MultiPeerMap *requests; |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * Bandwidth changed callback | 236 | * Bandwidth changed callback |
@@ -576,8 +576,9 @@ find_property_index (uint32_t type) | |||
576 | * @return GNUNET_OK (continue to iterate) | 576 | * @return GNUNET_OK (continue to iterate) |
577 | */ | 577 | */ |
578 | static int | 578 | static int |
579 | find_best_address_it (void *cls, const struct GNUNET_HashCode * key, | 579 | find_best_address_it (void *cls, |
580 | void *value) | 580 | const struct GNUNET_PeerIdentity *key, |
581 | void *value) | ||
581 | { | 582 | { |
582 | struct FindBestAddressCtx *fba_ctx = (struct FindBestAddressCtx *) cls; | 583 | struct FindBestAddressCtx *fba_ctx = (struct FindBestAddressCtx *) cls; |
583 | struct ATS_Address *current = (struct ATS_Address *) value; | 584 | struct ATS_Address *current = (struct ATS_Address *) value; |
@@ -717,11 +718,12 @@ get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type) | |||
717 | * @param cls last active address | 718 | * @param cls last active address |
718 | * @param key peer's key | 719 | * @param key peer's key |
719 | * @param value address to check | 720 | * @param value address to check |
720 | * @return GNUNET_NO on double active address else GNUNET_YES; | 721 | * @return #GNUNET_NO on double active address else #GNUNET_YES; |
721 | */ | 722 | */ |
722 | static int | 723 | static int |
723 | get_active_address_it (void *cls, const struct GNUNET_HashCode * key, | 724 | get_active_address_it (void *cls, |
724 | void *value) | 725 | const struct GNUNET_PeerIdentity *key, |
726 | void *value) | ||
725 | { | 727 | { |
726 | struct ATS_Address **dest = cls; | 728 | struct ATS_Address **dest = cls; |
727 | struct ATS_Address *aa = (struct ATS_Address *) value; | 729 | struct ATS_Address *aa = (struct ATS_Address *) value; |
@@ -752,16 +754,17 @@ get_active_address_it (void *cls, const struct GNUNET_HashCode * key, | |||
752 | */ | 754 | */ |
753 | static struct ATS_Address * | 755 | static struct ATS_Address * |
754 | get_active_address (void *solver, | 756 | get_active_address (void *solver, |
755 | struct GNUNET_CONTAINER_MultiHashMap * addresses, | 757 | const struct GNUNET_CONTAINER_MultiPeerMap * addresses, |
756 | const struct GNUNET_PeerIdentity *peer) | 758 | const struct GNUNET_PeerIdentity *peer) |
757 | { | 759 | { |
758 | struct ATS_Address * dest = NULL; | 760 | struct ATS_Address * dest = NULL; |
759 | 761 | ||
760 | GNUNET_CONTAINER_multihashmap_get_multiple (addresses, &peer->hashPubKey, | 762 | GNUNET_CONTAINER_multipeermap_get_multiple (addresses, peer, |
761 | &get_active_address_it, &dest); | 763 | &get_active_address_it, &dest); |
762 | return dest; | 764 | return dest; |
763 | } | 765 | } |
764 | 766 | ||
767 | |||
765 | static void | 768 | static void |
766 | addresse_increment (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, | 769 | addresse_increment (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, |
767 | int total, int active) | 770 | int total, int active) |
@@ -784,6 +787,7 @@ addresse_increment (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, | |||
784 | 787 | ||
785 | } | 788 | } |
786 | 789 | ||
790 | |||
787 | static int | 791 | static int |
788 | addresse_decrement (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, | 792 | addresse_decrement (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, |
789 | int total, int active) | 793 | int total, int active) |
@@ -856,8 +860,9 @@ addresse_decrement (struct GAS_PROPORTIONAL_Handle *s, struct Network *net, | |||
856 | */ | 860 | */ |
857 | void | 861 | void |
858 | GAS_proportional_address_change_preference (void *solver, | 862 | GAS_proportional_address_change_preference (void *solver, |
859 | const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind, | 863 | const struct GNUNET_PeerIdentity *peer, |
860 | double pref_rel) | 864 | enum GNUNET_ATS_PreferenceKind kind, |
865 | double pref_rel) | ||
861 | { | 866 | { |
862 | struct GAS_PROPORTIONAL_Handle *s = solver; | 867 | struct GAS_PROPORTIONAL_Handle *s = solver; |
863 | GNUNET_assert(NULL != solver); | 868 | GNUNET_assert(NULL != solver); |
@@ -866,6 +871,7 @@ GAS_proportional_address_change_preference (void *solver, | |||
866 | distribute_bandwidth_in_all_networks (s); | 871 | distribute_bandwidth_in_all_networks (s); |
867 | } | 872 | } |
868 | 873 | ||
874 | |||
869 | /** | 875 | /** |
870 | * Get application feedback for a peer | 876 | * Get application feedback for a peer |
871 | * | 877 | * |
@@ -910,19 +916,21 @@ GAS_proportional_get_preferred_address (void *solver, | |||
910 | GNUNET_assert(peer != NULL); | 916 | GNUNET_assert(peer != NULL); |
911 | 917 | ||
912 | /* Add to list of pending requests */ | 918 | /* Add to list of pending requests */ |
913 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (s->requests, | 919 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (s->requests, |
914 | &peer->hashPubKey)) | 920 | peer)) |
915 | { | 921 | { |
916 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (s->requests, &peer->hashPubKey, NULL, | 922 | GNUNET_assert (GNUNET_OK == |
917 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 923 | GNUNET_CONTAINER_multipeermap_put (s->requests, |
924 | peer, NULL, | ||
925 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
918 | } | 926 | } |
919 | 927 | ||
920 | /* Get address with: stick to current address, lower distance, lower latency */ | 928 | /* Get address with: stick to current address, lower distance, lower latency */ |
921 | fba_ctx.s = s; | 929 | fba_ctx.s = s; |
922 | fba_ctx.best = NULL; | 930 | fba_ctx.best = NULL; |
923 | 931 | ||
924 | GNUNET_CONTAINER_multihashmap_get_multiple (s->addresses, &peer->hashPubKey, | 932 | GNUNET_CONTAINER_multipeermap_get_multiple (s->addresses, peer, |
925 | &find_best_address_it, &fba_ctx); | 933 | &find_best_address_it, &fba_ctx); |
926 | if (NULL == fba_ctx.best) | 934 | if (NULL == fba_ctx.best) |
927 | { | 935 | { |
928 | LOG(GNUNET_ERROR_TYPE_INFO, "Cannot suggest address for peer `%s'\n", | 936 | LOG(GNUNET_ERROR_TYPE_INFO, "Cannot suggest address for peer `%s'\n", |
@@ -954,7 +962,7 @@ GAS_proportional_get_preferred_address (void *solver, | |||
954 | * - update quota for this address network | 962 | * - update quota for this address network |
955 | */ | 963 | */ |
956 | prev = get_active_address (s, | 964 | prev = get_active_address (s, |
957 | (struct GNUNET_CONTAINER_MultiHashMap *) s->addresses, peer); | 965 | s->addresses, peer); |
958 | if (NULL != prev) | 966 | if (NULL != prev) |
959 | { | 967 | { |
960 | net_prev = (struct Network *) prev->solver_information; | 968 | net_prev = (struct Network *) prev->solver_information; |
@@ -993,13 +1001,13 @@ GAS_proportional_stop_get_preferred_address (void *solver, | |||
993 | struct Network *cur_net; | 1001 | struct Network *cur_net; |
994 | 1002 | ||
995 | if (GNUNET_YES | 1003 | if (GNUNET_YES |
996 | == GNUNET_CONTAINER_multihashmap_contains (s->requests, | 1004 | == GNUNET_CONTAINER_multipeermap_contains (s->requests, |
997 | &peer->hashPubKey)) | 1005 | peer)) |
998 | GNUNET_CONTAINER_multihashmap_remove (s->requests, &peer->hashPubKey, | 1006 | GNUNET_CONTAINER_multipeermap_remove (s->requests, peer, |
999 | NULL ); | 1007 | NULL); |
1000 | 1008 | ||
1001 | cur = get_active_address (s, | 1009 | cur = get_active_address (s, |
1002 | (struct GNUNET_CONTAINER_MultiHashMap *) s->addresses, peer); | 1010 | s->addresses, peer); |
1003 | if (NULL != cur) | 1011 | if (NULL != cur) |
1004 | { | 1012 | { |
1005 | /* Disabling current address */ | 1013 | /* Disabling current address */ |
@@ -1115,6 +1123,7 @@ GAS_proportional_bulk_start (void *solver) | |||
1115 | s->bulk_lock++; | 1123 | s->bulk_lock++; |
1116 | } | 1124 | } |
1117 | 1125 | ||
1126 | |||
1118 | /** | 1127 | /** |
1119 | * Bulk operation done | 1128 | * Bulk operation done |
1120 | */ | 1129 | */ |
@@ -1140,6 +1149,7 @@ GAS_proportional_bulk_stop (void *solver) | |||
1140 | } | 1149 | } |
1141 | } | 1150 | } |
1142 | 1151 | ||
1152 | |||
1143 | /** | 1153 | /** |
1144 | * Add a new single address to a network | 1154 | * Add a new single address to a network |
1145 | * | 1155 | * |
@@ -1357,9 +1367,9 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1357 | addresse_increment (s, net, GNUNET_YES, GNUNET_NO); | 1367 | addresse_increment (s, net, GNUNET_YES, GNUNET_NO); |
1358 | aw->addr->solver_information = net; | 1368 | aw->addr->solver_information = net; |
1359 | 1369 | ||
1360 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (s->requests, &address->peer.hashPubKey)) | 1370 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) |
1361 | { | 1371 | { |
1362 | if (NULL == get_active_address (s, (struct GNUNET_CONTAINER_MultiHashMap *) s->addresses, &address->peer)) | 1372 | if (NULL == get_active_address (s, s->addresses, &address->peer)) |
1363 | { | 1373 | { |
1364 | if (NULL != (new_address = GAS_proportional_get_preferred_address (s, &address->peer))) | 1374 | if (NULL != (new_address = GAS_proportional_get_preferred_address (s, &address->peer))) |
1365 | s->bw_changed (s->bw_changed_cls, (struct ATS_Address *) address); | 1375 | s->bw_changed (s->bw_changed_cls, (struct ATS_Address *) address); |
@@ -1401,13 +1411,13 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1401 | */ | 1411 | */ |
1402 | void * | 1412 | void * |
1403 | GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1413 | GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1404 | const struct GNUNET_STATISTICS_Handle *stats, | 1414 | const struct GNUNET_STATISTICS_Handle *stats, |
1405 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, int *network, | 1415 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, int *network, |
1406 | unsigned long long *out_quota, unsigned long long *in_quota, | 1416 | unsigned long long *out_quota, unsigned long long *in_quota, |
1407 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, | 1417 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, |
1408 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, | 1418 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, |
1409 | void *get_preference_cls, GAS_get_properties get_properties, | 1419 | void *get_preference_cls, GAS_get_properties get_properties, |
1410 | void *get_properties_cls) | 1420 | void *get_properties_cls) |
1411 | { | 1421 | { |
1412 | int c; | 1422 | int c; |
1413 | struct GAS_PROPORTIONAL_Handle *s = | 1423 | struct GAS_PROPORTIONAL_Handle *s = |
@@ -1436,7 +1446,7 @@ GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1436 | s->bulk_lock = GNUNET_NO; | 1446 | s->bulk_lock = GNUNET_NO; |
1437 | s->addresses = addresses; | 1447 | s->addresses = addresses; |
1438 | 1448 | ||
1439 | s->requests = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 1449 | s->requests = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
1440 | 1450 | ||
1441 | for (c = 0; c < dest_length; c++) | 1451 | for (c = 0; c < dest_length; c++) |
1442 | { | 1452 | { |
@@ -1508,11 +1518,11 @@ GAS_proportional_done (void *solver) | |||
1508 | LOG(GNUNET_ERROR_TYPE_ERROR, | 1518 | LOG(GNUNET_ERROR_TYPE_ERROR, |
1509 | "Had %u active addresses not deleted during shutdown\n", | 1519 | "Had %u active addresses not deleted during shutdown\n", |
1510 | s->active_addresses); | 1520 | s->active_addresses); |
1511 | GNUNET_break(0); | 1521 | GNUNET_break (0); |
1512 | } | 1522 | } |
1513 | GNUNET_free(s->network_entries); | 1523 | GNUNET_free (s->network_entries); |
1514 | GNUNET_CONTAINER_multihashmap_destroy (s->requests); | 1524 | GNUNET_CONTAINER_multipeermap_destroy (s->requests); |
1515 | GNUNET_free(s); | 1525 | GNUNET_free (s); |
1516 | } | 1526 | } |
1517 | 1527 | ||
1518 | /* end of gnunet-service-ats-solver_proportional.c */ | 1528 | /* end of gnunet-service-ats-solver_proportional.c */ |
diff --git a/src/ats/gnunet-service-ats-solver_proportional.h b/src/ats/gnunet-service-ats-solver_proportional.h index 13cf54e8d..87b448866 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.h +++ b/src/ats/gnunet-service-ats-solver_proportional.h | |||
@@ -95,7 +95,7 @@ GAS_proportional_address_preference_feedback (void *solver, void *application, | |||
95 | void * | 95 | void * |
96 | GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 96 | GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
97 | const struct GNUNET_STATISTICS_Handle *stats, | 97 | const struct GNUNET_STATISTICS_Handle *stats, |
98 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, int *network, | 98 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, int *network, |
99 | unsigned long long *out_quota, unsigned long long *in_quota, | 99 | unsigned long long *out_quota, unsigned long long *in_quota, |
100 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, | 100 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, |
101 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, | 101 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, |
diff --git a/src/ats/gnunet-service-ats-solver_ril.c b/src/ats/gnunet-service-ats-solver_ril.c index 8cc91bdf3..512184627 100755 --- a/src/ats/gnunet-service-ats-solver_ril.c +++ b/src/ats/gnunet-service-ats-solver_ril.c | |||
@@ -290,7 +290,7 @@ struct GAS_RIL_Handle | |||
290 | /** | 290 | /** |
291 | * Hashmap containing all valid addresses | 291 | * Hashmap containing all valid addresses |
292 | */ | 292 | */ |
293 | const struct GNUNET_CONTAINER_MultiHashMap *addresses; | 293 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses; |
294 | 294 | ||
295 | /** | 295 | /** |
296 | * Callbacks for the solver | 296 | * Callbacks for the solver |
@@ -976,7 +976,9 @@ ril_get_agent (struct GAS_RIL_Handle *solver, const struct GNUNET_PeerIdentity * | |||
976 | 976 | ||
977 | for (cur = solver->agents_head; NULL != cur; cur = cur->next) | 977 | for (cur = solver->agents_head; NULL != cur; cur = cur->next) |
978 | { | 978 | { |
979 | if (0 == GNUNET_CRYPTO_hash_cmp (&peer->hashPubKey, &cur->peer.hashPubKey)) | 979 | if (0 == memcmp (peer, |
980 | &cur->peer, | ||
981 | sizeof (struct GNUNET_PeerIdentity))) | ||
980 | { | 982 | { |
981 | return cur; | 983 | return cur; |
982 | } | 984 | } |
@@ -1129,7 +1131,7 @@ GAS_ril_address_change_preference (void *s, | |||
1129 | void * | 1131 | void * |
1130 | GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1132 | GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1131 | const struct GNUNET_STATISTICS_Handle *stats, | 1133 | const struct GNUNET_STATISTICS_Handle *stats, |
1132 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, | 1134 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
1133 | int *network, | 1135 | int *network, |
1134 | unsigned long long *out_quota, | 1136 | unsigned long long *out_quota, |
1135 | unsigned long long *in_quota, | 1137 | unsigned long long *in_quota, |
@@ -1145,7 +1147,7 @@ GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1145 | unsigned long long tmp; | 1147 | unsigned long long tmp; |
1146 | char *string; | 1148 | char *string; |
1147 | struct RIL_Network * cur; | 1149 | struct RIL_Network * cur; |
1148 | struct GAS_RIL_Handle *solver = GNUNET_malloc (sizeof (struct GAS_RIL_Handle)); | 1150 | struct GAS_RIL_Handle *solver = GNUNET_new (struct GAS_RIL_Handle); |
1149 | 1151 | ||
1150 | LOG(GNUNET_ERROR_TYPE_DEBUG, "API_init() Initializing RIL solver\n"); | 1152 | LOG(GNUNET_ERROR_TYPE_DEBUG, "API_init() Initializing RIL solver\n"); |
1151 | 1153 | ||
diff --git a/src/ats/gnunet-service-ats-solver_ril.h b/src/ats/gnunet-service-ats-solver_ril.h index 0053e3b9d..16f1fee5f 100755 --- a/src/ats/gnunet-service-ats-solver_ril.h +++ b/src/ats/gnunet-service-ats-solver_ril.h | |||
@@ -80,7 +80,7 @@ GAS_ril_address_change_preference (void *solver, | |||
80 | void * | 80 | void * |
81 | GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 81 | GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
82 | const struct GNUNET_STATISTICS_Handle *stats, | 82 | const struct GNUNET_STATISTICS_Handle *stats, |
83 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, | 83 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
84 | int *network, | 84 | int *network, |
85 | unsigned long long *out_quota, | 85 | unsigned long long *out_quota, |
86 | unsigned long long *in_quota, | 86 | unsigned long long *in_quota, |
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 4db70dbae..8e3692b8e 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -294,7 +294,7 @@ struct GAS_Addresses_Handle | |||
294 | /** | 294 | /** |
295 | * A multihashmap to store all addresses | 295 | * A multihashmap to store all addresses |
296 | */ | 296 | */ |
297 | struct GNUNET_CONTAINER_MultiHashMap *addresses; | 297 | struct GNUNET_CONTAINER_MultiPeerMap *addresses; |
298 | 298 | ||
299 | /** | 299 | /** |
300 | * Configure WAN quota in | 300 | * Configure WAN quota in |
@@ -574,17 +574,19 @@ struct CompareAddressContext | |||
574 | struct ATS_Address *base_address; | 574 | struct ATS_Address *base_address; |
575 | }; | 575 | }; |
576 | 576 | ||
577 | |||
577 | /** | 578 | /** |
578 | * Comapre addresses | 579 | * Comapre addresses |
579 | * | 580 | * |
580 | * @param cls a CompareAddressContext containin the source address | 581 | * @param cls a CompareAddressContext containin the source address |
581 | * @param key peer id | 582 | * @param key peer id |
582 | * @param value the address to compare with | 583 | * @param value the address to compare with |
583 | * @return GNUNET_YES to continue, GNUNET_NO if address is founce | 584 | * @return #GNUNET_YES to continue, #GNUNET_NO if address is founce |
584 | */ | 585 | */ |
585 | |||
586 | static int | 586 | static int |
587 | compare_address_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 587 | compare_address_it (void *cls, |
588 | const struct GNUNET_PeerIdentity *key, | ||
589 | void *value) | ||
588 | { | 590 | { |
589 | struct CompareAddressContext *cac = cls; | 591 | struct CompareAddressContext *cac = cls; |
590 | struct ATS_Address *aa = value; | 592 | struct ATS_Address *aa = value; |
@@ -672,14 +674,16 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle, | |||
672 | cac.exact_address = NULL; | 674 | cac.exact_address = NULL; |
673 | cac.base_address = NULL; | 675 | cac.base_address = NULL; |
674 | cac.search = addr; | 676 | cac.search = addr; |
675 | GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses, | 677 | GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, |
676 | &peer->hashPubKey, &compare_address_it, &cac); | 678 | peer, |
679 | &compare_address_it, &cac); | ||
677 | 680 | ||
678 | if (cac.exact_address == NULL ) | 681 | if (cac.exact_address == NULL) |
679 | return cac.base_address; | 682 | return cac.base_address; |
680 | return cac.exact_address; | 683 | return cac.exact_address; |
681 | } | 684 | } |
682 | 685 | ||
686 | |||
683 | /** | 687 | /** |
684 | * Find the exact address | 688 | * Find the exact address |
685 | * | 689 | * |
@@ -787,13 +791,13 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
787 | { | 791 | { |
788 | /* Add a new address */ | 792 | /* Add a new address */ |
789 | GNUNET_assert( | 793 | GNUNET_assert( |
790 | GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (handle->addresses, | 794 | GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (handle->addresses, |
791 | &peer->hashPubKey, | 795 | peer, |
792 | new_address, | 796 | new_address, |
793 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 797 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
794 | 798 | ||
795 | GNUNET_STATISTICS_set (handle->stat, "# addresses", | 799 | GNUNET_STATISTICS_set (handle->stat, "# addresses", |
796 | GNUNET_CONTAINER_multihashmap_size (handle->addresses), GNUNET_NO); | 800 | GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO); |
797 | 801 | ||
798 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 802 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
799 | "Adding new address %p for peer `%s', length %u, session id %u, %s\n", | 803 | "Adding new address %p for peer `%s', length %u, session id %u, %s\n", |
@@ -1013,8 +1017,9 @@ struct DestroyContext | |||
1013 | * @return GNUNET_OK (continue to iterate) | 1017 | * @return GNUNET_OK (continue to iterate) |
1014 | */ | 1018 | */ |
1015 | static int | 1019 | static int |
1016 | destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, | 1020 | destroy_by_session_id (void *cls, |
1017 | void *value) | 1021 | const struct GNUNET_PeerIdentity *key, |
1022 | void *value) | ||
1018 | { | 1023 | { |
1019 | struct DestroyContext *dc = cls; | 1024 | struct DestroyContext *dc = cls; |
1020 | struct GAS_Addresses_Handle *handle = dc->handle; | 1025 | struct GAS_Addresses_Handle *handle = dc->handle; |
@@ -1038,7 +1043,9 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, | |||
1038 | 1043 | ||
1039 | /* Notify solver about deletion */ | 1044 | /* Notify solver about deletion */ |
1040 | GNUNET_assert( | 1045 | GNUNET_assert( |
1041 | GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->addresses, &aa->peer.hashPubKey, aa)); | 1046 | GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, |
1047 | &aa->peer, | ||
1048 | aa)); | ||
1042 | handle->s_del (handle->solver, aa, GNUNET_NO); | 1049 | handle->s_del (handle->solver, aa, GNUNET_NO); |
1043 | free_address (aa); | 1050 | free_address (aa); |
1044 | dc->result = GNUNET_NO; | 1051 | dc->result = GNUNET_NO; |
@@ -1069,7 +1076,8 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, | |||
1069 | 1076 | ||
1070 | /* Notify solver about deletion */ | 1077 | /* Notify solver about deletion */ |
1071 | GNUNET_assert( | 1078 | GNUNET_assert( |
1072 | GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->addresses, &aa->peer.hashPubKey, aa)); | 1079 | GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (handle->addresses, |
1080 | &aa->peer, aa)); | ||
1073 | handle->s_del (handle->solver, aa, GNUNET_NO); | 1081 | handle->s_del (handle->solver, aa, GNUNET_NO); |
1074 | free_address (aa); | 1082 | free_address (aa); |
1075 | dc->result = GNUNET_NO; | 1083 | dc->result = GNUNET_NO; |
@@ -1091,6 +1099,7 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, | |||
1091 | return GNUNET_OK; | 1099 | return GNUNET_OK; |
1092 | } | 1100 | } |
1093 | 1101 | ||
1102 | |||
1094 | /** | 1103 | /** |
1095 | * Remove an address or just a session for a peer. | 1104 | * Remove an address or just a session for a peer. |
1096 | * | 1105 | * |
@@ -1131,10 +1140,11 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle, | |||
1131 | dc.aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, | 1140 | dc.aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, |
1132 | session_id); | 1141 | session_id); |
1133 | 1142 | ||
1134 | GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses, | 1143 | GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, |
1135 | &peer->hashPubKey, &destroy_by_session_id, &dc); | 1144 | peer, |
1145 | &destroy_by_session_id, &dc); | ||
1136 | GNUNET_STATISTICS_set (handle->stat, "# addresses", | 1146 | GNUNET_STATISTICS_set (handle->stat, "# addresses", |
1137 | GNUNET_CONTAINER_multihashmap_size (handle->addresses), GNUNET_NO); | 1147 | GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO); |
1138 | free_address (dc.aa); | 1148 | free_address (dc.aa); |
1139 | } | 1149 | } |
1140 | 1150 | ||
@@ -1308,22 +1318,26 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, | |||
1308 | * @param cls not used | 1318 | * @param cls not used |
1309 | * @param key the peer | 1319 | * @param key the peer |
1310 | * @param value the address to reset | 1320 | * @param value the address to reset |
1311 | * @return GNUNET_OK to continue | 1321 | * @return #GNUNET_OK to continue |
1312 | */ | 1322 | */ |
1313 | static int | 1323 | static int |
1314 | reset_address_it (void *cls, const struct GNUNET_HashCode *key, void *value) | 1324 | reset_address_it (void *cls, |
1325 | const struct GNUNET_PeerIdentity *key, | ||
1326 | void *value) | ||
1315 | { | 1327 | { |
1316 | struct ATS_Address *aa = value; | 1328 | struct ATS_Address *aa = value; |
1317 | 1329 | ||
1318 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1330 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1319 | "Resetting interval for peer `%s' address %p from %llu to 0\n", | 1331 | "Resetting interval for peer `%s' address %p from %llu to 0\n", |
1320 | GNUNET_i2s (&aa->peer), aa, aa->block_interval); | 1332 | GNUNET_i2s (&aa->peer), |
1321 | 1333 | aa, | |
1334 | aa->block_interval); | ||
1322 | aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS; | 1335 | aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS; |
1323 | aa->block_interval = GNUNET_TIME_UNIT_ZERO; | 1336 | aa->block_interval = GNUNET_TIME_UNIT_ZERO; |
1324 | return GNUNET_OK; | 1337 | return GNUNET_OK; |
1325 | } | 1338 | } |
1326 | 1339 | ||
1340 | |||
1327 | /** | 1341 | /** |
1328 | * Reset suggestion backoff for a peer | 1342 | * Reset suggestion backoff for a peer |
1329 | * | 1343 | * |
@@ -1341,9 +1355,12 @@ GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, | |||
1341 | "RESET BACKOFF", GNUNET_i2s (peer)); | 1355 | "RESET BACKOFF", GNUNET_i2s (peer)); |
1342 | 1356 | ||
1343 | GNUNET_break( | 1357 | GNUNET_break( |
1344 | GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses, &peer->hashPubKey, &reset_address_it, NULL)); | 1358 | GNUNET_SYSERR != GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, |
1359 | peer, | ||
1360 | &reset_address_it, NULL)); | ||
1345 | } | 1361 | } |
1346 | 1362 | ||
1363 | |||
1347 | /** | 1364 | /** |
1348 | * The preference changed for a peer | 1365 | * The preference changed for a peer |
1349 | * | 1366 | * |
@@ -1436,9 +1453,9 @@ GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle, | |||
1436 | if (GNUNET_NO == handle->running) | 1453 | if (GNUNET_NO == handle->running) |
1437 | return; | 1454 | return; |
1438 | 1455 | ||
1439 | if (GNUNET_NO | 1456 | if (GNUNET_NO == |
1440 | == GNUNET_CONTAINER_multihashmap_contains (handle->addresses, | 1457 | GNUNET_CONTAINER_multipeermap_contains (handle->addresses, |
1441 | &peer->hashPubKey)) | 1458 | peer)) |
1442 | { | 1459 | { |
1443 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 1460 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
1444 | "Received `%s' for unknown peer `%s' from client %p\n", | 1461 | "Received `%s' for unknown peer `%s' from client %p\n", |
@@ -1475,9 +1492,9 @@ GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle, | |||
1475 | if (GNUNET_NO == handle->running) | 1492 | if (GNUNET_NO == handle->running) |
1476 | return; | 1493 | return; |
1477 | 1494 | ||
1478 | if (GNUNET_NO | 1495 | if (GNUNET_NO == |
1479 | == GNUNET_CONTAINER_multihashmap_contains (handle->addresses, | 1496 | GNUNET_CONTAINER_multipeermap_contains (handle->addresses, |
1480 | &peer->hashPubKey)) | 1497 | peer)) |
1481 | { | 1498 | { |
1482 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 1499 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
1483 | "Received `%s' for unknown peer `%s' from client %p\n", | 1500 | "Received `%s' for unknown peer `%s' from client %p\n", |
@@ -1699,7 +1716,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1699 | 1716 | ||
1700 | ah->stat = (struct GNUNET_STATISTICS_Handle *) stats; | 1717 | ah->stat = (struct GNUNET_STATISTICS_Handle *) stats; |
1701 | /* Initialize the addresses database */ | 1718 | /* Initialize the addresses database */ |
1702 | ah->addresses = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 1719 | ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
1703 | GNUNET_assert(NULL != ah->addresses); | 1720 | GNUNET_assert(NULL != ah->addresses); |
1704 | 1721 | ||
1705 | /* Figure out configured solution method */ | 1722 | /* Figure out configured solution method */ |
@@ -1808,29 +1825,30 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1808 | break; | 1825 | break; |
1809 | } | 1826 | } |
1810 | 1827 | ||
1811 | GNUNET_assert(NULL != ah->s_init); | 1828 | GNUNET_assert (NULL != ah->s_init); |
1812 | GNUNET_assert(NULL != ah->s_add); | 1829 | GNUNET_assert (NULL != ah->s_add); |
1813 | GNUNET_assert(NULL != ah->s_address_update_inuse); | 1830 | GNUNET_assert (NULL != ah->s_address_update_inuse); |
1814 | GNUNET_assert(NULL != ah->s_address_update_property); | 1831 | GNUNET_assert (NULL != ah->s_address_update_property); |
1815 | GNUNET_assert(NULL != ah->s_address_update_session); | 1832 | GNUNET_assert (NULL != ah->s_address_update_session); |
1816 | GNUNET_assert(NULL != ah->s_address_update_network); | 1833 | GNUNET_assert (NULL != ah->s_address_update_network); |
1817 | GNUNET_assert(NULL != ah->s_get); | 1834 | GNUNET_assert (NULL != ah->s_get); |
1818 | GNUNET_assert(NULL != ah->s_get_stop); | 1835 | GNUNET_assert (NULL != ah->s_get_stop); |
1819 | GNUNET_assert(NULL != ah->s_pref); | 1836 | GNUNET_assert (NULL != ah->s_pref); |
1820 | GNUNET_assert(NULL != ah->s_feedback); | 1837 | GNUNET_assert (NULL != ah->s_feedback); |
1821 | GNUNET_assert(NULL != ah->s_del); | 1838 | GNUNET_assert (NULL != ah->s_del); |
1822 | GNUNET_assert(NULL != ah->s_done); | 1839 | GNUNET_assert (NULL != ah->s_done); |
1823 | GNUNET_assert(NULL != ah->s_bulk_start); | 1840 | GNUNET_assert (NULL != ah->s_bulk_start); |
1824 | GNUNET_assert(NULL != ah->s_bulk_stop); | 1841 | GNUNET_assert (NULL != ah->s_bulk_stop); |
1825 | 1842 | ||
1826 | GAS_normalization_start (&normalized_preference_changed_cb, ah, | 1843 | GAS_normalization_start (&normalized_preference_changed_cb, ah, |
1827 | &normalized_property_changed_cb, ah); | 1844 | &normalized_property_changed_cb, ah); |
1828 | quota_count = load_quotas (cfg, quotas_in, quotas_out, | 1845 | quota_count = load_quotas (cfg, quotas_in, quotas_out, |
1829 | GNUNET_ATS_NetworkTypeCount); | 1846 | GNUNET_ATS_NetworkTypeCount); |
1830 | 1847 | ||
1831 | ah->solver = ah->s_init (cfg, stats, ah->addresses, quotas, quotas_in, | 1848 | ah->solver = ah->s_init (cfg, stats, ah->addresses, quotas, quotas_in, |
1832 | quotas_out, quota_count, &bandwidth_changed_cb, ah, &get_preferences_cb, | 1849 | quotas_out, quota_count, |
1833 | NULL, &get_property_cb, NULL ); | 1850 | &bandwidth_changed_cb, ah, &get_preferences_cb, |
1851 | NULL, &get_property_cb, NULL ); | ||
1834 | if (NULL == ah->solver) | 1852 | if (NULL == ah->solver) |
1835 | { | 1853 | { |
1836 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Failed to initialize solver!\n")); | 1854 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Failed to initialize solver!\n")); |
@@ -1841,7 +1859,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1841 | ah->running = GNUNET_YES; | 1859 | ah->running = GNUNET_YES; |
1842 | 1860 | ||
1843 | GNUNET_STATISTICS_set (ah->stat, "# addresses", | 1861 | GNUNET_STATISTICS_set (ah->stat, "# addresses", |
1844 | GNUNET_CONTAINER_multihashmap_size (ah->addresses), GNUNET_NO); | 1862 | GNUNET_CONTAINER_multipeermap_size (ah->addresses), GNUNET_NO); |
1845 | 1863 | ||
1846 | return ah; | 1864 | return ah; |
1847 | } | 1865 | } |
@@ -1852,18 +1870,19 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1852 | * @param cls NULL | 1870 | * @param cls NULL |
1853 | * @param key peer identity (unused) | 1871 | * @param key peer identity (unused) |
1854 | * @param value the 'struct ATS_Address' to free | 1872 | * @param value the 'struct ATS_Address' to free |
1855 | * @return GNUNET_OK (continue to iterate) | 1873 | * @return #GNUNET_OK (continue to iterate) |
1856 | */ | 1874 | */ |
1857 | static int | 1875 | static int |
1858 | destroy_all_address_it (void *cls, const struct GNUNET_HashCode * key, | 1876 | destroy_all_address_it (void *cls, |
1859 | void *value) | 1877 | const struct GNUNET_PeerIdentity *key, |
1878 | void *value) | ||
1860 | { | 1879 | { |
1861 | struct GAS_Addresses_Handle *handle = cls; | 1880 | struct GAS_Addresses_Handle *handle = cls; |
1862 | struct ATS_Address *aa = value; | 1881 | struct ATS_Address *aa = value; |
1863 | 1882 | ||
1864 | /* Remove */ | 1883 | /* Remove */ |
1865 | GNUNET_assert( | 1884 | GNUNET_assert(GNUNET_YES == |
1866 | GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->addresses, key, value)); | 1885 | GNUNET_CONTAINER_multipeermap_remove (handle->addresses, key, value)); |
1867 | /* Notify */ | 1886 | /* Notify */ |
1868 | handle->s_del (handle->solver, aa, GNUNET_NO); | 1887 | handle->s_del (handle->solver, aa, GNUNET_NO); |
1869 | /* Destroy */ | 1888 | /* Destroy */ |
@@ -1872,6 +1891,7 @@ destroy_all_address_it (void *cls, const struct GNUNET_HashCode * key, | |||
1872 | return GNUNET_OK; | 1891 | return GNUNET_OK; |
1873 | } | 1892 | } |
1874 | 1893 | ||
1894 | |||
1875 | /** | 1895 | /** |
1876 | * Remove all addresses | 1896 | * Remove all addresses |
1877 | * | 1897 | * |
@@ -1886,11 +1906,13 @@ GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle) | |||
1886 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Destroying all addresses\n"); | 1906 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Destroying all addresses\n"); |
1887 | handle->s_bulk_start (handle->solver); | 1907 | handle->s_bulk_start (handle->solver); |
1888 | if (handle->addresses != NULL ) | 1908 | if (handle->addresses != NULL ) |
1889 | GNUNET_CONTAINER_multihashmap_iterate (handle->addresses, | 1909 | GNUNET_CONTAINER_multipeermap_iterate (handle->addresses, |
1890 | &destroy_all_address_it, handle); | 1910 | &destroy_all_address_it, |
1911 | handle); | ||
1891 | handle->s_bulk_start (handle->solver); | 1912 | handle->s_bulk_start (handle->solver); |
1892 | } | 1913 | } |
1893 | 1914 | ||
1915 | |||
1894 | /** | 1916 | /** |
1895 | * Shutdown address subsystem. | 1917 | * Shutdown address subsystem. |
1896 | * | 1918 | * |
@@ -1905,7 +1927,7 @@ GAS_addresses_done (struct GAS_Addresses_Handle *handle) | |||
1905 | GNUNET_assert(NULL != handle); | 1927 | GNUNET_assert(NULL != handle); |
1906 | GAS_addresses_destroy_all (handle); | 1928 | GAS_addresses_destroy_all (handle); |
1907 | handle->running = GNUNET_NO; | 1929 | handle->running = GNUNET_NO; |
1908 | GNUNET_CONTAINER_multihashmap_destroy (handle->addresses); | 1930 | GNUNET_CONTAINER_multipeermap_destroy (handle->addresses); |
1909 | handle->addresses = NULL; | 1931 | handle->addresses = NULL; |
1910 | while (NULL != (cur = handle->r_head)) | 1932 | while (NULL != (cur = handle->r_head)) |
1911 | { | 1933 | { |
@@ -1918,34 +1940,36 @@ GAS_addresses_done (struct GAS_Addresses_Handle *handle) | |||
1918 | GAS_normalization_stop (); | 1940 | GAS_normalization_stop (); |
1919 | } | 1941 | } |
1920 | 1942 | ||
1943 | |||
1921 | struct PeerIteratorContext | 1944 | struct PeerIteratorContext |
1922 | { | 1945 | { |
1923 | GNUNET_ATS_Peer_Iterator it; | 1946 | GNUNET_ATS_Peer_Iterator it; |
1924 | void *it_cls; | 1947 | void *it_cls; |
1925 | struct GNUNET_CONTAINER_MultiHashMap *peers_returned; | 1948 | struct GNUNET_CONTAINER_MultiPeerMap *peers_returned; |
1926 | }; | 1949 | }; |
1927 | 1950 | ||
1951 | |||
1928 | /** | 1952 | /** |
1929 | * Iterator to iterate over all peers | 1953 | * Iterator to iterate over all peers |
1930 | * | 1954 | * |
1931 | * @param cls a PeerIteratorContext | 1955 | * @param cls a PeerIteratorContext |
1932 | * @param key the peer id | 1956 | * @param key the peer id |
1933 | * @param value the ATS_address | 1957 | * @param value the ATS_address |
1934 | * @return GNUNET_OK to continue | 1958 | * @return #GNUNET_OK to continue |
1935 | */ | 1959 | */ |
1936 | static int | 1960 | static int |
1937 | peer_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 1961 | peer_it (void *cls, |
1962 | const struct GNUNET_PeerIdentity *key, | ||
1963 | void *value) | ||
1938 | { | 1964 | { |
1939 | struct PeerIteratorContext *ip_ctx = cls; | 1965 | struct PeerIteratorContext *ip_ctx = cls; |
1940 | struct GNUNET_PeerIdentity tmp; | ||
1941 | 1966 | ||
1942 | if (GNUNET_NO | 1967 | if (GNUNET_NO == |
1943 | == GNUNET_CONTAINER_multihashmap_contains (ip_ctx->peers_returned, key)) | 1968 | GNUNET_CONTAINER_multipeermap_contains (ip_ctx->peers_returned, key)) |
1944 | { | 1969 | { |
1945 | GNUNET_CONTAINER_multihashmap_put (ip_ctx->peers_returned, key, NULL, | 1970 | GNUNET_CONTAINER_multipeermap_put (ip_ctx->peers_returned, key, NULL, |
1946 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1971 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1947 | tmp.hashPubKey = (*key); | 1972 | ip_ctx->it (ip_ctx->it_cls, key); |
1948 | ip_ctx->it (ip_ctx->it_cls, &tmp); | ||
1949 | } | 1973 | } |
1950 | 1974 | ||
1951 | return GNUNET_OK; | 1975 | return GNUNET_OK; |
@@ -1969,16 +1993,17 @@ GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle, | |||
1969 | return; | 1993 | return; |
1970 | GNUNET_assert(NULL != handle->addresses); | 1994 | GNUNET_assert(NULL != handle->addresses); |
1971 | 1995 | ||
1972 | size = GNUNET_CONTAINER_multihashmap_size (handle->addresses); | 1996 | size = GNUNET_CONTAINER_multipeermap_size (handle->addresses); |
1973 | if (0 != size) | 1997 | if (0 != size) |
1974 | { | 1998 | { |
1975 | ip_ctx.it = p_it; | 1999 | ip_ctx.it = p_it; |
1976 | ip_ctx.it_cls = p_it_cls; | 2000 | ip_ctx.it_cls = p_it_cls; |
1977 | ip_ctx.peers_returned = GNUNET_CONTAINER_multihashmap_create (size, | 2001 | ip_ctx.peers_returned = GNUNET_CONTAINER_multipeermap_create (size, |
1978 | GNUNET_NO); | 2002 | GNUNET_NO); |
1979 | GNUNET_CONTAINER_multihashmap_iterate (handle->addresses, &peer_it, | 2003 | GNUNET_CONTAINER_multipeermap_iterate (handle->addresses, |
1980 | &ip_ctx); | 2004 | &peer_it, |
1981 | GNUNET_CONTAINER_multihashmap_destroy (ip_ctx.peers_returned); | 2005 | &ip_ctx); |
2006 | GNUNET_CONTAINER_multipeermap_destroy (ip_ctx.peers_returned); | ||
1982 | } | 2007 | } |
1983 | p_it (p_it_cls, NULL ); | 2008 | p_it (p_it_cls, NULL ); |
1984 | } | 2009 | } |
@@ -1989,19 +2014,22 @@ struct PeerInfoIteratorContext | |||
1989 | void *it_cls; | 2014 | void *it_cls; |
1990 | }; | 2015 | }; |
1991 | 2016 | ||
2017 | |||
1992 | /** | 2018 | /** |
1993 | * Iterator to iterate over a peer's addresses | 2019 | * Iterator to iterate over a peer's addresses |
1994 | * | 2020 | * |
1995 | * @param cls a PeerInfoIteratorContext | 2021 | * @param cls a `struct PeerInfoIteratorContext` |
1996 | * @param key the peer id | 2022 | * @param key the peer id |
1997 | * @param value the ATS_address | 2023 | * @param value the `struct ATS_address` |
1998 | * @return GNUNET_OK to continue | 2024 | * @return #GNUNET_OK to continue |
1999 | */ | 2025 | */ |
2000 | static int | 2026 | static int |
2001 | peerinfo_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 2027 | peerinfo_it (void *cls, |
2028 | const struct GNUNET_PeerIdentity *key, | ||
2029 | void *value) | ||
2002 | { | 2030 | { |
2003 | struct PeerInfoIteratorContext *pi_ctx = cls; | 2031 | struct PeerInfoIteratorContext *pi_ctx = cls; |
2004 | struct ATS_Address *addr = (struct ATS_Address *) value; | 2032 | struct ATS_Address *addr = value; |
2005 | 2033 | ||
2006 | if (NULL != pi_ctx->it) | 2034 | if (NULL != pi_ctx->it) |
2007 | { | 2035 | { |
@@ -2012,6 +2040,7 @@ peerinfo_it (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
2012 | return GNUNET_YES; | 2040 | return GNUNET_YES; |
2013 | } | 2041 | } |
2014 | 2042 | ||
2043 | |||
2015 | /** | 2044 | /** |
2016 | * Return information all peers currently known to ATS | 2045 | * Return information all peers currently known to ATS |
2017 | * | 2046 | * |
@@ -2027,6 +2056,7 @@ GAS_addresses_get_peer_info (struct GAS_Addresses_Handle *handle, | |||
2027 | { | 2056 | { |
2028 | struct PeerInfoIteratorContext pi_ctx; | 2057 | struct PeerInfoIteratorContext pi_ctx; |
2029 | struct GNUNET_BANDWIDTH_Value32NBO zero_bw; | 2058 | struct GNUNET_BANDWIDTH_Value32NBO zero_bw; |
2059 | |||
2030 | GNUNET_assert(NULL != peer); | 2060 | GNUNET_assert(NULL != peer); |
2031 | GNUNET_assert(NULL != handle->addresses); | 2061 | GNUNET_assert(NULL != handle->addresses); |
2032 | if (NULL == pi_it) | 2062 | if (NULL == pi_it) |
@@ -2036,8 +2066,9 @@ GAS_addresses_get_peer_info (struct GAS_Addresses_Handle *handle, | |||
2036 | pi_ctx.it = pi_it; | 2066 | pi_ctx.it = pi_it; |
2037 | pi_ctx.it_cls = pi_it_cls; | 2067 | pi_ctx.it_cls = pi_it_cls; |
2038 | 2068 | ||
2039 | GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses, | 2069 | GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses, |
2040 | &peer->hashPubKey, &peerinfo_it, &pi_ctx); | 2070 | peer, |
2071 | &peerinfo_it, &pi_ctx); | ||
2041 | 2072 | ||
2042 | if (NULL != pi_it) | 2073 | if (NULL != pi_it) |
2043 | pi_it (pi_it_cls, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, zero_bw, | 2074 | pi_it (pi_it_cls, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, zero_bw, |
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index b5ae248e4..71dfde41f 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h | |||
@@ -411,7 +411,7 @@ typedef const double * | |||
411 | typedef void * | 411 | typedef void * |
412 | (*GAS_solver_init) (const struct GNUNET_CONFIGURATION_Handle *cfg, | 412 | (*GAS_solver_init) (const struct GNUNET_CONFIGURATION_Handle *cfg, |
413 | const struct GNUNET_STATISTICS_Handle *stats, | 413 | const struct GNUNET_STATISTICS_Handle *stats, |
414 | const struct GNUNET_CONTAINER_MultiHashMap *addresses, int *network, | 414 | const struct GNUNET_CONTAINER_MultiPeerMap *addresses, int *network, |
415 | unsigned long long *out_quota, unsigned long long *in_quota, | 415 | unsigned long long *out_quota, unsigned long long *in_quota, |
416 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, | 416 | int dest_length, GAS_bandwidth_changed_cb bw_changed_cb, |
417 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, | 417 | void *bw_changed_cb_cls, GAS_get_preferences get_preference, |
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c index fabef09e4..bd9dcb706 100644 --- a/src/ats/gnunet-service-ats_normalization.c +++ b/src/ats/gnunet-service-ats_normalization.c | |||
@@ -149,12 +149,13 @@ void *prop_ch_cb_cls; | |||
149 | /** | 149 | /** |
150 | * Hashmap to store peer information for preference normalization | 150 | * Hashmap to store peer information for preference normalization |
151 | */ | 151 | */ |
152 | static struct GNUNET_CONTAINER_MultiHashMap *preference_peers; | 152 | static struct GNUNET_CONTAINER_MultiPeerMap *preference_peers; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Hashmap to store peer information for property normalization | 155 | * Hashmap to store peer information for property normalization |
156 | * FIXME: this map is not used! | ||
156 | */ | 157 | */ |
157 | static struct GNUNET_CONTAINER_MultiHashMap *property_peers; | 158 | static struct GNUNET_CONTAINER_MultiPeerMap *property_peers; |
158 | 159 | ||
159 | /** | 160 | /** |
160 | * Clients in DLL: head | 161 | * Clients in DLL: head |
@@ -220,8 +221,8 @@ update_peers (struct GNUNET_PeerIdentity *id, | |||
220 | count, GNUNET_i2s (id), GNUNET_ATS_print_preference_type (kind), | 221 | count, GNUNET_i2s (id), GNUNET_ATS_print_preference_type (kind), |
221 | f_rel_total); | 222 | f_rel_total); |
222 | if (NULL | 223 | if (NULL |
223 | != (rp = GNUNET_CONTAINER_multihashmap_get (preference_peers, | 224 | != (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers, |
224 | &id->hashPubKey))) | 225 | id))) |
225 | { | 226 | { |
226 | backup = rp->f_rel[kind]; | 227 | backup = rp->f_rel[kind]; |
227 | if (0 < count) | 228 | if (0 < count) |
@@ -302,7 +303,7 @@ recalculate_rel_preferences (struct PreferenceClient *c, | |||
302 | { | 303 | { |
303 | /* Value did not chang, return old value*/ | 304 | /* Value did not chang, return old value*/ |
304 | GNUNET_assert( | 305 | GNUNET_assert( |
305 | NULL != (rp = GNUNET_CONTAINER_multihashmap_get (preference_peers, &p->id.hashPubKey))); | 306 | NULL != (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers, &p->id))); |
306 | ret = rp->f_rel[kind]; | 307 | ret = rp->f_rel[kind]; |
307 | } | 308 | } |
308 | } | 309 | } |
@@ -474,14 +475,14 @@ GAS_normalization_normalize_preference (void *src, | |||
474 | GNUNET_CONTAINER_DLL_insert(c_cur->p_head, c_cur->p_tail, p_cur); | 475 | GNUNET_CONTAINER_DLL_insert(c_cur->p_head, c_cur->p_tail, p_cur); |
475 | } | 476 | } |
476 | 477 | ||
477 | if (NULL == GNUNET_CONTAINER_multihashmap_get (preference_peers, | 478 | if (NULL == GNUNET_CONTAINER_multipeermap_get (preference_peers, |
478 | &peer->hashPubKey)) | 479 | peer)) |
479 | { | 480 | { |
480 | r_cur = GNUNET_malloc (sizeof (struct PeerRelative)); | 481 | r_cur = GNUNET_malloc (sizeof (struct PeerRelative)); |
481 | r_cur->id = (*peer); | 482 | r_cur->id = (*peer); |
482 | for (i = 0; i < GNUNET_ATS_PreferenceCount; i++) | 483 | for (i = 0; i < GNUNET_ATS_PreferenceCount; i++) |
483 | r_cur->f_rel[i] = DEFAULT_REL_PREFERENCE; | 484 | r_cur->f_rel[i] = DEFAULT_REL_PREFERENCE; |
484 | GNUNET_CONTAINER_multihashmap_put (preference_peers, &r_cur->id.hashPubKey, | 485 | GNUNET_CONTAINER_multipeermap_put (preference_peers, &r_cur->id, |
485 | r_cur, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 486 | r_cur, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
486 | } | 487 | } |
487 | 488 | ||
@@ -508,8 +509,8 @@ GAS_normalization_get_preferences (const struct GNUNET_PeerIdentity *id) | |||
508 | 509 | ||
509 | struct PeerRelative *rp; | 510 | struct PeerRelative *rp; |
510 | if (NULL | 511 | if (NULL |
511 | == (rp = GNUNET_CONTAINER_multihashmap_get (preference_peers, | 512 | == (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers, |
512 | &id->hashPubKey))) | 513 | id))) |
513 | { | 514 | { |
514 | return defvalues.f_rel; | 515 | return defvalues.f_rel; |
515 | } | 516 | } |
@@ -625,6 +626,7 @@ property_average (struct ATS_Address *address, | |||
625 | return res; | 626 | return res; |
626 | } | 627 | } |
627 | 628 | ||
629 | |||
628 | struct FindMinMaxCtx | 630 | struct FindMinMaxCtx |
629 | { | 631 | { |
630 | struct Property *p; | 632 | struct Property *p; |
@@ -632,11 +634,14 @@ struct FindMinMaxCtx | |||
632 | uint32_t max; | 634 | uint32_t max; |
633 | }; | 635 | }; |
634 | 636 | ||
637 | |||
635 | static int | 638 | static int |
636 | find_min_max_it (void *cls, const struct GNUNET_HashCode *h, void *k) | 639 | find_min_max_it (void *cls, |
640 | const struct GNUNET_PeerIdentity *h, | ||
641 | void *k) | ||
637 | { | 642 | { |
638 | struct ATS_Address *a = (struct ATS_Address *) k; | ||
639 | struct FindMinMaxCtx *find_res = cls; | 643 | struct FindMinMaxCtx *find_res = cls; |
644 | struct ATS_Address *a = k; | ||
640 | 645 | ||
641 | if (a->atsin[find_res->p->prop_type].avg > find_res->max) | 646 | if (a->atsin[find_res->p->prop_type].avg > find_res->max) |
642 | find_res->max = a->atsin[find_res->p->prop_type].avg; | 647 | find_res->max = a->atsin[find_res->p->prop_type].avg; |
@@ -647,11 +652,14 @@ find_min_max_it (void *cls, const struct GNUNET_HashCode *h, void *k) | |||
647 | return GNUNET_OK; | 652 | return GNUNET_OK; |
648 | } | 653 | } |
649 | 654 | ||
655 | |||
650 | static int | 656 | static int |
651 | normalize_address (void *cls, const struct GNUNET_HashCode *h, void *k) | 657 | normalize_address (void *cls, |
658 | const struct GNUNET_PeerIdentity *h, | ||
659 | void *k) | ||
652 | { | 660 | { |
653 | struct Property *p = cls; | 661 | struct Property *p = cls; |
654 | struct ATS_Address *address = (struct ATS_Address *) k; | 662 | struct ATS_Address *address = k; |
655 | 663 | ||
656 | double delta; | 664 | double delta; |
657 | uint32_t avg_value = address->atsin[p->prop_type].avg; | 665 | uint32_t avg_value = address->atsin[p->prop_type].avg; |
@@ -673,6 +681,7 @@ normalize_address (void *cls, const struct GNUNET_HashCode *h, void *k) | |||
673 | return GNUNET_OK; | 681 | return GNUNET_OK; |
674 | } | 682 | } |
675 | 683 | ||
684 | |||
676 | /** | 685 | /** |
677 | * Normalize avg_value to a range of values between [1.0, 2.0] | 686 | * Normalize avg_value to a range of values between [1.0, 2.0] |
678 | * based on min max values currently known. | 687 | * based on min max values currently known. |
@@ -682,10 +691,11 @@ normalize_address (void *cls, const struct GNUNET_HashCode *h, void *k) | |||
682 | * @param address the address | 691 | * @param address the address |
683 | * @param avg_value the value to normalize | 692 | * @param avg_value the value to normalize |
684 | */ | 693 | */ |
685 | |||
686 | static void | 694 | static void |
687 | property_normalize (struct GNUNET_CONTAINER_MultiHashMap *addresses, | 695 | property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
688 | struct Property *p, struct ATS_Address *address, uint32_t avg_value) | 696 | struct Property *p, |
697 | struct ATS_Address *address, | ||
698 | uint32_t avg_value) | ||
689 | { | 699 | { |
690 | struct FindMinMaxCtx find_ctx; | 700 | struct FindMinMaxCtx find_ctx; |
691 | int addr_count; | 701 | int addr_count; |
@@ -694,8 +704,8 @@ property_normalize (struct GNUNET_CONTAINER_MultiHashMap *addresses, | |||
694 | find_ctx.p = p; | 704 | find_ctx.p = p; |
695 | find_ctx.max = 0; | 705 | find_ctx.max = 0; |
696 | find_ctx.min = UINT32_MAX; | 706 | find_ctx.min = UINT32_MAX; |
697 | addr_count = GNUNET_CONTAINER_multihashmap_iterate (addresses, | 707 | addr_count = GNUNET_CONTAINER_multipeermap_iterate (addresses, |
698 | &find_min_max_it, &find_ctx); | 708 | &find_min_max_it, &find_ctx); |
699 | if (0 == addr_count) | 709 | if (0 == addr_count) |
700 | { | 710 | { |
701 | GNUNET_break(0); | 711 | GNUNET_break(0); |
@@ -731,13 +741,13 @@ property_normalize (struct GNUNET_CONTAINER_MultiHashMap *addresses, | |||
731 | if (GNUNET_NO == limits_changed) | 741 | if (GNUNET_NO == limits_changed) |
732 | { | 742 | { |
733 | /* normalize just this address */ | 743 | /* normalize just this address */ |
734 | normalize_address (p, &address->peer.hashPubKey, address); | 744 | normalize_address (p, &address->peer, address); |
735 | return; | 745 | return; |
736 | } | 746 | } |
737 | else | 747 | else |
738 | { | 748 | { |
739 | /* limits changed, normalize all addresses */ | 749 | /* limits changed, normalize all addresses */ |
740 | GNUNET_CONTAINER_multihashmap_iterate (addresses, &normalize_address, p); | 750 | GNUNET_CONTAINER_multipeermap_iterate (addresses, &normalize_address, p); |
741 | return; | 751 | return; |
742 | } | 752 | } |
743 | } | 753 | } |
@@ -751,10 +761,10 @@ property_normalize (struct GNUNET_CONTAINER_MultiHashMap *addresses, | |||
751 | * @param atsi_count the number of atsi information in the array | 761 | * @param atsi_count the number of atsi information in the array |
752 | */ | 762 | */ |
753 | void | 763 | void |
754 | GAS_normalization_normalize_property ( | 764 | GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
755 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | 765 | struct ATS_Address *address, |
756 | struct ATS_Address *address, const struct GNUNET_ATS_Information *atsi, | 766 | const struct GNUNET_ATS_Information *atsi, |
757 | uint32_t atsi_count) | 767 | uint32_t atsi_count) |
758 | { | 768 | { |
759 | struct Property *cur_prop; | 769 | struct Property *cur_prop; |
760 | int c1; | 770 | int c1; |
@@ -814,8 +824,8 @@ GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, | |||
814 | { | 824 | { |
815 | int c1; | 825 | int c1; |
816 | int i; | 826 | int i; |
817 | preference_peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 827 | preference_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
818 | property_peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 828 | property_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
819 | unsigned int existing_properties[] = GNUNET_ATS_QualityProperties; | 829 | unsigned int existing_properties[] = GNUNET_ATS_QualityProperties; |
820 | 830 | ||
821 | for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++) | 831 | for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++) |
@@ -840,20 +850,21 @@ GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, | |||
840 | return; | 850 | return; |
841 | } | 851 | } |
842 | 852 | ||
853 | |||
843 | /** | 854 | /** |
844 | * Free a peer | 855 | * Free a peer |
845 | * | 856 | * |
846 | * @param cls unused | 857 | * @param cls unused |
847 | * @param key the key | 858 | * @param key the key |
848 | * @param value RelativePeer | 859 | * @param value RelativePeer |
849 | * @return GNUNET_OK to continue | 860 | * @return #GNUNET_OK to continue |
850 | */ | 861 | */ |
851 | static int | 862 | static int |
852 | free_peer (void *cls, const struct GNUNET_HashCode * key, void *value) | 863 | free_peer (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
853 | { | 864 | { |
854 | struct PeerRelative *rp = value; | 865 | struct PeerRelative *rp = value; |
855 | if (GNUNET_YES | 866 | if (GNUNET_YES |
856 | == GNUNET_CONTAINER_multihashmap_remove (preference_peers, key, value)) | 867 | == GNUNET_CONTAINER_multipeermap_remove (preference_peers, key, value)) |
857 | GNUNET_free(rp); | 868 | GNUNET_free(rp); |
858 | else | 869 | else |
859 | GNUNET_break(0); | 870 | GNUNET_break(0); |
@@ -892,9 +903,9 @@ GAS_normalization_stop () | |||
892 | GNUNET_free(pc); | 903 | GNUNET_free(pc); |
893 | } | 904 | } |
894 | 905 | ||
895 | GNUNET_CONTAINER_multihashmap_iterate (preference_peers, &free_peer, NULL ); | 906 | GNUNET_CONTAINER_multipeermap_iterate (preference_peers, &free_peer, NULL ); |
896 | GNUNET_CONTAINER_multihashmap_destroy (preference_peers); | 907 | GNUNET_CONTAINER_multipeermap_destroy (preference_peers); |
897 | GNUNET_CONTAINER_multihashmap_destroy (property_peers); | 908 | GNUNET_CONTAINER_multipeermap_destroy (property_peers); |
898 | return; | 909 | return; |
899 | } | 910 | } |
900 | 911 | ||
diff --git a/src/ats/gnunet-service-ats_normalization.h b/src/ats/gnunet-service-ats_normalization.h index 969263b3e..1f0d081d4 100644 --- a/src/ats/gnunet-service-ats_normalization.h +++ b/src/ats/gnunet-service-ats_normalization.h | |||
@@ -51,8 +51,8 @@ typedef void | |||
51 | /** | 51 | /** |
52 | * Get the normalized preference values for a specific peer | 52 | * Get the normalized preference values for a specific peer |
53 | * | 53 | * |
54 | * @param id the peer | 54 | * @param id the peer @return pointer to the values, can be indexed |
55 | * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind, NULL if peer does not exist | 55 | * with GNUNET_ATS_PreferenceKind, NULL if peer does not exist |
56 | */ | 56 | */ |
57 | const double * | 57 | const double * |
58 | GAS_normalization_get_preferences (const struct GNUNET_PeerIdentity *id); | 58 | GAS_normalization_get_preferences (const struct GNUNET_PeerIdentity *id); |
@@ -79,9 +79,9 @@ GAS_normalization_get_properties (struct ATS_Address *address); | |||
79 | */ | 79 | */ |
80 | void | 80 | void |
81 | GAS_normalization_normalize_preference (void *src, | 81 | GAS_normalization_normalize_preference (void *src, |
82 | const struct GNUNET_PeerIdentity *peer, | 82 | const struct GNUNET_PeerIdentity *peer, |
83 | enum GNUNET_ATS_PreferenceKind kind, | 83 | enum GNUNET_ATS_PreferenceKind kind, |
84 | float score_abs); | 84 | float score_abs); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Update and normalize a atsi performance information | 87 | * Update and normalize a atsi performance information |
@@ -92,10 +92,10 @@ GAS_normalization_normalize_preference (void *src, | |||
92 | * @param atsi_count the number of atsi information in the array | 92 | * @param atsi_count the number of atsi information in the array |
93 | */ | 93 | */ |
94 | void | 94 | void |
95 | GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiHashMap *addresses, | 95 | GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, |
96 | struct ATS_Address *address, | 96 | struct ATS_Address *address, |
97 | const struct GNUNET_ATS_Information *atsi, | 97 | const struct GNUNET_ATS_Information *atsi, |
98 | uint32_t atsi_count); | 98 | uint32_t atsi_count); |
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
@@ -108,9 +108,9 @@ GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiHashMap *addr | |||
108 | */ | 108 | */ |
109 | void | 109 | void |
110 | GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, | 110 | GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, |
111 | void *pref_ch_cb_cls, | 111 | void *pref_ch_cb_cls, |
112 | GAS_Normalization_property_changed_cb property_ch_cb, | 112 | GAS_Normalization_property_changed_cb property_ch_cb, |
113 | void *property_ch_cb_cls); | 113 | void *property_ch_cb_cls); |
114 | 114 | ||
115 | 115 | ||
116 | /** | 116 | /** |
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c index 0b4948576..c75577cf9 100644 --- a/src/ats/gnunet-service-ats_reservations.c +++ b/src/ats/gnunet-service-ats_reservations.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /** | 36 | /** |
37 | * Map of peer identities to 'struct GNUNET_BANDWIDTH_Tracker *'s | 37 | * Map of peer identities to 'struct GNUNET_BANDWIDTH_Tracker *'s |
38 | */ | 38 | */ |
39 | static struct GNUNET_CONTAINER_MultiHashMap *trackers; | 39 | static struct GNUNET_CONTAINER_MultiPeerMap *trackers; |
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
@@ -57,7 +57,7 @@ GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | |||
57 | struct GNUNET_BANDWIDTH_Tracker *tracker; | 57 | struct GNUNET_BANDWIDTH_Tracker *tracker; |
58 | struct GNUNET_TIME_Relative ret; | 58 | struct GNUNET_TIME_Relative ret; |
59 | 59 | ||
60 | tracker = GNUNET_CONTAINER_multihashmap_get (trackers, &peer->hashPubKey); | 60 | tracker = GNUNET_CONTAINER_multipeermap_get (trackers, peer); |
61 | if (NULL == tracker) | 61 | if (NULL == tracker) |
62 | return GNUNET_TIME_UNIT_ZERO; /* not connected, satisfy now */ | 62 | return GNUNET_TIME_UNIT_ZERO; /* not connected, satisfy now */ |
63 | if (amount >= 0) | 63 | if (amount >= 0) |
@@ -93,14 +93,14 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer, | |||
93 | { | 93 | { |
94 | struct GNUNET_BANDWIDTH_Tracker *tracker; | 94 | struct GNUNET_BANDWIDTH_Tracker *tracker; |
95 | 95 | ||
96 | tracker = GNUNET_CONTAINER_multihashmap_get (trackers, &peer->hashPubKey); | 96 | tracker = GNUNET_CONTAINER_multipeermap_get (trackers, peer); |
97 | if (0 == ntohl (bandwidth_in.value__)) | 97 | if (0 == ntohl (bandwidth_in.value__)) |
98 | { | 98 | { |
99 | if (NULL == tracker) | 99 | if (NULL == tracker) |
100 | return; | 100 | return; |
101 | GNUNET_assert (GNUNET_YES == | 101 | GNUNET_assert (GNUNET_YES == |
102 | GNUNET_CONTAINER_multihashmap_remove (trackers, | 102 | GNUNET_CONTAINER_multipeermap_remove (trackers, |
103 | &peer->hashPubKey, | 103 | peer, |
104 | tracker)); | 104 | tracker)); |
105 | GNUNET_free (tracker); | 105 | GNUNET_free (tracker); |
106 | return; | 106 | return; |
@@ -110,7 +110,7 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer, | |||
110 | tracker = GNUNET_malloc (sizeof (struct GNUNET_BANDWIDTH_Tracker)); | 110 | tracker = GNUNET_malloc (sizeof (struct GNUNET_BANDWIDTH_Tracker)); |
111 | GNUNET_BANDWIDTH_tracker_init (tracker, bandwidth_in, | 111 | GNUNET_BANDWIDTH_tracker_init (tracker, bandwidth_in, |
112 | MAX_BANDWIDTH_CARRY_S); | 112 | MAX_BANDWIDTH_CARRY_S); |
113 | GNUNET_CONTAINER_multihashmap_put (trackers, &peer->hashPubKey, tracker, | 113 | GNUNET_CONTAINER_multipeermap_put (trackers, peer, tracker, |
114 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 114 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
115 | return; | 115 | return; |
116 | } | 116 | } |
@@ -124,7 +124,7 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer, | |||
124 | void | 124 | void |
125 | GAS_reservations_init () | 125 | GAS_reservations_init () |
126 | { | 126 | { |
127 | trackers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 127 | trackers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
@@ -137,7 +137,8 @@ GAS_reservations_init () | |||
137 | * @return GNUNET_OK (continue to iterate) | 137 | * @return GNUNET_OK (continue to iterate) |
138 | */ | 138 | */ |
139 | static int | 139 | static int |
140 | free_tracker (void *cls, const struct GNUNET_HashCode * key, void *value) | 140 | free_tracker (void *cls, |
141 | const struct GNUNET_PeerIdentity *key, void *value) | ||
141 | { | 142 | { |
142 | struct GNUNET_BANDWIDTH_Tracker *tracker = value; | 143 | struct GNUNET_BANDWIDTH_Tracker *tracker = value; |
143 | 144 | ||
@@ -152,8 +153,8 @@ free_tracker (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
152 | void | 153 | void |
153 | GAS_reservations_done () | 154 | GAS_reservations_done () |
154 | { | 155 | { |
155 | GNUNET_CONTAINER_multihashmap_iterate (trackers, &free_tracker, NULL); | 156 | GNUNET_CONTAINER_multipeermap_iterate (trackers, &free_tracker, NULL); |
156 | GNUNET_CONTAINER_multihashmap_destroy (trackers); | 157 | GNUNET_CONTAINER_multipeermap_destroy (trackers); |
157 | } | 158 | } |
158 | 159 | ||
159 | /* end of gnunet-service-ats_reservations.c */ | 160 | /* end of gnunet-service-ats_reservations.c */ |
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index fda99ed67..5f37f8922 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h | |||
@@ -35,8 +35,6 @@ extern "C" | |||
35 | #endif | 35 | #endif |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include "gnunet_bandwidth_lib.h" | ||
39 | |||
40 | /** | 38 | /** |
41 | * Bandwidth (in/out) to assume initially (before either peer has | 39 | * Bandwidth (in/out) to assume initially (before either peer has |
42 | * communicated any particular preference). Should be rather low; set | 40 | * communicated any particular preference). Should be rather low; set |
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h index d728414e7..910be8c72 100644 --- a/src/include/gnunet_network_lib.h +++ b/src/include/gnunet_network_lib.h | |||
@@ -23,12 +23,9 @@ | |||
23 | * @brief basic low-level networking interface | 23 | * @brief basic low-level networking interface |
24 | * @author Nils Durner | 24 | * @author Nils Durner |
25 | */ | 25 | */ |
26 | |||
27 | #ifndef GNUNET_NETWORK_LIB_H | 26 | #ifndef GNUNET_NETWORK_LIB_H |
28 | #define GNUNET_NETWORK_LIB_H | 27 | #define GNUNET_NETWORK_LIB_H |
29 | 28 | ||
30 | #include "platform.h" | ||
31 | |||
32 | #ifdef __cplusplus | 29 | #ifdef __cplusplus |
33 | extern "C" | 30 | extern "C" |
34 | { | 31 | { |
diff --git a/src/include/gnunet_statistics_service.h b/src/include/gnunet_statistics_service.h index 75c7bd18a..25562580a 100644 --- a/src/include/gnunet_statistics_service.h +++ b/src/include/gnunet_statistics_service.h | |||
@@ -39,9 +39,7 @@ extern "C" | |||
39 | #endif | 39 | #endif |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include "gnunet_common.h" | 42 | #include "gnunet_util_lib.h" |
43 | #include "gnunet_configuration_lib.h" | ||
44 | #include "gnunet_scheduler_lib.h" | ||
45 | 43 | ||
46 | /** | 44 | /** |
47 | * Version of the statistics API. | 45 | * Version of the statistics API. |
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index 025dbed90..0f62ba8db 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -37,29 +37,23 @@ extern "C" | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #include "gnunet_crypto_lib.h" | 39 | #include "gnunet_crypto_lib.h" |
40 | #include "gnunet_common.h" | ||
41 | #include "gnunet_bandwidth_lib.h" | 40 | #include "gnunet_bandwidth_lib.h" |
42 | #include "gnunet_bio_lib.h" | 41 | #include "gnunet_bio_lib.h" |
43 | #include "gnunet_connection_lib.h" | 42 | #include "gnunet_connection_lib.h" |
44 | #include "gnunet_client_lib.h" | 43 | #include "gnunet_client_lib.h" |
45 | #include "gnunet_configuration_lib.h" | ||
46 | #include "gnunet_container_lib.h" | 44 | #include "gnunet_container_lib.h" |
47 | #include "gnunet_disk_lib.h" | ||
48 | #include "gnunet_getopt_lib.h" | 45 | #include "gnunet_getopt_lib.h" |
49 | #include "gnunet_helper_lib.h" | 46 | #include "gnunet_helper_lib.h" |
50 | #include "gnunet_mq_lib.h" | 47 | #include "gnunet_mq_lib.h" |
51 | #include "gnunet_network_lib.h" | ||
52 | #include "gnunet_os_lib.h" | 48 | #include "gnunet_os_lib.h" |
53 | #include "gnunet_peer_lib.h" | 49 | #include "gnunet_peer_lib.h" |
54 | #include "gnunet_plugin_lib.h" | 50 | #include "gnunet_plugin_lib.h" |
55 | #include "gnunet_program_lib.h" | 51 | #include "gnunet_program_lib.h" |
56 | #include "gnunet_protocols.h" | 52 | #include "gnunet_protocols.h" |
57 | #include "gnunet_scheduler_lib.h" | ||
58 | #include "gnunet_server_lib.h" | 53 | #include "gnunet_server_lib.h" |
59 | #include "gnunet_service_lib.h" | 54 | #include "gnunet_service_lib.h" |
60 | #include "gnunet_signal_lib.h" | 55 | #include "gnunet_signal_lib.h" |
61 | #include "gnunet_strings_lib.h" | 56 | #include "gnunet_strings_lib.h" |
62 | #include "gnunet_time_lib.h" | ||
63 | 57 | ||
64 | #if 0 /* keep Emacsens' auto-indent happy */ | 58 | #if 0 /* keep Emacsens' auto-indent happy */ |
65 | { | 59 | { |
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index b23f43dde..7f472b3be 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -110,6 +110,8 @@ | |||
110 | * parts taken from aircrack-ng, parts changend. | 110 | * parts taken from aircrack-ng, parts changend. |
111 | */ | 111 | */ |
112 | #include "gnunet_config.h" | 112 | #include "gnunet_config.h" |
113 | #define SOCKTYPE int | ||
114 | #define FDTYPE int | ||
113 | #include <sys/socket.h> | 115 | #include <sys/socket.h> |
114 | #include <sys/ioctl.h> | 116 | #include <sys/ioctl.h> |
115 | #include <sys/types.h> | 117 | #include <sys/types.h> |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index acf356149..3adf5b35d 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -68,11 +68,6 @@ struct GNUNET_PEERINFO_Handle *GST_peerinfo; | |||
68 | static struct GNUNET_SERVER_Handle *GST_server; | 68 | static struct GNUNET_SERVER_Handle *GST_server; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Our public key. | ||
72 | */ | ||
73 | struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key; | ||
74 | |||
75 | /** | ||
76 | * Our private key. | 71 | * Our private key. |
77 | */ | 72 | */ |
78 | struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; | 73 | struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; |
@@ -790,9 +785,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
790 | 785 | ||
791 | GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); | 786 | GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); |
792 | GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg); | 787 | GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg); |
793 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key, &GST_my_public_key); | 788 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key, |
794 | GNUNET_CRYPTO_hash (&GST_my_public_key, sizeof (GST_my_public_key), | 789 | &GST_my_identity.public_key); |
795 | &GST_my_identity.hashPubKey); | ||
796 | GNUNET_assert (NULL != GST_my_private_key); | 790 | GNUNET_assert (NULL != GST_my_private_key); |
797 | 791 | ||
798 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 792 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 44b375dd8..9b68cb258 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h | |||
@@ -26,9 +26,9 @@ | |||
26 | #ifndef GNUNET_SERVICE_TRANSPORT_H | 26 | #ifndef GNUNET_SERVICE_TRANSPORT_H |
27 | #define GNUNET_SERVICE_TRANSPORT_H | 27 | #define GNUNET_SERVICE_TRANSPORT_H |
28 | 28 | ||
29 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
30 | #include "gnunet_transport_service.h" | 31 | #include "gnunet_transport_service.h" |
31 | #include "gnunet_util_lib.h" | ||
32 | 32 | ||
33 | #define VERBOSE_VALIDATION GNUNET_YES | 33 | #define VERBOSE_VALIDATION GNUNET_YES |
34 | 34 | ||
@@ -53,11 +53,6 @@ extern struct GNUNET_PeerIdentity GST_my_identity; | |||
53 | extern struct GNUNET_PEERINFO_Handle *GST_peerinfo; | 53 | extern struct GNUNET_PEERINFO_Handle *GST_peerinfo; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Our public key. | ||
57 | */ | ||
58 | extern struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key; | ||
59 | |||
60 | /** | ||
61 | * Our private key. | 56 | * Our private key. |
62 | */ | 57 | */ |
63 | extern struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; | 58 | extern struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; |
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 2bec6cb71..628943a42 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -182,7 +182,7 @@ static struct Blacklisters *bl_tail; | |||
182 | * Hashmap of blacklisted peers. Values are of type 'char *' (transport names), | 182 | * Hashmap of blacklisted peers. Values are of type 'char *' (transport names), |
183 | * can be NULL if we have no static blacklist. | 183 | * can be NULL if we have no static blacklist. |
184 | */ | 184 | */ |
185 | static struct GNUNET_CONTAINER_MultiHashMap *blacklist; | 185 | static struct GNUNET_CONTAINER_MultiPeerMap *blacklist; |
186 | 186 | ||
187 | 187 | ||
188 | /** | 188 | /** |
@@ -254,9 +254,9 @@ blacklist_cfg_iter (void *cls, const char *section, | |||
254 | char *plugs; | 254 | char *plugs; |
255 | char *pos; | 255 | char *pos; |
256 | 256 | ||
257 | if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string2 (option, | 257 | if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option, |
258 | strlen (option), | 258 | strlen (option), |
259 | &peer.hashPubKey)) | 259 | &peer.public_key)) |
260 | return; | 260 | return; |
261 | 261 | ||
262 | if ((NULL == value) || (0 == strcmp(value, ""))) | 262 | if ((NULL == value) || (0 == strcmp(value, ""))) |
@@ -334,7 +334,9 @@ GST_blacklist_start (struct GNUNET_SERVER_Handle *server, | |||
334 | * @return GNUNET_OK (continue to iterate) | 334 | * @return GNUNET_OK (continue to iterate) |
335 | */ | 335 | */ |
336 | static int | 336 | static int |
337 | free_blacklist_entry (void *cls, const struct GNUNET_HashCode * key, void *value) | 337 | free_blacklist_entry (void *cls, |
338 | const struct GNUNET_PeerIdentity *key, | ||
339 | void *value) | ||
338 | { | 340 | { |
339 | char *be = value; | 341 | char *be = value; |
340 | 342 | ||
@@ -351,9 +353,9 @@ GST_blacklist_stop () | |||
351 | { | 353 | { |
352 | if (NULL != blacklist) | 354 | if (NULL != blacklist) |
353 | { | 355 | { |
354 | GNUNET_CONTAINER_multihashmap_iterate (blacklist, &free_blacklist_entry, | 356 | GNUNET_CONTAINER_multipeermap_iterate (blacklist, &free_blacklist_entry, |
355 | NULL); | 357 | NULL); |
356 | GNUNET_CONTAINER_multihashmap_destroy (blacklist); | 358 | GNUNET_CONTAINER_multipeermap_destroy (blacklist); |
357 | blacklist = NULL; | 359 | blacklist = NULL; |
358 | } | 360 | } |
359 | } | 361 | } |
@@ -617,24 +619,25 @@ void | |||
617 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | 619 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, |
618 | const char *transport_name) | 620 | const char *transport_name) |
619 | { | 621 | { |
620 | char * transport = NULL; | 622 | char * transport = NULL; |
621 | if (NULL != transport_name) | 623 | |
622 | { | 624 | if (NULL != transport_name) |
623 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 625 | { |
624 | "Adding peer `%s' with plugin `%s' to blacklist\n", | 626 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
625 | GNUNET_i2s (peer), transport_name); | 627 | "Adding peer `%s' with plugin `%s' to blacklist\n", |
626 | transport = GNUNET_strdup (transport_name); | 628 | GNUNET_i2s (peer), transport_name); |
627 | } | 629 | transport = GNUNET_strdup (transport_name); |
628 | else | 630 | } |
629 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 631 | else |
630 | "Adding peer `%s' with all plugins to blacklist\n", | 632 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
631 | GNUNET_i2s (peer)); | 633 | "Adding peer `%s' with all plugins to blacklist\n", |
634 | GNUNET_i2s (peer)); | ||
632 | if (blacklist == NULL) | 635 | if (blacklist == NULL) |
633 | blacklist = | 636 | blacklist = |
634 | GNUNET_CONTAINER_multihashmap_create (TRANSPORT_BLACKLIST_HT_SIZE, | 637 | GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE, |
635 | GNUNET_NO); | 638 | GNUNET_NO); |
636 | 639 | ||
637 | GNUNET_CONTAINER_multihashmap_put (blacklist, &peer->hashPubKey, | 640 | GNUNET_CONTAINER_multipeermap_put (blacklist, peer, |
638 | transport, | 641 | transport, |
639 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 642 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
640 | } | 643 | } |
@@ -647,10 +650,12 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | |||
647 | * @param cls the transport name to match (const char*) | 650 | * @param cls the transport name to match (const char*) |
648 | * @param key the key (unused) | 651 | * @param key the key (unused) |
649 | * @param value the 'char *' (name of a blacklisted transport) | 652 | * @param value the 'char *' (name of a blacklisted transport) |
650 | * @return GNUNET_OK if the entry does not match, GNUNET_NO if it matches | 653 | * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches |
651 | */ | 654 | */ |
652 | static int | 655 | static int |
653 | test_blacklisted (void *cls, const struct GNUNET_HashCode * key, void *value) | 656 | test_blacklisted (void *cls, |
657 | const struct GNUNET_PeerIdentity *key, | ||
658 | void *value) | ||
654 | { | 659 | { |
655 | const char *transport_name = cls; | 660 | const char *transport_name = cls; |
656 | char *be = value; | 661 | char *be = value; |
@@ -665,10 +670,10 @@ test_blacklisted (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
665 | */ | 670 | */ |
666 | 671 | ||
667 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
668 | "Comparing BL request for peer `%4s':`%s' with BL entry: `%s'\n", | 673 | "Comparing BL request for peer `%4s':`%s' with BL entry: `%s'\n", |
669 | GNUNET_h2s (key), | 674 | GNUNET_i2s (key), |
670 | (NULL == transport_name) ? "unspecified" : transport_name, | 675 | (NULL == transport_name) ? "unspecified" : transport_name, |
671 | (NULL == be) ? "all plugins" : be); | 676 | (NULL == be) ? "all plugins" : be); |
672 | /* all plugins for this peer were blacklisted: disallow */ | 677 | /* all plugins for this peer were blacklisted: disallow */ |
673 | if (NULL == value) | 678 | if (NULL == value) |
674 | return GNUNET_NO; | 679 | return GNUNET_NO; |
@@ -708,7 +713,7 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, | |||
708 | * If iteration is aborted, we found a matching blacklist entry */ | 713 | * If iteration is aborted, we found a matching blacklist entry */ |
709 | if ((blacklist != NULL) && | 714 | if ((blacklist != NULL) && |
710 | (GNUNET_SYSERR == | 715 | (GNUNET_SYSERR == |
711 | GNUNET_CONTAINER_multihashmap_get_multiple (blacklist, &peer->hashPubKey, | 716 | GNUNET_CONTAINER_multipeermap_get_multiple (blacklist, peer, |
712 | &test_blacklisted, | 717 | &test_blacklisted, |
713 | (void *) transport_name))) | 718 | (void *) transport_name))) |
714 | { | 719 | { |
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 8c8d7854f..0347d67a5 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c | |||
@@ -170,7 +170,9 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
170 | 170 | ||
171 | friend_only = GNUNET_HELLO_is_friend_only (our_hello); | 171 | friend_only = GNUNET_HELLO_is_friend_only (our_hello); |
172 | GNUNET_free (our_hello); | 172 | GNUNET_free (our_hello); |
173 | our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, &gc, friend_only); | 173 | our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, |
174 | &address_generator, | ||
175 | &gc, friend_only); | ||
174 | GNUNET_assert (NULL != our_hello); | 176 | GNUNET_assert (NULL != our_hello); |
175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
176 | "Refreshed my %s `%s', new size is %d\n", | 178 | "Refreshed my %s `%s', new size is %d\n", |
@@ -213,7 +215,8 @@ GST_hello_start (int friend_only, GST_HelloCallback cb, void *cb_cls) | |||
213 | { | 215 | { |
214 | hello_cb = cb; | 216 | hello_cb = cb; |
215 | hello_cb_cls = cb_cls; | 217 | hello_cb_cls = cb_cls; |
216 | our_hello = GNUNET_HELLO_create (&GST_my_public_key, NULL, NULL, friend_only); | 218 | our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key, |
219 | NULL, NULL, friend_only); | ||
217 | GNUNET_assert (NULL != our_hello); | 220 | GNUNET_assert (NULL != our_hello); |
218 | refresh_hello (); | 221 | refresh_hello (); |
219 | } | 222 | } |
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index 0ebe18c55..7762d1811 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -114,7 +114,7 @@ struct GST_ManipulationHandle | |||
114 | /** | 114 | /** |
115 | * Hashmap contain all peers currently manipulated | 115 | * Hashmap contain all peers currently manipulated |
116 | */ | 116 | */ |
117 | struct GNUNET_CONTAINER_MultiHashMap *peers; | 117 | struct GNUNET_CONTAINER_MultiPeerMap *peers; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Peer containing information for general manipulation | 120 | * Peer containing information for general manipulation |
@@ -325,7 +325,7 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client, | |||
325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received traffic metrics for peer `%s'\n", | 325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received traffic metrics for peer `%s'\n", |
326 | GNUNET_i2s(&tm->peer)); | 326 | GNUNET_i2s(&tm->peer)); |
327 | 327 | ||
328 | if (NULL == (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &tm->peer.hashPubKey))) | 328 | if (NULL == (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, &tm->peer))) |
329 | { | 329 | { |
330 | tmp = GNUNET_malloc (sizeof (struct TM_Peer)); | 330 | tmp = GNUNET_malloc (sizeof (struct TM_Peer)); |
331 | tmp->peer = (tm->peer); | 331 | tmp->peer = (tm->peer); |
@@ -336,7 +336,9 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client, | |||
336 | tmp->metrics[c][c2] = UINT32_MAX; | 336 | tmp->metrics[c][c2] = UINT32_MAX; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | GNUNET_CONTAINER_multihashmap_put (man_handle.peers, &tm->peer.hashPubKey, tmp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 339 | GNUNET_CONTAINER_multipeermap_put (man_handle.peers, |
340 | &tm->peer, tmp, | ||
341 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
340 | } | 342 | } |
341 | 343 | ||
342 | ats = (struct GNUNET_ATS_Information *) &tm[1]; | 344 | ats = (struct GNUNET_ATS_Information *) &tm[1]; |
@@ -411,7 +413,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg | |||
411 | struct DelayQueueEntry *dqe; | 413 | struct DelayQueueEntry *dqe; |
412 | struct GNUNET_TIME_Relative delay; | 414 | struct GNUNET_TIME_Relative delay; |
413 | 415 | ||
414 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &target->hashPubKey))) | 416 | if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, target))) |
415 | { | 417 | { |
416 | GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target)); | 418 | GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target)); |
417 | /* Manipulate here */ | 419 | /* Manipulate here */ |
@@ -494,7 +496,7 @@ GST_manipulation_manipulate_metrics (const struct GNUNET_PeerIdentity *peer, | |||
494 | uint32_t m_tmp; | 496 | uint32_t m_tmp; |
495 | uint32_t g_tmp; | 497 | uint32_t g_tmp; |
496 | int d; | 498 | int d; |
497 | tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey); | 499 | tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer); |
498 | 500 | ||
499 | for (d = 0; d < ats_count; d++) | 501 | for (d = 0; d < ats_count; d++) |
500 | { | 502 | { |
@@ -546,7 +548,7 @@ GST_manipulation_recv (void *cls, | |||
546 | else | 548 | else |
547 | m_delay = GNUNET_TIME_UNIT_ZERO; | 549 | m_delay = GNUNET_TIME_UNIT_ZERO; |
548 | 550 | ||
549 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) | 551 | if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer))) |
550 | { | 552 | { |
551 | /* Manipulate receive delay */ | 553 | /* Manipulate receive delay */ |
552 | p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); | 554 | p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); |
@@ -632,13 +634,13 @@ GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg) | |||
632 | GNUNET_ATS_QUALITY_NET_DELAY, | 634 | GNUNET_ATS_QUALITY_NET_DELAY, |
633 | delay.rel_value_us); | 635 | delay.rel_value_us); |
634 | } | 636 | } |
635 | man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 637 | man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
636 | } | 638 | } |
637 | 639 | ||
638 | 640 | ||
639 | static int | 641 | static int |
640 | free_tmps (void *cls, | 642 | free_tmps (void *cls, |
641 | const struct GNUNET_HashCode * key, | 643 | const struct GNUNET_PeerIdentity *key, |
642 | void *value) | 644 | void *value) |
643 | { | 645 | { |
644 | struct DelayQueueEntry *dqe; | 646 | struct DelayQueueEntry *dqe; |
@@ -648,7 +650,7 @@ free_tmps (void *cls, | |||
648 | { | 650 | { |
649 | struct TM_Peer *tmp = (struct TM_Peer *) value; | 651 | struct TM_Peer *tmp = (struct TM_Peer *) value; |
650 | 652 | ||
651 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (man_handle.peers, key, value)) | 653 | if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (man_handle.peers, key, value)) |
652 | GNUNET_break (0); | 654 | GNUNET_break (0); |
653 | free_metric (tmp); | 655 | free_metric (tmp); |
654 | next = tmp->send_head; | 656 | next = tmp->send_head; |
@@ -683,7 +685,7 @@ GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer) | |||
683 | struct DelayQueueEntry *dqe; | 685 | struct DelayQueueEntry *dqe; |
684 | struct DelayQueueEntry *next; | 686 | struct DelayQueueEntry *next; |
685 | 687 | ||
686 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) | 688 | if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer))) |
687 | { | 689 | { |
688 | next = tmp->send_head; | 690 | next = tmp->send_head; |
689 | while (NULL != (dqe = next)) | 691 | while (NULL != (dqe = next)) |
@@ -729,8 +731,8 @@ GST_manipulation_stop () | |||
729 | { | 731 | { |
730 | struct DelayQueueEntry *cur; | 732 | struct DelayQueueEntry *cur; |
731 | struct DelayQueueEntry *next; | 733 | struct DelayQueueEntry *next; |
732 | GNUNET_CONTAINER_multihashmap_iterate (man_handle.peers, &free_tmps,NULL); | 734 | GNUNET_CONTAINER_multipeermap_iterate (man_handle.peers, &free_tmps,NULL); |
733 | GNUNET_CONTAINER_multihashmap_destroy (man_handle.peers); | 735 | GNUNET_CONTAINER_multipeermap_destroy (man_handle.peers); |
734 | 736 | ||
735 | next = generic_dqe_head; | 737 | next = generic_dqe_head; |
736 | while (NULL != (cur = next)) | 738 | while (NULL != (cur = next)) |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 1a6a87853..90f45f126 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -739,7 +739,7 @@ struct BlackListCheckContext | |||
739 | /** | 739 | /** |
740 | * Hash map from peer identities to the respective 'struct NeighbourMapEntry'. | 740 | * Hash map from peer identities to the respective 'struct NeighbourMapEntry'. |
741 | */ | 741 | */ |
742 | static struct GNUNET_CONTAINER_MultiHashMap *neighbours; | 742 | static struct GNUNET_CONTAINER_MultiPeerMap *neighbours; |
743 | 743 | ||
744 | /** | 744 | /** |
745 | * We keep blacklist checks in a DLL so that we can find | 745 | * We keep blacklist checks in a DLL so that we can find |
@@ -795,7 +795,7 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
795 | { | 795 | { |
796 | if (NULL == neighbours) | 796 | if (NULL == neighbours) |
797 | return NULL; | 797 | return NULL; |
798 | return GNUNET_CONTAINER_multihashmap_get (neighbours, &pid->hashPubKey); | 798 | return GNUNET_CONTAINER_multipeermap_get (neighbours, pid); |
799 | } | 799 | } |
800 | 800 | ||
801 | static const char * | 801 | static const char * |
@@ -1077,8 +1077,8 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
1077 | MEMDEBUG_free_non_null (backup_primary, __LINE__); | 1077 | MEMDEBUG_free_non_null (backup_primary, __LINE__); |
1078 | 1078 | ||
1079 | GNUNET_assert (GNUNET_YES == | 1079 | GNUNET_assert (GNUNET_YES == |
1080 | GNUNET_CONTAINER_multihashmap_remove (neighbours, | 1080 | GNUNET_CONTAINER_multipeermap_remove (neighbours, |
1081 | &n->id.hashPubKey, n)); | 1081 | &n->id, n)); |
1082 | 1082 | ||
1083 | // FIXME-ATS-API: we might want to be more specific about | 1083 | // FIXME-ATS-API: we might want to be more specific about |
1084 | // which states we do this from in the future (ATS should | 1084 | // which states we do this from in the future (ATS should |
@@ -1201,7 +1201,7 @@ send_disconnect (struct NeighbourMapEntry *n) | |||
1201 | htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT); | 1201 | htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT); |
1202 | disconnect_msg.timestamp = | 1202 | disconnect_msg.timestamp = |
1203 | GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 1203 | GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
1204 | disconnect_msg.public_key = GST_my_public_key; | 1204 | disconnect_msg.public_key = GST_my_identity.public_key; |
1205 | GNUNET_assert (GNUNET_OK == | 1205 | GNUNET_assert (GNUNET_OK == |
1206 | GNUNET_CRYPTO_ecc_sign (GST_my_private_key, | 1206 | GNUNET_CRYPTO_ecc_sign (GST_my_private_key, |
1207 | &disconnect_msg.purpose, | 1207 | &disconnect_msg.purpose, |
@@ -1799,8 +1799,8 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
1799 | MAX_BANDWIDTH_CARRY_S); | 1799 | MAX_BANDWIDTH_CARRY_S); |
1800 | n->task = GNUNET_SCHEDULER_add_now (&master_task, n); | 1800 | n->task = GNUNET_SCHEDULER_add_now (&master_task, n); |
1801 | GNUNET_assert (GNUNET_OK == | 1801 | GNUNET_assert (GNUNET_OK == |
1802 | GNUNET_CONTAINER_multihashmap_put (neighbours, | 1802 | GNUNET_CONTAINER_multipeermap_put (neighbours, |
1803 | &n->id.hashPubKey, n, | 1803 | &n->id, n, |
1804 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1804 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1805 | return n; | 1805 | return n; |
1806 | } | 1806 | } |
@@ -3223,7 +3223,7 @@ struct IteratorContext | |||
3223 | * @return GNUNET_OK (continue to iterate) | 3223 | * @return GNUNET_OK (continue to iterate) |
3224 | */ | 3224 | */ |
3225 | static int | 3225 | static int |
3226 | neighbours_iterate (void *cls, const struct GNUNET_HashCode * key, void *value) | 3226 | neighbours_iterate (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
3227 | { | 3227 | { |
3228 | struct IteratorContext *ic = cls; | 3228 | struct IteratorContext *ic = cls; |
3229 | struct NeighbourMapEntry *n = value; | 3229 | struct NeighbourMapEntry *n = value; |
@@ -3267,7 +3267,7 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls) | |||
3267 | return; /* can happen during shutdown */ | 3267 | return; /* can happen during shutdown */ |
3268 | ic.cb = cb; | 3268 | ic.cb = cb; |
3269 | ic.cb_cls = cb_cls; | 3269 | ic.cb_cls = cb_cls; |
3270 | GNUNET_CONTAINER_multihashmap_iterate (neighbours, &neighbours_iterate, &ic); | 3270 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, &neighbours_iterate, &ic); |
3271 | } | 3271 | } |
3272 | 3272 | ||
3273 | 3273 | ||
@@ -3375,7 +3375,7 @@ GST_neighbours_start (void *cls, | |||
3375 | connect_notify_cb = connect_cb; | 3375 | connect_notify_cb = connect_cb; |
3376 | disconnect_notify_cb = disconnect_cb; | 3376 | disconnect_notify_cb = disconnect_cb; |
3377 | address_change_cb = peer_address_cb; | 3377 | address_change_cb = peer_address_cb; |
3378 | neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE, GNUNET_NO); | 3378 | neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE, GNUNET_NO); |
3379 | } | 3379 | } |
3380 | 3380 | ||
3381 | 3381 | ||
@@ -3388,7 +3388,9 @@ GST_neighbours_start (void *cls, | |||
3388 | * @return GNUNET_OK (continue to iterate) | 3388 | * @return GNUNET_OK (continue to iterate) |
3389 | */ | 3389 | */ |
3390 | static int | 3390 | static int |
3391 | disconnect_all_neighbours (void *cls, const struct GNUNET_HashCode * key, void *value) | 3391 | disconnect_all_neighbours (void *cls, |
3392 | const struct GNUNET_PeerIdentity *key, | ||
3393 | void *value) | ||
3392 | { | 3394 | { |
3393 | struct NeighbourMapEntry *n = value; | 3395 | struct NeighbourMapEntry *n = value; |
3394 | 3396 | ||
@@ -3409,10 +3411,10 @@ GST_neighbours_stop () | |||
3409 | { | 3411 | { |
3410 | if (NULL == neighbours) | 3412 | if (NULL == neighbours) |
3411 | return; | 3413 | return; |
3412 | GNUNET_CONTAINER_multihashmap_iterate (neighbours, | 3414 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
3413 | &disconnect_all_neighbours, | 3415 | &disconnect_all_neighbours, |
3414 | NULL); | 3416 | NULL); |
3415 | GNUNET_CONTAINER_multihashmap_destroy (neighbours); | 3417 | GNUNET_CONTAINER_multipeermap_destroy (neighbours); |
3416 | neighbours = NULL; | 3418 | neighbours = NULL; |
3417 | callback_cls = NULL; | 3419 | callback_cls = NULL; |
3418 | connect_notify_cb = NULL; | 3420 | connect_notify_cb = NULL; |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index fe493f822..54393d753 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -311,7 +311,7 @@ static struct CheckHelloValidatedContext *chvc_tail; | |||
311 | * of the given peer that we are currently validating, have validated | 311 | * of the given peer that we are currently validating, have validated |
312 | * or are blocked from re-validation for a while). | 312 | * or are blocked from re-validation for a while). |
313 | */ | 313 | */ |
314 | static struct GNUNET_CONTAINER_MultiHashMap *validation_map; | 314 | static struct GNUNET_CONTAINER_MultiPeerMap *validation_map; |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * Context for peerinfo iteration. | 317 | * Context for peerinfo iteration. |
@@ -367,7 +367,7 @@ struct ValidationEntryMatchContext | |||
367 | * GNUNET_NO if the entry does match | 367 | * GNUNET_NO if the entry does match |
368 | */ | 368 | */ |
369 | static int | 369 | static int |
370 | validation_entry_match (void *cls, const struct GNUNET_HashCode * key, void *value) | 370 | validation_entry_match (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
371 | { | 371 | { |
372 | struct ValidationEntryMatchContext *vemc = cls; | 372 | struct ValidationEntryMatchContext *vemc = cls; |
373 | struct ValidationEntry *ve = value; | 373 | struct ValidationEntry *ve = value; |
@@ -390,7 +390,7 @@ validation_entry_match (void *cls, const struct GNUNET_HashCode * key, void *val | |||
390 | * @return GNUNET_YES (continue to iterate) | 390 | * @return GNUNET_YES (continue to iterate) |
391 | */ | 391 | */ |
392 | static int | 392 | static int |
393 | cleanup_validation_entry (void *cls, const struct GNUNET_HashCode * key, void *value) | 393 | cleanup_validation_entry (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
394 | { | 394 | { |
395 | struct ValidationEntry *ve = value; | 395 | struct ValidationEntry *ve = value; |
396 | 396 | ||
@@ -400,8 +400,8 @@ cleanup_validation_entry (void *cls, const struct GNUNET_HashCode * key, void *v | |||
400 | ve->bc = NULL; | 400 | ve->bc = NULL; |
401 | } | 401 | } |
402 | GNUNET_break (GNUNET_OK == | 402 | GNUNET_break (GNUNET_OK == |
403 | GNUNET_CONTAINER_multihashmap_remove (validation_map, | 403 | GNUNET_CONTAINER_multipeermap_remove (validation_map, |
404 | &ve->pid.hashPubKey, ve)); | 404 | &ve->pid, ve)); |
405 | GNUNET_HELLO_address_free (ve->address); | 405 | GNUNET_HELLO_address_free (ve->address); |
406 | if (GNUNET_SCHEDULER_NO_TASK != ve->timeout_task) | 406 | if (GNUNET_SCHEDULER_NO_TASK != ve->timeout_task) |
407 | { | 407 | { |
@@ -454,7 +454,7 @@ timeout_hello_validation (void *cls, | |||
454 | GNUNET_STATISTICS_update (GST_stats, | 454 | GNUNET_STATISTICS_update (GST_stats, |
455 | gettext_noop ("# address records discarded"), 1, | 455 | gettext_noop ("# address records discarded"), 1, |
456 | GNUNET_NO); | 456 | GNUNET_NO); |
457 | cleanup_validation_entry (NULL, &ve->pid.hashPubKey, ve); | 457 | cleanup_validation_entry (NULL, &ve->pid, ve); |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
@@ -686,8 +686,8 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, | |||
686 | 686 | ||
687 | vemc.ve = NULL; | 687 | vemc.ve = NULL; |
688 | vemc.address = address; | 688 | vemc.address = address; |
689 | GNUNET_CONTAINER_multihashmap_get_multiple (validation_map, | 689 | GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, |
690 | &address->peer.hashPubKey, | 690 | &address->peer, |
691 | &validation_entry_match, &vemc); | 691 | &validation_entry_match, &vemc); |
692 | if (NULL != (ve = vemc.ve)) | 692 | if (NULL != (ve = vemc.ve)) |
693 | return ve; | 693 | return ve; |
@@ -708,7 +708,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, | |||
708 | ve->timeout_task = | 708 | ve->timeout_task = |
709 | GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE, | 709 | GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE, |
710 | &timeout_hello_validation, ve); | 710 | &timeout_hello_validation, ve); |
711 | GNUNET_CONTAINER_multihashmap_put (validation_map, &address->peer.hashPubKey, | 711 | GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer, |
712 | ve, | 712 | ve, |
713 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 713 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
714 | ve->expecting_pong = GNUNET_NO; | 714 | ve->expecting_pong = GNUNET_NO; |
@@ -814,7 +814,7 @@ GST_validation_start (unsigned int max_fds) | |||
814 | validations_fast_start_threshold, | 814 | validations_fast_start_threshold, |
815 | GNUNET_STRINGS_relative_time_to_string (validation_delay, | 815 | GNUNET_STRINGS_relative_time_to_string (validation_delay, |
816 | GNUNET_YES)); | 816 | GNUNET_YES)); |
817 | validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE, | 817 | validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE, |
818 | GNUNET_NO); | 818 | GNUNET_NO); |
819 | pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL); | 819 | pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL); |
820 | } | 820 | } |
@@ -828,9 +828,9 @@ GST_validation_stop () | |||
828 | { | 828 | { |
829 | struct CheckHelloValidatedContext *chvc; | 829 | struct CheckHelloValidatedContext *chvc; |
830 | 830 | ||
831 | GNUNET_CONTAINER_multihashmap_iterate (validation_map, | 831 | GNUNET_CONTAINER_multipeermap_iterate (validation_map, |
832 | &cleanup_validation_entry, NULL); | 832 | &cleanup_validation_entry, NULL); |
833 | GNUNET_CONTAINER_multihashmap_destroy (validation_map); | 833 | GNUNET_CONTAINER_multipeermap_destroy (validation_map); |
834 | validation_map = NULL; | 834 | validation_map = NULL; |
835 | while (NULL != (chvc = chvc_head)) | 835 | while (NULL != (chvc = chvc_head)) |
836 | { | 836 | { |
@@ -1031,7 +1031,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1031 | 1031 | ||
1032 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1032 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1033 | "I am `%s', sending PONG to peer `%s'\n", | 1033 | "I am `%s', sending PONG to peer `%s'\n", |
1034 | GNUNET_h2s (&GST_my_identity.hashPubKey), | 1034 | GNUNET_i2s_full (&GST_my_identity), |
1035 | GNUNET_i2s (sender)); | 1035 | GNUNET_i2s (sender)); |
1036 | 1036 | ||
1037 | /* message with structure: | 1037 | /* message with structure: |
@@ -1404,10 +1404,10 @@ struct IteratorContext | |||
1404 | * @param cls the 'struct GST_ValidationIteratorContext' | 1404 | * @param cls the 'struct GST_ValidationIteratorContext' |
1405 | * @param key the peer's identity | 1405 | * @param key the peer's identity |
1406 | * @param value the 'struct ValidationEntry' | 1406 | * @param value the 'struct ValidationEntry' |
1407 | * @return GNUNET_OK (continue to iterate) | 1407 | * @return #GNUNET_OK (continue to iterate) |
1408 | */ | 1408 | */ |
1409 | static int | 1409 | static int |
1410 | iterate_addresses (void *cls, const struct GNUNET_HashCode * key, void *value) | 1410 | iterate_addresses (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
1411 | { | 1411 | { |
1412 | struct IteratorContext *ic = cls; | 1412 | struct IteratorContext *ic = cls; |
1413 | struct ValidationEntry *ve = value; | 1413 | struct ValidationEntry *ve = value; |
@@ -1434,8 +1434,8 @@ GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, | |||
1434 | 1434 | ||
1435 | ic.cb = cb; | 1435 | ic.cb = cb; |
1436 | ic.cb_cls = cb_cls; | 1436 | ic.cb_cls = cb_cls; |
1437 | GNUNET_CONTAINER_multihashmap_get_multiple (validation_map, | 1437 | GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, |
1438 | &target->hashPubKey, | 1438 | target, |
1439 | &iterate_addresses, &ic); | 1439 | &iterate_addresses, &ic); |
1440 | } | 1440 | } |
1441 | 1441 | ||
diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c index 05d1d1eef..0ab6c9fd1 100644 --- a/src/transport/gnunet-transport-wlan-sender.c +++ b/src/transport/gnunet-transport-wlan-sender.c | |||
@@ -24,8 +24,8 @@ | |||
24 | * @author David Brodski | 24 | * @author David Brodski |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_protocols.h" | ||
28 | #include "plugin_transport_wlan.h" | 27 | #include "plugin_transport_wlan.h" |
28 | #include "gnunet_protocols.h" | ||
29 | 29 | ||
30 | #define WLAN_MTU 1500 | 30 | #define WLAN_MTU 1500 |
31 | 31 | ||
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 641261c05..4fc1622b3 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -166,8 +166,6 @@ static GNUNET_SCHEDULER_TaskIdentifier end; | |||
166 | static GNUNET_SCHEDULER_TaskIdentifier op_timeout; | 166 | static GNUNET_SCHEDULER_TaskIdentifier op_timeout; |
167 | 167 | ||
168 | 168 | ||
169 | static struct GNUNET_CONTAINER_MultiHashMap *peers; | ||
170 | |||
171 | /** | 169 | /** |
172 | * Selected level of verbosity. | 170 | * Selected level of verbosity. |
173 | */ | 171 | */ |
@@ -255,11 +253,6 @@ shutdown_task (void *cls, | |||
255 | GNUNET_TRANSPORT_disconnect(handle); | 253 | GNUNET_TRANSPORT_disconnect(handle); |
256 | handle = NULL; | 254 | handle = NULL; |
257 | } | 255 | } |
258 | if (NULL != peers) | ||
259 | { | ||
260 | GNUNET_CONTAINER_multihashmap_destroy (peers); | ||
261 | peers = NULL; | ||
262 | } | ||
263 | if (benchmark_send) | 256 | if (benchmark_send) |
264 | { | 257 | { |
265 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 258 | duration = GNUNET_TIME_absolute_get_duration (start_time); |
@@ -300,7 +293,7 @@ operation_timeout (void *cls, | |||
300 | if ((try_connect) || (benchmark_send) || | 293 | if ((try_connect) || (benchmark_send) || |
301 | (benchmark_receive)) | 294 | (benchmark_receive)) |
302 | { | 295 | { |
303 | FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_h2s_full (&pid.hashPubKey)); | 296 | FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_i2s_full (&pid)); |
304 | if (GNUNET_SCHEDULER_NO_TASK != end) | 297 | if (GNUNET_SCHEDULER_NO_TASK != end) |
305 | GNUNET_SCHEDULER_cancel (end); | 298 | GNUNET_SCHEDULER_cancel (end); |
306 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | 299 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); |
@@ -525,7 +518,9 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
525 | if (try_connect) | 518 | if (try_connect) |
526 | { | 519 | { |
527 | /* all done, terminate instantly */ | 520 | /* all done, terminate instantly */ |
528 | FPRINTF (stdout, _("Successfully connected to `%s'\n"), GNUNET_h2s_full (&peer->hashPubKey)); | 521 | FPRINTF (stdout, |
522 | _("Successfully connected to `%s'\n"), | ||
523 | GNUNET_i2s_full (peer)); | ||
529 | ret = 0; | 524 | ret = 0; |
530 | 525 | ||
531 | if (GNUNET_SCHEDULER_NO_TASK != op_timeout) | 526 | if (GNUNET_SCHEDULER_NO_TASK != op_timeout) |
@@ -814,7 +809,9 @@ testservice_task (void *cls, | |||
814 | } | 809 | } |
815 | 810 | ||
816 | if ( (NULL != cpid) && | 811 | if ( (NULL != cpid) && |
817 | (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (cpid, &pid.hashPubKey))) | 812 | (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid, |
813 | strlen (cpid), | ||
814 | &pid.public_key))) | ||
818 | { | 815 | { |
819 | FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid); | 816 | FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid); |
820 | return; | 817 | return; |
@@ -914,7 +911,6 @@ testservice_task (void *cls, | |||
914 | } | 911 | } |
915 | else if (iterate_connections) /* -i: List all active addresses once */ | 912 | else if (iterate_connections) /* -i: List all active addresses once */ |
916 | { | 913 | { |
917 | peers = GNUNET_CONTAINER_multihashmap_create (20, GNUNET_NO); | ||
918 | address_resolution_in_progress = GNUNET_YES; | 914 | address_resolution_in_progress = GNUNET_YES; |
919 | pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg, | 915 | pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg, |
920 | (NULL == cpid) ? NULL : &pid, | 916 | (NULL == cpid) ? NULL : &pid, |
@@ -926,7 +922,6 @@ testservice_task (void *cls, | |||
926 | } | 922 | } |
927 | else if (monitor_connections) /* -m: List all active addresses continously */ | 923 | else if (monitor_connections) /* -m: List all active addresses continously */ |
928 | { | 924 | { |
929 | peers = GNUNET_CONTAINER_multihashmap_create (20, GNUNET_NO); | ||
930 | address_resolution_in_progress = GNUNET_YES; | 925 | address_resolution_in_progress = GNUNET_YES; |
931 | pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg, | 926 | pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg, |
932 | (NULL == cpid) ? NULL : &pid, | 927 | (NULL == cpid) ? NULL : &pid, |
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 2d112d4fe..d6db3d22d 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -42,9 +42,8 @@ | |||
42 | #define ENABLE_GET GNUNET_YES | 42 | #define ENABLE_GET GNUNET_YES |
43 | 43 | ||
44 | #include "platform.h" | 44 | #include "platform.h" |
45 | #include "gnunet_util_lib.h" | ||
45 | #include "gnunet_protocols.h" | 46 | #include "gnunet_protocols.h" |
46 | #include "gnunet_common.h" | ||
47 | #include "gnunet_server_lib.h" | ||
48 | #include "gnunet_transport_plugin.h" | 47 | #include "gnunet_transport_plugin.h" |
49 | #include "plugin_transport_http_common.h" | 48 | #include "plugin_transport_http_common.h" |
50 | #include <curl/curl.h> | 49 | #include <curl/curl.h> |
@@ -1405,9 +1404,9 @@ client_connect (struct Session *s) | |||
1405 | } | 1404 | } |
1406 | 1405 | ||
1407 | GNUNET_asprintf (&s->url, "%s/%s;%u", | 1406 | GNUNET_asprintf (&s->url, "%s/%s;%u", |
1408 | http_common_plugin_address_to_url (NULL, s->addr, s->addrlen), | 1407 | http_common_plugin_address_to_url (NULL, s->addr, s->addrlen), |
1409 | GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey), | 1408 | GNUNET_i2s_full (plugin->env->my_identity), |
1410 | plugin->last_tag); | 1409 | plugin->last_tag); |
1411 | 1410 | ||
1412 | plugin->last_tag++; | 1411 | plugin->last_tag++; |
1413 | 1412 | ||
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index 7a7f9ad0c..569a47255 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -23,9 +23,8 @@ | |||
23 | * @brief functionality shared by http client and server transport service plugin | 23 | * @brief functionality shared by http client and server transport service plugin |
24 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
25 | */ | 25 | */ |
26 | |||
27 | #include "platform.h" | 26 | #include "platform.h" |
28 | #include "gnunet_common.h" | 27 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_transport_plugin.h" | 28 | #include "gnunet_transport_plugin.h" |
30 | #include "plugin_transport_http_common.h" | 29 | #include "plugin_transport_http_common.h" |
31 | 30 | ||
@@ -37,16 +36,17 @@ struct SplittedHTTPAddress | |||
37 | int port; | 36 | int port; |
38 | }; | 37 | }; |
39 | 38 | ||
39 | |||
40 | static void | 40 | static void |
41 | http_clean_splitted (struct SplittedHTTPAddress *spa) | 41 | http_clean_splitted (struct SplittedHTTPAddress *spa) |
42 | { | 42 | { |
43 | if (NULL != spa) | 43 | if (NULL != spa) |
44 | { | 44 | { |
45 | GNUNET_free_non_null (spa->protocol); | 45 | GNUNET_free_non_null (spa->protocol); |
46 | GNUNET_free_non_null (spa->host); | 46 | GNUNET_free_non_null (spa->host); |
47 | GNUNET_free_non_null (spa->path); | 47 | GNUNET_free_non_null (spa->path); |
48 | GNUNET_free_non_null (spa); | 48 | GNUNET_free_non_null (spa); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | struct SplittedHTTPAddress * | 52 | struct SplittedHTTPAddress * |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 4d879e166..58e5db46a 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -25,8 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_common.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_server_lib.h" | ||
30 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_transport_plugin.h" | 30 | #include "gnunet_transport_plugin.h" |
32 | #include "gnunet_nat_lib.h" | 31 | #include "gnunet_nat_lib.h" |
@@ -924,14 +923,16 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, | |||
924 | */ | 923 | */ |
925 | 924 | ||
926 | static int | 925 | static int |
927 | server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GNUNET_PeerIdentity * target, uint32_t *tag) | 926 | server_parse_url (struct HTTP_Server_Plugin *plugin, |
927 | const char *url, | ||
928 | struct GNUNET_PeerIdentity *target, | ||
929 | uint32_t *tag) | ||
928 | { | 930 | { |
929 | char * tag_start = NULL; | 931 | char * tag_start = NULL; |
930 | char * tag_end = NULL; | 932 | char * tag_end = NULL; |
931 | char * target_start = NULL; | 933 | char * target_start = NULL; |
932 | char * separator = NULL; | 934 | char * separator = NULL; |
933 | char hash[plugin->peer_id_length+1]; | 935 | unsigned int hash_length; |
934 | int hash_length; | ||
935 | unsigned long int ctag; | 936 | unsigned long int ctag; |
936 | 937 | ||
937 | /* URL parsing | 938 | /* URL parsing |
@@ -1011,18 +1012,19 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN | |||
1011 | if (DEBUG_URL_PARSE) GNUNET_break (0); | 1012 | if (DEBUG_URL_PARSE) GNUNET_break (0); |
1012 | return GNUNET_SYSERR; | 1013 | return GNUNET_SYSERR; |
1013 | } | 1014 | } |
1014 | memcpy (hash, target_start, hash_length); | 1015 | if (GNUNET_OK != |
1015 | hash[hash_length] = '\0'; | 1016 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start, |
1016 | 1017 | hash_length, | |
1017 | if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((const char *) hash, &(target->hashPubKey))) | 1018 | &target->public_key)) |
1018 | { | 1019 | { |
1019 | /* hash conversion failed */ | 1020 | /* hash conversion failed */ |
1020 | if (DEBUG_URL_PARSE) GNUNET_break (0); | 1021 | if (DEBUG_URL_PARSE) GNUNET_break (0); |
1021 | return GNUNET_SYSERR; | 1022 | return GNUNET_SYSERR; |
1022 | } | 1023 | } |
1023 | 1024 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | |
1024 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1025 | plugin->name, |
1025 | "Found target `%s' in url\n", GNUNET_h2s_full(&target->hashPubKey)); | 1026 | "Found target `%s' in URL\n", |
1027 | GNUNET_i2s_full (target)); | ||
1026 | return GNUNET_OK; | 1028 | return GNUNET_OK; |
1027 | } | 1029 | } |
1028 | 1030 | ||
@@ -2879,7 +2881,7 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2879 | plugin->max_connections); | 2881 | plugin->max_connections); |
2880 | 2882 | ||
2881 | 2883 | ||
2882 | plugin->peer_id_length = strlen (GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey)); | 2884 | plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity)); |
2883 | 2885 | ||
2884 | return GNUNET_OK; | 2886 | return GNUNET_OK; |
2885 | } | 2887 | } |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 37a4aa7cd..0e49300b0 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -358,7 +358,7 @@ struct Plugin | |||
358 | /** | 358 | /** |
359 | * Map from peer identities to sessions for the given peer. | 359 | * Map from peer identities to sessions for the given peer. |
360 | */ | 360 | */ |
361 | struct GNUNET_CONTAINER_MultiHashMap *sessionmap; | 361 | struct GNUNET_CONTAINER_MultiPeerMap *sessionmap; |
362 | 362 | ||
363 | /** | 363 | /** |
364 | * Handle to the network service. | 364 | * Handle to the network service. |
@@ -379,7 +379,7 @@ struct Plugin | |||
379 | /** | 379 | /** |
380 | * Map of peers we have tried to contact behind a NAT | 380 | * Map of peers we have tried to contact behind a NAT |
381 | */ | 381 | */ |
382 | struct GNUNET_CONTAINER_MultiHashMap *nat_wait_conns; | 382 | struct GNUNET_CONTAINER_MultiPeerMap *nat_wait_conns; |
383 | 383 | ||
384 | /** | 384 | /** |
385 | * List of active TCP probes. | 385 | * List of active TCP probes. |
@@ -458,7 +458,7 @@ static void | |||
458 | inc_sessions (struct Plugin *plugin, struct Session *session, int line) | 458 | inc_sessions (struct Plugin *plugin, struct Session *session, int line) |
459 | { | 459 | { |
460 | sessions++; | 460 | sessions++; |
461 | unsigned int size = GNUNET_CONTAINER_multihashmap_size(plugin->sessionmap); | 461 | unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap); |
462 | if (sessions != size) | 462 | if (sessions != size) |
463 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n", | 463 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n", |
464 | sessions, size); | 464 | sessions, size); |
@@ -475,7 +475,7 @@ static void | |||
475 | dec_sessions (struct Plugin *plugin, struct Session *session, int line) | 475 | dec_sessions (struct Plugin *plugin, struct Session *session, int line) |
476 | { | 476 | { |
477 | GNUNET_assert (sessions > 0); | 477 | GNUNET_assert (sessions > 0); |
478 | unsigned int size = GNUNET_CONTAINER_multihashmap_size(plugin->sessionmap); | 478 | unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap); |
479 | sessions--; | 479 | sessions--; |
480 | if (sessions != size) | 480 | if (sessions != size) |
481 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n", | 481 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n", |
@@ -751,7 +751,7 @@ struct SessionClientCtx | |||
751 | 751 | ||
752 | static int | 752 | static int |
753 | session_lookup_by_client_it (void *cls, | 753 | session_lookup_by_client_it (void *cls, |
754 | const struct GNUNET_HashCode * key, | 754 | const struct GNUNET_PeerIdentity *key, |
755 | void *value) | 755 | void *value) |
756 | { | 756 | { |
757 | struct SessionClientCtx *sc_ctx = cls; | 757 | struct SessionClientCtx *sc_ctx = cls; |
@@ -781,7 +781,7 @@ lookup_session_by_client (struct Plugin *plugin, | |||
781 | 781 | ||
782 | sc_ctx.client = client; | 782 | sc_ctx.client = client; |
783 | sc_ctx.ret = NULL; | 783 | sc_ctx.ret = NULL; |
784 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessionmap, &session_lookup_by_client_it, &sc_ctx); | 784 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_lookup_by_client_it, &sc_ctx); |
785 | return sc_ctx.ret; | 785 | return sc_ctx.ret; |
786 | } | 786 | } |
787 | 787 | ||
@@ -1024,14 +1024,14 @@ disconnect_session (struct Session *session) | |||
1024 | 1024 | ||
1025 | stop_session_timeout (session); | 1025 | stop_session_timeout (session); |
1026 | 1026 | ||
1027 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (plugin->sessionmap, &session->target.hashPubKey, session)) | 1027 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap, &session->target, session)) |
1028 | { | 1028 | { |
1029 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 1029 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
1030 | gettext_noop ("# TCP sessions active"), -1, | 1030 | gettext_noop ("# TCP sessions active"), -1, |
1031 | GNUNET_NO); | 1031 | GNUNET_NO); |
1032 | dec_sessions (plugin, session, __LINE__); | 1032 | dec_sessions (plugin, session, __LINE__); |
1033 | } | 1033 | } |
1034 | else GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (plugin->nat_wait_conns, &session->target.hashPubKey, session)); | 1034 | else GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns, &session->target, session)); |
1035 | 1035 | ||
1036 | /* clean up state */ | 1036 | /* clean up state */ |
1037 | if (session->transmit_handle != NULL) | 1037 | if (session->transmit_handle != NULL) |
@@ -1093,32 +1093,36 @@ struct FindSessionContext | |||
1093 | int res; | 1093 | int res; |
1094 | }; | 1094 | }; |
1095 | 1095 | ||
1096 | int session_it (void *cls, | 1096 | |
1097 | const struct GNUNET_HashCode * key, | 1097 | static int |
1098 | void *value) | 1098 | session_it (void *cls, |
1099 | const struct GNUNET_PeerIdentity * key, | ||
1100 | void *value) | ||
1099 | { | 1101 | { |
1100 | struct FindSessionContext *res = cls; | 1102 | struct FindSessionContext *res = cls; |
1103 | |||
1101 | if (res->s == value) | 1104 | if (res->s == value) |
1102 | { | 1105 | { |
1103 | res->res = GNUNET_OK; | 1106 | res->res = GNUNET_OK; |
1104 | return GNUNET_NO; | 1107 | return GNUNET_NO; |
1105 | } | 1108 | } |
1106 | else | 1109 | return GNUNET_YES; |
1107 | return GNUNET_YES; | ||
1108 | } | 1110 | } |
1109 | 1111 | ||
1110 | int find_session (struct Plugin *plugin, struct Session *session) | 1112 | |
1113 | static int | ||
1114 | find_session (struct Plugin *plugin, struct Session *session) | ||
1111 | { | 1115 | { |
1112 | struct FindSessionContext session_map_res; | 1116 | struct FindSessionContext session_map_res; |
1113 | struct FindSessionContext nat_map_res; | 1117 | struct FindSessionContext nat_map_res; |
1114 | 1118 | ||
1115 | session_map_res.s = session; | 1119 | session_map_res.s = session; |
1116 | session_map_res.res = GNUNET_SYSERR; | 1120 | session_map_res.res = GNUNET_SYSERR; |
1117 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessionmap, &session_it, &session_map_res); | 1121 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_it, &session_map_res); |
1118 | 1122 | ||
1119 | nat_map_res.s = session; | 1123 | nat_map_res.s = session; |
1120 | nat_map_res.res = GNUNET_SYSERR; | 1124 | nat_map_res.res = GNUNET_SYSERR; |
1121 | GNUNET_CONTAINER_multihashmap_iterate (plugin->nat_wait_conns, &session_it, &nat_map_res); | 1125 | GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns, &session_it, &nat_map_res); |
1122 | 1126 | ||
1123 | if ((session_map_res.res == GNUNET_SYSERR) && (nat_map_res.res == GNUNET_SYSERR)) | 1127 | if ((session_map_res.res == GNUNET_SYSERR) && (nat_map_res.res == GNUNET_SYSERR)) |
1124 | { | 1128 | { |
@@ -1190,8 +1194,8 @@ tcp_plugin_send (void *cls, | |||
1190 | "Asked to transmit %u bytes to `%s', added message to list.\n", | 1194 | "Asked to transmit %u bytes to `%s', added message to list.\n", |
1191 | msgbuf_size, GNUNET_i2s (&session->target)); | 1195 | msgbuf_size, GNUNET_i2s (&session->target)); |
1192 | 1196 | ||
1193 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains_value (plugin->sessionmap, | 1197 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, |
1194 | &session->target.hashPubKey, | 1198 | &session->target, |
1195 | session)) | 1199 | session)) |
1196 | { | 1200 | { |
1197 | GNUNET_assert (session->client != NULL); | 1201 | GNUNET_assert (session->client != NULL); |
@@ -1209,7 +1213,7 @@ tcp_plugin_send (void *cls, | |||
1209 | process_pending_messages (session); | 1213 | process_pending_messages (session); |
1210 | return msgbuf_size; | 1214 | return msgbuf_size; |
1211 | } | 1215 | } |
1212 | else if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains_value(plugin->nat_wait_conns, &session->target.hashPubKey, session)) | 1216 | else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session)) |
1213 | { | 1217 | { |
1214 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1218 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1215 | "This NAT WAIT session for peer `%s' is not yet ready!\n", | 1219 | "This NAT WAIT session for peer `%s' is not yet ready!\n", |
@@ -1247,7 +1251,7 @@ struct SessionItCtx | |||
1247 | 1251 | ||
1248 | static int | 1252 | static int |
1249 | session_lookup_it (void *cls, | 1253 | session_lookup_it (void *cls, |
1250 | const struct GNUNET_HashCode *key, | 1254 | const struct GNUNET_PeerIdentity *key, |
1251 | void *value) | 1255 | void *value) |
1252 | { | 1256 | { |
1253 | struct SessionItCtx * si_ctx = cls; | 1257 | struct SessionItCtx * si_ctx = cls; |
@@ -1343,8 +1347,8 @@ tcp_plugin_get_session (void *cls, | |||
1343 | 1347 | ||
1344 | /* look for existing session */ | 1348 | /* look for existing session */ |
1345 | if (GNUNET_YES == | 1349 | if (GNUNET_YES == |
1346 | GNUNET_CONTAINER_multihashmap_contains (plugin->sessionmap, | 1350 | GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, |
1347 | &address->peer.hashPubKey)) | 1351 | &address->peer)) |
1348 | { | 1352 | { |
1349 | struct SessionItCtx si_ctx; | 1353 | struct SessionItCtx si_ctx; |
1350 | 1354 | ||
@@ -1353,8 +1357,8 @@ tcp_plugin_get_session (void *cls, | |||
1353 | 1357 | ||
1354 | si_ctx.result = NULL; | 1358 | si_ctx.result = NULL; |
1355 | 1359 | ||
1356 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap, | 1360 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, |
1357 | &address->peer.hashPubKey, | 1361 | &address->peer, |
1358 | &session_lookup_it, &si_ctx); | 1362 | &session_lookup_it, &si_ctx); |
1359 | if (si_ctx.result != NULL) | 1363 | if (si_ctx.result != NULL) |
1360 | { | 1364 | { |
@@ -1431,8 +1435,8 @@ tcp_plugin_get_session (void *cls, | |||
1431 | 1435 | ||
1432 | if ((is_natd == GNUNET_YES) && | 1436 | if ((is_natd == GNUNET_YES) && |
1433 | (GNUNET_YES == | 1437 | (GNUNET_YES == |
1434 | GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns, | 1438 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, |
1435 | &address->peer.hashPubKey))) | 1439 | &address->peer))) |
1436 | { | 1440 | { |
1437 | /* Only do one NAT punch attempt per peer identity */ | 1441 | /* Only do one NAT punch attempt per peer identity */ |
1438 | return NULL; | 1442 | return NULL; |
@@ -1440,8 +1444,8 @@ tcp_plugin_get_session (void *cls, | |||
1440 | 1444 | ||
1441 | if ((is_natd == GNUNET_YES) && (NULL != plugin->nat) && | 1445 | if ((is_natd == GNUNET_YES) && (NULL != plugin->nat) && |
1442 | (GNUNET_NO == | 1446 | (GNUNET_NO == |
1443 | GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns, | 1447 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, |
1444 | &address->peer.hashPubKey))) | 1448 | &address->peer))) |
1445 | { | 1449 | { |
1446 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1450 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1447 | "Found valid IPv4 NAT address (creating session)!\n") ; | 1451 | "Found valid IPv4 NAT address (creating session)!\n") ; |
@@ -1454,8 +1458,8 @@ tcp_plugin_get_session (void *cls, | |||
1454 | session); | 1458 | session); |
1455 | GNUNET_assert (session != NULL); | 1459 | GNUNET_assert (session != NULL); |
1456 | GNUNET_assert (GNUNET_OK == | 1460 | GNUNET_assert (GNUNET_OK == |
1457 | GNUNET_CONTAINER_multihashmap_put (plugin->nat_wait_conns, | 1461 | GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns, |
1458 | &session->target.hashPubKey, | 1462 | &session->target, |
1459 | session, | 1463 | session, |
1460 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1464 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1461 | 1465 | ||
@@ -1502,8 +1506,8 @@ tcp_plugin_get_session (void *cls, | |||
1502 | session->addrlen = addrlen; | 1506 | session->addrlen = addrlen; |
1503 | session->ats_address_network_type = ats.value; | 1507 | session->ats_address_network_type = ats.value; |
1504 | 1508 | ||
1505 | GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap, | 1509 | GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, |
1506 | &session->target.hashPubKey, | 1510 | &session->target, |
1507 | session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1511 | session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
1508 | inc_sessions (plugin, session, __LINE__); | 1512 | inc_sessions (plugin, session, __LINE__); |
1509 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1513 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1520,7 +1524,7 @@ tcp_plugin_get_session (void *cls, | |||
1520 | 1524 | ||
1521 | static int | 1525 | static int |
1522 | session_disconnect_it (void *cls, | 1526 | session_disconnect_it (void *cls, |
1523 | const struct GNUNET_HashCode * key, | 1527 | const struct GNUNET_PeerIdentity *key, |
1524 | void *value) | 1528 | void *value) |
1525 | { | 1529 | { |
1526 | struct Session *session = value; | 1530 | struct Session *session = value; |
@@ -1557,8 +1561,10 @@ tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
1557 | 1561 | ||
1558 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1562 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1559 | "Disconnecting peer `%4s'\n", GNUNET_i2s (target)); | 1563 | "Disconnecting peer `%4s'\n", GNUNET_i2s (target)); |
1560 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap, &target->hashPubKey, &session_disconnect_it, plugin); | 1564 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target, |
1561 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->nat_wait_conns, &target->hashPubKey, &session_disconnect_it, plugin); | 1565 | &session_disconnect_it, plugin); |
1566 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target, | ||
1567 | &session_disconnect_it, plugin); | ||
1562 | } | 1568 | } |
1563 | 1569 | ||
1564 | 1570 | ||
@@ -1933,9 +1939,9 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, | |||
1933 | } | 1939 | } |
1934 | 1940 | ||
1935 | session = | 1941 | session = |
1936 | GNUNET_CONTAINER_multihashmap_get (plugin->nat_wait_conns, | 1942 | GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns, |
1937 | &tcp_nat_probe-> | 1943 | &tcp_nat_probe-> |
1938 | clientIdentity.hashPubKey); | 1944 | clientIdentity); |
1939 | if (session == NULL) | 1945 | if (session == NULL) |
1940 | { | 1946 | { |
1941 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1947 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1959,12 +1965,12 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, | |||
1959 | disconnect_session (session); | 1965 | disconnect_session (session); |
1960 | return; | 1966 | return; |
1961 | } | 1967 | } |
1962 | GNUNET_assert (GNUNET_CONTAINER_multihashmap_remove | 1968 | GNUNET_assert (GNUNET_CONTAINER_multipeermap_remove |
1963 | (plugin->nat_wait_conns, | 1969 | (plugin->nat_wait_conns, |
1964 | &tcp_nat_probe->clientIdentity.hashPubKey, | 1970 | &tcp_nat_probe->clientIdentity, |
1965 | session) == GNUNET_YES); | 1971 | session) == GNUNET_YES); |
1966 | GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap, | 1972 | GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, |
1967 | &session->target.hashPubKey, session, | 1973 | &session->target, session, |
1968 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1974 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
1969 | session->last_activity = GNUNET_TIME_absolute_get (); | 1975 | session->last_activity = GNUNET_TIME_absolute_get (); |
1970 | session->inbound = GNUNET_NO; | 1976 | session->inbound = GNUNET_NO; |
@@ -2110,8 +2116,8 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client, | |||
2110 | session, | 2116 | session, |
2111 | GNUNET_a2s (vaddr, alen)); | 2117 | GNUNET_a2s (vaddr, alen)); |
2112 | GNUNET_free (vaddr); | 2118 | GNUNET_free (vaddr); |
2113 | GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap, | 2119 | GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, |
2114 | &session->target.hashPubKey, | 2120 | &session->target, |
2115 | session, | 2121 | session, |
2116 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2122 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2117 | inc_sessions (plugin, session, __LINE__); | 2123 | inc_sessions (plugin, session, __LINE__); |
@@ -2247,9 +2253,9 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
2247 | distance.value = session->ats_address_network_type; | 2253 | distance.value = session->ats_address_network_type; |
2248 | GNUNET_break (ntohl(session->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); | 2254 | GNUNET_break (ntohl(session->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED); |
2249 | 2255 | ||
2250 | GNUNET_assert (GNUNET_CONTAINER_multihashmap_contains_value (plugin->sessionmap, | 2256 | GNUNET_assert (GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, |
2251 | &session->target.hashPubKey, | 2257 | &session->target, |
2252 | session)); | 2258 | session)); |
2253 | 2259 | ||
2254 | delay = plugin->env->receive (plugin->env->cls, | 2260 | delay = plugin->env->receive (plugin->env->cls, |
2255 | &session->target, | 2261 | &session->target, |
@@ -2592,7 +2598,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2592 | myoptions = 0; | 2598 | myoptions = 0; |
2593 | 2599 | ||
2594 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 2600 | plugin = GNUNET_malloc (sizeof (struct Plugin)); |
2595 | plugin->sessionmap = GNUNET_CONTAINER_multihashmap_create (max_connections, GNUNET_YES); | 2601 | plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections, GNUNET_YES); |
2596 | plugin->max_connections = max_connections; | 2602 | plugin->max_connections = max_connections; |
2597 | plugin->cur_connections = 0; | 2603 | plugin->cur_connections = 0; |
2598 | plugin->open_port = bport; | 2604 | plugin->open_port = bport; |
@@ -2671,7 +2677,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2671 | 2677 | ||
2672 | GNUNET_SERVER_add_handlers (plugin->server, plugin->handlers); | 2678 | GNUNET_SERVER_add_handlers (plugin->server, plugin->handlers); |
2673 | GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); | 2679 | GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); |
2674 | plugin->nat_wait_conns = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); | 2680 | plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); |
2675 | if (bport != 0) | 2681 | if (bport != 0) |
2676 | LOG (GNUNET_ERROR_TYPE_INFO, | 2682 | LOG (GNUNET_ERROR_TYPE_INFO, |
2677 | _("TCP transport listening on port %llu\n"), bport); | 2683 | _("TCP transport listening on port %llu\n"), bport); |
@@ -2713,9 +2719,9 @@ libgnunet_plugin_transport_tcp_done (void *cls) | |||
2713 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down TCP plugin\n"); | 2719 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down TCP plugin\n"); |
2714 | 2720 | ||
2715 | /* Removing leftover sessions */ | 2721 | /* Removing leftover sessions */ |
2716 | GNUNET_CONTAINER_multihashmap_iterate(plugin->sessionmap, &session_disconnect_it, NULL); | 2722 | GNUNET_CONTAINER_multipeermap_iterate(plugin->sessionmap, &session_disconnect_it, NULL); |
2717 | /* Removing leftover NAT sessions */ | 2723 | /* Removing leftover NAT sessions */ |
2718 | GNUNET_CONTAINER_multihashmap_iterate(plugin->nat_wait_conns, &session_disconnect_it, NULL); | 2724 | GNUNET_CONTAINER_multipeermap_iterate(plugin->nat_wait_conns, &session_disconnect_it, NULL); |
2719 | 2725 | ||
2720 | next = ppc_dll_head; | 2726 | next = ppc_dll_head; |
2721 | for (cur = next; NULL != cur; cur = next) | 2727 | for (cur = next; NULL != cur; cur = next) |
@@ -2743,8 +2749,8 @@ libgnunet_plugin_transport_tcp_done (void *cls) | |||
2743 | GNUNET_CONNECTION_destroy (tcp_probe->sock); | 2749 | GNUNET_CONNECTION_destroy (tcp_probe->sock); |
2744 | GNUNET_free (tcp_probe); | 2750 | GNUNET_free (tcp_probe); |
2745 | } | 2751 | } |
2746 | GNUNET_CONTAINER_multihashmap_destroy (plugin->nat_wait_conns); | 2752 | GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns); |
2747 | GNUNET_CONTAINER_multihashmap_destroy (plugin->sessionmap); | 2753 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); |
2748 | GNUNET_free (plugin); | 2754 | GNUNET_free (plugin); |
2749 | GNUNET_free (api); | 2755 | GNUNET_free (api); |
2750 | return NULL; | 2756 | return NULL; |
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index 75554a0db..faee0c38d 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c | |||
@@ -25,10 +25,8 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
29 | #include "gnunet_connection_lib.h" | ||
30 | #include "gnunet_server_lib.h" | ||
31 | #include "gnunet_service_lib.h" | ||
32 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
33 | #include "gnunet_transport_service.h" | 31 | #include "gnunet_transport_service.h" |
34 | #include "gnunet_transport_plugin.h" | 32 | #include "gnunet_transport_plugin.h" |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index bc64fd5d2..4fe4d94cf 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1271,12 +1271,12 @@ disconnect_session (struct Session *s) | |||
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | GNUNET_assert (GNUNET_YES == | 1273 | GNUNET_assert (GNUNET_YES == |
1274 | GNUNET_CONTAINER_multihashmap_remove (plugin->sessions, | 1274 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, |
1275 | &s->target.hashPubKey, | 1275 | &s->target, |
1276 | s)); | 1276 | s)); |
1277 | GNUNET_STATISTICS_set(plugin->env->stats, | 1277 | GNUNET_STATISTICS_set(plugin->env->stats, |
1278 | "# UDP, sessions active", | 1278 | "# UDP, sessions active", |
1279 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), | 1279 | GNUNET_CONTAINER_multipeermap_size(plugin->sessions), |
1280 | GNUNET_NO); | 1280 | GNUNET_NO); |
1281 | if (s->rc > 0) | 1281 | if (s->rc > 0) |
1282 | s->in_destroy = GNUNET_YES; | 1282 | s->in_destroy = GNUNET_YES; |
@@ -1293,7 +1293,7 @@ disconnect_session (struct Session *s) | |||
1293 | * @return GNUNET_OK (continue to iterate) | 1293 | * @return GNUNET_OK (continue to iterate) |
1294 | */ | 1294 | */ |
1295 | static int | 1295 | static int |
1296 | disconnect_and_free_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 1296 | disconnect_and_free_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value) |
1297 | { | 1297 | { |
1298 | disconnect_session(value); | 1298 | disconnect_session(value); |
1299 | return GNUNET_OK; | 1299 | return GNUNET_OK; |
@@ -1317,7 +1317,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
1317 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1317 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1318 | "Disconnecting from peer `%s'\n", GNUNET_i2s (target)); | 1318 | "Disconnecting from peer `%s'\n", GNUNET_i2s (target)); |
1319 | /* Clean up sessions */ | 1319 | /* Clean up sessions */ |
1320 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessions, &target->hashPubKey, &disconnect_and_free_it, plugin); | 1320 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, target, |
1321 | &disconnect_and_free_it, plugin); | ||
1321 | } | 1322 | } |
1322 | 1323 | ||
1323 | 1324 | ||
@@ -1466,7 +1467,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
1466 | 1467 | ||
1467 | static int | 1468 | static int |
1468 | session_cmp_it (void *cls, | 1469 | session_cmp_it (void *cls, |
1469 | const struct GNUNET_HashCode * key, | 1470 | const struct GNUNET_PeerIdentity * key, |
1470 | void *value) | 1471 | void *value) |
1471 | { | 1472 | { |
1472 | struct SessionCompareContext * cctx = cls; | 1473 | struct SessionCompareContext * cctx = cls; |
@@ -1591,7 +1592,7 @@ udp_plugin_lookup_session (void *cls, | |||
1591 | "Looking for existing session for peer `%s' `%s' \n", | 1592 | "Looking for existing session for peer `%s' `%s' \n", |
1592 | GNUNET_i2s (&address->peer), | 1593 | GNUNET_i2s (&address->peer), |
1593 | udp_address_to_string(NULL, address->address, address->address_length)); | 1594 | udp_address_to_string(NULL, address->address, address->address_length)); |
1594 | GNUNET_CONTAINER_multihashmap_get_multiple(plugin->sessions, &address->peer.hashPubKey, session_cmp_it, &cctx); | 1595 | GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx); |
1595 | if (cctx.res != NULL) | 1596 | if (cctx.res != NULL) |
1596 | { | 1597 | { |
1597 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res); | 1598 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res); |
@@ -1623,13 +1624,13 @@ udp_plugin_create_session (void *cls, | |||
1623 | GNUNET_i2s(&address->peer), | 1624 | GNUNET_i2s(&address->peer), |
1624 | udp_address_to_string(NULL,address->address,address->address_length)); | 1625 | udp_address_to_string(NULL,address->address,address->address_length)); |
1625 | GNUNET_assert (GNUNET_OK == | 1626 | GNUNET_assert (GNUNET_OK == |
1626 | GNUNET_CONTAINER_multihashmap_put (plugin->sessions, | 1627 | GNUNET_CONTAINER_multipeermap_put (plugin->sessions, |
1627 | &s->target.hashPubKey, | 1628 | &s->target, |
1628 | s, | 1629 | s, |
1629 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 1630 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
1630 | GNUNET_STATISTICS_set(plugin->env->stats, | 1631 | GNUNET_STATISTICS_set(plugin->env->stats, |
1631 | "# UDP, sessions active", | 1632 | "# UDP, sessions active", |
1632 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), | 1633 | GNUNET_CONTAINER_multipeermap_size(plugin->sessions), |
1633 | GNUNET_NO); | 1634 | GNUNET_NO); |
1634 | return s; | 1635 | return s; |
1635 | } | 1636 | } |
@@ -1800,7 +1801,7 @@ udp_plugin_send (void *cls, | |||
1800 | GNUNET_break (0); | 1801 | GNUNET_break (0); |
1801 | return GNUNET_SYSERR; | 1802 | return GNUNET_SYSERR; |
1802 | } | 1803 | } |
1803 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains_value(plugin->sessions, &s->target.hashPubKey, s)) | 1804 | if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_contains_value(plugin->sessions, &s->target, s)) |
1804 | { | 1805 | { |
1805 | GNUNET_break (0); | 1806 | GNUNET_break (0); |
1806 | return GNUNET_SYSERR; | 1807 | return GNUNET_SYSERR; |
@@ -2137,7 +2138,9 @@ struct LookupContext | |||
2137 | 2138 | ||
2138 | 2139 | ||
2139 | static int | 2140 | static int |
2140 | lookup_session_by_addr_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 2141 | lookup_session_by_addr_it (void *cls, |
2142 | const struct GNUNET_PeerIdentity *key, | ||
2143 | void *value) | ||
2141 | { | 2144 | { |
2142 | struct LookupContext *l_ctx = cls; | 2145 | struct LookupContext *l_ctx = cls; |
2143 | struct Session * s = value; | 2146 | struct Session * s = value; |
@@ -2184,7 +2187,7 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg) | |||
2184 | l_ctx.addrlen = rc->addr_len; | 2187 | l_ctx.addrlen = rc->addr_len; |
2185 | l_ctx.res = NULL; | 2188 | l_ctx.res = NULL; |
2186 | l_ctx.must_have_frag_ctx = GNUNET_NO; | 2189 | l_ctx.must_have_frag_ctx = GNUNET_NO; |
2187 | GNUNET_CONTAINER_multihashmap_iterate (rc->plugin->sessions, | 2190 | GNUNET_CONTAINER_multipeermap_iterate (rc->plugin->sessions, |
2188 | &lookup_session_by_addr_it, | 2191 | &lookup_session_by_addr_it, |
2189 | &l_ctx); | 2192 | &l_ctx); |
2190 | s = l_ctx.res; | 2193 | s = l_ctx.res; |
@@ -2259,7 +2262,7 @@ read_process_ack (struct Plugin *plugin, | |||
2259 | l_ctx.addrlen = fromlen; | 2262 | l_ctx.addrlen = fromlen; |
2260 | l_ctx.res = NULL; | 2263 | l_ctx.res = NULL; |
2261 | l_ctx.must_have_frag_ctx = GNUNET_YES; | 2264 | l_ctx.must_have_frag_ctx = GNUNET_YES; |
2262 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, | 2265 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, |
2263 | &lookup_session_by_addr_it, | 2266 | &lookup_session_by_addr_it, |
2264 | &l_ctx); | 2267 | &l_ctx); |
2265 | s = l_ctx.res; | 2268 | s = l_ctx.res; |
@@ -3111,7 +3114,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3111 | p->enable_ipv6 = enable_v6; | 3114 | p->enable_ipv6 = enable_v6; |
3112 | p->enable_ipv4 = GNUNET_YES; /* default */ | 3115 | p->enable_ipv4 = GNUNET_YES; /* default */ |
3113 | p->env = env; | 3116 | p->env = env; |
3114 | p->sessions = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 3117 | p->sessions = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
3115 | p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 3118 | p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
3116 | p->mst = GNUNET_SERVER_mst_create (&process_inbound_tokenized_messages, p); | 3119 | p->mst = GNUNET_SERVER_mst_create (&process_inbound_tokenized_messages, p); |
3117 | GNUNET_BANDWIDTH_tracker_init (&p->tracker, | 3120 | GNUNET_BANDWIDTH_tracker_init (&p->tracker, |
@@ -3125,7 +3128,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3125 | { | 3128 | { |
3126 | LOG (GNUNET_ERROR_TYPE_ERROR, | 3129 | LOG (GNUNET_ERROR_TYPE_ERROR, |
3127 | _("Failed to create network sockets, plugin failed\n")); | 3130 | _("Failed to create network sockets, plugin failed\n")); |
3128 | GNUNET_CONTAINER_multihashmap_destroy (p->sessions); | 3131 | GNUNET_CONTAINER_multipeermap_destroy (p->sessions); |
3129 | GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs); | 3132 | GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs); |
3130 | GNUNET_SERVER_mst_destroy (p->mst); | 3133 | GNUNET_SERVER_mst_destroy (p->mst); |
3131 | GNUNET_free (p); | 3134 | GNUNET_free (p); |
@@ -3267,8 +3270,8 @@ libgnunet_plugin_transport_udp_done (void *cls) | |||
3267 | /* Clean up sessions */ | 3270 | /* Clean up sessions */ |
3268 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3271 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3269 | "Cleaning up sessions\n"); | 3272 | "Cleaning up sessions\n"); |
3270 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, &disconnect_and_free_it, plugin); | 3273 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, &disconnect_and_free_it, plugin); |
3271 | GNUNET_CONTAINER_multihashmap_destroy (plugin->sessions); | 3274 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); |
3272 | 3275 | ||
3273 | next = ppc_dll_head; | 3276 | next = ppc_dll_head; |
3274 | for (cur = next; NULL != cur; cur = next) | 3277 | for (cur = next; NULL != cur; cur = next) |
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index e168a534c..6fb573690 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h | |||
@@ -135,7 +135,7 @@ struct Plugin | |||
135 | * Session of peers with whom we are currently connected, | 135 | * Session of peers with whom we are currently connected, |
136 | * map of peer identity to 'struct PeerSession'. | 136 | * map of peer identity to 'struct PeerSession'. |
137 | */ | 137 | */ |
138 | struct GNUNET_CONTAINER_MultiHashMap *sessions; | 138 | struct GNUNET_CONTAINER_MultiPeerMap *sessions; |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Heap with all of our defragmentation activities. | 141 | * Heap with all of our defragmentation activities. |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index beed32d8d..4e153aab4 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -276,7 +276,7 @@ struct Plugin | |||
276 | /** | 276 | /** |
277 | * Sessions | 277 | * Sessions |
278 | */ | 278 | */ |
279 | struct GNUNET_CONTAINER_MultiHashMap *session_map; | 279 | struct GNUNET_CONTAINER_MultiPeerMap *session_map; |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * FD Read set | 282 | * FD Read set |
@@ -454,7 +454,7 @@ struct LookupCtx | |||
454 | */ | 454 | */ |
455 | static int | 455 | static int |
456 | lookup_session_it (void *cls, | 456 | lookup_session_it (void *cls, |
457 | const struct GNUNET_HashCode * key, | 457 | const struct GNUNET_PeerIdentity * key, |
458 | void *value) | 458 | void *value) |
459 | { | 459 | { |
460 | struct LookupCtx *lctx = cls; | 460 | struct LookupCtx *lctx = cls; |
@@ -498,8 +498,8 @@ lookup_session (struct Plugin *plugin, | |||
498 | lctx.s = NULL; | 498 | lctx.s = NULL; |
499 | lctx.ua = ua; | 499 | lctx.ua = ua; |
500 | lctx.ua_len = ua_len; | 500 | lctx.ua_len = ua_len; |
501 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map, | 501 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, |
502 | &sender->hashPubKey, | 502 | sender, |
503 | &lookup_session_it, &lctx); | 503 | &lookup_session_it, &lctx); |
504 | return lctx.s; | 504 | return lctx.s; |
505 | } | 505 | } |
@@ -542,12 +542,12 @@ disconnect_session (struct Session *s) | |||
542 | removed = GNUNET_YES; | 542 | removed = GNUNET_YES; |
543 | } | 543 | } |
544 | GNUNET_assert (GNUNET_YES == | 544 | GNUNET_assert (GNUNET_YES == |
545 | GNUNET_CONTAINER_multihashmap_remove (plugin->session_map, | 545 | GNUNET_CONTAINER_multipeermap_remove (plugin->session_map, |
546 | &s->target.hashPubKey, | 546 | &s->target, |
547 | s)); | 547 | s)); |
548 | GNUNET_STATISTICS_set (plugin->env->stats, | 548 | GNUNET_STATISTICS_set (plugin->env->stats, |
549 | "# UNIX sessions active", | 549 | "# UNIX sessions active", |
550 | GNUNET_CONTAINER_multihashmap_size (plugin->session_map), | 550 | GNUNET_CONTAINER_multipeermap_size (plugin->session_map), |
551 | GNUNET_NO); | 551 | GNUNET_NO); |
552 | if ((GNUNET_YES == removed) && (NULL == plugin->msg_head)) | 552 | if ((GNUNET_YES == removed) && (NULL == plugin->msg_head)) |
553 | reschedule_select (plugin); | 553 | reschedule_select (plugin); |
@@ -712,7 +712,7 @@ struct GetSessionIteratorContext | |||
712 | */ | 712 | */ |
713 | static int | 713 | static int |
714 | get_session_it (void *cls, | 714 | get_session_it (void *cls, |
715 | const struct GNUNET_HashCode *key, | 715 | const struct GNUNET_PeerIdentity *key, |
716 | void *value) | 716 | void *value) |
717 | { | 717 | { |
718 | struct GetSessionIteratorContext *gsi = cls; | 718 | struct GetSessionIteratorContext *gsi = cls; |
@@ -818,8 +818,8 @@ unix_plugin_get_session (void *cls, | |||
818 | gsi.address = (const char *) address->address; | 818 | gsi.address = (const char *) address->address; |
819 | gsi.addrlen = address->address_length; | 819 | gsi.addrlen = address->address_length; |
820 | gsi.res = NULL; | 820 | gsi.res = NULL; |
821 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map, | 821 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, |
822 | &address->peer.hashPubKey, | 822 | &address->peer, |
823 | &get_session_it, &gsi); | 823 | &get_session_it, &gsi); |
824 | if (NULL != gsi.res) | 824 | if (NULL != gsi.res) |
825 | { | 825 | { |
@@ -843,12 +843,12 @@ unix_plugin_get_session (void *cls, | |||
843 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 843 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
844 | "Creating a new session %p for address `%s'\n", | 844 | "Creating a new session %p for address `%s'\n", |
845 | s, unix_address_to_string (NULL, address->address, address->address_length)); | 845 | s, unix_address_to_string (NULL, address->address, address->address_length)); |
846 | (void) GNUNET_CONTAINER_multihashmap_put (plugin->session_map, | 846 | (void) GNUNET_CONTAINER_multipeermap_put (plugin->session_map, |
847 | &address->peer.hashPubKey, s, | 847 | &address->peer, s, |
848 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 848 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
849 | GNUNET_STATISTICS_set (plugin->env->stats, | 849 | GNUNET_STATISTICS_set (plugin->env->stats, |
850 | "# UNIX sessions active", | 850 | "# UNIX sessions active", |
851 | GNUNET_CONTAINER_multihashmap_size (plugin->session_map), | 851 | GNUNET_CONTAINER_multipeermap_size (plugin->session_map), |
852 | GNUNET_NO); | 852 | GNUNET_NO); |
853 | return s; | 853 | return s; |
854 | } | 854 | } |
@@ -898,8 +898,8 @@ unix_plugin_send (void *cls, | |||
898 | GNUNET_assert (NULL != session); | 898 | GNUNET_assert (NULL != session); |
899 | 899 | ||
900 | if (GNUNET_OK != | 900 | if (GNUNET_OK != |
901 | GNUNET_CONTAINER_multihashmap_contains_value (plugin->session_map, | 901 | GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map, |
902 | &session->target.hashPubKey, | 902 | &session->target, |
903 | session)) | 903 | session)) |
904 | { | 904 | { |
905 | LOG (GNUNET_ERROR_TYPE_ERROR, | 905 | LOG (GNUNET_ERROR_TYPE_ERROR, |
@@ -1553,7 +1553,9 @@ reschedule_session_timeout (struct Session *s) | |||
1553 | * @return GNUNET_YES (always, continue to iterate) | 1553 | * @return GNUNET_YES (always, continue to iterate) |
1554 | */ | 1554 | */ |
1555 | static int | 1555 | static int |
1556 | get_session_delete_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 1556 | get_session_delete_it (void *cls, |
1557 | const struct GNUNET_PeerIdentity *key, | ||
1558 | void *value) | ||
1557 | { | 1559 | { |
1558 | struct Session *s = value; | 1560 | struct Session *s = value; |
1559 | 1561 | ||
@@ -1567,7 +1569,7 @@ get_session_delete_it (void *cls, const struct GNUNET_HashCode * key, void *valu | |||
1567 | * | 1569 | * |
1568 | * @param cls closure for this call (should be handle to Plugin) | 1570 | * @param cls closure for this call (should be handle to Plugin) |
1569 | * @param target the peeridentity of the peer to disconnect | 1571 | * @param target the peeridentity of the peer to disconnect |
1570 | * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed | 1572 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed |
1571 | */ | 1573 | */ |
1572 | static void | 1574 | static void |
1573 | unix_disconnect (void *cls, | 1575 | unix_disconnect (void *cls, |
@@ -1576,8 +1578,8 @@ unix_disconnect (void *cls, | |||
1576 | struct Plugin *plugin = cls; | 1578 | struct Plugin *plugin = cls; |
1577 | 1579 | ||
1578 | GNUNET_assert (plugin != NULL); | 1580 | GNUNET_assert (plugin != NULL); |
1579 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map, | 1581 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map, |
1580 | &target->hashPubKey, | 1582 | target, |
1581 | &get_session_delete_it, plugin); | 1583 | &get_session_delete_it, plugin); |
1582 | } | 1584 | } |
1583 | 1585 | ||
@@ -1638,7 +1640,7 @@ libgnunet_plugin_transport_unix_init (void *cls) | |||
1638 | if (0 == sockets_created) | 1640 | if (0 == sockets_created) |
1639 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1641 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1640 | _("Failed to open UNIX listen socket\n")); | 1642 | _("Failed to open UNIX listen socket\n")); |
1641 | plugin->session_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 1643 | plugin->session_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
1642 | plugin->address_update_task = GNUNET_SCHEDULER_add_now (&address_notification, plugin); | 1644 | plugin->address_update_task = GNUNET_SCHEDULER_add_now (&address_notification, plugin); |
1643 | return api; | 1645 | return api; |
1644 | } | 1646 | } |
@@ -1701,9 +1703,9 @@ libgnunet_plugin_transport_unix_done (void *cls) | |||
1701 | plugin->unix_sock.desc = NULL; | 1703 | plugin->unix_sock.desc = NULL; |
1702 | plugin->with_ws = GNUNET_NO; | 1704 | plugin->with_ws = GNUNET_NO; |
1703 | } | 1705 | } |
1704 | GNUNET_CONTAINER_multihashmap_iterate (plugin->session_map, | 1706 | GNUNET_CONTAINER_multipeermap_iterate (plugin->session_map, |
1705 | &get_session_delete_it, plugin); | 1707 | &get_session_delete_it, plugin); |
1706 | GNUNET_CONTAINER_multihashmap_destroy (plugin->session_map); | 1708 | GNUNET_CONTAINER_multipeermap_destroy (plugin->session_map); |
1707 | if (NULL != plugin->rs) | 1709 | if (NULL != plugin->rs) |
1708 | GNUNET_NETWORK_fdset_destroy (plugin->rs); | 1710 | GNUNET_NETWORK_fdset_destroy (plugin->rs); |
1709 | if (NULL != plugin->ws) | 1711 | if (NULL != plugin->ws) |
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h index c6f990058..044c6818a 100644 --- a/src/transport/plugin_transport_wlan.h +++ b/src/transport/plugin_transport_wlan.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #ifndef PLUGIN_TRANSPORT_WLAN | 26 | #ifndef PLUGIN_TRANSPORT_WLAN |
27 | #define PLUGIN_TRANSPORT_WLAN | 27 | #define PLUGIN_TRANSPORT_WLAN |
28 | 28 | ||
29 | #include <stdint.h> | 29 | #include "gnunet_crypto_lib.h" |
30 | #include "gnunet_common.h" | 30 | #include "gnunet_common.h" |
31 | 31 | ||
32 | /** | 32 | /** |
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 7c33ad4ca..30cb87832 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * | 24 | * |
25 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
26 | */ | 26 | */ |
27 | |||
28 | #include "transport-testing.h" | 27 | #include "transport-testing.h" |
29 | 28 | ||
30 | 29 | ||
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h index f3906b495..99225936a 100644 --- a/src/transport/transport-testing.h +++ b/src/transport/transport-testing.h | |||
@@ -24,12 +24,9 @@ | |||
24 | * | 24 | * |
25 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
26 | */ | 26 | */ |
27 | |||
28 | #include "platform.h" | 27 | #include "platform.h" |
29 | #include "gnunet_common.h" | 28 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_hello_lib.h" | 29 | #include "gnunet_hello_lib.h" |
31 | #include "gnunet_program_lib.h" | ||
32 | #include "gnunet_container_lib.h" | ||
33 | #include "gnunet_transport_service.h" | 30 | #include "gnunet_transport_service.h" |
34 | #include "gnunet_testing_lib.h" | 31 | #include "gnunet_testing_lib.h" |
35 | 32 | ||
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index f83b6c098..cb6cefdb1 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -29,16 +29,11 @@ | |||
29 | * - test test test | 29 | * - test test test |
30 | */ | 30 | */ |
31 | #include "platform.h" | 31 | #include "platform.h" |
32 | #include "gnunet_util_lib.h" | ||
32 | #include "gnunet_constants.h" | 33 | #include "gnunet_constants.h" |
33 | #include "gnunet_bandwidth_lib.h" | ||
34 | #include "gnunet_client_lib.h" | ||
35 | #include "gnunet_constants.h" | ||
36 | #include "gnunet_container_lib.h" | ||
37 | #include "gnunet_arm_service.h" | 34 | #include "gnunet_arm_service.h" |
38 | #include "gnunet_hello_lib.h" | 35 | #include "gnunet_hello_lib.h" |
39 | #include "gnunet_protocols.h" | 36 | #include "gnunet_protocols.h" |
40 | #include "gnunet_server_lib.h" | ||
41 | #include "gnunet_time_lib.h" | ||
42 | #include "gnunet_transport_service.h" | 37 | #include "gnunet_transport_service.h" |
43 | #include "transport.h" | 38 | #include "transport.h" |
44 | 39 | ||
@@ -320,7 +315,7 @@ struct GNUNET_TRANSPORT_Handle | |||
320 | * Hash map of the current connected neighbours of this peer. | 315 | * Hash map of the current connected neighbours of this peer. |
321 | * Maps peer identities to 'struct Neighbour' entries. | 316 | * Maps peer identities to 'struct Neighbour' entries. |
322 | */ | 317 | */ |
323 | struct GNUNET_CONTAINER_MultiHashMap *neighbours; | 318 | struct GNUNET_CONTAINER_MultiPeerMap *neighbours; |
324 | 319 | ||
325 | /** | 320 | /** |
326 | * Heap sorting peers with pending messages by the timestamps that | 321 | * Heap sorting peers with pending messages by the timestamps that |
@@ -398,7 +393,7 @@ static struct Neighbour * | |||
398 | neighbour_find (struct GNUNET_TRANSPORT_Handle *h, | 393 | neighbour_find (struct GNUNET_TRANSPORT_Handle *h, |
399 | const struct GNUNET_PeerIdentity *peer) | 394 | const struct GNUNET_PeerIdentity *peer) |
400 | { | 395 | { |
401 | return GNUNET_CONTAINER_multihashmap_get (h->neighbours, &peer->hashPubKey); | 396 | return GNUNET_CONTAINER_multipeermap_get (h->neighbours, peer); |
402 | } | 397 | } |
403 | 398 | ||
404 | 399 | ||
@@ -424,8 +419,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, | |||
424 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, | 419 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, |
425 | MAX_BANDWIDTH_CARRY_S); | 420 | MAX_BANDWIDTH_CARRY_S); |
426 | GNUNET_assert (GNUNET_OK == | 421 | GNUNET_assert (GNUNET_OK == |
427 | GNUNET_CONTAINER_multihashmap_put (h->neighbours, | 422 | GNUNET_CONTAINER_multipeermap_put (h->neighbours, |
428 | &n->id.hashPubKey, n, | 423 | &n->id, n, |
429 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 424 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
430 | return n; | 425 | return n; |
431 | } | 426 | } |
@@ -442,7 +437,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, | |||
442 | * GNUNET_NO if not. | 437 | * GNUNET_NO if not. |
443 | */ | 438 | */ |
444 | static int | 439 | static int |
445 | neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value) | 440 | neighbour_delete (void *cls, |
441 | const struct GNUNET_PeerIdentity *key, void *value) | ||
446 | { | 442 | { |
447 | struct GNUNET_TRANSPORT_Handle *handle = cls; | 443 | struct GNUNET_TRANSPORT_Handle *handle = cls; |
448 | struct Neighbour *n = value; | 444 | struct Neighbour *n = value; |
@@ -452,7 +448,7 @@ neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
452 | GNUNET_assert (NULL == n->th); | 448 | GNUNET_assert (NULL == n->th); |
453 | GNUNET_assert (NULL == n->hn); | 449 | GNUNET_assert (NULL == n->hn); |
454 | GNUNET_assert (GNUNET_YES == | 450 | GNUNET_assert (GNUNET_YES == |
455 | GNUNET_CONTAINER_multihashmap_remove (handle->neighbours, key, | 451 | GNUNET_CONTAINER_multipeermap_remove (handle->neighbours, key, |
456 | n)); | 452 | n)); |
457 | GNUNET_free (n); | 453 | GNUNET_free (n); |
458 | return GNUNET_YES; | 454 | return GNUNET_YES; |
@@ -568,7 +564,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
568 | GNUNET_break (0); | 564 | GNUNET_break (0); |
569 | break; | 565 | break; |
570 | } | 566 | } |
571 | neighbour_delete (h, &dim->peer.hashPubKey, n); | 567 | neighbour_delete (h, &dim->peer, n); |
572 | break; | 568 | break; |
573 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK: | 569 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK: |
574 | if (size != sizeof (struct SendOkMessage)) | 570 | if (size != sizeof (struct SendOkMessage)) |
@@ -994,7 +990,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
994 | h->client = NULL; | 990 | h->client = NULL; |
995 | } | 991 | } |
996 | /* Forget about all neighbours that we used to be connected to */ | 992 | /* Forget about all neighbours that we used to be connected to */ |
997 | GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h); | 993 | GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, &neighbour_delete, h); |
998 | if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) | 994 | if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) |
999 | { | 995 | { |
1000 | GNUNET_SCHEDULER_cancel (h->quota_task); | 996 | GNUNET_SCHEDULER_cancel (h->quota_task); |
@@ -1341,15 +1337,15 @@ GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *o | |||
1341 | 1337 | ||
1342 | int | 1338 | int |
1343 | GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *handle, | 1339 | GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *handle, |
1344 | const struct GNUNET_PeerIdentity *peer) | 1340 | const struct GNUNET_PeerIdentity *peer) |
1345 | { | 1341 | { |
1346 | GNUNET_assert (NULL != handle); | 1342 | GNUNET_assert (NULL != handle); |
1347 | GNUNET_assert (NULL != peer); | 1343 | GNUNET_assert (NULL != peer); |
1348 | 1344 | ||
1349 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(handle->neighbours, &peer->hashPubKey)) | 1345 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer)) |
1350 | return GNUNET_YES; | 1346 | return GNUNET_YES; |
1351 | else | 1347 | else |
1352 | return GNUNET_NO; | 1348 | return GNUNET_NO; |
1353 | } | 1349 | } |
1354 | 1350 | ||
1355 | 1351 | ||
@@ -1455,7 +1451,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1455 | ret->nd_cb = nd; | 1451 | ret->nd_cb = nd; |
1456 | ret->reconnect_delay = GNUNET_TIME_UNIT_ZERO; | 1452 | ret->reconnect_delay = GNUNET_TIME_UNIT_ZERO; |
1457 | ret->neighbours = | 1453 | ret->neighbours = |
1458 | GNUNET_CONTAINER_multihashmap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES); | 1454 | GNUNET_CONTAINER_multipeermap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES); |
1459 | ret->ready_heap = | 1455 | ret->ready_heap = |
1460 | GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 1456 | GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
1461 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); | 1457 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); |
@@ -1488,7 +1484,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1488 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); | 1484 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); |
1489 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 1485 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
1490 | } | 1486 | } |
1491 | GNUNET_CONTAINER_multihashmap_destroy (handle->neighbours); | 1487 | GNUNET_CONTAINER_multipeermap_destroy (handle->neighbours); |
1492 | handle->neighbours = NULL; | 1488 | handle->neighbours = NULL; |
1493 | if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) | 1489 | if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) |
1494 | { | 1490 | { |
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c index 217aecdb5..9c1301ed2 100644 --- a/src/transport/transport_api_address_lookup.c +++ b/src/transport/transport_api_address_lookup.c | |||
@@ -28,14 +28,11 @@ | |||
28 | * transport plugin, and whether or not the address given is currently | 28 | * transport plugin, and whether or not the address given is currently |
29 | * in the 'connected' state (according to the transport service). | 29 | * in the 'connected' state (according to the transport service). |
30 | */ | 30 | */ |
31 | |||
32 | #include "platform.h" | 31 | #include "platform.h" |
33 | #include "gnunet_client_lib.h" | 32 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_arm_service.h" | 33 | #include "gnunet_arm_service.h" |
35 | #include "gnunet_hello_lib.h" | 34 | #include "gnunet_hello_lib.h" |
36 | #include "gnunet_protocols.h" | 35 | #include "gnunet_protocols.h" |
37 | #include "gnunet_server_lib.h" | ||
38 | #include "gnunet_time_lib.h" | ||
39 | #include "gnunet_transport_service.h" | 36 | #include "gnunet_transport_service.h" |
40 | #include "transport.h" | 37 | #include "transport.h" |
41 | 38 | ||
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index 152e573cd..94c9ac45a 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -18,12 +18,10 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #include "platform.h" | 20 | #include "platform.h" |
21 | #include "gnunet_client_lib.h" | 21 | #include "gnunet_util_lib.h" |
22 | #include "gnunet_arm_service.h" | 22 | #include "gnunet_arm_service.h" |
23 | #include "gnunet_hello_lib.h" | 23 | #include "gnunet_hello_lib.h" |
24 | #include "gnunet_protocols.h" | 24 | #include "gnunet_protocols.h" |
25 | #include "gnunet_server_lib.h" | ||
26 | #include "gnunet_time_lib.h" | ||
27 | #include "gnunet_transport_service.h" | 25 | #include "gnunet_transport_service.h" |
28 | #include "transport.h" | 26 | #include "transport.h" |
29 | 27 | ||
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 04646204f..dcd1ae781 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -24,12 +24,10 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_client_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_arm_service.h" | 28 | #include "gnunet_arm_service.h" |
29 | #include "gnunet_hello_lib.h" | 29 | #include "gnunet_hello_lib.h" |
30 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
31 | #include "gnunet_server_lib.h" | ||
32 | #include "gnunet_time_lib.h" | ||
33 | #include "gnunet_transport_service.h" | 31 | #include "gnunet_transport_service.h" |
34 | #include "transport.h" | 32 | #include "transport.h" |
35 | 33 | ||