aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index dc91ac32d..891519314 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -52,7 +52,7 @@
52/** 52/**
53 * How many buckets will we allow total. 53 * How many buckets will we allow total.
54 */ 54 */
55#define MAX_BUCKETS sizeof (GNUNET_HashCode) * 8 55#define MAX_BUCKETS sizeof (struct GNUNET_HashCode) * 8
56 56
57/** 57/**
58 * What is the maximum number of peers in a given bucket. 58 * What is the maximum number of peers in a given bucket.
@@ -140,7 +140,7 @@ struct PeerPutMessage
140 /** 140 /**
141 * The key we are storing under. 141 * The key we are storing under.
142 */ 142 */
143 GNUNET_HashCode key; 143 struct GNUNET_HashCode key;
144 144
145 /* put path (if tracked) */ 145 /* put path (if tracked) */
146 146
@@ -182,7 +182,7 @@ struct PeerResultMessage
182 /** 182 /**
183 * The key of the corresponding GET request. 183 * The key of the corresponding GET request.
184 */ 184 */
185 GNUNET_HashCode key; 185 struct GNUNET_HashCode key;
186 186
187 /* put path (if tracked) */ 187 /* put path (if tracked) */
188 188
@@ -241,7 +241,7 @@ struct PeerGetMessage
241 /** 241 /**
242 * The key we are looking for. 242 * The key we are looking for.
243 */ 243 */
244 GNUNET_HashCode key; 244 struct GNUNET_HashCode key;
245 245
246 /* xquery */ 246 /* xquery */
247 247
@@ -424,7 +424,7 @@ static struct GNUNET_ATS_PerformanceHandle *atsAPI;
424 * on error (same hashcode) 424 * on error (same hashcode)
425 */ 425 */
426static int 426static int
427find_bucket (const GNUNET_HashCode * hc) 427find_bucket (const struct GNUNET_HashCode * hc)
428{ 428{
429 unsigned int bits; 429 unsigned int bits;
430 430
@@ -518,10 +518,10 @@ struct BloomConstructorContext
518 * @return GNUNET_YES (we should continue to iterate) 518 * @return GNUNET_YES (we should continue to iterate)
519 */ 519 */
520static int 520static int
521add_known_to_bloom (void *cls, const GNUNET_HashCode * key, void *value) 521add_known_to_bloom (void *cls, const struct GNUNET_HashCode * key, void *value)
522{ 522{
523 struct BloomConstructorContext *ctx = cls; 523 struct BloomConstructorContext *ctx = cls;
524 GNUNET_HashCode mh; 524 struct GNUNET_HashCode mh;
525 525
526 GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh); 526 GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh);
527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -874,7 +874,7 @@ get_forward_count (uint32_t hop_count, uint32_t target_replication)
874 * the two hash codes increases 874 * the two hash codes increases
875 */ 875 */
876static unsigned int 876static unsigned int
877get_distance (const GNUNET_HashCode * target, const GNUNET_HashCode * have) 877get_distance (const struct GNUNET_HashCode * target, const struct GNUNET_HashCode * have)
878{ 878{
879 unsigned int bucket; 879 unsigned int bucket;
880 unsigned int msb; 880 unsigned int msb;
@@ -911,7 +911,7 @@ get_distance (const GNUNET_HashCode * target, const GNUNET_HashCode * have)
911 * mismatching bit at 'bucket' */ 911 * mismatching bit at 'bucket' */
912 lsb = 0; 912 lsb = 0;
913 for (i = bucket + 1; 913 for (i = bucket + 1;
914 (i < sizeof (GNUNET_HashCode) * 8) && (i < bucket + 1 + 32 - 9); i++) 914 (i < sizeof (struct GNUNET_HashCode) * 8) && (i < bucket + 1 + 32 - 9); i++)
915 { 915 {
916 if (GNUNET_CRYPTO_hash_get_bit (target, i) != 916 if (GNUNET_CRYPTO_hash_get_bit (target, i) !=
917 GNUNET_CRYPTO_hash_get_bit (have, i)) 917 GNUNET_CRYPTO_hash_get_bit (have, i))
@@ -934,7 +934,7 @@ get_distance (const GNUNET_HashCode * target, const GNUNET_HashCode * have)
934 * GNUNET_NO otherwise. 934 * GNUNET_NO otherwise.
935 */ 935 */
936static int 936static int
937am_closest_peer (const GNUNET_HashCode * key, 937am_closest_peer (const struct GNUNET_HashCode * key,
938 const struct GNUNET_CONTAINER_BloomFilter *bloom) 938 const struct GNUNET_CONTAINER_BloomFilter *bloom)
939{ 939{
940 int bits; 940 int bits;
@@ -943,7 +943,7 @@ am_closest_peer (const GNUNET_HashCode * key,
943 int count; 943 int count;
944 struct PeerInfo *pos; 944 struct PeerInfo *pos;
945 945
946 if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (GNUNET_HashCode))) 946 if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (struct GNUNET_HashCode)))
947 return GNUNET_YES; 947 return GNUNET_YES;
948 bucket_num = find_bucket (key); 948 bucket_num = find_bucket (key);
949 GNUNET_assert (bucket_num >= 0); 949 GNUNET_assert (bucket_num >= 0);
@@ -989,7 +989,7 @@ am_closest_peer (const GNUNET_HashCode * key,
989 * @return Peer to route to, or NULL on error 989 * @return Peer to route to, or NULL on error
990 */ 990 */
991static struct PeerInfo * 991static struct PeerInfo *
992select_peer (const GNUNET_HashCode * key, 992select_peer (const struct GNUNET_HashCode * key,
993 const struct GNUNET_CONTAINER_BloomFilter *bloom, uint32_t hops) 993 const struct GNUNET_CONTAINER_BloomFilter *bloom, uint32_t hops)
994{ 994{
995 unsigned int bc; 995 unsigned int bc;
@@ -1115,7 +1115,7 @@ select_peer (const GNUNET_HashCode * key,
1115 * @return number of peers returned in 'targets'. 1115 * @return number of peers returned in 'targets'.
1116 */ 1116 */
1117static unsigned int 1117static unsigned int
1118get_target_peers (const GNUNET_HashCode * key, 1118get_target_peers (const struct GNUNET_HashCode * key,
1119 struct GNUNET_CONTAINER_BloomFilter *bloom, 1119 struct GNUNET_CONTAINER_BloomFilter *bloom,
1120 uint32_t hop_count, uint32_t target_replication, 1120 uint32_t hop_count, uint32_t target_replication,
1121 struct PeerInfo ***targets) 1121 struct PeerInfo ***targets)
@@ -1185,7 +1185,7 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1185 struct GNUNET_TIME_Absolute expiration_time, 1185 struct GNUNET_TIME_Absolute expiration_time,
1186 uint32_t hop_count, 1186 uint32_t hop_count,
1187 struct GNUNET_CONTAINER_BloomFilter *bf, 1187 struct GNUNET_CONTAINER_BloomFilter *bf,
1188 const GNUNET_HashCode * key, 1188 const struct GNUNET_HashCode * key,
1189 unsigned int put_path_length, 1189 unsigned int put_path_length,
1190 struct GNUNET_PeerIdentity *put_path, 1190 struct GNUNET_PeerIdentity *put_path,
1191 const void *data, size_t data_size) 1191 const void *data, size_t data_size)
@@ -1295,7 +1295,7 @@ void
1295GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, 1295GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1296 enum GNUNET_DHT_RouteOption options, 1296 enum GNUNET_DHT_RouteOption options,
1297 uint32_t desired_replication_level, 1297 uint32_t desired_replication_level,
1298 uint32_t hop_count, const GNUNET_HashCode * key, 1298 uint32_t hop_count, const struct GNUNET_HashCode * key,
1299 const void *xquery, size_t xquery_size, 1299 const void *xquery, size_t xquery_size,
1300 const struct GNUNET_CONTAINER_BloomFilter *reply_bf, 1300 const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
1301 uint32_t reply_bf_mutator, 1301 uint32_t reply_bf_mutator,
@@ -1405,7 +1405,7 @@ void
1405GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, 1405GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
1406 enum GNUNET_BLOCK_Type type, 1406 enum GNUNET_BLOCK_Type type,
1407 struct GNUNET_TIME_Absolute expiration_time, 1407 struct GNUNET_TIME_Absolute expiration_time,
1408 const GNUNET_HashCode * key, 1408 const struct GNUNET_HashCode * key,
1409 unsigned int put_path_length, 1409 unsigned int put_path_length,
1410 const struct GNUNET_PeerIdentity *put_path, 1410 const struct GNUNET_PeerIdentity *put_path,
1411 unsigned int get_path_length, 1411 unsigned int get_path_length,
@@ -1508,7 +1508,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
1508 size_t payload_size; 1508 size_t payload_size;
1509 enum GNUNET_DHT_RouteOption options; 1509 enum GNUNET_DHT_RouteOption options;
1510 struct GNUNET_CONTAINER_BloomFilter *bf; 1510 struct GNUNET_CONTAINER_BloomFilter *bf;
1511 GNUNET_HashCode test_key; 1511 struct GNUNET_HashCode test_key;
1512 1512
1513 msize = ntohs (message->size); 1513 msize = ntohs (message->size);
1514 if (msize < sizeof (struct PeerPutMessage)) 1514 if (msize < sizeof (struct PeerPutMessage))
@@ -1541,7 +1541,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
1541 &test_key)) 1541 &test_key))
1542 { 1542 {
1543 case GNUNET_YES: 1543 case GNUNET_YES:
1544 if (0 != memcmp (&test_key, &put->key, sizeof (GNUNET_HashCode))) 1544 if (0 != memcmp (&test_key, &put->key, sizeof (struct GNUNET_HashCode)))
1545 { 1545 {
1546 GNUNET_break_op (0); 1546 GNUNET_break_op (0);
1547 return GNUNET_YES; 1547 return GNUNET_YES;
@@ -1615,14 +1615,14 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
1615 */ 1615 */
1616static void 1616static void
1617handle_find_peer (const struct GNUNET_PeerIdentity *sender, 1617handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1618 const GNUNET_HashCode * key, 1618 const struct GNUNET_HashCode * key,
1619 struct GNUNET_CONTAINER_BloomFilter *bf, uint32_t bf_mutator) 1619 struct GNUNET_CONTAINER_BloomFilter *bf, uint32_t bf_mutator)
1620{ 1620{
1621 int bucket_idx; 1621 int bucket_idx;
1622 struct PeerBucket *bucket; 1622 struct PeerBucket *bucket;
1623 struct PeerInfo *peer; 1623 struct PeerInfo *peer;
1624 unsigned int choice; 1624 unsigned int choice;
1625 GNUNET_HashCode mhash; 1625 struct GNUNET_HashCode mhash;
1626 const struct GNUNET_HELLO_Message *hello; 1626 const struct GNUNET_HELLO_Message *hello;
1627 1627
1628 /* first, check about our own HELLO */ 1628 /* first, check about our own HELLO */
@@ -1657,7 +1657,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1657 } 1657 }
1658 1658
1659 /* then, also consider sending a random HELLO from the closest bucket */ 1659 /* then, also consider sending a random HELLO from the closest bucket */
1660 if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (GNUNET_HashCode))) 1660 if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (struct GNUNET_HashCode)))
1661 bucket_idx = closest_bucket; 1661 bucket_idx = closest_bucket;
1662 else 1662 else
1663 bucket_idx = GNUNET_MIN (closest_bucket, find_bucket (key)); 1663 bucket_idx = GNUNET_MIN (closest_bucket, find_bucket (key));