GNUnet DHT globals. More...
#include "gnunet-service-dht_datacache.h"#include "gnunet-service-dht_neighbours.h"#include "gnunet_pils_service.h"#include "gnunet_statistics_service.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_DHT GNUNET_EXTRA_LOGGING |
| #define | MINIMUM_LOG_NSE 0.5 |
| Floor for the log of the network size estimate, and the value we use before the NSE service has told us anything. | |
Functions | |
| void | GDS_u_try_connect (const struct GNUNET_PeerIdentity *pid, const char *address) |
| Ask all underlays to connect to peer pid at address. | |
| void | GDS_u_send (struct GDS_Underlay *u, struct GNUNET_DHTU_Target *target, const void *msg, size_t msg_size, GNUNET_SCHEDULER_TaskCallback finished_cb, void *finished_cb_cls) |
| Send message to some other participant over the network. | |
| void | GDS_u_drop (struct GDS_Underlay *u, struct GNUNET_DHTU_PreferenceHandle *ph) |
| Drop a hold ph from underlay u. | |
| struct GNUNET_DHTU_PreferenceHandle * | GDS_u_hold (struct GDS_Underlay *u, struct GNUNET_DHTU_Target *target) |
| Create a hold on target at underlay u. | |
| bool | GDS_CLIENTS_handle_reply (const struct GNUNET_DATACACHE_Block *bd, const struct GNUNET_HashCode *query_hash, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *get_path) |
| Handle a reply we've received from another peer. | |
| void | GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, uint32_t desired_replication_level, const struct GNUNET_HashCode *key) |
| Check if some client is monitoring GET messages and notify them in that case. | |
| void | GDS_CLIENTS_process_get_resp (const struct GNUNET_DATACACHE_Block *bd, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length) |
| Check if some client is monitoring GET RESP messages and notify them in that case. | |
| void | GDS_CLIENTS_process_put (const struct GNUNET_DATACACHE_Block *bd, uint32_t hop_count, uint32_t desired_replication_level) |
| Check if some client is monitoring PUT messages and notify them in that case. | |
| void | GDS_CLIENTS_retry_requests (void) |
| Our routing table gained a peer. | |
| void | GDS_CLIENTS_retry_puts (void) |
| Our routing table gained a peer. | |
| double | GDS_NSE_get (void) |
| Return the current NSE. | |
Variables | |
| const struct GNUNET_CONFIGURATION_Handle * | GDS_cfg |
| Configuration we use. | |
| struct GNUNET_SERVICE_Handle * | GDS_service |
| Handle for the service. | |
| struct GNUNET_BLOCK_Context * | GDS_block_context |
| Our handle to the BLOCK library. | |
| struct GNUNET_STATISTICS_Handle * | GDS_stats |
| Handle for the statistics service. | |
| struct GNUNET_PILS_Handle * | GDS_pils |
| Handle for the pils service. | |
| struct GNUNET_MessageHeader * | GDS_my_hello |
| Our HELLO parser. | |
GNUnet DHT globals.
Definition in file gnunet-service-dht.h.
| #define DEBUG_DHT GNUNET_EXTRA_LOGGING |
Definition at line 35 of file gnunet-service-dht.h.
| #define MINIMUM_LOG_NSE 0.5 |
Floor for the log of the network size estimate, and the value we use before the NSE service has told us anything.
Routing divides by the estimate and drops requests whose hop count exceeds a multiple of it, so zero is not a usable "unknown".
Definition at line 201 of file gnunet-service-dht.h.
| void GDS_u_try_connect | ( | const struct GNUNET_PeerIdentity * | pid, |
| const char * | address | ||
| ) |
Ask all underlays to connect to peer pid at address.
| pid | identity of the peer we would connect to |
| address | an address of pid |
Definition at line 293 of file gnunet-service-dht.c.
References address, GDS_Underlay::next, u, and u_head.
Referenced by GDS_try_connect().
| void GDS_u_send | ( | struct GDS_Underlay * | u, |
| struct GNUNET_DHTU_Target * | target, | ||
| const void * | msg, | ||
| size_t | msg_size, | ||
| GNUNET_SCHEDULER_TaskCallback | finished_cb, | ||
| void * | finished_cb_cls | ||
| ) |
Send message to some other participant over the network.
Note that sending is not guaranteeing that the other peer actually received the message. For any given target, the DHT must wait for the finished_cb to be called before calling send() again.
| u | underlay to use for transmission |
| target | receiver identification |
| msg | message |
| msg_size | number of bytes in msg |
| finished_cb | function called once transmission is done (not called if target disconnects, then only the disconnect_cb is called). |
| finished_cb_cls | closure for finished_cb |
Definition at line 306 of file gnunet-service-dht.c.
References finished_cb(), msg, and u.
Referenced by do_send().
| void GDS_u_drop | ( | struct GDS_Underlay * | u, |
| struct GNUNET_DHTU_PreferenceHandle * | ph | ||
| ) |
Drop a hold ph from underlay u.
| u | the underlay controlling the hold |
| ph | the preference handle |
Definition at line 323 of file gnunet-service-dht.c.
References u.
Referenced by GDS_u_disconnect().
| struct GNUNET_DHTU_PreferenceHandle * GDS_u_hold | ( | struct GDS_Underlay * | u, |
| struct GNUNET_DHTU_Target * | target | ||
| ) |
Create a hold on target at underlay u.
| u | the underlay controlling the target |
| target | the peer to hold the connection to |
Definition at line 331 of file gnunet-service-dht.c.
References GNUNET_DHTU_PreferenceHandle::target, and u.
Referenced by update_hold().
| bool GDS_CLIENTS_handle_reply | ( | const struct GNUNET_DATACACHE_Block * | bd, |
| const struct GNUNET_HashCode * | query_hash, | ||
| unsigned int | get_path_length, | ||
| const struct GNUNET_DHT_PathElement * | get_path | ||
| ) |
Handle a reply we've received from another peer.
If the reply matches any of our pending queries, forward it to the respective client(s).
| bd | block details |
| query_hash | hash of the original query, might not match key in bd |
| get_path_length | number of entries in get_path |
| get_path | path the reply has taken |
Definition at line 1449 of file gnunet-service-dht_clients.c.
References ForwardReplyContext::bd, GNUNET_DATACACHE_Block::data, data_size, GNUNET_DATACACHE_Block::data_size, GNUNET_DATACACHE_Block::expiration_time, forward_map, forward_reply(), GDS_pils, GDS_stats, ForwardReplyContext::get_path, GNUNET_DHT_ClientResultMessage::get_path_length, ForwardReplyContext::get_path_length, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_DHT_RO_TRUNCATED, GNUNET_DHT_verify_path(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_NO, GNUNET_PILS_get_identity(), GNUNET_STATISTICS_update(), LOG, my_identity, GNUNET_DATACACHE_Block::put_path, GNUNET_DATACACHE_Block::put_path_length, GNUNET_DHT_ClientResultMessage::put_path_length, GNUNET_DATACACHE_Block::ro, and GNUNET_DATACACHE_Block::trunc_peer.
Referenced by handle_dht_local_put(), handle_dht_p2p_put(), handle_local_result(), and process_reply_with_path().
| void GDS_CLIENTS_process_get | ( | enum GNUNET_DHT_RouteOption | options, |
| enum GNUNET_BLOCK_Type | type, | ||
| uint32_t | hop_count, | ||
| uint32_t | desired_replication_level, | ||
| const struct GNUNET_HashCode * | key | ||
| ) |
Check if some client is monitoring GET messages and notify them in that case.
If tracked, path should include the local peer.
| options | Options, for instance RecordRoute, DemultiplexEverywhere. |
| type | The type of data in the request. |
| hop_count | Hop count so far. |
| desired_replication_level | Desired replication level. |
| key | Key of the requested data. |
Definition at line 1813 of file gnunet-service-dht_clients.c.
References GetActionContext::desired_replication_level, for_matching_monitors(), get_action(), GetActionContext::hop_count, key, options, GetActionContext::options, and type.
Referenced by cb_handle_dht_p2p_get_local_result(), and handle_dht_local_get().
| void GDS_CLIENTS_process_get_resp | ( | const struct GNUNET_DATACACHE_Block * | bd, |
| const struct GNUNET_DHT_PathElement * | get_path, | ||
| unsigned int | get_path_length | ||
| ) |
Check if some client is monitoring GET RESP messages and notify them in that case.
| bd | block details |
| get_path | Peers on GET path (or NULL if not recorded). |
| get_path_length | number of entries in get_path. |
Definition at line 1907 of file gnunet-service-dht_clients.c.
References ResponseActionContext::bd, for_matching_monitors(), ResponseActionContext::get_path, ResponseActionContext::get_path_length, GNUNET_DATACACHE_Block::key, response_action(), and GNUNET_DATACACHE_Block::type.
Referenced by process_reply_with_path().
| void GDS_CLIENTS_process_put | ( | const struct GNUNET_DATACACHE_Block * | bd, |
| uint32_t | hop_count, | ||
| uint32_t | desired_replication_level | ||
| ) |
Check if some client is monitoring PUT messages and notify them in that case.
The path should include our own peer ID (if recorded).
| bd | details about the block |
| hop_count | Hop count so far. |
| desired_replication_level | Desired replication level. |
Definition at line 1995 of file gnunet-service-dht_clients.c.
References PutActionContext::bd, PutActionContext::desired_replication_level, for_matching_monitors(), PutActionContext::hop_count, GNUNET_DATACACHE_Block::key, put_action(), and GNUNET_DATACACHE_Block::type.
Referenced by cb_forwarded_dht_p2p_put(), and handle_dht_local_put().
| void GDS_CLIENTS_retry_requests | ( | void | ) |
Our routing table gained a peer.
Reset the retry back-off of all pending client GET requests and re-transmit them now: a request that found no route earlier has been backing off for up to 15 minutes without ever reaching the network.
Definition at line 623 of file gnunet-service-dht_clients.c.
References forward_map, GDS_stats, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_update(), LOG, reset_retry_backoff(), retry_task, and transmit_next_request_task().
Referenced by GDS_u_connect().
| void GDS_CLIENTS_retry_puts | ( | void | ) |
Our routing table gained a peer.
Re-try the local PUTs that we were unable to route: nothing else will, as the DHT keeps no state about a PUT and the client was told the operation succeeded.
Definition at line 803 of file gnunet-service-dht_clients.c.
References GDS_stats, GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_SECONDS, LOG, PendingPut::next, pp_count, pp_head, and schedule_put_retry().
Referenced by GDS_u_connect().
| double GDS_NSE_get | ( | void | ) |
Return the current NSE.
Definition at line 229 of file gnunet-service-dht.c.
References log_of_network_size_estimate.
Referenced by get_forward_count(), handle_find_local_hello(), and select_peer().
|
extern |
Configuration we use.
Configuration we use.
Definition at line 290 of file gnunet-service-dht_clients.c.
Referenced by GDS_DATACACHE_init(), GDS_NEIGHBOURS_init(), load_underlay(), pid_change_cb(), and run().
|
extern |
Handle for the service.
Definition at line 285 of file gnunet-service-dht_clients.c.
Referenced by pid_change_cb(), and run().
|
extern |
Our handle to the BLOCK library.
Definition at line 270 of file gnunet-service-dht_clients.c.
Referenced by datacache_get_iterator(), forward_reply(), handle_dht_local_put(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_find_local_hello(), handle_find_my_hello(), process(), run(), send_find_peer_message(), shutdown_task(), and transmit_request().
|
extern |
Handle for the statistics service.
Definition at line 275 of file gnunet-service-dht_clients.c.
Referenced by cb_forwarded_dht_local_put(), cb_routing_put_message(), datacache_get_iterator(), do_send(), expire_oldest_entry(), forward_reply(), GDS_CLIENTS_handle_reply(), GDS_CLIENTS_retry_puts(), GDS_CLIENTS_retry_requests(), GDS_DATACACHE_get_closest(), GDS_DATACACHE_handle_get(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_ROUTING_add(), GDS_u_connect(), GDS_u_disconnect(), get_forward_count(), handle_dht_local_get(), handle_dht_local_get_stop(), handle_dht_local_put(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_find_my_hello(), process(), run(), select_peer(), send_find_peer_message(), shutdown_task(), transmit_request(), and update_network_size_estimate().
|
extern |
Handle for the pils service.
(may be NULL but needed for linking)
Definition at line 40 of file gnunet-dht-tvg.c.
Referenced by forward_reply(), GDS_CLIENTS_handle_reply(), handle_dht_local_get(), handle_dht_local_hello_get(), handle_dht_local_put(), and run().
|
extern |
Our HELLO parser.
Our HELLO parser.
Definition at line 153 of file gnunet-service-dht.c.
Referenced by handle_dht_local_hello_get(), handle_find_my_hello(), pid_change_cb(), and shutdown_task().