![]() |
GNUnet
0.11.x
|
GNUnet DHT routing code. More...
Go to the source code of this file.
Functions | |
int | GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, enum GNUNET_DHT_RouteOption options, uint32_t desired_replication_level, struct GNUNET_TIME_Absolute expiration_time, uint32_t hop_count, struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *key, unsigned int put_path_length, struct GNUNET_PeerIdentity *put_path, const void *data, size_t data_size) |
Perform a PUT operation. More... | |
int | GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, enum GNUNET_DHT_RouteOption options, uint32_t desired_replication_level, uint32_t hop_count, const struct GNUNET_HashCode *key, const void *xquery, size_t xquery_size, struct GNUNET_BLOCK_Group *bg, struct GNUNET_CONTAINER_BloomFilter *peer_bf) |
Perform a GET operation. More... | |
void | GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute expiration_time, const struct GNUNET_HashCode *key, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *get_path, const void *data, size_t data_size) |
Handle a reply (route to origin). More... | |
int | GDS_am_closest_peer (const struct GNUNET_HashCode *key, const struct GNUNET_CONTAINER_BloomFilter *bloom) |
Check whether my identity is closer than any known peers. More... | |
int | GDS_NEIGHBOURS_init (void) |
Initialize neighbours subsystem. More... | |
void | GDS_NEIGHBOURS_done (void) |
Shutdown neighbours subsystem. More... | |
struct GNUNET_PeerIdentity * | GDS_NEIGHBOURS_get_id (void) |
Get the ID of the local node. More... | |
Variables | |
struct GNUNET_HashCode | my_identity_hash |
Hash of the identity of this peer. More... | |
GNUnet DHT routing code.
Definition in file gnunet-service-dht_neighbours.h.
int GDS_NEIGHBOURS_handle_put | ( | enum GNUNET_BLOCK_Type | type, |
enum GNUNET_DHT_RouteOption | options, | ||
uint32_t | desired_replication_level, | ||
struct GNUNET_TIME_Absolute | expiration_time, | ||
uint32_t | hop_count, | ||
struct GNUNET_CONTAINER_BloomFilter * | bf, | ||
const struct GNUNET_HashCode * | key, | ||
unsigned int | put_path_length, | ||
struct GNUNET_PeerIdentity * | put_path, | ||
const void * | data, | ||
size_t | data_size | ||
) |
Perform a PUT operation.
Forwards the given request to other peers. Does not store the data locally. Does not give the data to local clients. May do nothing if this is the only peer in the network (or if we are the closest peer in the network).
type | type of the block |
options | routing options |
desired_replication_level | desired replication level |
expiration_time | when does the content expire |
hop_count | how many hops has this message traversed so far |
bf | Bloom filter of peers this PUT has already traversed |
key | key for the content |
put_path_length | number of entries in put_path |
put_path | peers this request has traversed so far (if tracked) |
data | payload to store |
data_size | number of bytes in data |
Forwards the given request to other peers. Does not store the data locally. Does not give the data to local clients. May do nothing if this is the only peer in the network (or if we are the closest peer in the network).
type | type of the block |
options | routing options |
desired_replication_level | desired replication count |
expiration_time | when does the content expire |
hop_count | how many hops has this message traversed so far |
bf | Bloom filter of peers this PUT has already traversed |
key | key for the content |
put_path_length | number of entries in put_path |
put_path | peers this request has traversed so far (if tracked) |
data | payload to store |
data_size | number of bytes in data |
Definition at line 1240 of file gnunet-service-dht_neighbours.c.
References PeerPutMessage::bloomfilter, data_size, PeerPutMessage::desired_replication_level, DHT_BLOOM_SIZE, env, PeerPutMessage::expiration_time, GDS_stats, get_target_peers(), gettext_noop, GNUNET_assert, GNUNET_break, GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE, GNUNET_CONTAINER_bloomfilter_add(), GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_P2P_PUT, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), GNUNET_YES, PeerPutMessage::hop_count, PeerInfo::id, PeerPutMessage::key, MAXIMUM_PENDING_PER_PEER, PeerInfo::mq, my_identity, my_identity_hash, PeerPutMessage::options, PeerInfo::phash, PeerPutMessage::put_path_length, and PeerPutMessage::type.
Referenced by handle_dht_local_put(), and handle_dht_p2p_put().
int GDS_NEIGHBOURS_handle_get | ( | enum GNUNET_BLOCK_Type | type, |
enum GNUNET_DHT_RouteOption | options, | ||
uint32_t | desired_replication_level, | ||
uint32_t | hop_count, | ||
const struct GNUNET_HashCode * | key, | ||
const void * | xquery, | ||
size_t | xquery_size, | ||
struct GNUNET_BLOCK_Group * | bg, | ||
struct GNUNET_CONTAINER_BloomFilter * | peer_bf | ||
) |
Perform a GET operation.
Forwards the given request to other peers. Does not lookup the key locally. May do nothing if this is the only peer in the network (or if we are the closest peer in the network).
type | type of the block |
options | routing options |
desired_replication_level | desired replication count |
hop_count | how many hops did this request traverse so far? |
key | key for the content |
xquery | extended query |
xquery_size | number of bytes in xquery |
bg | block group to filter replies |
peer_bf | filter for peers not to select (again, updated) |
Forwards the given request to other peers. Does not lookup the key locally. May do nothing if this is the only peer in the network (or if we are the closest peer in the network).
type | type of the block |
options | routing options |
desired_replication_level | desired replication count |
hop_count | how many hops did this request traverse so far? |
key | key for the content |
xquery | extended query |
xquery_size | number of bytes in xquery |
bg | group to use for filtering replies |
peer_bf | filter for peers not to select (again) |
Definition at line 1377 of file gnunet-service-dht_neighbours.c.
References PeerGetMessage::bf_mutator, PeerGetMessage::bloomfilter, PeerGetMessage::desired_replication_level, DHT_BLOOM_SIZE, env, GDS_stats, get_target_peers(), gettext_noop, GNUNET_assert, GNUNET_BLOCK_group_serialize(), GNUNET_break, GNUNET_CONTAINER_bloomfilter_add(), GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_test(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_P2P_GET, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_YES, PeerGetMessage::hop_count, PeerInfo::id, PeerPutMessage::key, PeerGetMessage::key, MAXIMUM_PENDING_PER_PEER, PeerInfo::mq, my_identity, my_identity_hash, PeerGetMessage::options, PeerInfo::phash, PeerGetMessage::type, and PeerGetMessage::xquery_size.
Referenced by handle_dht_p2p_get(), send_find_peer_message(), and transmit_request().
void GDS_NEIGHBOURS_handle_reply | ( | const struct GNUNET_PeerIdentity * | target, |
enum GNUNET_BLOCK_Type | type, | ||
struct GNUNET_TIME_Absolute | expiration_time, | ||
const struct GNUNET_HashCode * | key, | ||
unsigned int | put_path_length, | ||
const struct GNUNET_PeerIdentity * | put_path, | ||
unsigned int | get_path_length, | ||
const struct GNUNET_PeerIdentity * | get_path, | ||
const void * | data, | ||
size_t | data_size | ||
) |
Handle a reply (route to origin).
Only forwards the reply back to other peers waiting for it. Does not do local caching or forwarding to local clients.
target | neighbour that should receive the block (if still connected) |
type | type of the block |
expiration_time | when does the content expire |
key | key for the content |
put_path_length | number of entries in put_path |
put_path | peers the original PUT traversed (if tracked) |
get_path_length | number of entries in put_path |
get_path | peers this reply has traversed so far (if tracked) |
data | payload of the reply |
data_size | number of bytes in data |
Only forwards the reply back to the given peer. Does not do local caching or forwarding to local clients.
target | neighbour that should receive the block (if still connected) |
type | type of the block |
expiration_time | when does the content expire |
key | key for the content |
put_path_length | number of entries in put_path |
put_path | peers the original PUT traversed (if tracked) |
get_path_length | number of entries in get_path |
get_path | peers this reply has traversed so far (if tracked) |
data | payload of the reply |
data_size | number of bytes in data |
Definition at line 1518 of file gnunet-service-dht_neighbours.c.
References env, PeerResultMessage::expiration_time, GDS_stats, PeerResultMessage::get_path_length, gettext_noop, GNUNET_break, GNUNET_CONTAINER_multipeermap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), PeerPutMessage::key, PeerResultMessage::key, MAXIMUM_PENDING_PER_PEER, PeerInfo::mq, pi, PeerPutMessage::put_path_length, PeerResultMessage::put_path_length, and PeerResultMessage::type.
Referenced by handle_find_peer(), handle_local_result(), and process().
int GDS_am_closest_peer | ( | const struct GNUNET_HashCode * | key, |
const struct GNUNET_CONTAINER_BloomFilter * | bloom | ||
) |
Check whether my identity is closer than any known peers.
If a non-null bloomfilter is given, check if this is the closest peer that hasn't already been routed to.
key | hash code to check closeness to |
bloom | bloomfilter, exclude these entries from the decision |
Definition at line 951 of file gnunet-service-dht_neighbours.c.
References GNUNET_HashCode::bits, find_bucket(), GNUNET_assert, GNUNET_CONTAINER_bloomfilter_test(), GNUNET_CRYPTO_hash_matching_bits(), GNUNET_memcmp, GNUNET_NO, GNUNET_YES, PeerBucket::head, k_buckets, my_identity_hash, PeerInfo::next, and PeerInfo::phash.
Referenced by handle_dht_p2p_get(), and handle_dht_p2p_put().
int GDS_NEIGHBOURS_init | ( | void | ) |
Initialize neighbours subsystem.
Definition at line 2491 of file gnunet-service-dht_neighbours.c.
References bucket_size, cache_results, core_init(), disable_try_connect, GDS_cfg, getenv(), GNUNET_ATS_connectivity_init(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CONTAINER_multipeermap_create(), GNUNET_CORE_connect(), GNUNET_MESSAGE_TYPE_DHT_P2P_GET, GNUNET_MESSAGE_TYPE_DHT_P2P_PUT, GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, handle_core_connect(), handle_core_disconnect(), and log_route_details_stderr.
Referenced by run().
void GDS_NEIGHBOURS_done | ( | void | ) |
Shutdown neighbours subsystem.
Definition at line 2548 of file gnunet-service-dht_neighbours.c.
References free_connect_info(), GNUNET_assert, GNUNET_ATS_connectivity_done(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_CONTAINER_multipeermap_size(), and GNUNET_CORE_disconnect().
Referenced by shutdown_task().
struct GNUNET_PeerIdentity* GDS_NEIGHBOURS_get_id | ( | void | ) |
Get the ID of the local node.
Definition at line 2575 of file gnunet-service-dht_neighbours.c.
References my_identity.
Referenced by handle_dht_local_get(), and handle_dht_local_put().
struct GNUNET_HashCode my_identity_hash |
Hash of the identity of this peer.
Definition at line 405 of file gnunet-service-dht_neighbours.c.
Referenced by core_init(), find_bucket(), GDS_am_closest_peer(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_find_peer(), and send_find_peer_message().