![]() |
GNUnet
0.11.x
|
GNUnet DHT service's client management code. More...
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_protocols.h"
#include "gnunet_statistics_service.h"
#include "gnunet-service-dht.h"
#include "gnunet-service-dht_datacache.h"
#include "gnunet-service-dht_neighbours.h"
#include "dht.h"
Go to the source code of this file.
Data Structures | |
struct | ClientQueryRecord |
Entry in the local forwarding map for a client's GET request. More... | |
struct | ClientMonitorRecord |
Struct containing parameters of monitoring requests. More... | |
struct | ClientHandle |
Struct containing information about a client, handle to connect to it, and any pending messages that need to be sent to it. More... | |
struct | FindByUniqueIdContext |
Closure for find_by_unique_id(). More... | |
struct | RemoveByUniqueIdContext |
Closure for remove_by_unique_id(). More... | |
struct | ForwardReplyContext |
Closure for forward_reply() More... | |
Macros | |
#define | LOG_TRAFFIC(kind, ...) |
Should routing details be logged to stderr (for debugging)? More... | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "dht-clients", __VA_ARGS__) |
#define | GDS_DHT_SERVICE_INIT(name, run) |
Define "main" method using service macro. More... | |
Functions | |
static void | remove_client_record (struct ClientQueryRecord *record) |
Free data structures associated with the given query. More... | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) |
Functions with this signature are called whenever a local client is connects to us. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx) |
Functions with this signature are called whenever a client is disconnected on the network level. More... | |
static void | transmit_request (struct ClientQueryRecord *cqr) |
Route the given request via the DHT. More... | |
static void | transmit_next_request_task (void *cls) |
Task that looks at the retry_heap and transmits all of the requests on the heap that are ready for transmission. More... | |
static int | check_dht_local_put (void *cls, const struct GNUNET_DHT_ClientPutMessage *dht_msg) |
Check DHT PUT messages from the client. More... | |
static void | handle_dht_local_put (void *cls, const struct GNUNET_DHT_ClientPutMessage *dht_msg) |
Handler for PUT messages. More... | |
static int | check_dht_local_get (void *cls, const struct GNUNET_DHT_ClientGetMessage *get) |
Check DHT GET messages from the client. More... | |
static void | handle_local_result (void *cls, 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 result from local datacache for a GET operation. More... | |
static void | handle_dht_local_get (void *cls, const struct GNUNET_DHT_ClientGetMessage *get) |
Handler for DHT GET messages from the client. More... | |
static int | find_by_unique_id (void *cls, const struct GNUNET_HashCode *key, void *value) |
Function called for each existing DHT record for the given query. More... | |
static int | check_dht_local_get_result_seen (void *cls, const struct GNUNET_DHT_ClientGetResultSeenMessage *seen) |
Check "GET result seen" messages from the client. More... | |
static void | handle_dht_local_get_result_seen (void *cls, const struct GNUNET_DHT_ClientGetResultSeenMessage *seen) |
Handler for "GET result seen" messages from the client. More... | |
static int | remove_by_unique_id (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator over hash map entries that frees all entries that match the given client and unique ID. More... | |
static void | handle_dht_local_get_stop (void *cls, const struct GNUNET_DHT_ClientGetStopMessage *dht_stop_msg) |
Handler for any generic DHT stop messages, calls the appropriate handler depending on message type (if processed locally) More... | |
static void | handle_dht_local_monitor (void *cls, const struct GNUNET_DHT_MonitorStartStopMessage *msg) |
Handler for monitor start messages. More... | |
static void | handle_dht_local_monitor_stop (void *cls, const struct GNUNET_DHT_MonitorStartStopMessage *msg) |
Handler for monitor stop messages. More... | |
static int | forward_reply (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator over hash map entries that send a given reply to each of the matching clients. More... | |
void | GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration, const struct GNUNET_HashCode *key, unsigned int get_path_length, const struct GNUNET_PeerIdentity *get_path, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, enum GNUNET_BLOCK_Type type, size_t data_size, const void *data) |
Handle a reply we've received from another peer. More... | |
void | GDS_CLIENTS_process_get (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, const struct GNUNET_HashCode *key) |
Check if some client is monitoring GET messages and notify them in that case. More... | |
void | GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type, const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const void *data, size_t size) |
Check if some client is monitoring GET RESP messages and notify them in that case. More... | |
void | GDS_CLIENTS_process_put (uint32_t options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, uint32_t desired_replication_level, unsigned int path_length, const struct GNUNET_PeerIdentity *path, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const void *data, size_t size) |
Check if some client is monitoring PUT messages and notify them in that case. More... | |
static void | GDS_CLIENTS_init () |
Initialize client subsystem. More... | |
static void | GDS_CLIENTS_stop () |
Shutdown client subsystem. More... | |
void | __attribute__ ((destructor)) |
MINIMIZE heap size (way below 128k) since this process doesn't need much. More... | |
Variables | |
struct GNUNET_BLOCK_Context * | GDS_block_context |
Our handle to the BLOCK library. More... | |
struct GNUNET_STATISTICS_Handle * | GDS_stats |
Handle for the statistics service. More... | |
struct GNUNET_SERVICE_Handle * | GDS_service |
Handle for the service. More... | |
const struct GNUNET_CONFIGURATION_Handle * | GDS_cfg |
The configuration the DHT service is running with. More... | |
static struct ClientMonitorRecord * | monitor_head |
List of active monitoring requests. More... | |
static struct ClientMonitorRecord * | monitor_tail |
List of active monitoring requests. More... | |
static struct GNUNET_CONTAINER_MultiHashMap * | forward_map |
Hashmap for fast key based lookup, maps keys to struct ClientQueryRecord entries. More... | |
static struct GNUNET_CONTAINER_Heap * | retry_heap |
Heap with all of our client's request, sorted by retry time (earliest on top). More... | |
static struct GNUNET_SCHEDULER_Task * | retry_task |
Task that re-transmits requests (using retry_heap). More... | |
GNUnet DHT service's client management code.
Definition in file gnunet-service-dht_clients.c.
#define LOG_TRAFFIC | ( | kind, | |
... | |||
) |
Should routing details be logged to stderr (for debugging)?
Definition at line 41 of file gnunet-service-dht_clients.c.
Referenced by forward_reply(), handle_dht_local_get(), and handle_dht_local_put().
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "dht-clients", __VA_ARGS__) |
Definition at line 44 of file gnunet-service-dht_clients.c.
Referenced by forward_reply(), GDS_CLIENTS_handle_reply(), handle_dht_local_get(), handle_dht_local_get_stop(), handle_dht_local_put(), and transmit_request().
Define "main" method using service macro.
name | name of the service, i.e. "dht" or "xdht" |
run | name of the initializaton method for the service |
Definition at line 1488 of file gnunet-service-dht_clients.c.
Referenced by run().
|
static |
Free data structures associated with the given query.
record | record to remove |
Definition at line 265 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientHandle::cqr_head, ClientHandle::cqr_tail, GNUNET_array_grow, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_heap_remove_node(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_YES, ClientQueryRecord::hnode, ClientQueryRecord::key, ClientQueryRecord::seen_replies, and ClientQueryRecord::seen_replies_count.
Referenced by client_disconnect_cb(), forward_reply(), and remove_by_unique_id().
|
static |
Functions with this signature are called whenever a local client is connects to us.
cls | closure (NULL for dht) |
client | identification of the client |
mq | message queue for talking to client |
struct ClientHandle
for client Definition at line 295 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientHandle::client, GNUNET_new, mq, and ClientHandle::mq.
|
static |
Functions with this signature are called whenever a client is disconnected on the network level.
cls | closure (NULL for dht) |
client | identification of the client |
app_ctx | our struct ClientHandle for client |
Definition at line 317 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientMonitorRecord::ch, ClientHandle::cqr_head, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, ClientMonitorRecord::key, monitor, monitor_head, ClientQueryRecord::next, ClientMonitorRecord::next, and remove_client_record().
|
static |
Route the given request via the DHT.
This includes updating the bloom filter and retransmission times, building the P2P message and initiating the routing operation.
Definition at line 360 of file gnunet-service-dht_clients.c.
References DHT_BLOOM_SIZE, GDS_NEIGHBOURS_handle_get(), gettext_noop, GNUNET_BLOCK_group_create(), GNUNET_BLOCK_group_destroy(), GNUNET_BLOCK_group_set_seen(), GNUNET_CONSTANTS_BLOOMFILTER_K, GNUNET_CONTAINER_bloomfilter_free(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_STD_BACKOFF, ClientQueryRecord::key, LOG, ClientQueryRecord::msg_options, ClientQueryRecord::replication, ClientQueryRecord::retry_frequency, ClientQueryRecord::retry_time, ClientQueryRecord::seen_replies, ClientQueryRecord::seen_replies_count, ClientQueryRecord::type, ClientQueryRecord::xquery, and ClientQueryRecord::xquery_size.
Referenced by transmit_next_request_task().
|
static |
Task that looks at the retry_heap and transmits all of the requests on the heap that are ready for transmission.
Then re-schedules itself (unless the heap is empty).
cls | unused |
Definition at line 419 of file gnunet-service-dht_clients.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_SCHEDULER_add_at(), GNUNET_TIME_absolute_get_remaining(), ClientQueryRecord::hnode, GNUNET_TIME_Relative::rel_value_us, ClientQueryRecord::retry_time, and transmit_request().
Referenced by handle_dht_local_get().
|
static |
Check DHT PUT messages from the client.
cls | the client we received this message from |
dht_msg | the actual message received |
Definition at line 458 of file gnunet-service-dht_clients.c.
References GNUNET_OK.
|
static |
Handler for PUT messages.
cls | the client we received this message from |
dht_msg | the actual message received |
Definition at line 473 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientHandle::client, GNUNET_DHT_ClientPutMessage::desired_replication_level, DHT_BLOOM_SIZE, GNUNET_DHT_ClientPutMessage::expiration, GDS_CLIENTS_handle_reply(), GDS_CLIENTS_process_put(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_get_id(), GDS_NEIGHBOURS_handle_put(), gettext_noop, GNUNET_CONSTANTS_BLOOMFILTER_K, GNUNET_CONTAINER_bloomfilter_free(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_h2s_full(), GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_ntoh(), GNUNET_DHT_ClientPutMessage::header, GNUNET_DHT_ClientPutMessage::key, LOG, LOG_TRAFFIC, GNUNET_DHT_ClientPutMessage::options, size, GNUNET_MessageHeader::size, and GNUNET_DHT_ClientPutMessage::type.
|
static |
Check DHT GET messages from the client.
cls | the client we received this message from |
message | the actual message received |
Definition at line 550 of file gnunet-service-dht_clients.c.
References GNUNET_OK.
|
static |
Handle a result from local datacache for a GET operation.
cls | the struct ClientHandle of the client doing the query |
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 573 of file gnunet-service-dht_clients.c.
References GDS_CLIENTS_handle_reply().
Referenced by handle_dht_local_get().
|
static |
Handler for DHT GET messages from the client.
cls | the client we received this message from |
message | the actual message received |
Definition at line 602 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientHandle::client, ClientHandle::cqr_head, ClientHandle::cqr_tail, GDS_CLIENTS_process_get(), GDS_DATACACHE_handle_get(), GDS_NEIGHBOURS_get_id(), gettext_noop, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_h2s_full(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_SECONDS, handle_local_result(), ClientQueryRecord::hnode, ClientQueryRecord::key, LOG, LOG_TRAFFIC, ClientQueryRecord::msg_options, ClientQueryRecord::replication, ClientQueryRecord::retry_frequency, ClientQueryRecord::retry_time, size, transmit_next_request_task(), ClientQueryRecord::type, ClientQueryRecord::unique_id, ClientQueryRecord::xquery, and ClientQueryRecord::xquery_size.
|
static |
Function called for each existing DHT record for the given query.
Checks if it matches the UID given in the closure and if so returns the entry as a result.
cls | the search context |
key | query for the lookup (not used) |
value | the struct ClientQueryRecord |
Definition at line 697 of file gnunet-service-dht_clients.c.
References FindByUniqueIdContext::cqr, GNUNET_NO, GNUNET_YES, ClientQueryRecord::unique_id, FindByUniqueIdContext::unique_id, and value.
Referenced by handle_dht_local_get_result_seen().
|
static |
Check "GET result seen" messages from the client.
cls | the client we received this message from |
message | the actual message received |
Definition at line 719 of file gnunet-service-dht_clients.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_DHT_ClientGetResultSeenMessage::header, size, and GNUNET_MessageHeader::size.
|
static |
Handler for "GET result seen" messages from the client.
cls | the client we received this message from |
message | the actual message received |
Definition at line 746 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientHandle::client, FindByUniqueIdContext::cqr, find_by_unique_id(), GNUNET_array_grow, GNUNET_break, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_memcpy, GNUNET_SERVICE_client_drop(), GNUNET_DHT_ClientGetResultSeenMessage::header, GNUNET_DHT_ClientGetResultSeenMessage::key, ClientQueryRecord::seen_replies, ClientQueryRecord::seen_replies_count, size, GNUNET_MessageHeader::size, GNUNET_DHT_ClientGetResultSeenMessage::unique_id, and FindByUniqueIdContext::unique_id.
|
static |
Iterator over hash map entries that frees all entries that match the given client and unique ID.
cls | unique ID and client to search for in source routes |
key | current key code |
value | value in the hash map, a ClientQueryRecord |
Definition at line 812 of file gnunet-service-dht_clients.c.
References RemoveByUniqueIdContext::ch, ClientHandle::client, ctx, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_YES, remove_client_record(), ClientQueryRecord::unique_id, RemoveByUniqueIdContext::unique_id, and value.
Referenced by handle_dht_local_get_stop().
|
static |
Handler for any generic DHT stop messages, calls the appropriate handler depending on message type (if processed locally)
cls | client we received this message from |
message | the actual message received |
Definition at line 839 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, RemoveByUniqueIdContext::ch, ClientHandle::client, gettext_noop, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_DHT_ClientGetStopMessage::key, LOG, remove_by_unique_id(), GNUNET_DHT_ClientGetStopMessage::unique_id, and RemoveByUniqueIdContext::unique_id.
|
static |
Handler for monitor start messages.
cls | the client we received this message from |
msg | the actual message received |
Definition at line 872 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientMonitorRecord::ch, ClientHandle::client, GNUNET_DHT_MonitorStartStopMessage::filter_key, ClientMonitorRecord::get, GNUNET_DHT_MonitorStartStopMessage::get, ClientMonitorRecord::get_resp, GNUNET_DHT_MonitorStartStopMessage::get_resp, GNUNET_CONTAINER_DLL_insert, GNUNET_memcpy, GNUNET_new, GNUNET_SERVICE_client_continue(), ClientMonitorRecord::key, GNUNET_DHT_MonitorStartStopMessage::key, ClientMonitorRecord::put, GNUNET_DHT_MonitorStartStopMessage::put, ClientMonitorRecord::type, and GNUNET_DHT_MonitorStartStopMessage::type.
|
static |
Handler for monitor stop messages.
cls | the client we received this message from |
msg | the actual message received |
Definition at line 909 of file gnunet-service-dht_clients.c.
References ClientQueryRecord::ch, ClientMonitorRecord::ch, ClientHandle::client, GNUNET_DHT_MonitorStartStopMessage::filter_key, ClientMonitorRecord::get, GNUNET_DHT_MonitorStartStopMessage::get, ClientMonitorRecord::get_resp, GNUNET_DHT_MonitorStartStopMessage::get_resp, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SERVICE_client_continue(), ClientMonitorRecord::key, GNUNET_DHT_MonitorStartStopMessage::key, ClientMonitorRecord::next, ClientMonitorRecord::put, GNUNET_DHT_MonitorStartStopMessage::put, ClientMonitorRecord::type, and GNUNET_DHT_MonitorStartStopMessage::type.
|
static |
Iterator over hash map entries that send a given reply to each of the matching clients.
With some tricky recycling of the buffer.
cls | the 'struct ForwardReplyContext' |
key | current key |
value | value in the hash map, a ClientQueryRecord |
Definition at line 1008 of file gnunet-service-dht_clients.c.
References _, ClientQueryRecord::ch, ClientHandle::client, ForwardReplyContext::data, ForwardReplyContext::data_size, env, GNUNET_DHT_ClientResultMessage::expiration, ForwardReplyContext::expiration, ForwardReplyContext::get_path, GNUNET_DHT_ClientResultMessage::get_path_length, ForwardReplyContext::get_path_length, gettext_noop, GNUNET_array_append, GNUNET_BLOCK_EO_NONE, GNUNET_BLOCK_evaluate(), GNUNET_BLOCK_EVALUATION_OK_DUPLICATE, GNUNET_BLOCK_EVALUATION_OK_LAST, GNUNET_BLOCK_EVALUATION_OK_MORE, GNUNET_BLOCK_EVALUATION_REQUEST_INVALID, GNUNET_BLOCK_EVALUATION_REQUEST_VALID, GNUNET_BLOCK_EVALUATION_RESULT_INVALID, GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT, GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED, GNUNET_BLOCK_TYPE_ANY, GNUNET_break, GNUNET_break_op, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_h2s_full(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), GNUNET_YES, GNUNET_DHT_ClientResultMessage::key, ClientQueryRecord::key, LOG, LOG_TRAFFIC, ClientHandle::mq, ForwardReplyContext::put_path, GNUNET_DHT_ClientResultMessage::put_path_length, ForwardReplyContext::put_path_length, record(), remove_client_record(), ClientQueryRecord::seen_replies, ClientQueryRecord::seen_replies_count, ClientQueryRecord::type, GNUNET_DHT_ClientResultMessage::type, ForwardReplyContext::type, ClientQueryRecord::unique_id, GNUNET_DHT_ClientResultMessage::unique_id, value, ClientQueryRecord::xquery, and ClientQueryRecord::xquery_size.
Referenced by GDS_CLIENTS_handle_reply().
void GDS_CLIENTS_handle_reply | ( | struct GNUNET_TIME_Absolute | expiration, |
const struct GNUNET_HashCode * | key, | ||
unsigned int | get_path_length, | ||
const struct GNUNET_PeerIdentity * | get_path, | ||
unsigned int | put_path_length, | ||
const struct GNUNET_PeerIdentity * | put_path, | ||
enum GNUNET_BLOCK_Type | type, | ||
size_t | data_size, | ||
const void * | data | ||
) |
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).
expiration | when will the reply expire |
key | the query this reply is for |
get_path_length | number of peers in get_path |
get_path | path the reply took on get |
put_path_length | number of peers in put_path |
put_path | path the reply took on put |
type | type of the reply |
data_size | number of bytes in data |
data | application payload data |
Definition at line 1162 of file gnunet-service-dht_clients.c.
References data, ForwardReplyContext::data, data_size, ForwardReplyContext::data_size, expiration, ForwardReplyContext::expiration, forward_reply(), ForwardReplyContext::get_path, GNUNET_DHT_ClientResultMessage::get_path_length, ForwardReplyContext::get_path_length, gettext_noop, GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_NO, GNUNET_STATISTICS_update(), LOG, ForwardReplyContext::put_path, GNUNET_DHT_ClientResultMessage::put_path_length, ForwardReplyContext::put_path_length, ClientQueryRecord::type, and ForwardReplyContext::type.
Referenced by handle_dht_local_put(), handle_dht_p2p_put(), handle_local_result(), and process_reply_with_path().
void GDS_CLIENTS_process_get | ( | uint32_t | options, |
enum GNUNET_BLOCK_Type | type, | ||
uint32_t | hop_count, | ||
uint32_t | desired_replication_level, | ||
unsigned int | path_length, | ||
const struct GNUNET_PeerIdentity * | path, | ||
const struct GNUNET_HashCode * | key | ||
) |
Check if some client is monitoring GET messages and notify them in that case.
options | Options, for instance RecordRoute, DemultiplexEverywhere. |
type | The type of data in the request. |
hop_count | Hop count so far. |
path_length | number of entries in path (or 0 if not recorded). |
path | peers on the GET path (or NULL if not recorded). |
desired_replication_level | Desired replication level. |
key | Key of the requested data. |
Definition at line 1227 of file gnunet-service-dht_clients.c.
References ClientMonitorRecord::ch, GNUNET_DHT_MonitorGetMessage::desired_replication_level, env, GNUNET_DHT_MonitorGetMessage::get_path_length, GNUNET_array_append, GNUNET_BLOCK_TYPE_ANY, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_DHT_MonitorGetMessage::hop_count, ClientMonitorRecord::key, GNUNET_DHT_MonitorGetMessage::key, ClientQueryRecord::key, m, ClientHandle::mq, ClientMonitorRecord::next, GNUNET_DHT_MonitorGetMessage::options, ClientMonitorRecord::type, and GNUNET_DHT_MonitorGetMessage::type.
Referenced by handle_dht_local_get(), and handle_dht_p2p_get().
void GDS_CLIENTS_process_get_resp | ( | enum GNUNET_BLOCK_Type | type, |
const struct GNUNET_PeerIdentity * | get_path, | ||
unsigned int | get_path_length, | ||
const struct GNUNET_PeerIdentity * | put_path, | ||
unsigned int | put_path_length, | ||
struct GNUNET_TIME_Absolute | exp, | ||
const struct GNUNET_HashCode * | key, | ||
const void * | data, | ||
size_t | size | ||
) |
Check if some client is monitoring GET RESP messages and notify them in that case.
type | The type of data in the result. |
get_path | Peers on GET path (or NULL if not recorded). |
get_path_length | number of entries in get_path. |
put_path | peers on the PUT path (or NULL if not recorded). |
put_path_length | number of entries in get_path. |
exp | Expiration time of the data. |
key | Key of the data. |
data | Pointer to the result data. |
size | Number of bytes in data. |
Definition at line 1303 of file gnunet-service-dht_clients.c.
References ClientMonitorRecord::ch, env, GNUNET_DHT_MonitorGetRespMessage::expiration_time, GNUNET_DHT_MonitorGetRespMessage::get_path_length, GNUNET_array_append, GNUNET_BLOCK_TYPE_ANY, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TIME_absolute_hton(), ClientMonitorRecord::key, GNUNET_DHT_MonitorGetRespMessage::key, ClientQueryRecord::key, m, ClientHandle::mq, ClientMonitorRecord::next, GNUNET_DHT_MonitorGetRespMessage::put_path_length, size, ClientMonitorRecord::type, and GNUNET_DHT_MonitorGetRespMessage::type.
Referenced by process_reply_with_path().
void GDS_CLIENTS_process_put | ( | uint32_t | options, |
enum GNUNET_BLOCK_Type | type, | ||
uint32_t | hop_count, | ||
uint32_t | desired_replication_level, | ||
unsigned int | path_length, | ||
const struct GNUNET_PeerIdentity * | path, | ||
struct GNUNET_TIME_Absolute | exp, | ||
const struct GNUNET_HashCode * | key, | ||
const void * | data, | ||
size_t | size | ||
) |
Check if some client is monitoring PUT messages and notify them in that case.
options | Options, for instance RecordRoute, DemultiplexEverywhere. |
type | The type of data in the request. |
hop_count | Hop count so far. |
path_length | number of entries in path (or 0 if not recorded). |
path | peers on the PUT path (or NULL if not recorded). |
desired_replication_level | Desired replication level. |
exp | Expiration time of the data. |
key | Key under which data is to be stored. |
data | Pointer to the data carried. |
size | Number of bytes in data. |
Definition at line 1386 of file gnunet-service-dht_clients.c.
References ClientMonitorRecord::ch, GNUNET_DHT_MonitorPutMessage::desired_replication_level, env, GNUNET_DHT_MonitorPutMessage::expiration_time, GNUNET_array_append, GNUNET_BLOCK_TYPE_ANY, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TIME_absolute_hton(), GNUNET_DHT_MonitorPutMessage::hop_count, ClientMonitorRecord::key, GNUNET_DHT_MonitorPutMessage::key, ClientQueryRecord::key, m, ClientHandle::mq, ClientMonitorRecord::next, GNUNET_DHT_MonitorPutMessage::options, GNUNET_DHT_MonitorPutMessage::put_path_length, size, ClientMonitorRecord::type, and GNUNET_DHT_MonitorPutMessage::type.
Referenced by handle_dht_local_put(), and handle_dht_p2p_put().
|
static |
Initialize client subsystem.
server | the initialized server |
Definition at line 1458 of file gnunet-service-dht_clients.c.
References GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_CONTAINER_multihashmap_create(), and GNUNET_YES.
Referenced by run().
|
static |
Shutdown client subsystem.
Definition at line 1472 of file gnunet-service-dht_clients.c.
References GNUNET_SCHEDULER_cancel().
Referenced by shutdown_task().
void __attribute__ | ( | (destructor) | ) |
MINIMIZE heap size (way below 128k) since this process doesn't need much.
Definition at line 1526 of file gnunet-service-dht_clients.c.
References GNUNET_assert, GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_heap_get_size(), GNUNET_CONTAINER_multihashmap_destroy(), and GNUNET_CONTAINER_multihashmap_size().
struct GNUNET_BLOCK_Context* GDS_block_context |
Our handle to the BLOCK library.
Definition at line 216 of file gnunet-service-dht_clients.c.
Referenced by datacache_get_iterator(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_find_peer(), process(), run(), send_find_peer_message(), and shutdown_task().
struct GNUNET_STATISTICS_Handle* GDS_stats |
Handle for the statistics service.
Definition at line 221 of file gnunet-service-dht_clients.c.
Referenced by datacache_get_iterator(), expire_oldest_entry(), GDS_DATACACHE_handle_get(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_ROUTING_add(), get_forward_count(), handle_core_connect(), handle_core_disconnect(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_find_peer(), process(), process_hello(), run(), select_peer(), send_find_peer_message(), shutdown_task(), and update_network_size_estimate().
struct GNUNET_SERVICE_Handle* GDS_service |
Handle for the service.
Definition at line 226 of file gnunet-service-dht_clients.c.
Referenced by core_init(), and run().
const struct GNUNET_CONFIGURATION_Handle* GDS_cfg |
The configuration the DHT service is running with.
Configuration we use.
Definition at line 231 of file gnunet-service-dht_clients.c.
Referenced by GDS_DATACACHE_init(), GDS_HELLO_init(), GDS_NEIGHBOURS_init(), GDS_NSE_init(), run(), and try_connect().
|
static |
List of active monitoring requests.
Definition at line 236 of file gnunet-service-dht_clients.c.
Referenced by client_disconnect_cb().
|
static |
List of active monitoring requests.
Definition at line 241 of file gnunet-service-dht_clients.c.
|
static |
Hashmap for fast key based lookup, maps keys to struct ClientQueryRecord
entries.
Definition at line 246 of file gnunet-service-dht_clients.c.
|
static |
Heap with all of our client's request, sorted by retry time (earliest on top).
Definition at line 251 of file gnunet-service-dht_clients.c.
|
static |
Task that re-transmits requests (using retry_heap).
Definition at line 256 of file gnunet-service-dht_clients.c.