aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 21:03:31 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 21:03:31 +0000
commit6d5b099541c60303b664547f18f4aaa864e33d68 (patch)
tree3169f571d3f66ec23ab540d17c012f00103688f2
parenta0ba5b741b56036bd35bd9ba88164324b2ff7ada (diff)
downloadgnunet-6d5b099541c60303b664547f18f4aaa864e33d68.tar.gz
gnunet-6d5b099541c60303b664547f18f4aaa864e33d68.zip
-getting core, nse, testbed, ats-tool and peerinfo-tool to compile again (part of #3047)
-rw-r--r--src/ats-tool/gnunet-ats.c4
-rw-r--r--src/core/core_api.c39
-rw-r--r--src/core/gnunet-core.c6
-rw-r--r--src/core/gnunet-service-core_clients.c75
-rw-r--r--src/core/gnunet-service-core_kx.c46
-rw-r--r--src/core/gnunet-service-core_neighbours.c28
-rw-r--r--src/core/gnunet-service-core_sessions.c35
-rw-r--r--src/dht/gnunet-service-dht_hello.c20
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c2
-rw-r--r--src/dht/plugin_block_dht.c14
-rw-r--r--src/include/gnunet_nse_service.h4
-rw-r--r--src/nse/gnunet-service-nse.c68
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c34
-rw-r--r--src/testbed/gnunet-daemon-testbed-blacklist.c16
-rw-r--r--src/testbed/gnunet-service-testbed_meminfo.c2
-rw-r--r--src/testbed/gnunet-testbed-profiler.c1
-rw-r--r--src/testbed/testbed.h2
-rw-r--r--src/testbed/testbed_api.h2
18 files changed, 196 insertions, 202 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index b42b7f372..710931321 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -352,7 +352,9 @@ testservice_ats (void *cls,
352 352
353 if (NULL != pid_str) 353 if (NULL != pid_str)
354 { 354 {
355 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (pid_str, &pid.hashPubKey)) 355 if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (pid_str,
356 strlen (pid_str),
357 &pid.public_key))
356 { 358 {
357 FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), pid_str); 359 FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), pid_str);
358 return; 360 return;
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 959eb275a..8b9389bdf 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -277,7 +277,7 @@ struct GNUNET_CORE_Handle
277 * Hash map listing all of the peers that we are currently 277 * Hash map listing all of the peers that we are currently
278 * connected to. 278 * connected to.
279 */ 279 */
280 struct GNUNET_CONTAINER_MultiHashMap *peers; 280 struct GNUNET_CONTAINER_MultiPeerMap *peers;
281 281
282 /** 282 /**
283 * Identity of this peer. 283 * Identity of this peer.
@@ -357,7 +357,8 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
357 * @return #GNUNET_YES (continue) 357 * @return #GNUNET_YES (continue)
358 */ 358 */
359static int 359static int
360disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key, 360disconnect_and_free_peer_entry (void *cls,
361 const struct GNUNET_PeerIdentity *key,
361 void *value) 362 void *value)
362{ 363{
363 struct GNUNET_CORE_Handle *h = cls; 364 struct GNUNET_CORE_Handle *h = cls;
@@ -389,7 +390,7 @@ disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key,
389 } 390 }
390 /* done with 'voluntary' cleanups, now on to normal freeing */ 391 /* done with 'voluntary' cleanups, now on to normal freeing */
391 GNUNET_assert (GNUNET_YES == 392 GNUNET_assert (GNUNET_YES ==
392 GNUNET_CONTAINER_multihashmap_remove (h->peers, key, pr)); 393 GNUNET_CONTAINER_multipeermap_remove (h->peers, key, pr));
393 GNUNET_assert (pr->ch == h); 394 GNUNET_assert (pr->ch == h);
394 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task); 395 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task);
395 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); 396 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task);
@@ -435,7 +436,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h)
435 cm->cont (cm->cont_cls, GNUNET_NO); 436 cm->cont (cm->cont_cls, GNUNET_NO);
436 GNUNET_free (cm); 437 GNUNET_free (cm);
437 } 438 }
438 GNUNET_CONTAINER_multihashmap_iterate (h->peers, 439 GNUNET_CONTAINER_multipeermap_iterate (h->peers,
439 &disconnect_and_free_peer_entry, h); 440 &disconnect_and_free_peer_entry, h);
440 while (NULL != (pr = h->ready_peer_head)) 441 while (NULL != (pr = h->ready_peer_head))
441 GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr); 442 GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr);
@@ -790,14 +791,14 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
790 "Successfully reconnected to core service.\n"); 791 "Successfully reconnected to core service.\n");
791 } 792 }
792 /* fake 'connect to self' */ 793 /* fake 'connect to self' */
793 pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &h->me.hashPubKey); 794 pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &h->me);
794 GNUNET_assert (NULL == pr); 795 GNUNET_assert (NULL == pr);
795 pr = GNUNET_new (struct PeerRecord); 796 pr = GNUNET_new (struct PeerRecord);
796 pr->peer = h->me; 797 pr->peer = h->me;
797 pr->ch = h; 798 pr->ch = h;
798 GNUNET_assert (GNUNET_YES == 799 GNUNET_assert (GNUNET_YES ==
799 GNUNET_CONTAINER_multihashmap_put (h->peers, 800 GNUNET_CONTAINER_multipeermap_put (h->peers,
800 &h->me.hashPubKey, pr, 801 &h->me, pr,
801 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 802 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
802 if (NULL != h->connects) 803 if (NULL != h->connects)
803 h->connects (h->cls, &h->me); 804 h->connects (h->cls, &h->me);
@@ -826,7 +827,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
826 GNUNET_break (0); 827 GNUNET_break (0);
827 return; 828 return;
828 } 829 }
829 pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &cnm->peer.hashPubKey); 830 pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &cnm->peer);
830 if (NULL != pr) 831 if (NULL != pr)
831 { 832 {
832 GNUNET_break (0); 833 GNUNET_break (0);
@@ -837,8 +838,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
837 pr->peer = cnm->peer; 838 pr->peer = cnm->peer;
838 pr->ch = h; 839 pr->ch = h;
839 GNUNET_assert (GNUNET_YES == 840 GNUNET_assert (GNUNET_YES ==
840 GNUNET_CONTAINER_multihashmap_put (h->peers, 841 GNUNET_CONTAINER_multipeermap_put (h->peers,
841 &cnm->peer.hashPubKey, pr, 842 &cnm->peer, pr,
842 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 843 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
843 if (NULL != h->connects) 844 if (NULL != h->connects)
844 h->connects (h->cls, &cnm->peer); 845 h->connects (h->cls, &cnm->peer);
@@ -861,7 +862,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
861 LOG (GNUNET_ERROR_TYPE_DEBUG, 862 LOG (GNUNET_ERROR_TYPE_DEBUG,
862 "Received notification about disconnect from `%s'.\n", 863 "Received notification about disconnect from `%s'.\n",
863 GNUNET_i2s (&dnm->peer)); 864 GNUNET_i2s (&dnm->peer));
864 pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &dnm->peer.hashPubKey); 865 pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &dnm->peer);
865 if (NULL == pr) 866 if (NULL == pr)
866 { 867 {
867 GNUNET_break (0); 868 GNUNET_break (0);
@@ -870,7 +871,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
870 } 871 }
871 trigger = ((pr->prev != NULL) || (pr->next != NULL) || 872 trigger = ((pr->prev != NULL) || (pr->next != NULL) ||
872 (h->ready_peer_head == pr)); 873 (h->ready_peer_head == pr));
873 disconnect_and_free_peer_entry (h, &dnm->peer.hashPubKey, pr); 874 disconnect_and_free_peer_entry (h, &dnm->peer, pr);
874 if (trigger) 875 if (trigger)
875 trigger_next_request (h, GNUNET_NO); 876 trigger_next_request (h, GNUNET_NO);
876 break; 877 break;
@@ -916,7 +917,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
916 GNUNET_break_op (0); 917 GNUNET_break_op (0);
917 continue; 918 continue;
918 } 919 }
919 pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &ntm->peer.hashPubKey); 920 pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &ntm->peer);
920 if (NULL == pr) 921 if (NULL == pr)
921 { 922 {
922 GNUNET_break (0); 923 GNUNET_break (0);
@@ -976,7 +977,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
976 return; 977 return;
977 } 978 }
978 smr = (const struct SendMessageReady *) msg; 979 smr = (const struct SendMessageReady *) msg;
979 pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &smr->peer.hashPubKey); 980 pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &smr->peer);
980 if (NULL == pr) 981 if (NULL == pr)
981 { 982 {
982 GNUNET_break (0); 983 GNUNET_break (0);
@@ -1157,7 +1158,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1157 h->handlers = handlers; 1158 h->handlers = handlers;
1158 h->hcnt = 0; 1159 h->hcnt = 0;
1159 h->currently_down = GNUNET_YES; 1160 h->currently_down = GNUNET_YES;
1160 h->peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 1161 h->peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
1161 if (NULL != handlers) 1162 if (NULL != handlers)
1162 while (handlers[h->hcnt].callback != NULL) 1163 while (handlers[h->hcnt].callback != NULL)
1163 h->hcnt++; 1164 h->hcnt++;
@@ -1205,7 +1206,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle)
1205 GNUNET_CLIENT_disconnect (handle->client); 1206 GNUNET_CLIENT_disconnect (handle->client);
1206 handle->client = NULL; 1207 handle->client = NULL;
1207 } 1208 }
1208 GNUNET_CONTAINER_multihashmap_iterate (handle->peers, 1209 GNUNET_CONTAINER_multipeermap_iterate (handle->peers,
1209 &disconnect_and_free_peer_entry, 1210 &disconnect_and_free_peer_entry,
1210 handle); 1211 handle);
1211 if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) 1212 if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1213,7 +1214,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle)
1213 GNUNET_SCHEDULER_cancel (handle->reconnect_task); 1214 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
1214 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1215 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
1215 } 1216 }
1216 GNUNET_CONTAINER_multihashmap_destroy (handle->peers); 1217 GNUNET_CONTAINER_multipeermap_destroy (handle->peers);
1217 handle->peers = NULL; 1218 handle->peers = NULL;
1218 GNUNET_break (handle->ready_peer_head == NULL); 1219 GNUNET_break (handle->ready_peer_head == NULL);
1219 GNUNET_free (handle); 1220 GNUNET_free (handle);
@@ -1287,7 +1288,7 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1287 "Asking core for transmission of %u bytes to `%s'\n", 1288 "Asking core for transmission of %u bytes to `%s'\n",
1288 (unsigned int) notify_size, 1289 (unsigned int) notify_size,
1289 GNUNET_i2s (target)); 1290 GNUNET_i2s (target));
1290 pr = GNUNET_CONTAINER_multihashmap_get (handle->peers, &target->hashPubKey); 1291 pr = GNUNET_CONTAINER_multipeermap_get (handle->peers, target);
1291 if (NULL == pr) 1292 if (NULL == pr)
1292 { 1293 {
1293 /* attempt to send to peer that is not connected */ 1294 /* attempt to send to peer that is not connected */
@@ -1382,7 +1383,7 @@ GNUNET_CORE_is_peer_connected_sync (const struct GNUNET_CORE_Handle *h,
1382{ 1383{
1383 GNUNET_assert (NULL != h); 1384 GNUNET_assert (NULL != h);
1384 GNUNET_assert (NULL != pid); 1385 GNUNET_assert (NULL != pid);
1385 return GNUNET_CONTAINER_multihashmap_contains (h->peers, &pid->hashPubKey); 1386 return GNUNET_CONTAINER_multipeermap_contains (h->peers, pid);
1386} 1387}
1387 1388
1388 1389
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c
index 9bfd18ec9..cfdae33bf 100644
--- a/src/core/gnunet-core.c
+++ b/src/core/gnunet-core.c
@@ -75,12 +75,10 @@ static void
75connected_peer_callback (void *cls, 75connected_peer_callback (void *cls,
76 const struct GNUNET_PeerIdentity *peer) 76 const struct GNUNET_PeerIdentity *peer)
77{ 77{
78 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
79
80 if (NULL == peer) 78 if (NULL == peer)
81 return; 79 return;
82 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); 80 printf (_("Peer `%s'\n"),
83 printf (_("Peer `%s'\n"), (const char *) &enc); 81 GNUNET_i2s_full (peer));
84} 82}
85 83
86 84
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c
index 7514da8a2..bcbb56ef3 100644
--- a/src/core/gnunet-service-core_clients.c
+++ b/src/core/gnunet-service-core_clients.c
@@ -73,12 +73,12 @@ struct GSC_Client
73 * Map of peer identities to active transmission requests of this 73 * Map of peer identities to active transmission requests of this
74 * client to the peer (of type 'struct GSC_ClientActiveRequest'). 74 * client to the peer (of type 'struct GSC_ClientActiveRequest').
75 */ 75 */
76 struct GNUNET_CONTAINER_MultiHashMap *requests; 76 struct GNUNET_CONTAINER_MultiPeerMap *requests;
77 77
78 /** 78 /**
79 * Map containing all peers that this client knows we're connected to. 79 * Map containing all peers that this client knows we're connected to.
80 */ 80 */
81 struct GNUNET_CONTAINER_MultiHashMap *connectmap; 81 struct GNUNET_CONTAINER_MultiPeerMap *connectmap;
82 82
83 /** 83 /**
84 * Options for messages this client cares about, 84 * Options for messages this client cares about,
@@ -247,8 +247,8 @@ send_to_all_clients (const struct GNUNET_PeerIdentity *partner,
247 GNUNET_assert ( (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) || 247 GNUNET_assert ( (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) ||
248 (GNUNET_YES != tm) || 248 (GNUNET_YES != tm) ||
249 (GNUNET_YES == 249 (GNUNET_YES ==
250 GNUNET_CONTAINER_multihashmap_contains (c->connectmap, 250 GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
251 &partner->hashPubKey)) ); 251 partner)) );
252 send_to_client (c, msg, can_drop); 252 send_to_client (c, msg, can_drop);
253 } 253 }
254} 254}
@@ -298,10 +298,10 @@ handle_client_init (void *cls, struct GNUNET_SERVER_Client *client,
298 c->options = ntohl (im->options); 298 c->options = ntohl (im->options);
299 all_client_options |= c->options; 299 all_client_options |= c->options;
300 c->types = (const uint16_t *) &c[1]; 300 c->types = (const uint16_t *) &c[1];
301 c->connectmap = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); 301 c->connectmap = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO);
302 GNUNET_assert (GNUNET_YES == 302 GNUNET_assert (GNUNET_YES ==
303 GNUNET_CONTAINER_multihashmap_put (c->connectmap, 303 GNUNET_CONTAINER_multipeermap_put (c->connectmap,
304 &GSC_my_identity.hashPubKey, 304 &GSC_my_identity,
305 NULL, 305 NULL,
306 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 306 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
307 wtypes = (uint16_t *) & c[1]; 307 wtypes = (uint16_t *) & c[1];
@@ -349,7 +349,7 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
349 return; 349 return;
350 } 350 }
351 if (c->requests == NULL) 351 if (c->requests == NULL)
352 c->requests = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); 352 c->requests = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO);
353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
354 "Client asked for transmission to `%s'\n", 354 "Client asked for transmission to `%s'\n",
355 GNUNET_i2s (&req->peer)); 355 GNUNET_i2s (&req->peer));
@@ -359,8 +359,8 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
359 sizeof (struct GNUNET_PeerIdentity))); 359 sizeof (struct GNUNET_PeerIdentity)));
360 if ((!is_loopback) && 360 if ((!is_loopback) &&
361 (GNUNET_YES != 361 (GNUNET_YES !=
362 GNUNET_CONTAINER_multihashmap_contains (c->connectmap, 362 GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
363 &req->peer.hashPubKey))) 363 &req->peer)))
364 { 364 {
365 /* neighbour must have disconnected since request was issued, 365 /* neighbour must have disconnected since request was issued,
366 * ignore (client will realize it once it processes the 366 * ignore (client will realize it once it processes the
@@ -373,14 +373,14 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client,
373 return; 373 return;
374 } 374 }
375 375
376 car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey); 376 car = GNUNET_CONTAINER_multipeermap_get (c->requests, &req->peer);
377 if (car == NULL) 377 if (car == NULL)
378 { 378 {
379 /* create new entry */ 379 /* create new entry */
380 car = GNUNET_malloc (sizeof (struct GSC_ClientActiveRequest)); 380 car = GNUNET_malloc (sizeof (struct GSC_ClientActiveRequest));
381 GNUNET_assert (GNUNET_OK == 381 GNUNET_assert (GNUNET_OK ==
382 GNUNET_CONTAINER_multihashmap_put (c->requests, 382 GNUNET_CONTAINER_multipeermap_put (c->requests,
383 &req->peer.hashPubKey, 383 &req->peer,
384 car, 384 car,
385 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 385 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
386 car->client_handle = c; 386 car->client_handle = c;
@@ -462,7 +462,7 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client,
462 return; 462 return;
463 } 463 }
464 tc.car = 464 tc.car =
465 GNUNET_CONTAINER_multihashmap_get (c->requests, &sm->peer.hashPubKey); 465 GNUNET_CONTAINER_multipeermap_get (c->requests, &sm->peer);
466 if (NULL == tc.car) 466 if (NULL == tc.car)
467 { 467 {
468 /* Must have been that we first approved the request, then got disconnected 468 /* Must have been that we first approved the request, then got disconnected
@@ -478,8 +478,8 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client,
478 return; 478 return;
479 } 479 }
480 GNUNET_assert (GNUNET_YES == 480 GNUNET_assert (GNUNET_YES ==
481 GNUNET_CONTAINER_multihashmap_remove (c->requests, 481 GNUNET_CONTAINER_multipeermap_remove (c->requests,
482 &sm->peer.hashPubKey, 482 &sm->peer,
483 tc.car)); 483 tc.car));
484 tc.cork = ntohl (sm->cork); 484 tc.cork = ntohl (sm->cork);
485 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 485 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -561,18 +561,19 @@ client_tokenizer_callback (void *cls, void *client,
561 * @param cls NULL 561 * @param cls NULL
562 * @param key identity of peer for which this is an active request 562 * @param key identity of peer for which this is an active request
563 * @param value the 'struct GSC_ClientActiveRequest' to free 563 * @param value the 'struct GSC_ClientActiveRequest' to free
564 * @return GNUNET_YES (continue iteration) 564 * @return #GNUNET_YES (continue iteration)
565 */ 565 */
566static int 566static int
567destroy_active_client_request (void *cls, const struct GNUNET_HashCode * key, 567destroy_active_client_request (void *cls,
568 const struct GNUNET_PeerIdentity *key,
568 void *value) 569 void *value)
569{ 570{
570 struct GSC_ClientActiveRequest *car = value; 571 struct GSC_ClientActiveRequest *car = value;
571 572
572 GNUNET_assert (GNUNET_YES == 573 GNUNET_assert (GNUNET_YES ==
573 GNUNET_CONTAINER_multihashmap_remove (car-> 574 GNUNET_CONTAINER_multipeermap_remove (car->
574 client_handle->requests, 575 client_handle->requests,
575 &car->target.hashPubKey, 576 &car->target,
576 car)); 577 car));
577 GSC_SESSIONS_dequeue_request (car); 578 GSC_SESSIONS_dequeue_request (car);
578 GNUNET_free (car); 579 GNUNET_free (car);
@@ -601,12 +602,12 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
601 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, c); 602 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, c);
602 if (c->requests != NULL) 603 if (c->requests != NULL)
603 { 604 {
604 GNUNET_CONTAINER_multihashmap_iterate (c->requests, 605 GNUNET_CONTAINER_multipeermap_iterate (c->requests,
605 &destroy_active_client_request, 606 &destroy_active_client_request,
606 NULL); 607 NULL);
607 GNUNET_CONTAINER_multihashmap_destroy (c->requests); 608 GNUNET_CONTAINER_multipeermap_destroy (c->requests);
608 } 609 }
609 GNUNET_CONTAINER_multihashmap_destroy (c->connectmap); 610 GNUNET_CONTAINER_multipeermap_destroy (c->connectmap);
610 c->connectmap = NULL; 611 c->connectmap = NULL;
611 GSC_TYPEMAP_remove (c->types, c->tcnt); 612 GSC_TYPEMAP_remove (c->types, c->tcnt);
612 GNUNET_free (c); 613 GNUNET_free (c);
@@ -633,8 +634,8 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car)
633 634
634 c = car->client_handle; 635 c = car->client_handle;
635 if (GNUNET_YES != 636 if (GNUNET_YES !=
636 GNUNET_CONTAINER_multihashmap_contains (c->connectmap, 637 GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
637 &car->target.hashPubKey)) 638 &car->target))
638 { 639 {
639 /* connection has gone down since, drop request */ 640 /* connection has gone down since, drop request */
640 GNUNET_assert (0 != 641 GNUNET_assert (0 !=
@@ -665,9 +666,9 @@ void
665GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car) 666GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car)
666{ 667{
667 GNUNET_assert (GNUNET_YES == 668 GNUNET_assert (GNUNET_YES ==
668 GNUNET_CONTAINER_multihashmap_remove (car-> 669 GNUNET_CONTAINER_multipeermap_remove (car->
669 client_handle->requests, 670 client_handle->requests,
670 &car->target.hashPubKey, 671 &car->target,
671 car)); 672 car));
672 GNUNET_free (car); 673 GNUNET_free (car);
673} 674}
@@ -702,19 +703,19 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
702 if (old_match == new_match) 703 if (old_match == new_match)
703 { 704 {
704 GNUNET_assert (old_match == 705 GNUNET_assert (old_match ==
705 GNUNET_CONTAINER_multihashmap_contains (client->connectmap, 706 GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
706 &neighbour->hashPubKey)); 707 neighbour));
707 return; /* no change */ 708 return; /* no change */
708 } 709 }
709 if (old_match == GNUNET_NO) 710 if (old_match == GNUNET_NO)
710 { 711 {
711 /* send connect */ 712 /* send connect */
712 GNUNET_assert (GNUNET_NO == 713 GNUNET_assert (GNUNET_NO ==
713 GNUNET_CONTAINER_multihashmap_contains (client->connectmap, 714 GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
714 &neighbour->hashPubKey)); 715 neighbour));
715 GNUNET_assert (GNUNET_YES == 716 GNUNET_assert (GNUNET_YES ==
716 GNUNET_CONTAINER_multihashmap_put (client->connectmap, 717 GNUNET_CONTAINER_multipeermap_put (client->connectmap,
717 &neighbour->hashPubKey, 718 neighbour,
718 NULL, 719 NULL,
719 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 720 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
720 size = sizeof (struct ConnectNotifyMessage); 721 size = sizeof (struct ConnectNotifyMessage);
@@ -731,11 +732,11 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
731 { 732 {
732 /* send disconnect */ 733 /* send disconnect */
733 GNUNET_assert (GNUNET_YES == 734 GNUNET_assert (GNUNET_YES ==
734 GNUNET_CONTAINER_multihashmap_contains (client->connectmap, 735 GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
735 &neighbour->hashPubKey)); 736 neighbour));
736 GNUNET_assert (GNUNET_YES == 737 GNUNET_assert (GNUNET_YES ==
737 GNUNET_CONTAINER_multihashmap_remove (client->connectmap, 738 GNUNET_CONTAINER_multipeermap_remove (client->connectmap,
738 &neighbour->hashPubKey, 739 neighbour,
739 NULL)); 740 NULL));
740 dcm.header.size = htons (sizeof (struct DisconnectNotifyMessage)); 741 dcm.header.size = htons (sizeof (struct DisconnectNotifyMessage));
741 dcm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); 742 dcm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT);
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 675ac83a6..bf3c5cdaf 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -116,7 +116,7 @@ struct EphemeralKeyMessage
116 /** 116 /**
117 * Public key of the signing peer (persistent version, not the ephemeral public key). 117 * Public key of the signing peer (persistent version, not the ephemeral public key).
118 */ 118 */
119 struct GNUNET_CRYPTO_EccPublicSignKey origin_public_key; 119 struct GNUNET_PeerIdentity origin_identity;
120 120
121}; 121};
122 122
@@ -390,11 +390,6 @@ static struct GNUNET_CRYPTO_EccPrivateKey *my_ephemeral_key;
390static struct EphemeralKeyMessage current_ekm; 390static struct EphemeralKeyMessage current_ekm;
391 391
392/** 392/**
393 * Our public key.
394 */
395static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
396
397/**
398 * Our message stream tokenizer (for encrypted payload). 393 * Our message stream tokenizer (for encrypted payload).
399 */ 394 */
400static struct GNUNET_SERVER_MessageStreamTokenizer *mst; 395static struct GNUNET_SERVER_MessageStreamTokenizer *mst;
@@ -453,9 +448,9 @@ derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
453 static const char ctx[] = "initialization vector"; 448 static const char ctx[] = "initialization vector";
454 449
455 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), 450 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed),
456 &identity->hashPubKey.bits, 451 identity,
457 sizeof (identity->hashPubKey.bits), ctx, 452 sizeof (struct GNUNET_PeerIdentity), ctx,
458 sizeof (ctx), NULL); 453 sizeof (ctx), NULL);
459} 454}
460 455
461 456
@@ -476,9 +471,11 @@ derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
476 static const char ctx[] = "pong initialization vector"; 471 static const char ctx[] = "pong initialization vector";
477 472
478 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), 473 GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed),
479 &identity->hashPubKey.bits, 474 identity,
480 sizeof (identity->hashPubKey.bits), &challenge, 475 sizeof (struct GNUNET_PeerIdentity),
481 sizeof (challenge), ctx, sizeof (ctx), NULL); 476 &challenge, sizeof (challenge),
477 ctx, sizeof (ctx),
478 NULL);
482} 479}
483 480
484 481
@@ -661,6 +658,8 @@ struct GSC_KeyExchangeInfo *
661GSC_KX_start (const struct GNUNET_PeerIdentity *pid) 658GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
662{ 659{
663 struct GSC_KeyExchangeInfo *kx; 660 struct GSC_KeyExchangeInfo *kx;
661 struct GNUNET_HashCode h1;
662 struct GNUNET_HashCode h2;
664 663
665 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 664 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
666 "Initiating key exchange with `%s'\n", 665 "Initiating key exchange with `%s'\n",
@@ -674,8 +673,11 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
674 GNUNET_CONTAINER_DLL_insert (kx_head, 673 GNUNET_CONTAINER_DLL_insert (kx_head,
675 kx_tail, 674 kx_tail,
676 kx); 675 kx);
677 if (0 < GNUNET_CRYPTO_hash_cmp (&pid->hashPubKey, 676 GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1);
678 &GSC_my_identity.hashPubKey)) 677 GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2);
678
679 if (0 < GNUNET_CRYPTO_hash_cmp (&h1,
680 &h2))
679 { 681 {
680 /* peer with "lower" identity starts KX, otherwise we typically end up 682 /* peer with "lower" identity starts KX, otherwise we typically end up
681 with both peers starting the exchange and transmit the 'set key' 683 with both peers starting the exchange and transmit the 'set key'
@@ -742,7 +744,6 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
742 struct GNUNET_TIME_Absolute start_t; 744 struct GNUNET_TIME_Absolute start_t;
743 struct GNUNET_TIME_Absolute end_t; 745 struct GNUNET_TIME_Absolute end_t;
744 struct GNUNET_TIME_Absolute now; 746 struct GNUNET_TIME_Absolute now;
745 struct GNUNET_PeerIdentity signer_id;
746 enum KxStateMachine sender_status; 747 enum KxStateMachine sender_status;
747 uint16_t size; 748 uint16_t size;
748 struct GNUNET_HashCode key_material; 749 struct GNUNET_HashCode key_material;
@@ -772,11 +773,9 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
772 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
773 "Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY", 774 "Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY",
774 GNUNET_i2s (&kx->peer)); 775 GNUNET_i2s (&kx->peer));
775 GNUNET_CRYPTO_hash (&m->origin_public_key,
776 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
777 &signer_id.hashPubKey);
778 if (0 != 776 if (0 !=
779 memcmp (&signer_id, &kx->peer, 777 memcmp (&m->origin_identity,
778 &kx->peer.public_key,
780 sizeof (struct GNUNET_PeerIdentity))) 779 sizeof (struct GNUNET_PeerIdentity)))
781 { 780 {
782 GNUNET_break_op (0); 781 GNUNET_break_op (0);
@@ -791,7 +790,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
791 (GNUNET_OK != 790 (GNUNET_OK !=
792 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, 791 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY,
793 &m->purpose, 792 &m->purpose,
794 &m->signature, &m->origin_public_key))) 793 &m->signature, &m->origin_identity.public_key)))
795 { 794 {
796 /* invalid signature */ 795 /* invalid signature */
797 GNUNET_break_op (0); 796 GNUNET_break_op (0);
@@ -1496,7 +1495,7 @@ sign_ephemeral_key ()
1496 } 1495 }
1497 GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key, 1496 GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key,
1498 &current_ekm.ephemeral_key); 1497 &current_ekm.ephemeral_key);
1499 current_ekm.origin_public_key = my_public_key; 1498 current_ekm.origin_identity = GSC_my_identity;
1500 GNUNET_assert (GNUNET_OK == 1499 GNUNET_assert (GNUNET_OK ==
1501 GNUNET_CRYPTO_ecc_sign (my_private_key, 1500 GNUNET_CRYPTO_ecc_sign (my_private_key,
1502 &current_ekm.purpose, 1501 &current_ekm.purpose,
@@ -1543,9 +1542,8 @@ GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk)
1543{ 1542{
1544 GNUNET_assert (NULL != pk); 1543 GNUNET_assert (NULL != pk);
1545 my_private_key = pk; 1544 my_private_key = pk;
1546 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key); 1545 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
1547 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), 1546 &GSC_my_identity.public_key);
1548 &GSC_my_identity.hashPubKey);
1549 if (GNUNET_YES == 1547 if (GNUNET_YES ==
1550 GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, 1548 GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg,
1551 "core", 1549 "core",
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c
index 3841986ac..d82d119d7 100644
--- a/src/core/gnunet-service-core_neighbours.c
+++ b/src/core/gnunet-service-core_neighbours.c
@@ -111,7 +111,7 @@ struct Neighbour
111/** 111/**
112 * Map of peer identities to 'struct Neighbour'. 112 * Map of peer identities to 'struct Neighbour'.
113 */ 113 */
114static struct GNUNET_CONTAINER_MultiHashMap *neighbours; 114static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
115 115
116/** 116/**
117 * Transport service. 117 * Transport service.
@@ -131,7 +131,7 @@ find_neighbour (const struct GNUNET_PeerIdentity *peer)
131{ 131{
132 if (NULL == neighbours) 132 if (NULL == neighbours)
133 return NULL; 133 return NULL;
134 return GNUNET_CONTAINER_multihashmap_get (neighbours, &peer->hashPubKey); 134 return GNUNET_CONTAINER_multipeermap_get (neighbours, peer);
135} 135}
136 136
137 137
@@ -173,11 +173,11 @@ free_neighbour (struct Neighbour *n)
173 n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK; 173 n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK;
174 } 174 }
175 GNUNET_assert (GNUNET_OK == 175 GNUNET_assert (GNUNET_OK ==
176 GNUNET_CONTAINER_multihashmap_remove (neighbours, 176 GNUNET_CONTAINER_multipeermap_remove (neighbours,
177 &n->peer.hashPubKey, n)); 177 &n->peer, n));
178 GNUNET_STATISTICS_set (GSC_stats, 178 GNUNET_STATISTICS_set (GSC_stats,
179 gettext_noop ("# neighbour entries allocated"), 179 gettext_noop ("# neighbour entries allocated"),
180 GNUNET_CONTAINER_multihashmap_size (neighbours), 180 GNUNET_CONTAINER_multipeermap_size (neighbours),
181 GNUNET_NO); 181 GNUNET_NO);
182 GNUNET_free (n); 182 GNUNET_free (n);
183} 183}
@@ -321,12 +321,12 @@ handle_transport_notify_connect (void *cls,
321 n = GNUNET_malloc (sizeof (struct Neighbour)); 321 n = GNUNET_malloc (sizeof (struct Neighbour));
322 n->peer = *peer; 322 n->peer = *peer;
323 GNUNET_assert (GNUNET_OK == 323 GNUNET_assert (GNUNET_OK ==
324 GNUNET_CONTAINER_multihashmap_put (neighbours, 324 GNUNET_CONTAINER_multipeermap_put (neighbours,
325 &n->peer.hashPubKey, n, 325 &n->peer, n,
326 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 326 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
327 GNUNET_STATISTICS_set (GSC_stats, 327 GNUNET_STATISTICS_set (GSC_stats,
328 gettext_noop ("# neighbour entries allocated"), 328 gettext_noop ("# neighbour entries allocated"),
329 GNUNET_CONTAINER_multihashmap_size (neighbours), 329 GNUNET_CONTAINER_multipeermap_size (neighbours),
330 GNUNET_NO); 330 GNUNET_NO);
331 n->kxinfo = GSC_KX_start (peer); 331 n->kxinfo = GSC_KX_start (peer);
332} 332}
@@ -454,7 +454,7 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target,
454int 454int
455GSC_NEIGHBOURS_init () 455GSC_NEIGHBOURS_init ()
456{ 456{
457 neighbours = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 457 neighbours = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
458 transport = 458 transport =
459 GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL, 459 GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL,
460 &handle_transport_receive, 460 &handle_transport_receive,
@@ -462,7 +462,7 @@ GSC_NEIGHBOURS_init ()
462 &handle_transport_notify_disconnect); 462 &handle_transport_notify_disconnect);
463 if (NULL == transport) 463 if (NULL == transport)
464 { 464 {
465 GNUNET_CONTAINER_multihashmap_destroy (neighbours); 465 GNUNET_CONTAINER_multipeermap_destroy (neighbours);
466 neighbours = NULL; 466 neighbours = NULL;
467 return GNUNET_SYSERR; 467 return GNUNET_SYSERR;
468 } 468 }
@@ -479,7 +479,9 @@ GSC_NEIGHBOURS_init ()
479 * @return GNUNET_OK (continue to iterate) 479 * @return GNUNET_OK (continue to iterate)
480 */ 480 */
481static int 481static int
482free_neighbour_helper (void *cls, const struct GNUNET_HashCode * key, void *value) 482free_neighbour_helper (void *cls,
483 const struct GNUNET_PeerIdentity * key,
484 void *value)
483{ 485{
484 struct Neighbour *n = value; 486 struct Neighbour *n = value;
485 487
@@ -503,9 +505,9 @@ GSC_NEIGHBOURS_done ()
503 } 505 }
504 if (NULL != neighbours) 506 if (NULL != neighbours)
505 { 507 {
506 GNUNET_CONTAINER_multihashmap_iterate (neighbours, &free_neighbour_helper, 508 GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_helper,
507 NULL); 509 NULL);
508 GNUNET_CONTAINER_multihashmap_destroy (neighbours); 510 GNUNET_CONTAINER_multipeermap_destroy (neighbours);
509 neighbours = NULL; 511 neighbours = NULL;
510 } 512 }
511} 513}
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index f1a53bee8..6c66086bd 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -147,7 +147,7 @@ struct Session
147/** 147/**
148 * Map of peer identities to 'struct Session'. 148 * Map of peer identities to 'struct Session'.
149 */ 149 */
150static struct GNUNET_CONTAINER_MultiHashMap *sessions; 150static struct GNUNET_CONTAINER_MultiPeerMap *sessions;
151 151
152 152
153/** 153/**
@@ -160,7 +160,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *sessions;
160static struct Session * 160static struct Session *
161find_session (const struct GNUNET_PeerIdentity *peer) 161find_session (const struct GNUNET_PeerIdentity *peer)
162{ 162{
163 return GNUNET_CONTAINER_multihashmap_get (sessions, &peer->hashPubKey); 163 return GNUNET_CONTAINER_multipeermap_get (sessions, peer);
164} 164}
165 165
166 166
@@ -202,12 +202,11 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
202 GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, 202 GSC_CLIENTS_notify_clients_about_neighbour (&session->peer,
203 session->tmap, NULL); 203 session->tmap, NULL);
204 GNUNET_assert (GNUNET_YES == 204 GNUNET_assert (GNUNET_YES ==
205 GNUNET_CONTAINER_multihashmap_remove (sessions, 205 GNUNET_CONTAINER_multipeermap_remove (sessions,
206 &session-> 206 &session->peer,
207 peer.hashPubKey,
208 session)); 207 session));
209 GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), 208 GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"),
210 GNUNET_CONTAINER_multihashmap_size (sessions), 209 GNUNET_CONTAINER_multipeermap_size (sessions),
211 GNUNET_NO); 210 GNUNET_NO);
212 GSC_TYPEMAP_destroy (session->tmap); 211 GSC_TYPEMAP_destroy (session->tmap);
213 session->tmap = NULL; 212 session->tmap = NULL;
@@ -273,11 +272,11 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer,
273 session->typemap_task = 272 session->typemap_task =
274 GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session); 273 GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session);
275 GNUNET_assert (GNUNET_OK == 274 GNUNET_assert (GNUNET_OK ==
276 GNUNET_CONTAINER_multihashmap_put (sessions, &peer->hashPubKey, 275 GNUNET_CONTAINER_multipeermap_put (sessions, peer,
277 session, 276 session,
278 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 277 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
279 GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"), 278 GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"),
280 GNUNET_CONTAINER_multihashmap_size (sessions), 279 GNUNET_CONTAINER_multipeermap_size (sessions),
281 GNUNET_NO); 280 GNUNET_NO);
282 GSC_CLIENTS_notify_clients_about_neighbour (peer, 281 GSC_CLIENTS_notify_clients_about_neighbour (peer,
283 NULL, session->tmap); 282 NULL, session->tmap);
@@ -293,7 +292,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer,
293 * @return GNUNET_OK (continue to iterate) 292 * @return GNUNET_OK (continue to iterate)
294 */ 293 */
295static int 294static int
296notify_client_about_session (void *cls, const struct GNUNET_HashCode * key, 295notify_client_about_session (void *cls, const struct GNUNET_PeerIdentity * key,
297 void *value) 296 void *value)
298{ 297{
299 struct GSC_Client *client = cls; 298 struct GSC_Client *client = cls;
@@ -315,7 +314,7 @@ void
315GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client) 314GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client)
316{ 315{
317 /* notify new client about existing sessions */ 316 /* notify new client about existing sessions */
318 GNUNET_CONTAINER_multihashmap_iterate (sessions, &notify_client_about_session, 317 GNUNET_CONTAINER_multipeermap_iterate (sessions, &notify_client_about_session,
319 client); 318 client);
320} 319}
321 320
@@ -559,7 +558,7 @@ try_transmission (struct Session *session)
559 * @return always GNUNET_OK 558 * @return always GNUNET_OK
560 */ 559 */
561static int 560static int
562do_send_message (void *cls, const struct GNUNET_HashCode * key, void *value) 561do_send_message (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
563{ 562{
564 const struct GNUNET_MessageHeader *hdr = cls; 563 const struct GNUNET_MessageHeader *hdr = cls;
565 struct Session *session = value; 564 struct Session *session = value;
@@ -586,7 +585,7 @@ GSC_SESSIONS_broadcast (const struct GNUNET_MessageHeader *msg)
586{ 585{
587 if (NULL == sessions) 586 if (NULL == sessions)
588 return; 587 return;
589 GNUNET_CONTAINER_multihashmap_iterate (sessions, &do_send_message, 588 GNUNET_CONTAINER_multipeermap_iterate (sessions, &do_send_message,
590 (void *) msg); 589 (void *) msg);
591} 590}
592 591
@@ -652,7 +651,7 @@ GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
652 */ 651 */
653#include "core.h" 652#include "core.h"
654static int 653static int
655queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void *value) 654queue_connect_message (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
656{ 655{
657 struct GNUNET_SERVER_TransmitContext *tc = cls; 656 struct GNUNET_SERVER_TransmitContext *tc = cls;
658 struct Session *session = value; 657 struct Session *session = value;
@@ -687,7 +686,7 @@ GSC_SESSIONS_handle_client_iterate_peers (void *cls,
687 struct GNUNET_SERVER_TransmitContext *tc; 686 struct GNUNET_SERVER_TransmitContext *tc;
688 687
689 tc = GNUNET_SERVER_transmit_context_create (client); 688 tc = GNUNET_SERVER_transmit_context_create (client);
690 GNUNET_CONTAINER_multihashmap_iterate (sessions, &queue_connect_message, tc); 689 GNUNET_CONTAINER_multipeermap_iterate (sessions, &queue_connect_message, tc);
691 done_msg.size = htons (sizeof (struct GNUNET_MessageHeader)); 690 done_msg.size = htons (sizeof (struct GNUNET_MessageHeader));
692 done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END); 691 done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END);
693 GNUNET_SERVER_transmit_context_append_message (tc, &done_msg); 692 GNUNET_SERVER_transmit_context_append_message (tc, &done_msg);
@@ -760,7 +759,7 @@ GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer,
760void 759void
761GSC_SESSIONS_init () 760GSC_SESSIONS_init ()
762{ 761{
763 sessions = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 762 sessions = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
764} 763}
765 764
766 765
@@ -773,7 +772,7 @@ GSC_SESSIONS_init ()
773 * @return GNUNET_OK (continue to iterate) 772 * @return GNUNET_OK (continue to iterate)
774 */ 773 */
775static int 774static int
776free_session_helper (void *cls, const struct GNUNET_HashCode * key, void *value) 775free_session_helper (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
777{ 776{
778 struct Session *session = value; 777 struct Session *session = value;
779 778
@@ -790,8 +789,8 @@ GSC_SESSIONS_done ()
790{ 789{
791 if (NULL != sessions) 790 if (NULL != sessions)
792 { 791 {
793 GNUNET_CONTAINER_multihashmap_iterate (sessions, &free_session_helper, NULL); 792 GNUNET_CONTAINER_multipeermap_iterate (sessions, &free_session_helper, NULL);
794 GNUNET_CONTAINER_multihashmap_destroy (sessions); 793 GNUNET_CONTAINER_multipeermap_destroy (sessions);
795 sessions = NULL; 794 sessions = NULL;
796 } 795 }
797} 796}
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c
index 2ce7f1925..d3415d11d 100644
--- a/src/dht/gnunet-service-dht_hello.c
+++ b/src/dht/gnunet-service-dht_hello.c
@@ -40,7 +40,7 @@ static struct GNUNET_PEERINFO_NotifyContext *pnc;
40/** 40/**
41 * Hash map of peers to HELLOs. 41 * Hash map of peers to HELLOs.
42 */ 42 */
43static struct GNUNET_CONTAINER_MultiHashMap *peer_to_hello; 43static struct GNUNET_CONTAINER_MultiPeerMap *peer_to_hello;
44 44
45 45
46/** 46/**
@@ -54,7 +54,7 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
54{ 54{
55 if (NULL == peer_to_hello) 55 if (NULL == peer_to_hello)
56 return NULL; 56 return NULL;
57 return GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey); 57 return GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
58} 58}
59 59
60 60
@@ -81,13 +81,13 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
81 GNUNET_STATISTICS_update (GDS_stats, 81 GNUNET_STATISTICS_update (GDS_stats,
82 gettext_noop ("# HELLOs obtained from peerinfo"), 1, 82 gettext_noop ("# HELLOs obtained from peerinfo"), 1,
83 GNUNET_NO); 83 GNUNET_NO);
84 hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey); 84 hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
85 GNUNET_free_non_null (hm); 85 GNUNET_free_non_null (hm);
86 hm = GNUNET_malloc (GNUNET_HELLO_size (hello)); 86 hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
87 memcpy (hm, hello, GNUNET_HELLO_size (hello)); 87 memcpy (hm, hello, GNUNET_HELLO_size (hello));
88 GNUNET_assert (GNUNET_SYSERR != 88 GNUNET_assert (GNUNET_SYSERR !=
89 GNUNET_CONTAINER_multihashmap_put (peer_to_hello, 89 GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
90 &peer->hashPubKey, hm, 90 peer, hm,
91 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)); 91 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
92} 92}
93 93
@@ -99,7 +99,7 @@ void
99GDS_HELLO_init () 99GDS_HELLO_init ()
100{ 100{
101 pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL); 101 pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL);
102 peer_to_hello = GNUNET_CONTAINER_multihashmap_create (256, GNUNET_NO); 102 peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
103} 103}
104 104
105 105
@@ -107,7 +107,9 @@ GDS_HELLO_init ()
107 * Free memory occopied by the HELLO. 107 * Free memory occopied by the HELLO.
108 */ 108 */
109static int 109static int
110free_hello (void *cls, const struct GNUNET_HashCode * key, void *hello) 110free_hello (void *cls,
111 const struct GNUNET_PeerIdentity *key,
112 void *hello)
111{ 113{
112 GNUNET_free (hello); 114 GNUNET_free (hello);
113 return GNUNET_OK; 115 return GNUNET_OK;
@@ -127,8 +129,8 @@ GDS_HELLO_done ()
127 } 129 }
128 if (NULL != peer_to_hello) 130 if (NULL != peer_to_hello)
129 { 131 {
130 GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello, &free_hello, NULL); 132 GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL);
131 GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello); 133 GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello);
132 } 134 }
133} 135}
134 136
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 11ba71aef..62c29e421 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -26,8 +26,8 @@
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_block_lib.h"
30#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_block_lib.h"
31#include "gnunet_hello_lib.h" 31#include "gnunet_hello_lib.h"
32#include "gnunet_constants.h" 32#include "gnunet_constants.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index ac4732cff..a21167fb0 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -42,11 +42,11 @@
42 * @param type block type 42 * @param type block type
43 * @param query original query (hash) 43 * @param query original query (hash)
44 * @param bf pointer to bloom filter associated with query; possibly updated (!) 44 * @param bf pointer to bloom filter associated with query; possibly updated (!)
45 * @param bf_mutator mutation value for bf 45 * @param bf_mutator mutation value for @a bf
46 * @param xquery extended query data (can be NULL, depending on type) 46 * @param xquery extended query data (can be NULL, depending on type)
47 * @param xquery_size number of bytes in xquery 47 * @param xquery_size number of bytes in @a xquery
48 * @param reply_block response to validate 48 * @param reply_block response to validate
49 * @param reply_block_size number of bytes in reply block 49 * @param reply_block_size number of bytes in @a reply_block
50 * @return characterization of result 50 * @return characterization of result
51 */ 51 */
52static enum GNUNET_BLOCK_EvaluationResult 52static enum GNUNET_BLOCK_EvaluationResult
@@ -61,6 +61,7 @@ block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
61 const struct GNUNET_HELLO_Message *hello; 61 const struct GNUNET_HELLO_Message *hello;
62 struct GNUNET_PeerIdentity pid; 62 struct GNUNET_PeerIdentity pid;
63 const struct GNUNET_MessageHeader *msg; 63 const struct GNUNET_MessageHeader *msg;
64 struct GNUNET_HashCode phash;
64 65
65 if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) 66 if (type != GNUNET_BLOCK_TYPE_DHT_HELLO)
66 return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; 67 return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
@@ -90,7 +91,8 @@ block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
90 } 91 }
91 if (NULL != bf) 92 if (NULL != bf)
92 { 93 {
93 GNUNET_BLOCK_mingle_hash (&pid.hashPubKey, bf_mutator, &mhash); 94 GNUNET_CRYPTO_hash (&pid, sizeof (pid), &phash);
95 GNUNET_BLOCK_mingle_hash (&phash, bf_mutator, &mhash);
94 if (NULL != *bf) 96 if (NULL != *bf)
95 { 97 {
96 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) 98 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash))
@@ -114,9 +116,9 @@ block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
114 * @param cls closure 116 * @param cls closure
115 * @param type block type 117 * @param type block type
116 * @param block block to get the key for 118 * @param block block to get the key for
117 * @param block_size number of bytes in block 119 * @param block_size number of bytes @a block
118 * @param key set to the key (query) for the given block 120 * @param key set to the key (query) for the given block
119 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 121 * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
120 * (or if extracting a key from a block of this type does not work) 122 * (or if extracting a key from a block of this type does not work)
121 */ 123 */
122static int 124static int
diff --git a/src/include/gnunet_nse_service.h b/src/include/gnunet_nse_service.h
index edec078ba..d52315ea9 100644
--- a/src/include/gnunet_nse_service.h
+++ b/src/include/gnunet_nse_service.h
@@ -39,9 +39,7 @@ extern "C"
39#endif 39#endif
40#endif 40#endif
41 41
42#include "gnunet_common.h" 42#include "gnunet_util_lib.h"
43#include "gnunet_configuration_lib.h"
44#include "gnunet_scheduler_lib.h"
45 43
46/** 44/**
47 * Version of the network size estimation API. 45 * Version of the network size estimation API.
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 98ace893e..2453c7e11 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -189,7 +189,7 @@ struct GNUNET_NSE_FloodMessage
189 /** 189 /**
190 * Public key of the originator. 190 * Public key of the originator.
191 */ 191 */
192 struct GNUNET_CRYPTO_EccPublicSignKey pkey; 192 struct GNUNET_PeerIdentity origin;
193 193
194 /** 194 /**
195 * Proof of work, causing leading zeros when hashed with pkey. 195 * Proof of work, causing leading zeros when hashed with pkey.
@@ -221,7 +221,7 @@ static struct GNUNET_CORE_Handle *coreAPI;
221/** 221/**
222 * Map of all connected peers. 222 * Map of all connected peers.
223 */ 223 */
224static struct GNUNET_CONTAINER_MultiHashMap *peers; 224static struct GNUNET_CONTAINER_MultiPeerMap *peers;
225 225
226/** 226/**
227 * The current network size estimate. Number of bits matching on 227 * The current network size estimate. Number of bits matching on
@@ -286,11 +286,6 @@ static struct GNUNET_TIME_Absolute next_timestamp;
286static struct GNUNET_TIME_Absolute current_timestamp; 286static struct GNUNET_TIME_Absolute current_timestamp;
287 287
288/** 288/**
289 * The public key of this peer.
290 */
291static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
292
293/**
294 * The private key of this peer. 289 * The private key of this peer.
295 */ 290 */
296static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; 291static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
@@ -392,7 +387,7 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
392 em->reserved = htonl (0); 387 em->reserved = htonl (0);
393 em->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 388 em->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
394 double se = mean - 0.332747; 389 double se = mean - 0.332747;
395 nsize = log2 (GNUNET_CONTAINER_multihashmap_size (peers) + 1); 390 nsize = log2 (GNUNET_CONTAINER_multipeermap_size (peers) + 1);
396 em->size_estimate = GNUNET_hton_double (GNUNET_MAX (se, nsize)); 391 em->size_estimate = GNUNET_hton_double (GNUNET_MAX (se, nsize));
397 em->std_deviation = GNUNET_hton_double (std_dev); 392 em->std_deviation = GNUNET_hton_double (std_dev);
398 GNUNET_STATISTICS_set (stats, "# nodes in the network (estimate)", 393 GNUNET_STATISTICS_set (stats, "# nodes in the network (estimate)",
@@ -510,10 +505,12 @@ get_matching_bits (struct GNUNET_TIME_Absolute timestamp,
510 const struct GNUNET_PeerIdentity *id) 505 const struct GNUNET_PeerIdentity *id)
511{ 506{
512 struct GNUNET_HashCode timestamp_hash; 507 struct GNUNET_HashCode timestamp_hash;
508 struct GNUNET_HashCode pid_hash;
513 509
514 GNUNET_CRYPTO_hash (&timestamp.abs_value_us, sizeof (timestamp.abs_value_us), 510 GNUNET_CRYPTO_hash (&timestamp.abs_value_us, sizeof (timestamp.abs_value_us),
515 &timestamp_hash); 511 &timestamp_hash);
516 return GNUNET_CRYPTO_hash_matching_bits (&timestamp_hash, &id->hashPubKey); 512 GNUNET_CRYPTO_hash (id, sizeof (struct GNUNET_PeerIdentity), &pid_hash);
513 return GNUNET_CRYPTO_hash_matching_bits (&timestamp_hash, &pid_hash);
517} 514}
518 515
519 516
@@ -716,7 +713,7 @@ setup_flood_message (unsigned int slot,
716 sizeof (struct GNUNET_CRYPTO_EccSignature)); 713 sizeof (struct GNUNET_CRYPTO_EccSignature));
717 fm->matching_bits = htonl (matching_bits); 714 fm->matching_bits = htonl (matching_bits);
718 fm->timestamp = GNUNET_TIME_absolute_hton (ts); 715 fm->timestamp = GNUNET_TIME_absolute_hton (ts);
719 fm->pkey = my_public_key; 716 fm->origin = my_identity;
720 fm->proof_of_work = my_proof; 717 fm->proof_of_work = my_proof;
721 if (nse_work_required > 0) 718 if (nse_work_required > 0)
722 GNUNET_assert (GNUNET_OK == 719 GNUNET_assert (GNUNET_OK ==
@@ -738,7 +735,7 @@ setup_flood_message (unsigned int slot,
738 */ 735 */
739static int 736static int
740schedule_current_round (void *cls, 737schedule_current_round (void *cls,
741 const struct GNUNET_HashCode * key, 738 const struct GNUNET_PeerIdentity * key,
742 void *value) 739 void *value)
743{ 740{
744 struct NSEPeerEntry *peer_entry = value; 741 struct NSEPeerEntry *peer_entry = value;
@@ -817,7 +814,7 @@ update_flood_message (void *cls,
817 for (i = 0; i < HISTORY_SIZE; i++) 814 for (i = 0; i < HISTORY_SIZE; i++)
818 hop_count_max = 815 hop_count_max =
819 GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max); 816 GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max);
820 GNUNET_CONTAINER_multihashmap_iterate (peers, &schedule_current_round, NULL); 817 GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL);
821 flood_task = 818 flood_task =
822 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining 819 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
823 (next_timestamp), &update_flood_message, 820 (next_timestamp), &update_flood_message,
@@ -907,8 +904,8 @@ find_proof (void *cls,
907 unsigned int i; 904 unsigned int i;
908 905
909 proof_task = GNUNET_SCHEDULER_NO_TASK; 906 proof_task = GNUNET_SCHEDULER_NO_TASK;
910 memcpy (&buf[sizeof (uint64_t)], &my_public_key, 907 memcpy (&buf[sizeof (uint64_t)], &my_identity,
911 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); 908 sizeof (struct GNUNET_PeerIdentity));
912 i = 0; 909 i = 0;
913 counter = my_proof; 910 counter = my_proof;
914 while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) 911 while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
@@ -959,7 +956,7 @@ static int
959verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood) 956verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
960{ 957{
961 if (GNUNET_YES != 958 if (GNUNET_YES !=
962 check_proof_of_work (&incoming_flood->pkey, 959 check_proof_of_work (&incoming_flood->origin.public_key,
963 incoming_flood->proof_of_work)) 960 incoming_flood->proof_of_work))
964 { 961 {
965 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work invalid: %llu!\n", 962 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work invalid: %llu!\n",
@@ -973,7 +970,7 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
973 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND, 970 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
974 &incoming_flood->purpose, 971 &incoming_flood->purpose,
975 &incoming_flood->signature, 972 &incoming_flood->signature,
976 &incoming_flood->pkey))) 973 &incoming_flood->origin.public_key)))
977 { 974 {
978 GNUNET_break_op (0); 975 GNUNET_break_op (0);
979 return GNUNET_NO; 976 return GNUNET_NO;
@@ -993,7 +990,7 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
993 */ 990 */
994static int 991static int
995update_flood_times (void *cls, 992update_flood_times (void *cls,
996 const struct GNUNET_HashCode *key, 993 const struct GNUNET_PeerIdentity *key,
997 void *value) 994 void *value)
998{ 995{
999 struct NSEPeerEntry *exclude = cls; 996 struct NSEPeerEntry *exclude = cls;
@@ -1062,11 +1059,14 @@ handle_p2p_size_estimate (void *cls,
1062 char pred[5]; 1059 char pred[5];
1063 struct GNUNET_PeerIdentity os; 1060 struct GNUNET_PeerIdentity os;
1064 1061
1065 GNUNET_CRYPTO_hash (&incoming_flood->pkey, 1062 GNUNET_snprintf (origin,
1066 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 1063 sizeof (origin),
1067 &os.hashPubKey); 1064 "%4s",
1068 GNUNET_snprintf (origin, sizeof (origin), "%s", GNUNET_i2s (&os)); 1065 GNUNET_i2s (&incoming_flood->origin));
1069 GNUNET_snprintf (pred, sizeof (pred), "%s", GNUNET_i2s (peer)); 1066 GNUNET_snprintf (pred,
1067 sizeof (pred),
1068 "%4s",
1069 GNUNET_i2s (peer));
1070 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1070 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1071 "Flood at %s from `%s' via `%s' at `%s' with bits %u\n", 1071 "Flood at %s from `%s' via `%s' at `%s' with bits %u\n",
1072 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp)), 1072 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp)),
@@ -1075,7 +1075,7 @@ handle_p2p_size_estimate (void *cls,
1075 } 1075 }
1076#endif 1076#endif
1077 1077
1078 peer_entry = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); 1078 peer_entry = GNUNET_CONTAINER_multipeermap_get (peers, peer);
1079 if (NULL == peer_entry) 1079 if (NULL == peer_entry)
1080 { 1080 {
1081 GNUNET_break (0); 1081 GNUNET_break (0);
@@ -1117,7 +1117,8 @@ handle_p2p_size_estimate (void *cls,
1117 { 1117 {
1118 /* send to self, update our own estimate IF this also comes from us! */ 1118 /* send to self, update our own estimate IF this also comes from us! */
1119 if (0 == 1119 if (0 ==
1120 memcmp (&incoming_flood->pkey, &my_public_key, sizeof (my_public_key))) 1120 memcmp (&incoming_flood->origin,
1121 &my_identity, sizeof (my_identity)))
1121 update_network_size_estimate (); 1122 update_network_size_estimate ();
1122 return GNUNET_OK; 1123 return GNUNET_OK;
1123 } 1124 }
@@ -1205,7 +1206,7 @@ handle_p2p_size_estimate (void *cls,
1205 update_network_size_estimate (); 1206 update_network_size_estimate ();
1206 1207
1207 /* flood to rest */ 1208 /* flood to rest */
1208 GNUNET_CONTAINER_multihashmap_iterate (peers, &update_flood_times, 1209 GNUNET_CONTAINER_multipeermap_iterate (peers, &update_flood_times,
1209 peer_entry); 1210 peer_entry);
1210 return GNUNET_OK; 1211 return GNUNET_OK;
1211} 1212}
@@ -1230,7 +1231,7 @@ handle_core_connect (void *cls,
1230 peer_entry = GNUNET_new (struct NSEPeerEntry); 1231 peer_entry = GNUNET_new (struct NSEPeerEntry);
1231 peer_entry->id = *peer; 1232 peer_entry->id = *peer;
1232 GNUNET_assert (GNUNET_OK == 1233 GNUNET_assert (GNUNET_OK ==
1233 GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey, 1234 GNUNET_CONTAINER_multipeermap_put (peers, peer,
1234 peer_entry, 1235 peer_entry,
1235 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 1236 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1236 peer_entry->transmit_task = 1237 peer_entry->transmit_task =
@@ -1256,14 +1257,14 @@ handle_core_disconnect (void *cls,
1256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1257 "Peer `%s' disconnected from us\n", 1258 "Peer `%s' disconnected from us\n",
1258 GNUNET_i2s (peer)); 1259 GNUNET_i2s (peer));
1259 pos = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); 1260 pos = GNUNET_CONTAINER_multipeermap_get (peers, peer);
1260 if (NULL == pos) 1261 if (NULL == pos)
1261 { 1262 {
1262 GNUNET_break (0); 1263 GNUNET_break (0);
1263 return; 1264 return;
1264 } 1265 }
1265 GNUNET_assert (GNUNET_YES == 1266 GNUNET_assert (GNUNET_YES ==
1266 GNUNET_CONTAINER_multihashmap_remove (peers, &peer->hashPubKey, 1267 GNUNET_CONTAINER_multipeermap_remove (peers, peer,
1267 pos)); 1268 pos));
1268 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) { 1269 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) {
1269 GNUNET_SCHEDULER_cancel (pos->transmit_task); 1270 GNUNET_SCHEDULER_cancel (pos->transmit_task);
@@ -1335,7 +1336,7 @@ shutdown_task (void *cls,
1335 } 1336 }
1336 if (NULL != peers) 1337 if (NULL != peers)
1337 { 1338 {
1338 GNUNET_CONTAINER_multihashmap_destroy (peers); 1339 GNUNET_CONTAINER_multipeermap_destroy (peers);
1339 peers = NULL; 1340 peers = NULL;
1340 } 1341 }
1341 if (NULL != my_private_key) 1342 if (NULL != my_private_key)
@@ -1381,7 +1382,7 @@ core_init (void *cls,
1381 GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval); 1382 GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval);
1382 estimate_index = HISTORY_SIZE - 1; 1383 estimate_index = HISTORY_SIZE - 1;
1383 estimate_count = 0; 1384 estimate_count = 0;
1384 if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof)) 1385 if (GNUNET_YES == check_proof_of_work (&my_identity.public_key, my_proof))
1385 { 1386 {
1386 int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE; 1387 int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE;
1387 prev_time.abs_value_us = 1388 prev_time.abs_value_us =
@@ -1476,9 +1477,8 @@ run (void *cls,
1476 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); 1477 pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
1477 GNUNET_assert (NULL != pk); 1478 GNUNET_assert (NULL != pk);
1478 my_private_key = pk; 1479 my_private_key = pk;
1479 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key); 1480 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
1480 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), 1481 &my_identity.public_key);
1481 &my_identity.hashPubKey);
1482 if (GNUNET_OK != 1482 if (GNUNET_OK !=
1483 GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof)) 1483 GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof))
1484 { 1484 {
@@ -1499,7 +1499,7 @@ run (void *cls,
1499 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, 1499 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
1500 &find_proof, NULL); 1500 &find_proof, NULL);
1501 1501
1502 peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 1502 peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
1503 GNUNET_SERVER_add_handlers (srv, handlers); 1503 GNUNET_SERVER_add_handlers (srv, handlers);
1504 nc = GNUNET_SERVER_notification_context_create (srv, 1); 1504 nc = GNUNET_SERVER_notification_context_create (srv, 1);
1505 /* Connect to core service and register core handlers */ 1505 /* Connect to core service and register core handlers */
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 8963637c9..af7a8f757 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -190,11 +190,6 @@ static struct GNUNET_PEERINFO_IteratorContext *pic;
190static struct GNUNET_PeerIdentity my_peer_identity; 190static struct GNUNET_PeerIdentity my_peer_identity;
191 191
192/** 192/**
193 * My public key.
194 */
195static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
196
197/**
198 * Head of list of print contexts. 193 * Head of list of print contexts.
199 */ 194 */
200static struct PrintContext *pc_head; 195static struct PrintContext *pc_head;
@@ -232,13 +227,11 @@ state_machine (void *cls,
232static void 227static void
233dump_pc (struct PrintContext *pc) 228dump_pc (struct PrintContext *pc)
234{ 229{
235 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
236 unsigned int i; 230 unsigned int i;
237 231
238 GNUNET_CRYPTO_hash_to_enc (&pc->peer.hashPubKey, &enc);
239 printf (_("%sPeer `%s'\n"), 232 printf (_("%sPeer `%s'\n"),
240 (GNUNET_YES == pc->friend_only) ? "F2F: " : "", 233 (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
241 (const char *) &enc); 234 GNUNET_i2s_full (&pc->peer));
242 for (i = 0; i < pc->num_addresses; i++) 235 for (i = 0; i < pc->num_addresses; i++)
243 { 236 {
244 if (NULL != pc->address_list[i].result) 237 if (NULL != pc->address_list[i].result)
@@ -345,7 +338,6 @@ static void
345print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, 338print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
346 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 339 const struct GNUNET_HELLO_Message *hello, const char *err_msg)
347{ 340{
348 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
349 struct PrintContext *pc; 341 struct PrintContext *pc;
350 int friend_only; 342 int friend_only;
351 343
@@ -367,10 +359,9 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
367 friend_only = GNUNET_HELLO_is_friend_only (hello); 359 friend_only = GNUNET_HELLO_is_friend_only (hello);
368 if ((GNUNET_YES == be_quiet) || (NULL == hello)) 360 if ((GNUNET_YES == be_quiet) || (NULL == hello))
369 { 361 {
370 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
371 printf ("%s%s\n", 362 printf ("%s%s\n",
372 (GNUNET_YES == friend_only) ? "F2F: " : "", 363 (GNUNET_YES == friend_only) ? "F2F: " : "",
373 (const char *) &enc); 364 GNUNET_i2s_full (peer));
374 return; 365 return;
375 } 366 }
376 pc = GNUNET_malloc (sizeof (struct PrintContext)); 367 pc = GNUNET_malloc (sizeof (struct PrintContext));
@@ -546,7 +537,8 @@ parse_hello_uri (const char *put_uri)
546{ 537{
547 struct GNUNET_HELLO_Message *hello = NULL; 538 struct GNUNET_HELLO_Message *hello = NULL;
548 539
549 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_public_key, &hello, &GPI_plugins_find); 540 int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key,
541 &hello, &GPI_plugins_find);
550 542
551 if (NULL != hello) { 543 if (NULL != hello) {
552 /* WARNING: this adds the address from URI WITHOUT verification! */ 544 /* WARNING: this adds the address from URI WITHOUT verification! */
@@ -677,9 +669,9 @@ run (void *cls, char *const *args, const char *cfgfile,
677 return; 669 return;
678 } 670 }
679 GNUNET_free (fn); 671 GNUNET_free (fn);
680 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &my_public_key); 672 GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv,
673 &my_peer_identity.public_key);
681 GNUNET_free (priv); 674 GNUNET_free (priv);
682 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), &my_peer_identity.hashPubKey);
683 } 675 }
684 676
685 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 677 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
@@ -725,14 +717,14 @@ state_machine (void *cls,
725 } 717 }
726 else if (GNUNET_YES == get_self) 718 else if (GNUNET_YES == get_self)
727 { 719 {
728 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
729 get_self = GNUNET_NO; 720 get_self = GNUNET_NO;
730 GNUNET_CRYPTO_hash_to_enc (&my_peer_identity.hashPubKey, &enc);
731 if (be_quiet) 721 if (be_quiet)
732 printf ("%s\n", (char *) &enc); 722 printf ("%s\n",
723 GNUNET_i2s_full (&my_peer_identity));
733 else 724 else
734 printf (_("I am peer `%s'.\n"), (const char *) &enc); 725 printf (_("I am peer `%s'.\n"),
735 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 726 GNUNET_i2s_full (&my_peer_identity));
727 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
736 } 728 }
737 else if (GNUNET_YES == get_uri) 729 else if (GNUNET_YES == get_uri)
738 { 730 {
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c
index 264397735..d14944362 100644
--- a/src/testbed/gnunet-daemon-testbed-blacklist.c
+++ b/src/testbed/gnunet-daemon-testbed-blacklist.c
@@ -56,7 +56,7 @@
56/** 56/**
57 * The map to store the peer identities to allow/deny 57 * The map to store the peer identities to allow/deny
58 */ 58 */
59static struct GNUNET_CONTAINER_MultiHashMap *map; 59static struct GNUNET_CONTAINER_MultiPeerMap *map;
60 60
61/** 61/**
62 * The array of peer identities we read from whitelist/blacklist 62 * The array of peer identities we read from whitelist/blacklist
@@ -92,9 +92,9 @@ static int mode;
92 * #GNUNET_NO if not. 92 * #GNUNET_NO if not.
93 */ 93 */
94static int 94static int
95iterator (void *cls, const struct GNUNET_HashCode *key, void *value) 95iterator (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
96{ 96{
97 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (map, key, 97 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (map, key,
98 value)); 98 value));
99 return GNUNET_YES; 99 return GNUNET_YES;
100} 100}
@@ -108,10 +108,10 @@ cleanup_map ()
108{ 108{
109 if (NULL != map) 109 if (NULL != map)
110 { 110 {
111 GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_iterate (map, 111 GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multipeermap_iterate (map,
112 &iterator, 112 &iterator,
113 NULL)); 113 NULL));
114 GNUNET_CONTAINER_multihashmap_destroy (map); 114 GNUNET_CONTAINER_multipeermap_destroy (map);
115 map = NULL; 115 map = NULL;
116 } 116 }
117} 117}
@@ -145,7 +145,7 @@ check_access (void *cls, const struct GNUNET_PeerIdentity * pid)
145 int contains; 145 int contains;
146 146
147 if (NULL != map) 147 if (NULL != map)
148 contains = GNUNET_CONTAINER_multihashmap_contains (map, &(pid->hashPubKey)); 148 contains = GNUNET_CONTAINER_multipeermap_contains (map, pid);
149 else 149 else
150 contains = GNUNET_NO; 150 contains = GNUNET_NO;
151 if (ACCESS_DENY == mode) 151 if (ACCESS_DENY == mode)
@@ -178,13 +178,13 @@ setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg)
178 npeers = fsize / sizeof (struct GNUNET_PeerIdentity); 178 npeers = fsize / sizeof (struct GNUNET_PeerIdentity);
179 if (0 != npeers) 179 if (0 != npeers)
180 { 180 {
181 map = GNUNET_CONTAINER_multihashmap_create (npeers, GNUNET_YES); 181 map = GNUNET_CONTAINER_multipeermap_create (npeers, GNUNET_YES);
182 ilist = GNUNET_malloc_large (fsize); 182 ilist = GNUNET_malloc_large (fsize);
183 GNUNET_assert (fsize == GNUNET_DISK_fn_read (fname, ilist, fsize)); 183 GNUNET_assert (fsize == GNUNET_DISK_fn_read (fname, ilist, fsize));
184 } 184 }
185 for (cnt = 0; cnt < npeers; cnt++) 185 for (cnt = 0; cnt < npeers; cnt++)
186 { 186 {
187 if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (map, &(ilist[cnt].hashPubKey), 187 if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_put (map, &ilist[cnt],
188 &ilist[cnt], 188 &ilist[cnt],
189 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 189 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
190 { 190 {
diff --git a/src/testbed/gnunet-service-testbed_meminfo.c b/src/testbed/gnunet-service-testbed_meminfo.c
index a875050ac..3914a324d 100644
--- a/src/testbed/gnunet-service-testbed_meminfo.c
+++ b/src/testbed/gnunet-service-testbed_meminfo.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21#include "platform.h" 21#include "platform.h"
22#include "gnunet_common.h" 22#include "gnunet_util_lib.h"
23 23
24/* 24/*
25 * File for parsing top-level /proc entities. 25 * File for parsing top-level /proc entities.
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 0b36fed9f..8d85280fe 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -25,7 +25,6 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_common.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_testbed_service.h" 29#include "gnunet_testbed_service.h"
31#include "testbed_api_hosts.h" 30#include "testbed_api_hosts.h"
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index e6330ea89..f781eea0d 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -657,7 +657,7 @@ struct GNUNET_TESTBED_PeerConfigurationInformationMessage
657 /** 657 /**
658 * Identity of the peer. 658 * Identity of the peer.
659 */ 659 */
660 struct GNUNET_PeerIdentity peer_identity GNUNET_PACKED; 660 struct GNUNET_PeerIdentity peer_identity;
661 661
662 /** 662 /**
663 * The size of configuration when uncompressed 663 * The size of configuration when uncompressed
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index f09bb61b9..3b6678c56 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -27,7 +27,7 @@
27#ifndef TESTBED_API_H 27#ifndef TESTBED_API_H
28#define TESTBED_API_H 28#define TESTBED_API_H
29 29
30#include "gnunet_scheduler_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_testbed_service.h" 31#include "gnunet_testbed_service.h"
32#include "testbed.h" 32#include "testbed.h"
33#include "testbed_helper.h" 33#include "testbed_helper.h"