summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
commita0ba5b741b56036bd35bd9ba88164324b2ff7ada (patch)
tree3fd10a0fc15f9a9e7cf5415b2bec86d97d7fe825 /src/transport
parent427dd6f998fb1fde515a3b5c800f9f6d308197b2 (diff)
-getting ATS and transport to compile again (part of #3047)
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c2
-rw-r--r--src/transport/gnunet-service-transport.c10
-rw-r--r--src/transport/gnunet-service-transport.h7
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c63
-rw-r--r--src/transport/gnunet-service-transport_hello.c7
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c26
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c28
-rw-r--r--src/transport/gnunet-service-transport_validation.c34
-rw-r--r--src/transport/gnunet-transport-wlan-sender.c2
-rw-r--r--src/transport/gnunet-transport.c19
-rw-r--r--src/transport/plugin_transport_http_client.c9
-rw-r--r--src/transport/plugin_transport_http_common.c18
-rw-r--r--src/transport/plugin_transport_http_server.c30
-rw-r--r--src/transport/plugin_transport_tcp.c110
-rw-r--r--src/transport/plugin_transport_template.c4
-rw-r--r--src/transport/plugin_transport_udp.c39
-rw-r--r--src/transport/plugin_transport_udp.h2
-rw-r--r--src/transport/plugin_transport_unix.c46
-rw-r--r--src/transport/plugin_transport_wlan.h2
-rw-r--r--src/transport/transport-testing.c1
-rw-r--r--src/transport/transport-testing.h5
-rw-r--r--src/transport/transport_api.c44
-rw-r--r--src/transport/transport_api_address_lookup.c5
-rw-r--r--src/transport/transport_api_address_to_string.c4
-rw-r--r--src/transport/transport_api_blacklist.c4
25 files changed, 257 insertions, 264 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index b23f43dde..7f472b3be 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -110,6 +110,8 @@
* parts taken from aircrack-ng, parts changend.
*/
#include "gnunet_config.h"
+#define SOCKTYPE int
+#define FDTYPE int
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/types.h>
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index acf356149..3adf5b35d 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -68,11 +68,6 @@ struct GNUNET_PEERINFO_Handle *GST_peerinfo;
static struct GNUNET_SERVER_Handle *GST_server;
/**
- * Our public key.
- */
-struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key;
-
-/**
* Our private key.
*/
struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key;
@@ -790,9 +785,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg);
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key, &GST_my_public_key);
- GNUNET_CRYPTO_hash (&GST_my_public_key, sizeof (GST_my_public_key),
- &GST_my_identity.hashPubKey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key,
+ &GST_my_identity.public_key);
GNUNET_assert (NULL != GST_my_private_key);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index 44b375dd8..9b68cb258 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -26,9 +26,9 @@
#ifndef GNUNET_SERVICE_TRANSPORT_H
#define GNUNET_SERVICE_TRANSPORT_H
+#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
-#include "gnunet_util_lib.h"
#define VERBOSE_VALIDATION GNUNET_YES
@@ -53,11 +53,6 @@ extern struct GNUNET_PeerIdentity GST_my_identity;
extern struct GNUNET_PEERINFO_Handle *GST_peerinfo;
/**
- * Our public key.
- */
-extern struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key;
-
-/**
* Our private key.
*/
extern struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key;
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 2bec6cb71..628943a42 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -182,7 +182,7 @@ static struct Blacklisters *bl_tail;
* Hashmap of blacklisted peers. Values are of type 'char *' (transport names),
* can be NULL if we have no static blacklist.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *blacklist;
+static struct GNUNET_CONTAINER_MultiPeerMap *blacklist;
/**
@@ -254,9 +254,9 @@ blacklist_cfg_iter (void *cls, const char *section,
char *plugs;
char *pos;
- if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string2 (option,
- strlen (option),
- &peer.hashPubKey))
+ if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option,
+ strlen (option),
+ &peer.public_key))
return;
if ((NULL == value) || (0 == strcmp(value, "")))
@@ -334,7 +334,9 @@ GST_blacklist_start (struct GNUNET_SERVER_Handle *server,
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_blacklist_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
+free_blacklist_entry (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
char *be = value;
@@ -351,9 +353,9 @@ GST_blacklist_stop ()
{
if (NULL != blacklist)
{
- GNUNET_CONTAINER_multihashmap_iterate (blacklist, &free_blacklist_entry,
+ GNUNET_CONTAINER_multipeermap_iterate (blacklist, &free_blacklist_entry,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (blacklist);
+ GNUNET_CONTAINER_multipeermap_destroy (blacklist);
blacklist = NULL;
}
}
@@ -617,24 +619,25 @@ void
GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
const char *transport_name)
{
- char * transport = NULL;
- if (NULL != transport_name)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Adding peer `%s' with plugin `%s' to blacklist\n",
- GNUNET_i2s (peer), transport_name);
- transport = GNUNET_strdup (transport_name);
- }
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Adding peer `%s' with all plugins to blacklist\n",
- GNUNET_i2s (peer));
+ char * transport = NULL;
+
+ if (NULL != transport_name)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Adding peer `%s' with plugin `%s' to blacklist\n",
+ GNUNET_i2s (peer), transport_name);
+ transport = GNUNET_strdup (transport_name);
+ }
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Adding peer `%s' with all plugins to blacklist\n",
+ GNUNET_i2s (peer));
if (blacklist == NULL)
blacklist =
- GNUNET_CONTAINER_multihashmap_create (TRANSPORT_BLACKLIST_HT_SIZE,
+ GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE,
GNUNET_NO);
-
- GNUNET_CONTAINER_multihashmap_put (blacklist, &peer->hashPubKey,
+
+ GNUNET_CONTAINER_multipeermap_put (blacklist, peer,
transport,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
@@ -647,10 +650,12 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
* @param cls the transport name to match (const char*)
* @param key the key (unused)
* @param value the 'char *' (name of a blacklisted transport)
- * @return GNUNET_OK if the entry does not match, GNUNET_NO if it matches
+ * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches
*/
static int
-test_blacklisted (void *cls, const struct GNUNET_HashCode * key, void *value)
+test_blacklisted (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
const char *transport_name = cls;
char *be = value;
@@ -665,10 +670,10 @@ test_blacklisted (void *cls, const struct GNUNET_HashCode * key, void *value)
*/
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Comparing BL request for peer `%4s':`%s' with BL entry: `%s'\n",
- GNUNET_h2s (key),
- (NULL == transport_name) ? "unspecified" : transport_name,
- (NULL == be) ? "all plugins" : be);
+ "Comparing BL request for peer `%4s':`%s' with BL entry: `%s'\n",
+ GNUNET_i2s (key),
+ (NULL == transport_name) ? "unspecified" : transport_name,
+ (NULL == be) ? "all plugins" : be);
/* all plugins for this peer were blacklisted: disallow */
if (NULL == value)
return GNUNET_NO;
@@ -708,7 +713,7 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
* If iteration is aborted, we found a matching blacklist entry */
if ((blacklist != NULL) &&
(GNUNET_SYSERR ==
- GNUNET_CONTAINER_multihashmap_get_multiple (blacklist, &peer->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (blacklist, peer,
&test_blacklisted,
(void *) transport_name)))
{
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 8c8d7854f..0347d67a5 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -170,7 +170,9 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
friend_only = GNUNET_HELLO_is_friend_only (our_hello);
GNUNET_free (our_hello);
- our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, &gc, friend_only);
+ our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key,
+ &address_generator,
+ &gc, friend_only);
GNUNET_assert (NULL != our_hello);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Refreshed my %s `%s', new size is %d\n",
@@ -213,7 +215,8 @@ GST_hello_start (int friend_only, GST_HelloCallback cb, void *cb_cls)
{
hello_cb = cb;
hello_cb_cls = cb_cls;
- our_hello = GNUNET_HELLO_create (&GST_my_public_key, NULL, NULL, friend_only);
+ our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key,
+ NULL, NULL, friend_only);
GNUNET_assert (NULL != our_hello);
refresh_hello ();
}
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 0ebe18c55..7762d1811 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -114,7 +114,7 @@ struct GST_ManipulationHandle
/**
* Hashmap contain all peers currently manipulated
*/
- struct GNUNET_CONTAINER_MultiHashMap *peers;
+ struct GNUNET_CONTAINER_MultiPeerMap *peers;
/**
* Peer containing information for general manipulation
@@ -325,7 +325,7 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received traffic metrics for peer `%s'\n",
GNUNET_i2s(&tm->peer));
- if (NULL == (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &tm->peer.hashPubKey)))
+ if (NULL == (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, &tm->peer)))
{
tmp = GNUNET_malloc (sizeof (struct TM_Peer));
tmp->peer = (tm->peer);
@@ -336,7 +336,9 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
tmp->metrics[c][c2] = UINT32_MAX;
}
}
- GNUNET_CONTAINER_multihashmap_put (man_handle.peers, &tm->peer.hashPubKey, tmp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ GNUNET_CONTAINER_multipeermap_put (man_handle.peers,
+ &tm->peer, tmp,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
ats = (struct GNUNET_ATS_Information *) &tm[1];
@@ -411,7 +413,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
struct DelayQueueEntry *dqe;
struct GNUNET_TIME_Relative delay;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &target->hashPubKey)))
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, target)))
{
GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
/* Manipulate here */
@@ -494,7 +496,7 @@ GST_manipulation_manipulate_metrics (const struct GNUNET_PeerIdentity *peer,
uint32_t m_tmp;
uint32_t g_tmp;
int d;
- tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey);
+ tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer);
for (d = 0; d < ats_count; d++)
{
@@ -546,7 +548,7 @@ GST_manipulation_recv (void *cls,
else
m_delay = GNUNET_TIME_UNIT_ZERO;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey)))
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer)))
{
/* Manipulate receive delay */
p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE);
@@ -632,13 +634,13 @@ GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg)
GNUNET_ATS_QUALITY_NET_DELAY,
delay.rel_value_us);
}
- man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
}
static int
free_tmps (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct DelayQueueEntry *dqe;
@@ -648,7 +650,7 @@ free_tmps (void *cls,
{
struct TM_Peer *tmp = (struct TM_Peer *) value;
- if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (man_handle.peers, key, value))
+ if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (man_handle.peers, key, value))
GNUNET_break (0);
free_metric (tmp);
next = tmp->send_head;
@@ -683,7 +685,7 @@ GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer)
struct DelayQueueEntry *dqe;
struct DelayQueueEntry *next;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey)))
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer)))
{
next = tmp->send_head;
while (NULL != (dqe = next))
@@ -729,8 +731,8 @@ GST_manipulation_stop ()
{
struct DelayQueueEntry *cur;
struct DelayQueueEntry *next;
- GNUNET_CONTAINER_multihashmap_iterate (man_handle.peers, &free_tmps,NULL);
- GNUNET_CONTAINER_multihashmap_destroy (man_handle.peers);
+ GNUNET_CONTAINER_multipeermap_iterate (man_handle.peers, &free_tmps,NULL);
+ GNUNET_CONTAINER_multipeermap_destroy (man_handle.peers);
next = generic_dqe_head;
while (NULL != (cur = next))
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 1a6a87853..90f45f126 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -739,7 +739,7 @@ struct BlackListCheckContext
/**
* Hash map from peer identities to the respective 'struct NeighbourMapEntry'.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *neighbours;
+static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
/**
* We keep blacklist checks in a DLL so that we can find
@@ -795,7 +795,7 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid)
{
if (NULL == neighbours)
return NULL;
- return GNUNET_CONTAINER_multihashmap_get (neighbours, &pid->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_get (neighbours, pid);
}
static const char *
@@ -1077,8 +1077,8 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
MEMDEBUG_free_non_null (backup_primary, __LINE__);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (neighbours,
- &n->id.hashPubKey, n));
+ GNUNET_CONTAINER_multipeermap_remove (neighbours,
+ &n->id, n));
// FIXME-ATS-API: we might want to be more specific about
// which states we do this from in the future (ATS should
@@ -1201,7 +1201,7 @@ send_disconnect (struct NeighbourMapEntry *n)
htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
disconnect_msg.timestamp =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
- disconnect_msg.public_key = GST_my_public_key;
+ disconnect_msg.public_key = GST_my_identity.public_key;
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_ecc_sign (GST_my_private_key,
&disconnect_msg.purpose,
@@ -1799,8 +1799,8 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer)
MAX_BANDWIDTH_CARRY_S);
n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (neighbours,
- &n->id.hashPubKey, n,
+ GNUNET_CONTAINER_multipeermap_put (neighbours,
+ &n->id, n,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return n;
}
@@ -3223,7 +3223,7 @@ struct IteratorContext
* @return GNUNET_OK (continue to iterate)
*/
static int
-neighbours_iterate (void *cls, const struct GNUNET_HashCode * key, void *value)
+neighbours_iterate (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
{
struct IteratorContext *ic = cls;
struct NeighbourMapEntry *n = value;
@@ -3267,7 +3267,7 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls)
return; /* can happen during shutdown */
ic.cb = cb;
ic.cb_cls = cb_cls;
- GNUNET_CONTAINER_multihashmap_iterate (neighbours, &neighbours_iterate, &ic);
+ GNUNET_CONTAINER_multipeermap_iterate (neighbours, &neighbours_iterate, &ic);
}
@@ -3375,7 +3375,7 @@ GST_neighbours_start (void *cls,
connect_notify_cb = connect_cb;
disconnect_notify_cb = disconnect_cb;
address_change_cb = peer_address_cb;
- neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE, GNUNET_NO);
+ neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE, GNUNET_NO);
}
@@ -3388,7 +3388,9 @@ GST_neighbours_start (void *cls,
* @return GNUNET_OK (continue to iterate)
*/
static int
-disconnect_all_neighbours (void *cls, const struct GNUNET_HashCode * key, void *value)
+disconnect_all_neighbours (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
struct NeighbourMapEntry *n = value;
@@ -3409,10 +3411,10 @@ GST_neighbours_stop ()
{
if (NULL == neighbours)
return;
- GNUNET_CONTAINER_multihashmap_iterate (neighbours,
+ GNUNET_CONTAINER_multipeermap_iterate (neighbours,
&disconnect_all_neighbours,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (neighbours);
+ GNUNET_CONTAINER_multipeermap_destroy (neighbours);
neighbours = NULL;
callback_cls = NULL;
connect_notify_cb = NULL;
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index fe493f822..54393d753 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -311,7 +311,7 @@ static struct CheckHelloValidatedContext *chvc_tail;
* of the given peer that we are currently validating, have validated
* or are blocked from re-validation for a while).
*/
-static struct GNUNET_CONTAINER_MultiHashMap *validation_map;
+static struct GNUNET_CONTAINER_MultiPeerMap *validation_map;
/**
* Context for peerinfo iteration.
@@ -367,7 +367,7 @@ struct ValidationEntryMatchContext
* GNUNET_NO if the entry does match
*/
static int
-validation_entry_match (void *cls, const struct GNUNET_HashCode * key, void *value)
+validation_entry_match (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
{
struct ValidationEntryMatchContext *vemc = cls;
struct ValidationEntry *ve = value;
@@ -390,7 +390,7 @@ validation_entry_match (void *cls, const struct GNUNET_HashCode * key, void *val
* @return GNUNET_YES (continue to iterate)
*/
static int
-cleanup_validation_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
+cleanup_validation_entry (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
{
struct ValidationEntry *ve = value;
@@ -400,8 +400,8 @@ cleanup_validation_entry (void *cls, const struct GNUNET_HashCode * key, void *v
ve->bc = NULL;
}
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (validation_map,
- &ve->pid.hashPubKey, ve));
+ GNUNET_CONTAINER_multipeermap_remove (validation_map,
+ &ve->pid, ve));
GNUNET_HELLO_address_free (ve->address);
if (GNUNET_SCHEDULER_NO_TASK != ve->timeout_task)
{
@@ -454,7 +454,7 @@ timeout_hello_validation (void *cls,
GNUNET_STATISTICS_update (GST_stats,
gettext_noop ("# address records discarded"), 1,
GNUNET_NO);
- cleanup_validation_entry (NULL, &ve->pid.hashPubKey, ve);
+ cleanup_validation_entry (NULL, &ve->pid, ve);
}
@@ -686,8 +686,8 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key,
vemc.ve = NULL;
vemc.address = address;
- GNUNET_CONTAINER_multihashmap_get_multiple (validation_map,
- &address->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
+ &address->peer,
&validation_entry_match, &vemc);
if (NULL != (ve = vemc.ve))
return ve;
@@ -708,7 +708,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key,
ve->timeout_task =
GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE,
&timeout_hello_validation, ve);
- GNUNET_CONTAINER_multihashmap_put (validation_map, &address->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer,
ve,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
ve->expecting_pong = GNUNET_NO;
@@ -814,7 +814,7 @@ GST_validation_start (unsigned int max_fds)
validations_fast_start_threshold,
GNUNET_STRINGS_relative_time_to_string (validation_delay,
GNUNET_YES));
- validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE,
+ validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE,
GNUNET_NO);
pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL);
}
@@ -828,9 +828,9 @@ GST_validation_stop ()
{
struct CheckHelloValidatedContext *chvc;
- GNUNET_CONTAINER_multihashmap_iterate (validation_map,
+ GNUNET_CONTAINER_multipeermap_iterate (validation_map,
&cleanup_validation_entry, NULL);
- GNUNET_CONTAINER_multihashmap_destroy (validation_map);
+ GNUNET_CONTAINER_multipeermap_destroy (validation_map);
validation_map = NULL;
while (NULL != (chvc = chvc_head))
{
@@ -1031,7 +1031,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"I am `%s', sending PONG to peer `%s'\n",
- GNUNET_h2s (&GST_my_identity.hashPubKey),
+ GNUNET_i2s_full (&GST_my_identity),
GNUNET_i2s (sender));
/* message with structure:
@@ -1404,10 +1404,10 @@ struct IteratorContext
* @param cls the 'struct GST_ValidationIteratorContext'
* @param key the peer's identity
* @param value the 'struct ValidationEntry'
- * @return GNUNET_OK (continue to iterate)
+ * @return #GNUNET_OK (continue to iterate)
*/
static int
-iterate_addresses (void *cls, const struct GNUNET_HashCode * key, void *value)
+iterate_addresses (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct IteratorContext *ic = cls;
struct ValidationEntry *ve = value;
@@ -1434,8 +1434,8 @@ GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
ic.cb = cb;
ic.cb_cls = cb_cls;
- GNUNET_CONTAINER_multihashmap_get_multiple (validation_map,
- &target->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
+ target,
&iterate_addresses, &ic);
}
diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c
index 05d1d1eef..0ab6c9fd1 100644
--- a/src/transport/gnunet-transport-wlan-sender.c
+++ b/src/transport/gnunet-transport-wlan-sender.c
@@ -24,8 +24,8 @@
* @author David Brodski
*/
#include "platform.h"
-#include "gnunet_protocols.h"
#include "plugin_transport_wlan.h"
+#include "gnunet_protocols.h"
#define WLAN_MTU 1500
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 641261c05..4fc1622b3 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -166,8 +166,6 @@ static GNUNET_SCHEDULER_TaskIdentifier end;
static GNUNET_SCHEDULER_TaskIdentifier op_timeout;
-static struct GNUNET_CONTAINER_MultiHashMap *peers;
-
/**
* Selected level of verbosity.
*/
@@ -255,11 +253,6 @@ shutdown_task (void *cls,
GNUNET_TRANSPORT_disconnect(handle);
handle = NULL;
}
- if (NULL != peers)
- {
- GNUNET_CONTAINER_multihashmap_destroy (peers);
- peers = NULL;
- }
if (benchmark_send)
{
duration = GNUNET_TIME_absolute_get_duration (start_time);
@@ -300,7 +293,7 @@ operation_timeout (void *cls,
if ((try_connect) || (benchmark_send) ||
(benchmark_receive))
{
- FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_h2s_full (&pid.hashPubKey));
+ FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_i2s_full (&pid));
if (GNUNET_SCHEDULER_NO_TASK != end)
GNUNET_SCHEDULER_cancel (end);
end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
@@ -525,7 +518,9 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
if (try_connect)
{
/* all done, terminate instantly */
- FPRINTF (stdout, _("Successfully connected to `%s'\n"), GNUNET_h2s_full (&peer->hashPubKey));
+ FPRINTF (stdout,
+ _("Successfully connected to `%s'\n"),
+ GNUNET_i2s_full (peer));
ret = 0;
if (GNUNET_SCHEDULER_NO_TASK != op_timeout)
@@ -814,7 +809,9 @@ testservice_task (void *cls,
}
if ( (NULL != cpid) &&
- (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (cpid, &pid.hashPubKey)))
+ (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid,
+ strlen (cpid),
+ &pid.public_key)))
{
FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
return;
@@ -914,7 +911,6 @@ testservice_task (void *cls,
}
else if (iterate_connections) /* -i: List all active addresses once */
{
- peers = GNUNET_CONTAINER_multihashmap_create (20, GNUNET_NO);
address_resolution_in_progress = GNUNET_YES;
pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg,
(NULL == cpid) ? NULL : &pid,
@@ -926,7 +922,6 @@ testservice_task (void *cls,
}
else if (monitor_connections) /* -m: List all active addresses continously */
{
- peers = GNUNET_CONTAINER_multihashmap_create (20, GNUNET_NO);
address_resolution_in_progress = GNUNET_YES;
pic = GNUNET_TRANSPORT_peer_get_active_addresses (cfg,
(NULL == cpid) ? NULL : &pid,
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 2d112d4fe..d6db3d22d 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -42,9 +42,8 @@
#define ENABLE_GET GNUNET_YES
#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_common.h"
-#include "gnunet_server_lib.h"
#include "gnunet_transport_plugin.h"
#include "plugin_transport_http_common.h"
#include <curl/curl.h>
@@ -1405,9 +1404,9 @@ client_connect (struct Session *s)
}
GNUNET_asprintf (&s->url, "%s/%s;%u",
- http_common_plugin_address_to_url (NULL, s->addr, s->addrlen),
- GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),
- plugin->last_tag);
+ http_common_plugin_address_to_url (NULL, s->addr, s->addrlen),
+ GNUNET_i2s_full (plugin->env->my_identity),
+ plugin->last_tag);
plugin->last_tag++;
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index 7a7f9ad0c..569a47255 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -23,9 +23,8 @@
* @brief functionality shared by http client and server transport service plugin
* @author Matthias Wachs
*/
-
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#include "gnunet_transport_plugin.h"
#include "plugin_transport_http_common.h"
@@ -37,16 +36,17 @@ struct SplittedHTTPAddress
int port;
};
+
static void
http_clean_splitted (struct SplittedHTTPAddress *spa)
{
- if (NULL != spa)
- {
- GNUNET_free_non_null (spa->protocol);
- GNUNET_free_non_null (spa->host);
- GNUNET_free_non_null (spa->path);
- GNUNET_free_non_null (spa);
- }
+ if (NULL != spa)
+ {
+ GNUNET_free_non_null (spa->protocol);
+ GNUNET_free_non_null (spa->host);
+ GNUNET_free_non_null (spa->path);
+ GNUNET_free_non_null (spa);
+ }
}
struct SplittedHTTPAddress *
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 4d879e166..58e5db46a 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_server_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_plugin.h"
#include "gnunet_nat_lib.h"
@@ -924,14 +923,16 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
*/
static int
-server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GNUNET_PeerIdentity * target, uint32_t *tag)
+server_parse_url (struct HTTP_Server_Plugin *plugin,
+ const char *url,
+ struct GNUNET_PeerIdentity *target,
+ uint32_t *tag)
{
char * tag_start = NULL;
char * tag_end = NULL;
char * target_start = NULL;
char * separator = NULL;
- char hash[plugin->peer_id_length+1];
- int hash_length;
+ unsigned int hash_length;
unsigned long int ctag;
/* URL parsing
@@ -1011,18 +1012,19 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN
if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
- memcpy (hash, target_start, hash_length);
- hash[hash_length] = '\0';
-
- if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((const char *) hash, &(target->hashPubKey)))
- {
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start,
+ hash_length,
+ &target->public_key))
+ {
/* hash conversion failed */
if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
-
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Found target `%s' in url\n", GNUNET_h2s_full(&target->hashPubKey));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ plugin->name,
+ "Found target `%s' in URL\n",
+ GNUNET_i2s_full (target));
return GNUNET_OK;
}
@@ -2879,7 +2881,7 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin)
plugin->max_connections);
- plugin->peer_id_length = strlen (GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey));
+ plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity));
return GNUNET_OK;
}
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 37a4aa7cd..0e49300b0 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -358,7 +358,7 @@ struct Plugin
/**
* Map from peer identities to sessions for the given peer.
*/
- struct GNUNET_CONTAINER_MultiHashMap *sessionmap;
+ struct GNUNET_CONTAINER_MultiPeerMap *sessionmap;
/**
* Handle to the network service.
@@ -379,7 +379,7 @@ struct Plugin
/**
* Map of peers we have tried to contact behind a NAT
*/
- struct GNUNET_CONTAINER_MultiHashMap *nat_wait_conns;
+ struct GNUNET_CONTAINER_MultiPeerMap *nat_wait_conns;
/**
* List of active TCP probes.
@@ -458,7 +458,7 @@ static void
inc_sessions (struct Plugin *plugin, struct Session *session, int line)
{
sessions++;
- unsigned int size = GNUNET_CONTAINER_multihashmap_size(plugin->sessionmap);
+ unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap);
if (sessions != size)
LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n",
sessions, size);
@@ -475,7 +475,7 @@ static void
dec_sessions (struct Plugin *plugin, struct Session *session, int line)
{
GNUNET_assert (sessions > 0);
- unsigned int size = GNUNET_CONTAINER_multihashmap_size(plugin->sessionmap);
+ unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap);
sessions--;
if (sessions != size)
LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map size: %u\n",
@@ -751,7 +751,7 @@ struct SessionClientCtx
static int
session_lookup_by_client_it (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct SessionClientCtx *sc_ctx = cls;
@@ -781,7 +781,7 @@ lookup_session_by_client (struct Plugin *plugin,
sc_ctx.client = client;
sc_ctx.ret = NULL;
- GNUNET_CONTAINER_multihashmap_iterate (plugin->sessionmap, &session_lookup_by_client_it, &sc_ctx);
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_lookup_by_client_it, &sc_ctx);
return sc_ctx.ret;
}
@@ -1024,14 +1024,14 @@ disconnect_session (struct Session *session)
stop_session_timeout (session);
- if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (plugin->sessionmap, &session->target.hashPubKey, session))
+ if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap, &session->target, session))
{
GNUNET_STATISTICS_update (session->plugin->env->stats,
gettext_noop ("# TCP sessions active"), -1,
GNUNET_NO);
dec_sessions (plugin, session, __LINE__);
}
- else GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (plugin->nat_wait_conns, &session->target.hashPubKey, session));
+ else GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns, &session->target, session));
/* clean up state */
if (session->transmit_handle != NULL)
@@ -1093,32 +1093,36 @@ struct FindSessionContext
int res;
};
-int session_it (void *cls,
- const struct GNUNET_HashCode * key,
- void *value)
+
+static int
+session_it (void *cls,
+ const struct GNUNET_PeerIdentity * key,
+ void *value)
{
struct FindSessionContext *res = cls;
+
if (res->s == value)
{
res->res = GNUNET_OK;
return GNUNET_NO;
}
- else
- return GNUNET_YES;
+ return GNUNET_YES;
}
-int find_session (struct Plugin *plugin, struct Session *session)
+
+static int
+find_session (struct Plugin *plugin, struct Session *session)
{
struct FindSessionContext session_map_res;
struct FindSessionContext nat_map_res;
session_map_res.s = session;
session_map_res.res = GNUNET_SYSERR;
- GNUNET_CONTAINER_multihashmap_iterate (plugin->sessionmap, &session_it, &session_map_res);
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_it, &session_map_res);
nat_map_res.s = session;
nat_map_res.res = GNUNET_SYSERR;
- GNUNET_CONTAINER_multihashmap_iterate (plugin->nat_wait_conns, &session_it, &nat_map_res);
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns, &session_it, &nat_map_res);
if ((session_map_res.res == GNUNET_SYSERR) && (nat_map_res.res == GNUNET_SYSERR))
{
@@ -1190,8 +1194,8 @@ tcp_plugin_send (void *cls,
"Asked to transmit %u bytes to `%s', added message to list.\n",
msgbuf_size, GNUNET_i2s (&session->target));
- if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains_value (plugin->sessionmap,
- &session->target.hashPubKey,
+ if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
+ &session->target,
session))
{
GNUNET_assert (session->client != NULL);
@@ -1209,7 +1213,7 @@ tcp_plugin_send (void *cls,
process_pending_messages (session);
return msgbuf_size;
}
- else if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains_value(plugin->nat_wait_conns, &session->target.hashPubKey, session))
+ else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"This NAT WAIT session for peer `%s' is not yet ready!\n",
@@ -1247,7 +1251,7 @@ struct SessionItCtx
static int
session_lookup_it (void *cls,
- const struct GNUNET_HashCode *key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct SessionItCtx * si_ctx = cls;
@@ -1343,8 +1347,8 @@ tcp_plugin_get_session (void *cls,
/* look for existing session */
if (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_contains (plugin->sessionmap,
- &address->peer.hashPubKey))
+ GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap,
+ &address->peer))
{
struct SessionItCtx si_ctx;
@@ -1353,8 +1357,8 @@ tcp_plugin_get_session (void *cls,
si_ctx.result = NULL;
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap,
- &address->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap,
+ &address->peer,
&session_lookup_it, &si_ctx);
if (si_ctx.result != NULL)
{
@@ -1431,8 +1435,8 @@ tcp_plugin_get_session (void *cls,
if ((is_natd == GNUNET_YES) &&
(GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns,
- &address->peer.hashPubKey)))
+ GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns,
+ &address->peer)))
{
/* Only do one NAT punch attempt per peer identity */
return NULL;
@@ -1440,8 +1444,8 @@ tcp_plugin_get_session (void *cls,
if ((is_natd == GNUNET_YES) && (NULL != plugin->nat) &&
(GNUNET_NO ==
- GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns,
- &address->peer.hashPubKey)))
+ GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns,
+ &address->peer)))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found valid IPv4 NAT address (creating session)!\n") ;
@@ -1454,8 +1458,8 @@ tcp_plugin_get_session (void *cls,
session);
GNUNET_assert (session != NULL);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (plugin->nat_wait_conns,
- &session->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns,
+ &session->target,
session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
@@ -1502,8 +1506,8 @@ tcp_plugin_get_session (void *cls,
session->addrlen = addrlen;
session->ats_address_network_type = ats.value;
- GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap,
- &session->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
+ &session->target,
session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
inc_sessions (plugin, session, __LINE__);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1520,7 +1524,7 @@ tcp_plugin_get_session (void *cls,
static int
session_disconnect_it (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct Session *session = value;
@@ -1557,8 +1561,10 @@ tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting peer `%4s'\n", GNUNET_i2s (target));
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap, &target->hashPubKey, &session_disconnect_it, plugin);
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->nat_wait_conns, &target->hashPubKey, &session_disconnect_it, plugin);
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target,
+ &session_disconnect_it, plugin);
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target,
+ &session_disconnect_it, plugin);
}
@@ -1933,9 +1939,9 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
}
session =
- GNUNET_CONTAINER_multihashmap_get (plugin->nat_wait_conns,
+ GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns,
&tcp_nat_probe->
- clientIdentity.hashPubKey);
+ clientIdentity);
if (session == NULL)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1959,12 +1965,12 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
disconnect_session (session);
return;
}
- GNUNET_assert (GNUNET_CONTAINER_multihashmap_remove
+ GNUNET_assert (GNUNET_CONTAINER_multipeermap_remove
(plugin->nat_wait_conns,
- &tcp_nat_probe->clientIdentity.hashPubKey,
+ &tcp_nat_probe->clientIdentity,
session) == GNUNET_YES);
- GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap,
- &session->target.hashPubKey, session,
+ GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
+ &session->target, session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
session->last_activity = GNUNET_TIME_absolute_get ();
session->inbound = GNUNET_NO;
@@ -2110,8 +2116,8 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client,
session,
GNUNET_a2s (vaddr, alen));
GNUNET_free (vaddr);
- GNUNET_CONTAINER_multihashmap_put (plugin->sessionmap,
- &session->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
+ &session->target,
session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
inc_sessions (plugin, session, __LINE__);
@@ -2247,9 +2253,9 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
distance.value = session->ats_address_network_type;
GNUNET_break (ntohl(session->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
- GNUNET_assert (GNUNET_CONTAINER_multihashmap_contains_value (plugin->sessionmap,
- &session->target.hashPubKey,
- session));
+ GNUNET_assert (GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
+ &session->target,
+ session));
delay = plugin->env->receive (plugin->env->cls,
&session->target,
@@ -2592,7 +2598,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
myoptions = 0;
plugin = GNUNET_malloc (sizeof (struct Plugin));
- plugin->sessionmap = GNUNET_CONTAINER_multihashmap_create (max_connections, GNUNET_YES);
+ plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections, GNUNET_YES);
plugin->max_connections = max_connections;
plugin->cur_connections = 0;
plugin->open_port = bport;
@@ -2671,7 +2677,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
GNUNET_SERVER_add_handlers (plugin->server, plugin->handlers);
GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin);
- plugin->nat_wait_conns = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
+ plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
if (bport != 0)
LOG (GNUNET_ERROR_TYPE_INFO,
_("TCP transport listening on port %llu\n"), bport);
@@ -2713,9 +2719,9 @@ libgnunet_plugin_transport_tcp_done (void *cls)
LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down TCP plugin\n");
/* Removing leftover sessions */
- GNUNET_CONTAINER_multihashmap_iterate(plugin->sessionmap, &session_disconnect_it, NULL);
+ GNUNET_CONTAINER_multipeermap_iterate(plugin->sessionmap, &session_disconnect_it, NULL);
/* Removing leftover NAT sessions */
- GNUNET_CONTAINER_multihashmap_iterate(plugin->nat_wait_conns, &session_disconnect_it, NULL);
+ GNUNET_CONTAINER_multipeermap_iterate(plugin->nat_wait_conns, &session_disconnect_it, NULL);
next = ppc_dll_head;
for (cur = next; NULL != cur; cur = next)
@@ -2743,8 +2749,8 @@ libgnunet_plugin_transport_tcp_done (void *cls)
GNUNET_CONNECTION_destroy (tcp_probe->sock);
GNUNET_free (tcp_probe);
}
- GNUNET_CONTAINER_multihashmap_destroy (plugin->nat_wait_conns);
- GNUNET_CONTAINER_multihashmap_destroy (plugin->sessionmap);
+ GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns);
+ GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap);
GNUNET_free (plugin);
GNUNET_free (api);
return NULL;
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index 75554a0db..faee0c38d 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -25,10 +25,8 @@
*/
#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
#include "gnunet_transport_plugin.h"
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index bc64fd5d2..4fe4d94cf 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1271,12 +1271,12 @@ disconnect_session (struct Session *s)
}
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (plugin->sessions,
- &s->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
+ &s->target,
s));
GNUNET_STATISTICS_set(plugin->env->stats,
"# UDP, sessions active",
- GNUNET_CONTAINER_multihashmap_size(plugin->sessions),
+ GNUNET_CONTAINER_multipeermap_size(plugin->sessions),
GNUNET_NO);
if (s->rc > 0)
s->in_destroy = GNUNET_YES;
@@ -1293,7 +1293,7 @@ disconnect_session (struct Session *s)
* @return GNUNET_OK (continue to iterate)
*/
static int
-disconnect_and_free_it (void *cls, const struct GNUNET_HashCode * key, void *value)
+disconnect_and_free_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
{
disconnect_session(value);
return GNUNET_OK;
@@ -1317,7 +1317,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting from peer `%s'\n", GNUNET_i2s (target));
/* Clean up sessions */
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessions, &target->hashPubKey, &disconnect_and_free_it, plugin);
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, target,
+ &disconnect_and_free_it, plugin);
}
@@ -1466,7 +1467,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
static int
session_cmp_it (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity * key,
void *value)
{
struct SessionCompareContext * cctx = cls;
@@ -1591,7 +1592,7 @@ udp_plugin_lookup_session (void *cls,
"Looking for existing session for peer `%s' `%s' \n",
GNUNET_i2s (&address->peer),
udp_address_to_string(NULL, address->address, address->address_length));
- GNUNET_CONTAINER_multihashmap_get_multiple(plugin->sessions, &address->peer.hashPubKey, session_cmp_it, &cctx);
+ GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx);
if (cctx.res != NULL)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res);
@@ -1623,13 +1624,13 @@ udp_plugin_create_session (void *cls,
GNUNET_i2s(&address->peer),
udp_address_to_string(NULL,address->address,address->address_length));
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (plugin->sessions,
- &s->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
+ &s->target,
s,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
GNUNET_STATISTICS_set(plugin->env->stats,
"# UDP, sessions active",
- GNUNET_CONTAINER_multihashmap_size(plugin->sessions),
+ GNUNET_CONTAINER_multipeermap_size(plugin->sessions),
GNUNET_NO);
return s;
}
@@ -1800,7 +1801,7 @@ udp_plugin_send (void *cls,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains_value(plugin->sessions, &s->target.hashPubKey, s))
+ if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_contains_value(plugin->sessions, &s->target, s))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -2137,7 +2138,9 @@ struct LookupContext
static int
-lookup_session_by_addr_it (void *cls, const struct GNUNET_HashCode * key, void *value)
+lookup_session_by_addr_it (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
struct LookupContext *l_ctx = cls;
struct Session * s = value;
@@ -2184,7 +2187,7 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
l_ctx.addrlen = rc->addr_len;
l_ctx.res = NULL;
l_ctx.must_have_frag_ctx = GNUNET_NO;
- GNUNET_CONTAINER_multihashmap_iterate (rc->plugin->sessions,
+ GNUNET_CONTAINER_multipeermap_iterate (rc->plugin->sessions,
&lookup_session_by_addr_it,
&l_ctx);
s = l_ctx.res;
@@ -2259,7 +2262,7 @@ read_process_ack (struct Plugin *plugin,
l_ctx.addrlen = fromlen;
l_ctx.res = NULL;
l_ctx.must_have_frag_ctx = GNUNET_YES;
- GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions,
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
&lookup_session_by_addr_it,
&l_ctx);
s = l_ctx.res;
@@ -3111,7 +3114,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
p->enable_ipv6 = enable_v6;
p->enable_ipv4 = GNUNET_YES; /* default */
p->env = env;
- p->sessions = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ p->sessions = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
p->mst = GNUNET_SERVER_mst_create (&process_inbound_tokenized_messages, p);
GNUNET_BANDWIDTH_tracker_init (&p->tracker,
@@ -3125,7 +3128,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
_("Failed to create network sockets, plugin failed\n"));
- GNUNET_CONTAINER_multihashmap_destroy (p->sessions);
+ GNUNET_CONTAINER_multipeermap_destroy (p->sessions);
GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs);
GNUNET_SERVER_mst_destroy (p->mst);
GNUNET_free (p);
@@ -3267,8 +3270,8 @@ libgnunet_plugin_transport_udp_done (void *cls)
/* Clean up sessions */
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Cleaning up sessions\n");
- GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, &disconnect_and_free_it, plugin);
- GNUNET_CONTAINER_multihashmap_destroy (plugin->sessions);
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, &disconnect_and_free_it, plugin);
+ GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
next = ppc_dll_head;
for (cur = next; NULL != cur; cur = next)
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h
index e168a534c..6fb573690 100644
--- a/src/transport/plugin_transport_udp.h
+++ b/src/transport/plugin_transport_udp.h
@@ -135,7 +135,7 @@ struct Plugin
* Session of peers with whom we are currently connected,
* map of peer identity to 'struct PeerSession'.
*/
- struct GNUNET_CONTAINER_MultiHashMap *sessions;
+ struct GNUNET_CONTAINER_MultiPeerMap *sessions;
/**
* Heap with all of our defragmentation activities.
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index beed32d8d..4e153aab4 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -276,7 +276,7 @@ struct Plugin
/**
* Sessions
*/
- struct GNUNET_CONTAINER_MultiHashMap *session_map;
+ struct GNUNET_CONTAINER_MultiPeerMap *session_map;
/**
* FD Read set
@@ -454,7 +454,7 @@ struct LookupCtx
*/
static int
lookup_session_it (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity * key,
void *value)
{
struct LookupCtx *lctx = cls;
@@ -498,8 +498,8 @@ lookup_session (struct Plugin *plugin,
lctx.s = NULL;
lctx.ua = ua;
lctx.ua_len = ua_len;
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map,
- &sender->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
+ sender,
&lookup_session_it, &lctx);
return lctx.s;
}
@@ -542,12 +542,12 @@ disconnect_session (struct Session *s)
removed = GNUNET_YES;
}
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (plugin->session_map,
- &s->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (plugin->session_map,
+ &s->target,
s));
GNUNET_STATISTICS_set (plugin->env->stats,
"# UNIX sessions active",
- GNUNET_CONTAINER_multihashmap_size (plugin->session_map),
+ GNUNET_CONTAINER_multipeermap_size (plugin->session_map),
GNUNET_NO);
if ((GNUNET_YES == removed) && (NULL == plugin->msg_head))
reschedule_select (plugin);
@@ -712,7 +712,7 @@ struct GetSessionIteratorContext
*/
static int
get_session_it (void *cls,
- const struct GNUNET_HashCode *key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct GetSessionIteratorContext *gsi = cls;
@@ -818,8 +818,8 @@ unix_plugin_get_session (void *cls,
gsi.address = (const char *) address->address;
gsi.addrlen = address->address_length;
gsi.res = NULL;
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map,
- &address->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
+ &address->peer,
&get_session_it, &gsi);
if (NULL != gsi.res)
{
@@ -843,12 +843,12 @@ unix_plugin_get_session (void *cls,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Creating a new session %p for address `%s'\n",
s, unix_address_to_string (NULL, address->address, address->address_length));
- (void) GNUNET_CONTAINER_multihashmap_put (plugin->session_map,
- &address->peer.hashPubKey, s,
+ (void) GNUNET_CONTAINER_multipeermap_put (plugin->session_map,
+ &address->peer, s,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
GNUNET_STATISTICS_set (plugin->env->stats,
"# UNIX sessions active",
- GNUNET_CONTAINER_multihashmap_size (plugin->session_map),
+ GNUNET_CONTAINER_multipeermap_size (plugin->session_map),
GNUNET_NO);
return s;
}
@@ -898,8 +898,8 @@ unix_plugin_send (void *cls,
GNUNET_assert (NULL != session);
if (GNUNET_OK !=
- GNUNET_CONTAINER_multihashmap_contains_value (plugin->session_map,
- &session->target.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map,
+ &session->target,
session))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -1553,7 +1553,9 @@ reschedule_session_timeout (struct Session *s)
* @return GNUNET_YES (always, continue to iterate)
*/
static int
-get_session_delete_it (void *cls, const struct GNUNET_HashCode * key, void *value)
+get_session_delete_it (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
struct Session *s = value;
@@ -1567,7 +1569,7 @@ get_session_delete_it (void *cls, const struct GNUNET_HashCode * key, void *valu
*
* @param cls closure for this call (should be handle to Plugin)
* @param target the peeridentity of the peer to disconnect
- * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed
*/
static void
unix_disconnect (void *cls,
@@ -1576,8 +1578,8 @@ unix_disconnect (void *cls,
struct Plugin *plugin = cls;
GNUNET_assert (plugin != NULL);
- GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map,
- &target->hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
+ target,
&get_session_delete_it, plugin);
}
@@ -1638,7 +1640,7 @@ libgnunet_plugin_transport_unix_init (void *cls)
if (0 == sockets_created)
LOG (GNUNET_ERROR_TYPE_WARNING,
_("Failed to open UNIX listen socket\n"));
- plugin->session_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ plugin->session_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
plugin->address_update_task = GNUNET_SCHEDULER_add_now (&address_notification, plugin);
return api;
}
@@ -1701,9 +1703,9 @@ libgnunet_plugin_transport_unix_done (void *cls)
plugin->unix_sock.desc = NULL;
plugin->with_ws = GNUNET_NO;
}
- GNUNET_CONTAINER_multihashmap_iterate (plugin->session_map,
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->session_map,
&get_session_delete_it, plugin);
- GNUNET_CONTAINER_multihashmap_destroy (plugin->session_map);
+ GNUNET_CONTAINER_multipeermap_destroy (plugin->session_map);
if (NULL != plugin->rs)
GNUNET_NETWORK_fdset_destroy (plugin->rs);
if (NULL != plugin->ws)
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index c6f990058..044c6818a 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -26,7 +26,7 @@
#ifndef PLUGIN_TRANSPORT_WLAN
#define PLUGIN_TRANSPORT_WLAN
-#include <stdint.h>
+#include "gnunet_crypto_lib.h"
#include "gnunet_common.h"
/**
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index 7c33ad4ca..30cb87832 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -24,7 +24,6 @@
*
* @author Matthias Wachs
*/
-
#include "transport-testing.h"
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h
index f3906b495..99225936a 100644
--- a/src/transport/transport-testing.h
+++ b/src/transport/transport-testing.h
@@ -24,12 +24,9 @@
*
* @author Matthias Wachs
*/
-
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_container_lib.h"
#include "gnunet_transport_service.h"
#include "gnunet_testing_lib.h"
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index f83b6c098..cb6cefdb1 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -29,16 +29,11 @@
* - test test test
*/
#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
-#include "gnunet_bandwidth_lib.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_container_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
@@ -320,7 +315,7 @@ struct GNUNET_TRANSPORT_Handle
* Hash map of the current connected neighbours of this peer.
* Maps peer identities to 'struct Neighbour' entries.
*/
- struct GNUNET_CONTAINER_MultiHashMap *neighbours;
+ struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
/**
* Heap sorting peers with pending messages by the timestamps that
@@ -398,7 +393,7 @@ static struct Neighbour *
neighbour_find (struct GNUNET_TRANSPORT_Handle *h,
const struct GNUNET_PeerIdentity *peer)
{
- return GNUNET_CONTAINER_multihashmap_get (h->neighbours, &peer->hashPubKey);
+ return GNUNET_CONTAINER_multipeermap_get (h->neighbours, peer);
}
@@ -424,8 +419,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
MAX_BANDWIDTH_CARRY_S);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (h->neighbours,
- &n->id.hashPubKey, n,
+ GNUNET_CONTAINER_multipeermap_put (h->neighbours,
+ &n->id, n,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return n;
}
@@ -442,7 +437,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
* GNUNET_NO if not.
*/
static int
-neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value)
+neighbour_delete (void *cls,
+ const struct GNUNET_PeerIdentity *key, void *value)
{
struct GNUNET_TRANSPORT_Handle *handle = cls;
struct Neighbour *n = value;
@@ -452,7 +448,7 @@ neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value)
GNUNET_assert (NULL == n->th);
GNUNET_assert (NULL == n->hn);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (handle->neighbours, key,
+ GNUNET_CONTAINER_multipeermap_remove (handle->neighbours, key,
n));
GNUNET_free (n);
return GNUNET_YES;
@@ -568,7 +564,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_break (0);
break;
}
- neighbour_delete (h, &dim->peer.hashPubKey, n);
+ neighbour_delete (h, &dim->peer, n);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK:
if (size != sizeof (struct SendOkMessage))
@@ -994,7 +990,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
h->client = NULL;
}
/* Forget about all neighbours that we used to be connected to */
- GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
+ GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, &neighbour_delete, h);
if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (h->quota_task);
@@ -1341,15 +1337,15 @@ GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *o
int
GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *handle,
- const struct GNUNET_PeerIdentity *peer)
+ const struct GNUNET_PeerIdentity *peer)
{
- GNUNET_assert (NULL != handle);
- GNUNET_assert (NULL != peer);
-
- if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(handle->neighbours, &peer->hashPubKey))
- return GNUNET_YES;
- else
- return GNUNET_NO;
+ GNUNET_assert (NULL != handle);
+ GNUNET_assert (NULL != peer);
+
+ if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer))
+ return GNUNET_YES;
+ else
+ return GNUNET_NO;
}
@@ -1455,7 +1451,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
ret->nd_cb = nd;
ret->reconnect_delay = GNUNET_TIME_UNIT_ZERO;
ret->neighbours =
- GNUNET_CONTAINER_multihashmap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES);
+ GNUNET_CONTAINER_multipeermap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES);
ret->ready_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
@@ -1488,7 +1484,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
GNUNET_SCHEDULER_cancel (handle->reconnect_task);
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
- GNUNET_CONTAINER_multihashmap_destroy (handle->neighbours);
+ GNUNET_CONTAINER_multipeermap_destroy (handle->neighbours);
handle->neighbours = NULL;
if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK)
{
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index 217aecdb5..9c1301ed2 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -28,14 +28,11 @@
* transport plugin, and whether or not the address given is currently
* in the 'connected' state (according to the transport service).
*/
-
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index 152e573cd..94c9ac45a 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -18,12 +18,10 @@
Boston, MA 02111-1307, USA.
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c
index 04646204f..dcd1ae781 100644
--- a/src/transport/transport_api_blacklist.c
+++ b/src/transport/transport_api_blacklist.c
@@ -24,12 +24,10 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"