diff options
Diffstat (limited to 'src/transport')
25 files changed, 257 insertions, 264 deletions
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 | ||