/*
This file is part of GNUnet.
- Copyright (C) 2010 GNUnet e.V.
+ Copyright (C) 2010, 2017 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
{
struct GNUNET_HashCode m;
- GNUNET_CRYPTO_hash (&mingle_number, sizeof (uint32_t), &m);
- GNUNET_CRYPTO_hash_xor (&m, in, hc);
+ GNUNET_CRYPTO_hash (&mingle_number,
+ sizeof (uint32_t),
+ &m);
+ GNUNET_CRYPTO_hash_xor (&m,
+ in,
+ hc);
}
plugin = GNUNET_new (struct Plugin);
plugin->api = api;
plugin->library_name = GNUNET_strdup (library_name);
- GNUNET_array_append (ctx->plugins, ctx->num_plugins, plugin);
+ GNUNET_array_append (ctx->plugins,
+ ctx->num_plugins,
+ plugin);
}
ctx = GNUNET_new (struct GNUNET_BLOCK_Context);
ctx->cfg = cfg;
- GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", NULL, &add_plugin, ctx);
+ GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_",
+ NULL,
+ &add_plugin,
+ ctx);
return ctx;
}
{
plugin = ctx->plugins[i];
GNUNET_break (NULL ==
- GNUNET_PLUGIN_unload (plugin->library_name, plugin->api));
+ GNUNET_PLUGIN_unload (plugin->library_name,
+ plugin->api));
GNUNET_free (plugin->library_name);
GNUNET_free (plugin);
}
enum GNUNET_BLOCK_Type type)
{
struct Plugin *plugin;
- unsigned int i;
unsigned int j;
- for (i = 0; i < ctx->num_plugins; i++)
+ for (unsigned i = 0; i < ctx->num_plugins; i++)
{
plugin = ctx->plugins[i];
j = 0;
type);
if (NULL == plugin->create_group)
return NULL;
- va_start (ap, raw_data_size);
+ va_start (ap,
+ raw_data_size);
bg = plugin->create_group (plugin->cls,
type,
nonce,
if (plugin == NULL)
return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
- return plugin->get_key (plugin->cls, type, block, block_size, key);
+ return plugin->get_key (plugin->cls,
+ type,
+ block,
+ block_size,
+ key);
}
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_block_lib.h"
-#include "gnunet_block_group_lib.h"
#include "gnunet_hello_lib.h"
#include "gnunet_constants.h"
#include "gnunet_protocols.h"
GNUNET_CRYPTO_hash (key,
sizeof (struct GNUNET_PeerIdentity),
&key_hash);
- GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
- &key_hash);
+ GNUNET_BLOCK_group_set_seen (bg,
+ &key_hash,
+ 1);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding known peer (%s) to bloomfilter for FIND PEER\n",
GNUNET_i2s (key));
newly_found_peers = 0;
return;
}
- bg = GNUNET_BLOCK_GROUP_bf_create (NULL,
- DHT_BLOOM_SIZE,
- GNUNET_CONSTANTS_BLOOMFILTER_K,
- GNUNET_BLOCK_TYPE_DHT_HELLO,
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX),
- NULL,
- 0);
+ bg = GNUNET_BLOCK_group_create (GDS_block_context,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ UINT32_MAX),
+ NULL,
+ 0);
GNUNET_CONTAINER_multipeermap_iterate (all_connected_peers,
&add_known_to_bloom,
bg);
struct PeerInfo *peer;
unsigned int choice;
const struct GNUNET_HELLO_Message *hello;
+ size_t hello_size;
/* first, check about our own HELLO */
if (NULL != GDS_my_hello)
{
- if (GNUNET_YES !=
- GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
- &my_identity_hash))
+ hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello);
+ GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader));
+ if (GNUNET_BLOCK_EVALUATION_OK_MORE ==
+ GNUNET_BLOCK_evaluate (GDS_block_context,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
+ bg,
+ GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO,
+ &my_identity_hash,
+ NULL, 0,
+ GDS_my_hello,
+ hello_size))
{
- size_t hello_size;
-
- hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello);
- GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader));
GDS_NEIGHBOURS_handle_reply (sender,
GNUNET_BLOCK_TYPE_DHT_HELLO,
- GNUNET_TIME_relative_to_absolute
- (hello_expiration),
+ GNUNET_TIME_relative_to_absolute (hello_expiration),
key,
0,
NULL,
if (NULL == peer)
peer = bucket->head;
hello = GDS_HELLO_get (peer->id);
+ hello_size = GNUNET_HELLO_size (hello);
} while ( (NULL == hello) ||
- (GNUNET_YES ==
- GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
- &peer->phash)) );
+ (GNUNET_BLOCK_EVALUATION_OK_MORE !=
+ GNUNET_BLOCK_evaluate (GDS_block_context,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
+ bg,
+ GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO,
+ &peer->phash,
+ NULL, 0,
+ hello,
+ hello_size)) );
GDS_NEIGHBOURS_handle_reply (sender,
GNUNET_BLOCK_TYPE_DHT_HELLO,
GNUNET_TIME_relative_to_absolute
0,
NULL,
hello,
- GNUNET_HELLO_size (hello));
+ hello_size);
}
xquery);
GNUNET_free (tmp);
}
- bg = GNUNET_BLOCK_group_create (GDS_block_context,
- type,
- get->bf_mutator,
- &xquery[xquery_size],
- reply_bf_size);
eval
= GNUNET_BLOCK_evaluate (GDS_block_context,
type,
- bg,
+ NULL,
GNUNET_BLOCK_EO_NONE,
&get->key,
xquery,
{
/* request invalid or block type not supported */
GNUNET_break_op (eval == GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED);
- GNUNET_BLOCK_group_destroy (bg);
return;
}
peer_bf = GNUNET_CONTAINER_bloomfilter_init (get->bloomfilter,
GNUNET_break_op (GNUNET_YES ==
GNUNET_CONTAINER_bloomfilter_test (peer_bf,
&peer->phash));
+ bg = GNUNET_BLOCK_group_create (GDS_block_context,
+ type,
+ get->bf_mutator,
+ &xquery[xquery_size],
+ reply_bf_size);
/* remember request for routing replies */
GDS_ROUTING_add (peer->id,
type,