[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29725 - in gnunet/src: ats-tool core dht include nse peeri
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29725 - in gnunet/src: ats-tool core dht include nse peerinfo-tool testbed |
Date: |
Mon, 30 Sep 2013 23:03:31 +0200 |
Author: grothoff
Date: 2013-09-30 23:03:31 +0200 (Mon, 30 Sep 2013)
New Revision: 29725
Modified:
gnunet/src/ats-tool/gnunet-ats.c
gnunet/src/core/core_api.c
gnunet/src/core/gnunet-core.c
gnunet/src/core/gnunet-service-core_clients.c
gnunet/src/core/gnunet-service-core_kx.c
gnunet/src/core/gnunet-service-core_neighbours.c
gnunet/src/core/gnunet-service-core_sessions.c
gnunet/src/dht/gnunet-service-dht_hello.c
gnunet/src/dht/gnunet-service-dht_neighbours.c
gnunet/src/dht/plugin_block_dht.c
gnunet/src/include/gnunet_nse_service.h
gnunet/src/nse/gnunet-service-nse.c
gnunet/src/peerinfo-tool/gnunet-peerinfo.c
gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c
gnunet/src/testbed/gnunet-service-testbed_meminfo.c
gnunet/src/testbed/gnunet-testbed-profiler.c
gnunet/src/testbed/testbed.h
gnunet/src/testbed/testbed_api.h
Log:
-getting core, nse, testbed, ats-tool and peerinfo-tool to compile again (part
of #3047)
Modified: gnunet/src/ats-tool/gnunet-ats.c
===================================================================
--- gnunet/src/ats-tool/gnunet-ats.c 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/ats-tool/gnunet-ats.c 2013-09-30 21:03:31 UTC (rev 29725)
@@ -352,7 +352,9 @@
if (NULL != pid_str)
{
- if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (pid_str, &pid.hashPubKey))
+ if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (pid_str,
+ strlen
(pid_str),
+
&pid.public_key))
{
FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), pid_str);
return;
Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/core/core_api.c 2013-09-30 21:03:31 UTC (rev 29725)
@@ -277,7 +277,7 @@
* Hash map listing all of the peers that we are currently
* connected to.
*/
- struct GNUNET_CONTAINER_MultiHashMap *peers;
+ struct GNUNET_CONTAINER_MultiPeerMap *peers;
/**
* Identity of this peer.
@@ -357,7 +357,8 @@
* @return #GNUNET_YES (continue)
*/
static int
-disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key,
+disconnect_and_free_peer_entry (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct GNUNET_CORE_Handle *h = cls;
@@ -389,7 +390,7 @@
}
/* done with 'voluntary' cleanups, now on to normal freeing */
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (h->peers, key, pr));
+ GNUNET_CONTAINER_multipeermap_remove (h->peers, key, pr));
GNUNET_assert (pr->ch == h);
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task);
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task);
@@ -435,7 +436,7 @@
cm->cont (cm->cont_cls, GNUNET_NO);
GNUNET_free (cm);
}
- GNUNET_CONTAINER_multihashmap_iterate (h->peers,
+ GNUNET_CONTAINER_multipeermap_iterate (h->peers,
&disconnect_and_free_peer_entry, h);
while (NULL != (pr = h->ready_peer_head))
GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr);
@@ -790,14 +791,14 @@
"Successfully reconnected to core service.\n");
}
/* fake 'connect to self' */
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &h->me.hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &h->me);
GNUNET_assert (NULL == pr);
pr = GNUNET_new (struct PeerRecord);
pr->peer = h->me;
pr->ch = h;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_put (h->peers,
- &h->me.hashPubKey, pr,
+ GNUNET_CONTAINER_multipeermap_put (h->peers,
+ &h->me, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
if (NULL != h->connects)
h->connects (h->cls, &h->me);
@@ -826,7 +827,7 @@
GNUNET_break (0);
return;
}
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &cnm->peer.hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &cnm->peer);
if (NULL != pr)
{
GNUNET_break (0);
@@ -837,8 +838,8 @@
pr->peer = cnm->peer;
pr->ch = h;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_put (h->peers,
- &cnm->peer.hashPubKey,
pr,
+ GNUNET_CONTAINER_multipeermap_put (h->peers,
+ &cnm->peer, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
if (NULL != h->connects)
h->connects (h->cls, &cnm->peer);
@@ -861,7 +862,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received notification about disconnect from `%s'.\n",
GNUNET_i2s (&dnm->peer));
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &dnm->peer.hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &dnm->peer);
if (NULL == pr)
{
GNUNET_break (0);
@@ -870,7 +871,7 @@
}
trigger = ((pr->prev != NULL) || (pr->next != NULL) ||
(h->ready_peer_head == pr));
- disconnect_and_free_peer_entry (h, &dnm->peer.hashPubKey, pr);
+ disconnect_and_free_peer_entry (h, &dnm->peer, pr);
if (trigger)
trigger_next_request (h, GNUNET_NO);
break;
@@ -916,7 +917,7 @@
GNUNET_break_op (0);
continue;
}
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &ntm->peer.hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &ntm->peer);
if (NULL == pr)
{
GNUNET_break (0);
@@ -976,7 +977,7 @@
return;
}
smr = (const struct SendMessageReady *) msg;
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &smr->peer.hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (h->peers, &smr->peer);
if (NULL == pr)
{
GNUNET_break (0);
@@ -1157,7 +1158,7 @@
h->handlers = handlers;
h->hcnt = 0;
h->currently_down = GNUNET_YES;
- h->peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ h->peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
if (NULL != handlers)
while (handlers[h->hcnt].callback != NULL)
h->hcnt++;
@@ -1205,7 +1206,7 @@
GNUNET_CLIENT_disconnect (handle->client);
handle->client = NULL;
}
- GNUNET_CONTAINER_multihashmap_iterate (handle->peers,
+ GNUNET_CONTAINER_multipeermap_iterate (handle->peers,
&disconnect_and_free_peer_entry,
handle);
if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1213,7 +1214,7 @@
GNUNET_SCHEDULER_cancel (handle->reconnect_task);
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
- GNUNET_CONTAINER_multihashmap_destroy (handle->peers);
+ GNUNET_CONTAINER_multipeermap_destroy (handle->peers);
handle->peers = NULL;
GNUNET_break (handle->ready_peer_head == NULL);
GNUNET_free (handle);
@@ -1287,7 +1288,7 @@
"Asking core for transmission of %u bytes to `%s'\n",
(unsigned int) notify_size,
GNUNET_i2s (target));
- pr = GNUNET_CONTAINER_multihashmap_get (handle->peers, &target->hashPubKey);
+ pr = GNUNET_CONTAINER_multipeermap_get (handle->peers, target);
if (NULL == pr)
{
/* attempt to send to peer that is not connected */
@@ -1382,7 +1383,7 @@
{
GNUNET_assert (NULL != h);
GNUNET_assert (NULL != pid);
- return GNUNET_CONTAINER_multihashmap_contains (h->peers, &pid->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_contains (h->peers, pid);
}
Modified: gnunet/src/core/gnunet-core.c
===================================================================
--- gnunet/src/core/gnunet-core.c 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/core/gnunet-core.c 2013-09-30 21:03:31 UTC (rev 29725)
@@ -75,12 +75,10 @@
connected_peer_callback (void *cls,
const struct GNUNET_PeerIdentity *peer)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded enc;
-
if (NULL == peer)
return;
- GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
- printf (_("Peer `%s'\n"), (const char *) &enc);
+ printf (_("Peer `%s'\n"),
+ GNUNET_i2s_full (peer));
}
Modified: gnunet/src/core/gnunet-service-core_clients.c
===================================================================
--- gnunet/src/core/gnunet-service-core_clients.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/core/gnunet-service-core_clients.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -73,12 +73,12 @@
* Map of peer identities to active transmission requests of this
* client to the peer (of type 'struct GSC_ClientActiveRequest').
*/
- struct GNUNET_CONTAINER_MultiHashMap *requests;
+ struct GNUNET_CONTAINER_MultiPeerMap *requests;
/**
* Map containing all peers that this client knows we're connected to.
*/
- struct GNUNET_CONTAINER_MultiHashMap *connectmap;
+ struct GNUNET_CONTAINER_MultiPeerMap *connectmap;
/**
* Options for messages this client cares about,
@@ -247,8 +247,8 @@
GNUNET_assert ( (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND))
||
(GNUNET_YES != tm) ||
(GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
-
&partner->hashPubKey)) );
+ GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
+ partner)) );
send_to_client (c, msg, can_drop);
}
}
@@ -298,10 +298,10 @@
c->options = ntohl (im->options);
all_client_options |= c->options;
c->types = (const uint16_t *) &c[1];
- c->connectmap = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
+ c->connectmap = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_put (c->connectmap,
-
&GSC_my_identity.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (c->connectmap,
+ &GSC_my_identity,
NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
wtypes = (uint16_t *) & c[1];
@@ -349,7 +349,7 @@
return;
}
if (c->requests == NULL)
- c->requests = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
+ c->requests = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client asked for transmission to `%s'\n",
GNUNET_i2s (&req->peer));
@@ -359,8 +359,8 @@
sizeof (struct GNUNET_PeerIdentity)));
if ((!is_loopback) &&
(GNUNET_YES !=
- GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
- &req->peer.hashPubKey)))
+ GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
+ &req->peer)))
{
/* neighbour must have disconnected since request was issued,
* ignore (client will realize it once it processes the
@@ -373,14 +373,14 @@
return;
}
- car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey);
+ car = GNUNET_CONTAINER_multipeermap_get (c->requests, &req->peer);
if (car == NULL)
{
/* create new entry */
car = GNUNET_malloc (sizeof (struct GSC_ClientActiveRequest));
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (c->requests,
- &req->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (c->requests,
+ &req->peer,
car,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
car->client_handle = c;
@@ -462,7 +462,7 @@
return;
}
tc.car =
- GNUNET_CONTAINER_multihashmap_get (c->requests, &sm->peer.hashPubKey);
+ GNUNET_CONTAINER_multipeermap_get (c->requests, &sm->peer);
if (NULL == tc.car)
{
/* Must have been that we first approved the request, then got disconnected
@@ -478,8 +478,8 @@
return;
}
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (c->requests,
- &sm->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (c->requests,
+ &sm->peer,
tc.car));
tc.cork = ntohl (sm->cork);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -561,18 +561,19 @@
* @param cls NULL
* @param key identity of peer for which this is an active request
* @param value the 'struct GSC_ClientActiveRequest' to free
- * @return GNUNET_YES (continue iteration)
+ * @return #GNUNET_YES (continue iteration)
*/
static int
-destroy_active_client_request (void *cls, const struct GNUNET_HashCode * key,
+destroy_active_client_request (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct GSC_ClientActiveRequest *car = value;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (car->
+ GNUNET_CONTAINER_multipeermap_remove (car->
client_handle->requests,
- &car->target.hashPubKey,
+ &car->target,
car));
GSC_SESSIONS_dequeue_request (car);
GNUNET_free (car);
@@ -601,12 +602,12 @@
GNUNET_CONTAINER_DLL_remove (client_head, client_tail, c);
if (c->requests != NULL)
{
- GNUNET_CONTAINER_multihashmap_iterate (c->requests,
+ GNUNET_CONTAINER_multipeermap_iterate (c->requests,
&destroy_active_client_request,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (c->requests);
+ GNUNET_CONTAINER_multipeermap_destroy (c->requests);
}
- GNUNET_CONTAINER_multihashmap_destroy (c->connectmap);
+ GNUNET_CONTAINER_multipeermap_destroy (c->connectmap);
c->connectmap = NULL;
GSC_TYPEMAP_remove (c->types, c->tcnt);
GNUNET_free (c);
@@ -633,8 +634,8 @@
c = car->client_handle;
if (GNUNET_YES !=
- GNUNET_CONTAINER_multihashmap_contains (c->connectmap,
- &car->target.hashPubKey))
+ GNUNET_CONTAINER_multipeermap_contains (c->connectmap,
+ &car->target))
{
/* connection has gone down since, drop request */
GNUNET_assert (0 !=
@@ -665,9 +666,9 @@
GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (car->
+ GNUNET_CONTAINER_multipeermap_remove (car->
client_handle->requests,
- &car->target.hashPubKey,
+ &car->target,
car));
GNUNET_free (car);
}
@@ -702,19 +703,19 @@
if (old_match == new_match)
{
GNUNET_assert (old_match ==
- GNUNET_CONTAINER_multihashmap_contains (client->connectmap,
-
&neighbour->hashPubKey));
+ GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
+ neighbour));
return; /* no change */
}
if (old_match == GNUNET_NO)
{
/* send connect */
GNUNET_assert (GNUNET_NO ==
- GNUNET_CONTAINER_multihashmap_contains (client->connectmap,
-
&neighbour->hashPubKey));
+ GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
+ neighbour));
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_put (client->connectmap,
- &neighbour->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (client->connectmap,
+ neighbour,
NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
size = sizeof (struct ConnectNotifyMessage);
@@ -731,11 +732,11 @@
{
/* send disconnect */
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_contains (client->connectmap,
-
&neighbour->hashPubKey));
+ GNUNET_CONTAINER_multipeermap_contains (client->connectmap,
+ neighbour));
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (client->connectmap,
-
&neighbour->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (client->connectmap,
+ neighbour,
NULL));
dcm.header.size = htons (sizeof (struct DisconnectNotifyMessage));
dcm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT);
Modified: gnunet/src/core/gnunet-service-core_kx.c
===================================================================
--- gnunet/src/core/gnunet-service-core_kx.c 2013-09-30 20:35:10 UTC (rev
29724)
+++ gnunet/src/core/gnunet-service-core_kx.c 2013-09-30 21:03:31 UTC (rev
29725)
@@ -116,7 +116,7 @@
/**
* Public key of the signing peer (persistent version, not the ephemeral
public key).
*/
- struct GNUNET_CRYPTO_EccPublicSignKey origin_public_key;
+ struct GNUNET_PeerIdentity origin_identity;
};
@@ -390,11 +390,6 @@
static struct EphemeralKeyMessage current_ekm;
/**
- * Our public key.
- */
-static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
-
-/**
* Our message stream tokenizer (for encrypted payload).
*/
static struct GNUNET_SERVER_MessageStreamTokenizer *mst;
@@ -453,9 +448,9 @@
static const char ctx[] = "initialization vector";
GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed),
- &identity->hashPubKey.bits,
- sizeof (identity->hashPubKey.bits), ctx,
- sizeof (ctx), NULL);
+ identity,
+ sizeof (struct GNUNET_PeerIdentity), ctx,
+ sizeof (ctx), NULL);
}
@@ -476,9 +471,11 @@
static const char ctx[] = "pong initialization vector";
GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed),
- &identity->hashPubKey.bits,
- sizeof (identity->hashPubKey.bits), &challenge,
- sizeof (challenge), ctx, sizeof (ctx), NULL);
+ identity,
+ sizeof (struct GNUNET_PeerIdentity),
+ &challenge, sizeof (challenge),
+ ctx, sizeof (ctx),
+ NULL);
}
@@ -661,6 +658,8 @@
GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
{
struct GSC_KeyExchangeInfo *kx;
+ struct GNUNET_HashCode h1;
+ struct GNUNET_HashCode h2;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Initiating key exchange with `%s'\n",
@@ -674,8 +673,11 @@
GNUNET_CONTAINER_DLL_insert (kx_head,
kx_tail,
kx);
- if (0 < GNUNET_CRYPTO_hash_cmp (&pid->hashPubKey,
- &GSC_my_identity.hashPubKey))
+ GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1);
+ GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity),
&h2);
+
+ if (0 < GNUNET_CRYPTO_hash_cmp (&h1,
+ &h2))
{
/* peer with "lower" identity starts KX, otherwise we typically end up
with both peers starting the exchange and transmit the 'set key'
@@ -742,7 +744,6 @@
struct GNUNET_TIME_Absolute start_t;
struct GNUNET_TIME_Absolute end_t;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_PeerIdentity signer_id;
enum KxStateMachine sender_status;
uint16_t size;
struct GNUNET_HashCode key_material;
@@ -772,11 +773,9 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core service receives `%s' request from `%4s'.\n",
"EPHEMERAL_KEY",
GNUNET_i2s (&kx->peer));
- GNUNET_CRYPTO_hash (&m->origin_public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
- &signer_id.hashPubKey);
if (0 !=
- memcmp (&signer_id, &kx->peer,
+ memcmp (&m->origin_identity,
+ &kx->peer.public_key,
sizeof (struct GNUNET_PeerIdentity)))
{
GNUNET_break_op (0);
@@ -791,7 +790,7 @@
(GNUNET_OK !=
GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY,
&m->purpose,
- &m->signature, &m->origin_public_key)))
+ &m->signature,
&m->origin_identity.public_key)))
{
/* invalid signature */
GNUNET_break_op (0);
@@ -1496,7 +1495,7 @@
}
GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key,
¤t_ekm.ephemeral_key);
- current_ekm.origin_public_key = my_public_key;
+ current_ekm.origin_identity = GSC_my_identity;
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_ecc_sign (my_private_key,
¤t_ekm.purpose,
@@ -1543,9 +1542,8 @@
{
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
&my_public_key);
- GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
- &GSC_my_identity.hashPubKey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
+ &GSC_my_identity.public_key);
if (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg,
"core",
Modified: gnunet/src/core/gnunet-service-core_neighbours.c
===================================================================
--- gnunet/src/core/gnunet-service-core_neighbours.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/core/gnunet-service-core_neighbours.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -111,7 +111,7 @@
/**
* Map of peer identities to 'struct Neighbour'.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *neighbours;
+static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
/**
* Transport service.
@@ -131,7 +131,7 @@
{
if (NULL == neighbours)
return NULL;
- return GNUNET_CONTAINER_multihashmap_get (neighbours, &peer->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_get (neighbours, peer);
}
@@ -173,11 +173,11 @@
n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (neighbours,
- &n->peer.hashPubKey,
n));
+ GNUNET_CONTAINER_multipeermap_remove (neighbours,
+ &n->peer, n));
GNUNET_STATISTICS_set (GSC_stats,
gettext_noop ("# neighbour entries allocated"),
- GNUNET_CONTAINER_multihashmap_size (neighbours),
+ GNUNET_CONTAINER_multipeermap_size (neighbours),
GNUNET_NO);
GNUNET_free (n);
}
@@ -321,12 +321,12 @@
n = GNUNET_malloc (sizeof (struct Neighbour));
n->peer = *peer;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (neighbours,
- &n->peer.hashPubKey, n,
+ GNUNET_CONTAINER_multipeermap_put (neighbours,
+ &n->peer, n,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
GNUNET_STATISTICS_set (GSC_stats,
gettext_noop ("# neighbour entries allocated"),
- GNUNET_CONTAINER_multihashmap_size (neighbours),
+ GNUNET_CONTAINER_multipeermap_size (neighbours),
GNUNET_NO);
n->kxinfo = GSC_KX_start (peer);
}
@@ -454,7 +454,7 @@
int
GSC_NEIGHBOURS_init ()
{
- neighbours = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ neighbours = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
transport =
GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL,
&handle_transport_receive,
@@ -462,7 +462,7 @@
&handle_transport_notify_disconnect);
if (NULL == transport)
{
- GNUNET_CONTAINER_multihashmap_destroy (neighbours);
+ GNUNET_CONTAINER_multipeermap_destroy (neighbours);
neighbours = NULL;
return GNUNET_SYSERR;
}
@@ -479,7 +479,9 @@
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_neighbour_helper (void *cls, const struct GNUNET_HashCode * key, void
*value)
+free_neighbour_helper (void *cls,
+ const struct GNUNET_PeerIdentity * key,
+ void *value)
{
struct Neighbour *n = value;
@@ -503,9 +505,9 @@
}
if (NULL != neighbours)
{
- GNUNET_CONTAINER_multihashmap_iterate (neighbours, &free_neighbour_helper,
+ GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_helper,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (neighbours);
+ GNUNET_CONTAINER_multipeermap_destroy (neighbours);
neighbours = NULL;
}
}
Modified: gnunet/src/core/gnunet-service-core_sessions.c
===================================================================
--- gnunet/src/core/gnunet-service-core_sessions.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/core/gnunet-service-core_sessions.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -147,7 +147,7 @@
/**
* Map of peer identities to 'struct Session'.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *sessions;
+static struct GNUNET_CONTAINER_MultiPeerMap *sessions;
/**
@@ -160,7 +160,7 @@
static struct Session *
find_session (const struct GNUNET_PeerIdentity *peer)
{
- return GNUNET_CONTAINER_multihashmap_get (sessions, &peer->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_get (sessions, peer);
}
@@ -202,12 +202,11 @@
GSC_CLIENTS_notify_clients_about_neighbour (&session->peer,
session->tmap, NULL);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (sessions,
- &session->
- peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (sessions,
+ &session->peer,
session));
GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"),
- GNUNET_CONTAINER_multihashmap_size (sessions),
+ GNUNET_CONTAINER_multipeermap_size (sessions),
GNUNET_NO);
GSC_TYPEMAP_destroy (session->tmap);
session->tmap = NULL;
@@ -273,11 +272,11 @@
session->typemap_task =
GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (sessions,
&peer->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (sessions, peer,
session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
GNUNET_STATISTICS_set (GSC_stats, gettext_noop ("# peers connected"),
- GNUNET_CONTAINER_multihashmap_size (sessions),
+ GNUNET_CONTAINER_multipeermap_size (sessions),
GNUNET_NO);
GSC_CLIENTS_notify_clients_about_neighbour (peer,
NULL, session->tmap);
@@ -293,7 +292,7 @@
* @return GNUNET_OK (continue to iterate)
*/
static int
-notify_client_about_session (void *cls, const struct GNUNET_HashCode * key,
+notify_client_about_session (void *cls, const struct GNUNET_PeerIdentity * key,
void *value)
{
struct GSC_Client *client = cls;
@@ -315,7 +314,7 @@
GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client)
{
/* notify new client about existing sessions */
- GNUNET_CONTAINER_multihashmap_iterate (sessions,
¬ify_client_about_session,
+ GNUNET_CONTAINER_multipeermap_iterate (sessions,
¬ify_client_about_session,
client);
}
@@ -559,7 +558,7 @@
* @return always GNUNET_OK
*/
static int
-do_send_message (void *cls, const struct GNUNET_HashCode * key, void *value)
+do_send_message (void *cls, const struct GNUNET_PeerIdentity * key, void
*value)
{
const struct GNUNET_MessageHeader *hdr = cls;
struct Session *session = value;
@@ -586,7 +585,7 @@
{
if (NULL == sessions)
return;
- GNUNET_CONTAINER_multihashmap_iterate (sessions, &do_send_message,
+ GNUNET_CONTAINER_multipeermap_iterate (sessions, &do_send_message,
(void *) msg);
}
@@ -652,7 +651,7 @@
*/
#include "core.h"
static int
-queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void
*value)
+queue_connect_message (void *cls, const struct GNUNET_PeerIdentity * key, void
*value)
{
struct GNUNET_SERVER_TransmitContext *tc = cls;
struct Session *session = value;
@@ -687,7 +686,7 @@
struct GNUNET_SERVER_TransmitContext *tc;
tc = GNUNET_SERVER_transmit_context_create (client);
- GNUNET_CONTAINER_multihashmap_iterate (sessions, &queue_connect_message, tc);
+ GNUNET_CONTAINER_multipeermap_iterate (sessions, &queue_connect_message, tc);
done_msg.size = htons (sizeof (struct GNUNET_MessageHeader));
done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END);
GNUNET_SERVER_transmit_context_append_message (tc, &done_msg);
@@ -760,7 +759,7 @@
void
GSC_SESSIONS_init ()
{
- sessions = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ sessions = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
}
@@ -773,7 +772,7 @@
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_session_helper (void *cls, const struct GNUNET_HashCode * key, void
*value)
+free_session_helper (void *cls, const struct GNUNET_PeerIdentity * key, void
*value)
{
struct Session *session = value;
@@ -790,8 +789,8 @@
{
if (NULL != sessions)
{
- GNUNET_CONTAINER_multihashmap_iterate (sessions, &free_session_helper,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (sessions);
+ GNUNET_CONTAINER_multipeermap_iterate (sessions, &free_session_helper,
NULL);
+ GNUNET_CONTAINER_multipeermap_destroy (sessions);
sessions = NULL;
}
}
Modified: gnunet/src/dht/gnunet-service-dht_hello.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_hello.c 2013-09-30 20:35:10 UTC (rev
29724)
+++ gnunet/src/dht/gnunet-service-dht_hello.c 2013-09-30 21:03:31 UTC (rev
29725)
@@ -40,7 +40,7 @@
/**
* Hash map of peers to HELLOs.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *peer_to_hello;
+static struct GNUNET_CONTAINER_MultiPeerMap *peer_to_hello;
/**
@@ -54,7 +54,7 @@
{
if (NULL == peer_to_hello)
return NULL;
- return GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
}
@@ -81,13 +81,13 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# HELLOs obtained from peerinfo"),
1,
GNUNET_NO);
- hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey);
+ hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
GNUNET_free_non_null (hm);
hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
memcpy (hm, hello, GNUNET_HELLO_size (hello));
GNUNET_assert (GNUNET_SYSERR !=
- GNUNET_CONTAINER_multihashmap_put (peer_to_hello,
- &peer->hashPubKey, hm,
+ GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
+ peer, hm,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
}
@@ -99,7 +99,7 @@
GDS_HELLO_init ()
{
pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL);
- peer_to_hello = GNUNET_CONTAINER_multihashmap_create (256, GNUNET_NO);
+ peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
}
@@ -107,7 +107,9 @@
* Free memory occopied by the HELLO.
*/
static int
-free_hello (void *cls, const struct GNUNET_HashCode * key, void *hello)
+free_hello (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *hello)
{
GNUNET_free (hello);
return GNUNET_OK;
@@ -127,8 +129,8 @@
}
if (NULL != peer_to_hello)
{
- GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello, &free_hello, NULL);
- GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello);
+ GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL);
+ GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello);
}
}
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -26,8 +26,8 @@
*/
#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet_block_lib.h"
-#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
#include "gnunet_constants.h"
#include "gnunet_protocols.h"
Modified: gnunet/src/dht/plugin_block_dht.c
===================================================================
--- gnunet/src/dht/plugin_block_dht.c 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/dht/plugin_block_dht.c 2013-09-30 21:03:31 UTC (rev 29725)
@@ -42,11 +42,11 @@
* @param type block type
* @param query original query (hash)
* @param bf pointer to bloom filter associated with query; possibly updated
(!)
- * @param bf_mutator mutation value for bf
+ * @param bf_mutator mutation value for @a bf
* @param xquery extended query data (can be NULL, depending on type)
- * @param xquery_size number of bytes in xquery
+ * @param xquery_size number of bytes in @a xquery
* @param reply_block response to validate
- * @param reply_block_size number of bytes in reply block
+ * @param reply_block_size number of bytes in @a reply_block
* @return characterization of result
*/
static enum GNUNET_BLOCK_EvaluationResult
@@ -61,6 +61,7 @@
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_PeerIdentity pid;
const struct GNUNET_MessageHeader *msg;
+ struct GNUNET_HashCode phash;
if (type != GNUNET_BLOCK_TYPE_DHT_HELLO)
return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
@@ -90,7 +91,8 @@
}
if (NULL != bf)
{
- GNUNET_BLOCK_mingle_hash (&pid.hashPubKey, bf_mutator, &mhash);
+ GNUNET_CRYPTO_hash (&pid, sizeof (pid), &phash);
+ GNUNET_BLOCK_mingle_hash (&phash, bf_mutator, &mhash);
if (NULL != *bf)
{
if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash))
@@ -114,9 +116,9 @@
* @param cls closure
* @param type block type
* @param block block to get the key for
- * @param block_size number of bytes in block
+ * @param block_size number of bytes @a block
* @param key set to the key (query) for the given block
- * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
* (or if extracting a key from a block of this type does not work)
*/
static int
Modified: gnunet/src/include/gnunet_nse_service.h
===================================================================
--- gnunet/src/include/gnunet_nse_service.h 2013-09-30 20:35:10 UTC (rev
29724)
+++ gnunet/src/include/gnunet_nse_service.h 2013-09-30 21:03:31 UTC (rev
29725)
@@ -39,9 +39,7 @@
#endif
#endif
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
/**
* Version of the network size estimation API.
Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/nse/gnunet-service-nse.c 2013-09-30 21:03:31 UTC (rev 29725)
@@ -189,7 +189,7 @@
/**
* Public key of the originator.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey pkey;
+ struct GNUNET_PeerIdentity origin;
/**
* Proof of work, causing leading zeros when hashed with pkey.
@@ -221,7 +221,7 @@
/**
* Map of all connected peers.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *peers;
+static struct GNUNET_CONTAINER_MultiPeerMap *peers;
/**
* The current network size estimate. Number of bits matching on
@@ -286,11 +286,6 @@
static struct GNUNET_TIME_Absolute current_timestamp;
/**
- * The public key of this peer.
- */
-static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
-
-/**
* The private key of this peer.
*/
static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
@@ -392,7 +387,7 @@
em->reserved = htonl (0);
em->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
double se = mean - 0.332747;
- nsize = log2 (GNUNET_CONTAINER_multihashmap_size (peers) + 1);
+ nsize = log2 (GNUNET_CONTAINER_multipeermap_size (peers) + 1);
em->size_estimate = GNUNET_hton_double (GNUNET_MAX (se, nsize));
em->std_deviation = GNUNET_hton_double (std_dev);
GNUNET_STATISTICS_set (stats, "# nodes in the network (estimate)",
@@ -510,10 +505,12 @@
const struct GNUNET_PeerIdentity *id)
{
struct GNUNET_HashCode timestamp_hash;
+ struct GNUNET_HashCode pid_hash;
GNUNET_CRYPTO_hash (×tamp.abs_value_us, sizeof (timestamp.abs_value_us),
×tamp_hash);
- return GNUNET_CRYPTO_hash_matching_bits (×tamp_hash, &id->hashPubKey);
+ GNUNET_CRYPTO_hash (id, sizeof (struct GNUNET_PeerIdentity), &pid_hash);
+ return GNUNET_CRYPTO_hash_matching_bits (×tamp_hash, &pid_hash);
}
@@ -716,7 +713,7 @@
sizeof (struct GNUNET_CRYPTO_EccSignature));
fm->matching_bits = htonl (matching_bits);
fm->timestamp = GNUNET_TIME_absolute_hton (ts);
- fm->pkey = my_public_key;
+ fm->origin = my_identity;
fm->proof_of_work = my_proof;
if (nse_work_required > 0)
GNUNET_assert (GNUNET_OK ==
@@ -738,7 +735,7 @@
*/
static int
schedule_current_round (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity * key,
void *value)
{
struct NSEPeerEntry *peer_entry = value;
@@ -817,7 +814,7 @@
for (i = 0; i < HISTORY_SIZE; i++)
hop_count_max =
GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count),
hop_count_max);
- GNUNET_CONTAINER_multihashmap_iterate (peers, &schedule_current_round, NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL);
flood_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
(next_timestamp), &update_flood_message,
@@ -907,8 +904,8 @@
unsigned int i;
proof_task = GNUNET_SCHEDULER_NO_TASK;
- memcpy (&buf[sizeof (uint64_t)], &my_public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
+ memcpy (&buf[sizeof (uint64_t)], &my_identity,
+ sizeof (struct GNUNET_PeerIdentity));
i = 0;
counter = my_proof;
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
@@ -959,7 +956,7 @@
verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
{
if (GNUNET_YES !=
- check_proof_of_work (&incoming_flood->pkey,
+ check_proof_of_work (&incoming_flood->origin.public_key,
incoming_flood->proof_of_work))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work invalid: %llu!\n",
@@ -973,7 +970,7 @@
GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
&incoming_flood->purpose,
&incoming_flood->signature,
- &incoming_flood->pkey)))
+ &incoming_flood->origin.public_key)))
{
GNUNET_break_op (0);
return GNUNET_NO;
@@ -993,7 +990,7 @@
*/
static int
update_flood_times (void *cls,
- const struct GNUNET_HashCode *key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct NSEPeerEntry *exclude = cls;
@@ -1062,11 +1059,14 @@
char pred[5];
struct GNUNET_PeerIdentity os;
- GNUNET_CRYPTO_hash (&incoming_flood->pkey,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
- &os.hashPubKey);
- GNUNET_snprintf (origin, sizeof (origin), "%s", GNUNET_i2s (&os));
- GNUNET_snprintf (pred, sizeof (pred), "%s", GNUNET_i2s (peer));
+ GNUNET_snprintf (origin,
+ sizeof (origin),
+ "%4s",
+ GNUNET_i2s (&incoming_flood->origin));
+ GNUNET_snprintf (pred,
+ sizeof (pred),
+ "%4s",
+ GNUNET_i2s (peer));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Flood at %s from `%s' via `%s' at `%s' with bits %u\n",
GNUNET_STRINGS_absolute_time_to_string
(GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp)),
@@ -1075,7 +1075,7 @@
}
#endif
- peer_entry = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
+ peer_entry = GNUNET_CONTAINER_multipeermap_get (peers, peer);
if (NULL == peer_entry)
{
GNUNET_break (0);
@@ -1117,7 +1117,8 @@
{
/* send to self, update our own estimate IF this also comes from us! */
if (0 ==
- memcmp (&incoming_flood->pkey, &my_public_key, sizeof (my_public_key)))
+ memcmp (&incoming_flood->origin,
+ &my_identity, sizeof (my_identity)))
update_network_size_estimate ();
return GNUNET_OK;
}
@@ -1205,7 +1206,7 @@
update_network_size_estimate ();
/* flood to rest */
- GNUNET_CONTAINER_multihashmap_iterate (peers, &update_flood_times,
+ GNUNET_CONTAINER_multipeermap_iterate (peers, &update_flood_times,
peer_entry);
return GNUNET_OK;
}
@@ -1230,7 +1231,7 @@
peer_entry = GNUNET_new (struct NSEPeerEntry);
peer_entry->id = *peer;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (peers, peer,
peer_entry,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
peer_entry->transmit_task =
@@ -1256,14 +1257,14 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' disconnected from us\n",
GNUNET_i2s (peer));
- pos = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
+ pos = GNUNET_CONTAINER_multipeermap_get (peers, peer);
if (NULL == pos)
{
GNUNET_break (0);
return;
}
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (peers,
&peer->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (peers, peer,
pos));
if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) {
GNUNET_SCHEDULER_cancel (pos->transmit_task);
@@ -1335,7 +1336,7 @@
}
if (NULL != peers)
{
- GNUNET_CONTAINER_multihashmap_destroy (peers);
+ GNUNET_CONTAINER_multipeermap_destroy (peers);
peers = NULL;
}
if (NULL != my_private_key)
@@ -1381,7 +1382,7 @@
GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval);
estimate_index = HISTORY_SIZE - 1;
estimate_count = 0;
- if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof))
+ if (GNUNET_YES == check_proof_of_work (&my_identity.public_key, my_proof))
{
int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE;
prev_time.abs_value_us =
@@ -1476,9 +1477,8 @@
pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
&my_public_key);
- GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
- &my_identity.hashPubKey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key,
+ &my_identity.public_key);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE",
&proof))
{
@@ -1499,7 +1499,7 @@
GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
&find_proof, NULL);
- peers = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
GNUNET_SERVER_add_handlers (srv, handlers);
nc = GNUNET_SERVER_notification_context_create (srv, 1);
/* Connect to core service and register core handlers */
Modified: gnunet/src/peerinfo-tool/gnunet-peerinfo.c
===================================================================
--- gnunet/src/peerinfo-tool/gnunet-peerinfo.c 2013-09-30 20:35:10 UTC (rev
29724)
+++ gnunet/src/peerinfo-tool/gnunet-peerinfo.c 2013-09-30 21:03:31 UTC (rev
29725)
@@ -190,11 +190,6 @@
static struct GNUNET_PeerIdentity my_peer_identity;
/**
- * My public key.
- */
-static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
-
-/**
* Head of list of print contexts.
*/
static struct PrintContext *pc_head;
@@ -232,13 +227,11 @@
static void
dump_pc (struct PrintContext *pc)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded enc;
unsigned int i;
- GNUNET_CRYPTO_hash_to_enc (&pc->peer.hashPubKey, &enc);
printf (_("%sPeer `%s'\n"),
- (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
- (const char *) &enc);
+ (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
+ GNUNET_i2s_full (&pc->peer));
for (i = 0; i < pc->num_addresses; i++)
{
if (NULL != pc->address_list[i].result)
@@ -345,7 +338,6 @@
print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello, const char *err_msg)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded enc;
struct PrintContext *pc;
int friend_only;
@@ -367,10 +359,9 @@
friend_only = GNUNET_HELLO_is_friend_only (hello);
if ((GNUNET_YES == be_quiet) || (NULL == hello))
{
- GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
printf ("%s%s\n",
- (GNUNET_YES == friend_only) ? "F2F: " : "",
- (const char *) &enc);
+ (GNUNET_YES == friend_only) ? "F2F: " : "",
+ GNUNET_i2s_full (peer));
return;
}
pc = GNUNET_malloc (sizeof (struct PrintContext));
@@ -546,7 +537,8 @@
{
struct GNUNET_HELLO_Message *hello = NULL;
- int ret = GNUNET_HELLO_parse_uri(put_uri, &my_public_key, &hello,
&GPI_plugins_find);
+ int ret = GNUNET_HELLO_parse_uri(put_uri, &my_peer_identity.public_key,
+ &hello, &GPI_plugins_find);
if (NULL != hello) {
/* WARNING: this adds the address from URI WITHOUT verification! */
@@ -677,9 +669,9 @@
return;
}
GNUNET_free (fn);
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv,
+
&my_peer_identity.public_key);
GNUNET_free (priv);
- GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_peer_identity.hashPubKey);
}
tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
@@ -725,14 +717,14 @@
}
else if (GNUNET_YES == get_self)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded enc;
get_self = GNUNET_NO;
- GNUNET_CRYPTO_hash_to_enc (&my_peer_identity.hashPubKey, &enc);
if (be_quiet)
- printf ("%s\n", (char *) &enc);
+ printf ("%s\n",
+ GNUNET_i2s_full (&my_peer_identity));
else
- printf (_("I am peer `%s'.\n"), (const char *) &enc);
- tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
+ printf (_("I am peer `%s'.\n"),
+ GNUNET_i2s_full (&my_peer_identity));
+ tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
}
else if (GNUNET_YES == get_uri)
{
Modified: gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c
===================================================================
--- gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c 2013-09-30
20:35:10 UTC (rev 29724)
+++ gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c 2013-09-30
21:03:31 UTC (rev 29725)
@@ -56,7 +56,7 @@
/**
* The map to store the peer identities to allow/deny
*/
-static struct GNUNET_CONTAINER_MultiHashMap *map;
+static struct GNUNET_CONTAINER_MultiPeerMap *map;
/**
* The array of peer identities we read from whitelist/blacklist
@@ -92,9 +92,9 @@
* #GNUNET_NO if not.
*/
static int
-iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterator (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
- GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (map, key,
+ GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (map, key,
value));
return GNUNET_YES;
}
@@ -108,10 +108,10 @@
{
if (NULL != map)
{
- GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_iterate (map,
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multipeermap_iterate (map,
&iterator,
NULL));
- GNUNET_CONTAINER_multihashmap_destroy (map);
+ GNUNET_CONTAINER_multipeermap_destroy (map);
map = NULL;
}
}
@@ -145,7 +145,7 @@
int contains;
if (NULL != map)
- contains = GNUNET_CONTAINER_multihashmap_contains (map,
&(pid->hashPubKey));
+ contains = GNUNET_CONTAINER_multipeermap_contains (map, pid);
else
contains = GNUNET_NO;
if (ACCESS_DENY == mode)
@@ -178,13 +178,13 @@
npeers = fsize / sizeof (struct GNUNET_PeerIdentity);
if (0 != npeers)
{
- map = GNUNET_CONTAINER_multihashmap_create (npeers, GNUNET_YES);
+ map = GNUNET_CONTAINER_multipeermap_create (npeers, GNUNET_YES);
ilist = GNUNET_malloc_large (fsize);
GNUNET_assert (fsize == GNUNET_DISK_fn_read (fname, ilist, fsize));
}
for (cnt = 0; cnt < npeers; cnt++)
{
- if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (map,
&(ilist[cnt].hashPubKey),
+ if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_put (map, &ilist[cnt],
&ilist[cnt],
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
Modified: gnunet/src/testbed/gnunet-service-testbed_meminfo.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_meminfo.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/testbed/gnunet-service-testbed_meminfo.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -19,7 +19,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
/*
* File for parsing top-level /proc entities.
Modified: gnunet/src/testbed/gnunet-testbed-profiler.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-profiler.c 2013-09-30 20:35:10 UTC
(rev 29724)
+++ gnunet/src/testbed/gnunet-testbed-profiler.c 2013-09-30 21:03:31 UTC
(rev 29725)
@@ -25,7 +25,6 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed_api_hosts.h"
Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/testbed/testbed.h 2013-09-30 21:03:31 UTC (rev 29725)
@@ -657,7 +657,7 @@
/**
* Identity of the peer.
*/
- struct GNUNET_PeerIdentity peer_identity GNUNET_PACKED;
+ struct GNUNET_PeerIdentity peer_identity;
/**
* The size of configuration when uncompressed
Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h 2013-09-30 20:35:10 UTC (rev 29724)
+++ gnunet/src/testbed/testbed_api.h 2013-09-30 21:03:31 UTC (rev 29725)
@@ -27,7 +27,7 @@
#ifndef TESTBED_API_H
#define TESTBED_API_H
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed.h"
#include "testbed_helper.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29725 - in gnunet/src: ats-tool core dht include nse peerinfo-tool testbed,
gnunet <=