GNUnet 0.22.1
dht_api.c File Reference

library to access the DHT service More...

#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_arm_service.h"
#include "gnunet_protocols.h"
#include "gnunet_dht_service.h"
#include "dht.h"
Include dependency graph for dht_api.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_DHT_PutHandle
 Handle to a PUT request. More...
 
struct  GNUNET_DHT_GetHandle
 Handle to a GET request. More...
 
struct  GNUNET_DHT_MonitorHandle
 Handle to a monitoring request. More...
 
struct  GNUNET_DHT_HelloGetHandle
 Handle to get a HELLO URL from the DHT for manual bootstrapping. More...
 
struct  GNUNET_DHT_Handle
 Connection to the DHT service. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "dht-api", __VA_ARGS__)
 

Functions

static enum GNUNET_GenericReturnValue try_connect (struct GNUNET_DHT_Handle *h)
 Try to (re)connect to the DHT service. More...
 
static void send_get (struct GNUNET_DHT_GetHandle *gh)
 Send GET message for a get_handle to DHT. More...
 
static void send_get_known_results (struct GNUNET_DHT_GetHandle *gh, unsigned int transmission_offset_start)
 Send GET message(s) for indicating which results are already known for a get_handle to DHT. More...
 
static enum GNUNET_GenericReturnValue add_get_request_to_pending (void *cls, const struct GNUNET_HashCode *key, void *value)
 Add the GET request corresponding to the given route handle to the pending queue (if it is not already in there). More...
 
static void send_monitor_start (struct GNUNET_DHT_MonitorHandle *mh)
 Send GNUNET_MESSAGE_TYPE_DHT_MONITOR_START message. More...
 
static void try_reconnect (void *cls)
 Try reconnecting to the dht service. More...
 
static void do_disconnect (struct GNUNET_DHT_Handle *h)
 Try reconnecting to the DHT service. More...
 
static void mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More...
 
static void handle_monitor_get (void *cls, const struct GNUNET_DHT_MonitorGetMessage *msg)
 Process a get monitor message from the service. More...
 
static enum GNUNET_GenericReturnValue check_monitor_get_resp (void *cls, const struct GNUNET_DHT_MonitorGetRespMessage *msg)
 Validate a get response monitor message from the service. More...
 
static void handle_monitor_get_resp (void *cls, const struct GNUNET_DHT_MonitorGetRespMessage *msg)
 Process a get response monitor message from the service. More...
 
static enum GNUNET_GenericReturnValue check_monitor_put (void *cls, const struct GNUNET_DHT_MonitorPutMessage *msg)
 Check validity of a put monitor message from the service. More...
 
static void handle_monitor_put (void *cls, const struct GNUNET_DHT_MonitorPutMessage *msg)
 Process a put monitor message from the service. More...
 
static enum GNUNET_GenericReturnValue check_client_result (void *cls, const struct GNUNET_DHT_ClientResultMessage *msg)
 Verify that client result message received from the service is well-formed. More...
 
static enum GNUNET_GenericReturnValue process_client_result (void *cls, const struct GNUNET_HashCode *key, void *value)
 Process a given reply that might match the given request. More...
 
static void handle_client_result (void *cls, const struct GNUNET_DHT_ClientResultMessage *msg)
 Process a client result message received from the service. More...
 
static enum GNUNET_GenericReturnValue check_client_hello (void *cls, const struct GNUNET_MessageHeader *hdr)
 Process a client HELLO message received from the service. More...
 
static void handle_client_hello (void *cls, const struct GNUNET_MessageHeader *hdr)
 Process a client HELLO message received from the service. More...
 
static void handle_put_cont (void *cls)
 Process a MQ PUT transmission notification. More...
 
struct GNUNET_DHT_HandleGNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int ht_len)
 Initialize the connection with the DHT service. More...
 
void GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
 Shutdown connection with the DHT service. More...
 
struct GNUNET_DHT_PutHandleGNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode *key, uint32_t desired_replication_level, enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, size_t size, const void *data, struct GNUNET_TIME_Absolute exp, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
 Perform a PUT operation storing data in the DHT. More...
 
void GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph)
 Cancels a DHT PUT operation. More...
 
struct GNUNET_DHT_GetHandleGNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *key, uint32_t desired_replication_level, enum GNUNET_DHT_RouteOption options, const void *xquery, size_t xquery_size, GNUNET_DHT_GetIterator iter, void *iter_cls)
 Perform an asynchronous GET operation on the DHT identified. More...
 
void GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, unsigned int num_results, const struct GNUNET_HashCode *results)
 Tell the DHT not to return any of the following known results to this client. More...
 
void GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
 Stop async DHT-get. More...
 
struct GNUNET_DHT_MonitorHandleGNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *key, GNUNET_DHT_MonitorGetCB get_cb, GNUNET_DHT_MonitorGetRespCB get_resp_cb, GNUNET_DHT_MonitorPutCB put_cb, void *cb_cls)
 Start monitoring the local DHT service. More...
 
void GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh)
 Stop monitoring. More...
 
char * GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, unsigned int path_len)
 Convert a peer path to a human-readable string. More...
 
unsigned int GNUNET_DHT_verify_path (const void *data, size_t data_size, struct GNUNET_TIME_Absolute exp_time, const struct GNUNET_PeerIdentity *bpid, const struct GNUNET_DHT_PathElement *put_path, unsigned int put_path_len, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_len, const struct GNUNET_PeerIdentity *me)
 Verify signatures on a path consisting of put_path and get_path in reverse order (starting at the last element of the get_path). More...
 
struct GNUNET_DHT_HelloGetHandleGNUNET_DHT_hello_get (struct GNUNET_DHT_Handle *dht_handle, GNUNET_DHT_HelloGetCallback cb, void *cb_cls)
 Obtain HELLO URL of the DHT identified by dht_handle. More...
 
void GNUNET_DHT_hello_get_cancel (struct GNUNET_DHT_HelloGetHandle *hgh)
 Cancel hello get operation. More...
 
void GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle, const char *url, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
 Offer HELLO URL of the DHT identified by dht_handle. More...
 

Detailed Description

library to access the DHT service

Author
Christian Grothoff
Nathan Evans

Definition in file dht_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "dht-api", __VA_ARGS__)

Definition at line 36 of file dht_api.c.

Function Documentation

◆ try_connect()

static enum GNUNET_GenericReturnValue try_connect ( struct GNUNET_DHT_Handle h)
static

Try to (re)connect to the DHT service.

Parameters
hDHT handle to reconnect
Returns
GNUNET_YES on success, GNUNET_NO on failure.

Definition at line 986 of file dht_api.c.

987{
989 GNUNET_MQ_hd_fixed_size (monitor_get,
992 h),
993 GNUNET_MQ_hd_var_size (monitor_get_resp,
996 h),
997 GNUNET_MQ_hd_var_size (monitor_put,
1000 h),
1001 GNUNET_MQ_hd_var_size (client_result,
1004 h),
1005 GNUNET_MQ_hd_var_size (client_hello,
1007 struct GNUNET_MessageHeader,
1008 h),
1010 };
1011
1012 if (NULL != h->mq)
1013 return GNUNET_OK;
1015 "dht",
1016 handlers,
1018 h);
1019 if (NULL == h->mq)
1020 {
1022 "Failed to connect to the DHT service!\n");
1023 return GNUNET_NO;
1024 }
1025 return GNUNET_YES;
1026}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: dht_api.c:517
#define LOG(kind,...)
Definition: dht_api.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1060
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
Receive information about transiting GETs.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP
Receive information about transiting GET responses.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
Receive information about transiting PUTs.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
Service returns result to client.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL
HELLO URL send between client and service (in either direction).
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Reply to a GET send from the service to a client.
Definition: dht.h:144
Message to monitor get requests going through peer, DHT service -> clients.
Definition: dht.h:334
Message to monitor get results going through peer, DHT service -> clients.
Definition: dht.h:377
Message to monitor put requests going through peer, DHT service -> clients.
Definition: dht.h:239
Message handler for a specific message type.
Header for all communications.

References GNUNET_ARM_Handle::cfg, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_WARNING, GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL, GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT, GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET, GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP, GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_NO, GNUNET_OK, GNUNET_YES, h, handlers, LOG, GNUNET_ARM_Handle::mq, and mq_error_handler().

Referenced by GNUNET_DHT_connect(), and try_reconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_get()

static void send_get ( struct GNUNET_DHT_GetHandle gh)
static

Send GET message for a get_handle to DHT.

Parameters
ghGET to generate messages for.

Definition at line 316 of file dht_api.c.

317{
318 struct GNUNET_DHT_Handle *h = gh->dht_handle;
319 struct GNUNET_MQ_Envelope *env;
320 struct GNUNET_DHT_ClientGetMessage *get_msg;
321
322 env = GNUNET_MQ_msg_extra (get_msg,
323 gh->xquery_size,
325 get_msg->options = htonl ((uint32_t) gh->options);
327 get_msg->type = htonl (gh->type);
328 get_msg->key = gh->key;
329 get_msg->unique_id = gh->unique_id;
330 GNUNET_memcpy (&get_msg[1],
331 &gh[1],
332 gh->xquery_size);
334 env);
335}
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:305
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:63
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
Client wants to lookup item in DHT.
DHT GET message sent from clients to service.
Definition: dht.h:72
uint64_t unique_id
Unique ID identifying this request, if 0 then the client will not expect a response.
Definition: dht.h:103
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
Definition: dht.h:81
struct GNUNET_HashCode key
The key to search for.
Definition: dht.h:97
uint32_t type
The type for the data for the GET request; actually an 'enum GNUNET_BLOCK_Type'.
Definition: dht.h:92
uint32_t desired_replication_level
Replication level for this message.
Definition: dht.h:86
enum GNUNET_BLOCK_Type type
Type of the block we are looking for.
Definition: dht_api.c:124
size_t xquery_size
Size of the extended query, allocated at the end of this struct.
Definition: dht_api.c:114
uint32_t desired_replication_level
Desired replication level.
Definition: dht_api.c:119
struct GNUNET_HashCode key
Key that this get request is for.
Definition: dht_api.c:104
uint64_t unique_id
Unique identifier for this request (for key collisions).
Definition: dht_api.c:109
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:93
enum GNUNET_DHT_RouteOption options
Routing options.
Definition: dht_api.c:129
Connection to the DHT service.
Definition: dht_api.c:235

References GNUNET_DHT_ClientGetMessage::desired_replication_level, GNUNET_DHT_GetHandle::desired_replication_level, GNUNET_DHT_GetHandle::dht_handle, env, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), h, GNUNET_DHT_ClientGetMessage::key, GNUNET_DHT_GetHandle::key, GNUNET_ARM_Handle::mq, GNUNET_DHT_ClientGetMessage::options, GNUNET_DHT_GetHandle::options, GNUNET_DHT_ClientGetMessage::type, GNUNET_DHT_GetHandle::type, GNUNET_DHT_ClientGetMessage::unique_id, GNUNET_DHT_GetHandle::unique_id, and GNUNET_DHT_GetHandle::xquery_size.

Referenced by add_get_request_to_pending(), and GNUNET_DHT_get_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_get_known_results()

static void send_get_known_results ( struct GNUNET_DHT_GetHandle gh,
unsigned int  transmission_offset_start 
)
static

Send GET message(s) for indicating which results are already known for a get_handle to DHT.

Complex as we need to send the list of known results, which means we may need multiple messages to block known results from the result set.

Parameters
ghGET to generate messages for
transmission_offset_startat which offset should we start?

Definition at line 348 of file dht_api.c.

350{
351 struct GNUNET_DHT_Handle *h = gh->dht_handle;
352 struct GNUNET_MQ_Envelope *env;
354 unsigned int delta;
355 unsigned int max;
356 unsigned int transmission_offset;
357
358 max = (GNUNET_MAX_MESSAGE_SIZE - sizeof(*msg))
359 / sizeof(struct GNUNET_HashCode);
360 transmission_offset = transmission_offset_start;
361 while (transmission_offset < gh->seen_results_end)
362 {
363 delta = gh->seen_results_end - transmission_offset;
364 if (delta > max)
365 delta = max;
367 delta * sizeof(struct GNUNET_HashCode),
369 msg->key = gh->key;
370 msg->unique_id = gh->unique_id;
371 GNUNET_memcpy (&msg[1],
372 &gh->seen_results[transmission_offset],
373 sizeof(struct GNUNET_HashCode) * delta);
375 env);
376 transmission_offset += delta;
377 }
378}
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
Certain results are already known to the client, filter those.
#define max(x, y)
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:36
DHT GET RESULTS KNOWN message sent from clients to service.
Definition: dht.h:114
unsigned int seen_results_end
Offset into the seen_results array marking the end of the positions that are actually used.
Definition: dht_api.c:141
struct GNUNET_HashCode * seen_results
Array of hash codes over the results that we have already seen.
Definition: dht_api.c:99
A 512-bit hashcode.

References delta, GNUNET_DHT_GetHandle::dht_handle, env, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), h, GNUNET_DHT_GetHandle::key, max, GNUNET_ARM_Handle::mq, msg, GNUNET_DHT_GetHandle::seen_results, GNUNET_DHT_GetHandle::seen_results_end, and GNUNET_DHT_GetHandle::unique_id.

Referenced by add_get_request_to_pending(), and GNUNET_DHT_get_filter_known_results().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_get_request_to_pending()

static enum GNUNET_GenericReturnValue add_get_request_to_pending ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Add the GET request corresponding to the given route handle to the pending queue (if it is not already in there).

Parameters
clsthe struct GNUNET_DHT_Handle *
keykey for the request (not used)
valuethe struct GNUNET_DHT_GetHandle *
Returns
GNUNET_YES (always)

Definition at line 391 of file dht_api.c.

394{
395 struct GNUNET_DHT_Handle *handle = cls;
396 struct GNUNET_DHT_GetHandle *gh = value;
397
399 "Retransmitting request related to %s to DHT %p\n",
400 GNUNET_h2s (key),
401 handle);
402 send_get (gh);
404 return GNUNET_YES;
405}
static void send_get(struct GNUNET_DHT_GetHandle *gh)
Send GET message for a get_handle to DHT.
Definition: dht_api.c:316
static void send_get_known_results(struct GNUNET_DHT_GetHandle *gh, unsigned int transmission_offset_start)
Send GET message(s) for indicating which results are already known for a get_handle to DHT.
Definition: dht_api.c:348
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_DEBUG
Handle to a GET request.
Definition: dht_api.c:79

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_YES, handle, key, LOG, send_get(), send_get_known_results(), and value.

Referenced by try_reconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_monitor_start()

static void send_monitor_start ( struct GNUNET_DHT_MonitorHandle mh)
static

Send GNUNET_MESSAGE_TYPE_DHT_MONITOR_START message.

Parameters
mhmonitor handle to generate start message for

Definition at line 414 of file dht_api.c.

415{
416 struct GNUNET_DHT_Handle *h = mh->dht_handle;
417 struct GNUNET_MQ_Envelope *env;
419
422 m->type = htonl (mh->type);
423 m->get = htons (NULL != mh->get_cb);
424 m->get_resp = htons (NULL != mh->get_resp_cb);
425 m->put = htons (NULL != mh->put_cb);
426 if (NULL != mh->key)
427 {
428 m->filter_key = htons (1);
429 m->key = *mh->key;
430 }
432 env);
433}
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:103
static struct GNUNET_CADET_Handle * mh
Cadet handle.
Definition: gnunet-cadet.c:92
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:78
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_START
Request information about transiting messages.
Message to request monitoring messages, clients -> DHT service.
Definition: dht.h:291

References env, GNUNET_MESSAGE_TYPE_DHT_MONITOR_START, GNUNET_MQ_msg, GNUNET_MQ_send(), h, m, mh, and GNUNET_ARM_Handle::mq.

Referenced by GNUNET_DHT_monitor_start(), and try_reconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_reconnect()

static void try_reconnect ( void *  cls)
static

Try reconnecting to the dht service.

Parameters
clsa struct GNUNET_DHT_Handle

Definition at line 442 of file dht_api.c.

443{
444 struct GNUNET_DHT_Handle *h = cls;
446
448 "Reconnecting with DHT %p\n",
449 h);
450 h->retry_time = GNUNET_TIME_STD_BACKOFF (h->retry_time);
451 h->reconnect_task = NULL;
452 if (GNUNET_YES != try_connect (h))
453 {
455 "DHT reconnect failed!\n");
457 = GNUNET_SCHEDULER_add_delayed (h->retry_time,
459 h);
460 return;
461 }
464 h);
465 for (mh = h->monitor_head; NULL != mh; mh = mh->next)
467}
static enum GNUNET_GenericReturnValue try_connect(struct GNUNET_DHT_Handle *h)
Try to (re)connect to the DHT service.
Definition: dht_api.c:986
static void try_reconnect(void *cls)
Try reconnecting to the dht service.
Definition: dht_api.c:442
static enum GNUNET_GenericReturnValue add_get_request_to_pending(void *cls, const struct GNUNET_HashCode *key, void *value)
Add the GET request corresponding to the given route handle to the pending queue (if it is not alread...
Definition: dht_api.c:391
static void send_monitor_start(struct GNUNET_DHT_MonitorHandle *mh)
Send GNUNET_MESSAGE_TYPE_DHT_MONITOR_START message.
Definition: dht_api.c:414
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1276
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147
Handle to a monitoring request.
Definition: dht_api.c:149

References add_get_request_to_pending(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, h, LOG, mh, GNUNET_ARM_Handle::reconnect_task, send_monitor_start(), try_connect(), and try_reconnect().

Referenced by do_disconnect(), and try_reconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_disconnect()

static void do_disconnect ( struct GNUNET_DHT_Handle h)
static

Try reconnecting to the DHT service.

Parameters
hhandle to dht to (possibly) disconnect and reconnect

Definition at line 476 of file dht_api.c.

477{
478 struct GNUNET_DHT_PutHandle *ph;
480 void *cont_cls;
481
482 if (NULL == h->mq)
483 return;
485 h->mq = NULL;
487 "Disconnecting from DHT service, will try to reconnect in %s\n",
489 GNUNET_YES));
490 /* notify client about all PUTs that (may) have failed due to disconnect */
491 while (NULL != (ph = h->put_head))
492 {
493 cont = ph->cont;
494 cont_cls = ph->cont_cls;
495 ph->env = NULL;
497 if (NULL != cont)
498 cont (cont_cls);
499 }
500 GNUNET_assert (NULL == h->reconnect_task);
502 = GNUNET_SCHEDULER_add_delayed (h->retry_time,
504 h);
505}
void GNUNET_DHT_put_cancel(struct GNUNET_DHT_PutHandle *ph)
Cancels a DHT PUT operation.
Definition: dht_api.c:1139
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:700
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:579
Handle to a PUT request.
Definition: dht_api.c:43
void * cont_cls
Closure for cont.
Definition: dht_api.c:67
struct GNUNET_MQ_Envelope * env
Envelope from the PUT operation.
Definition: dht_api.c:72
GNUNET_SCHEDULER_TaskCallback cont
Continuation to call when done.
Definition: dht_api.c:57

References GNUNET_DHT_PutHandle::cont, GNUNET_DHT_PutHandle::cont_cls, GNUNET_DHT_PutHandle::env, GNUNET_assert, GNUNET_DHT_put_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_YES, h, GNUNET_ARM_Handle::mq, GNUNET_ARM_Handle::reconnect_task, and try_reconnect().

Referenced by mq_error_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mq_error_handler()

static void mq_error_handler ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.

Not every message queue implementation supports an error handler.

Parameters
clsclosure with the struct GNUNET_DHT_Handle *
errorerror code

Definition at line 517 of file dht_api.c.

519{
520 struct GNUNET_DHT_Handle *h = cls;
521
523}
static void do_disconnect(struct GNUNET_DHT_Handle *h)
Try reconnecting to the DHT service.
Definition: dht_api.c:476

References do_disconnect(), and h.

Referenced by try_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_monitor_get()

static void handle_monitor_get ( void *  cls,
const struct GNUNET_DHT_MonitorGetMessage msg 
)
static

Process a get monitor message from the service.

Parameters
clsThe DHT handle.
msgMonitor get message from the service.

Definition at line 533 of file dht_api.c.

535{
536 struct GNUNET_DHT_Handle *handle = cls;
537 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
538
539 for (struct GNUNET_DHT_MonitorHandle *mh = handle->monitor_head;
540 NULL != mh;
541 mh = mh->next)
542 {
543 if (NULL == mh->get_cb)
544 continue;
545 if ( (GNUNET_BLOCK_TYPE_ANY != mh->type) &&
546 (mh->type != ntohl (msg->type)))
547 continue;
548 if ( (NULL != mh->key) &&
549 (0 != GNUNET_memcmp (mh->key,
550 &msg->key)) )
551 continue;
552 mh->get_cb (mh->cb_cls,
553 ro,
554 ntohl (msg->type),
555 ntohl (msg->hop_count),
556 ntohl (msg->desired_replication_level),
557 &msg->key);
558 }
559}
GNUNET_DHT_RouteOption
Options for routing.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
@ GNUNET_BLOCK_TYPE_ANY
Identifier for any block.

References GNUNET_BLOCK_TYPE_ANY, GNUNET_memcmp, handle, mh, msg, and GNUNET_MessageHeader::type.

◆ check_monitor_get_resp()

static enum GNUNET_GenericReturnValue check_monitor_get_resp ( void *  cls,
const struct GNUNET_DHT_MonitorGetRespMessage msg 
)
static

Validate a get response monitor message from the service.

Parameters
clsThe DHT handle.
msgmonitor get response message from the service
Returns
GNUNET_OK if everything went fine, GNUNET_SYSERR if the message is malformed.

Definition at line 571 of file dht_api.c.

573{
574 size_t msize = ntohs (msg->header.size) - sizeof(*msg);
575 uint32_t getl = ntohl (msg->get_path_length);
576 uint32_t putl = ntohl (msg->put_path_length);
577 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
578 bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
579
580 if (truncated)
581 {
582 if (msize < sizeof (struct GNUNET_PeerIdentity))
583 {
584 GNUNET_break (0);
585 return GNUNET_SYSERR;
586 }
587 msize -= sizeof (struct GNUNET_PeerIdentity);
588 }
589 if ((getl + putl < getl) ||
590 ((msize / sizeof(struct GNUNET_DHT_PathElement)) < getl + putl))
591 {
592 GNUNET_break (0);
593 return GNUNET_SYSERR;
594 }
595 return GNUNET_OK;
596}
@ GNUNET_DHT_RO_TRUNCATED
Flag set if the path was truncated.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
@ GNUNET_SYSERR
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
The identity of the host (wraps the signing key of the peer).

References GNUNET_break, GNUNET_DHT_RO_TRUNCATED, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.

◆ handle_monitor_get_resp()

static void handle_monitor_get_resp ( void *  cls,
const struct GNUNET_DHT_MonitorGetRespMessage msg 
)
static

Process a get response monitor message from the service.

Parameters
clsThe DHT handle.
msgmonitor get response message from the service

Definition at line 606 of file dht_api.c.

608{
609 struct GNUNET_DHT_Handle *handle = cls;
610 size_t msize = ntohs (msg->header.size) - sizeof(*msg);
611 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
612 uint32_t getl = ntohl (msg->get_path_length);
613 uint32_t putl = ntohl (msg->put_path_length);
614 bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
615 const struct GNUNET_PeerIdentity *trunc_peer
616 = truncated
617 ? (const struct GNUNET_PeerIdentity *) &msg[1]
618 : NULL;
619 const struct GNUNET_DHT_PathElement *path
620 = truncated
621 ? (const struct GNUNET_DHT_PathElement *) &trunc_peer[1]
622 : (const struct GNUNET_DHT_PathElement *) &msg[1];
623
624 if (truncated)
625 msize -= sizeof (struct GNUNET_PeerIdentity);
626 msize -= sizeof(struct GNUNET_DHT_PathElement) * (putl + getl);
627 for (struct GNUNET_DHT_MonitorHandle *mh = handle->monitor_head;
628 NULL != mh;
629 mh = mh->next)
630 {
631 if (NULL == mh->get_resp_cb)
632 continue;
633 if ( (GNUNET_BLOCK_TYPE_ANY != mh->type) &&
634 (mh->type != ntohl (msg->type)) )
635 continue;
636 if ( (NULL != mh->key) &&
637 (0 != GNUNET_memcmp (mh->key,
638 &msg->key)) )
639 continue;
640 mh->get_resp_cb (mh->cb_cls,
641 ntohl (msg->type),
642 trunc_peer,
643 &path[putl],
644 getl,
645 path,
646 putl,
647 GNUNET_TIME_absolute_ntoh (msg->expiration_time),
648 &msg->key,
649 (const void *) &path[getl + putl],
650 msize);
651 }
652}
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:739

References GNUNET_BLOCK_TYPE_ANY, GNUNET_DHT_RO_TRUNCATED, GNUNET_memcmp, GNUNET_TIME_absolute_ntoh(), handle, mh, msg, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

Here is the call graph for this function:

◆ check_monitor_put()

static enum GNUNET_GenericReturnValue check_monitor_put ( void *  cls,
const struct GNUNET_DHT_MonitorPutMessage msg 
)
static

Check validity of a put monitor message from the service.

Parameters
clsThe DHT handle.
msgMonitor put message from the service.
Returns
GNUNET_OK if everything went fine, GNUNET_SYSERR if the message is malformed.

Definition at line 664 of file dht_api.c.

666{
667 size_t msize = ntohs (msg->header.size) - sizeof(*msg);
668 uint32_t putl = ntohl (msg->put_path_length);
669 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
670 bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
671
672 if (truncated)
673 {
674 if (msize < sizeof (struct GNUNET_PeerIdentity))
675 {
676 GNUNET_break (0);
677 return GNUNET_SYSERR;
678 }
679 msize -= sizeof (struct GNUNET_PeerIdentity);
680 }
681 if ((msize / sizeof(struct GNUNET_DHT_PathElement)) < putl)
682 {
683 GNUNET_break (0);
684 return GNUNET_SYSERR;
685 }
686 return GNUNET_OK;
687}

References GNUNET_break, GNUNET_DHT_RO_TRUNCATED, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.

◆ handle_monitor_put()

static void handle_monitor_put ( void *  cls,
const struct GNUNET_DHT_MonitorPutMessage msg 
)
static

Process a put monitor message from the service.

Parameters
clsThe DHT handle.
msgMonitor put message from the service.

Definition at line 697 of file dht_api.c.

699{
700 struct GNUNET_DHT_Handle *handle = cls;
701 size_t msize = ntohs (msg->header.size) - sizeof(*msg);
702 uint32_t putl = ntohl (msg->put_path_length);
703 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
704 bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
705 const struct GNUNET_PeerIdentity *trunc_peer
706 = truncated
707 ? (const struct GNUNET_PeerIdentity *) &msg[1]
708 : NULL;
709 const struct GNUNET_DHT_PathElement *path
710 = truncated
711 ? (const struct GNUNET_DHT_PathElement *) &trunc_peer[1]
712 : (const struct GNUNET_DHT_PathElement *) &msg[1];
713
714 if (truncated)
715 msize -= sizeof (struct GNUNET_PeerIdentity);
716 msize -= sizeof(struct GNUNET_DHT_PathElement) * putl;
717 for (struct GNUNET_DHT_MonitorHandle *mh = handle->monitor_head;
718 NULL != mh;
719 mh = mh->next)
720 {
721 if (NULL == mh->put_cb)
722 continue;
723 if ( (GNUNET_BLOCK_TYPE_ANY != mh->type) &&
724 (mh->type != ntohl (msg->type)) )
725 continue;
726 if ( (NULL != mh->key) &&
727 (0 != GNUNET_memcmp (mh->key,
728 &msg->key)) )
729 continue;
730 mh->put_cb (mh->cb_cls,
731 ro,
732 ntohl (msg->type),
733 ntohl (msg->hop_count),
734 ntohl (msg->desired_replication_level),
735 trunc_peer,
736 putl,
737 path,
738 GNUNET_TIME_absolute_ntoh (msg->expiration_time),
739 &msg->key,
740 (const void *) &path[putl],
741 msize);
742 }
743}

References GNUNET_BLOCK_TYPE_ANY, GNUNET_DHT_RO_TRUNCATED, GNUNET_memcmp, GNUNET_TIME_absolute_ntoh(), handle, mh, msg, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

Here is the call graph for this function:

◆ check_client_result()

static enum GNUNET_GenericReturnValue check_client_result ( void *  cls,
const struct GNUNET_DHT_ClientResultMessage msg 
)
static

Verify that client result message received from the service is well-formed.

Parameters
clsThe DHT handle.
msgMonitor put message from the service.
Returns
GNUNET_OK if everything went fine, GNUNET_SYSERR if the message is malformed.

Definition at line 755 of file dht_api.c.

757{
758 size_t msize = ntohs (msg->header.size) - sizeof(*msg);
759 uint32_t put_path_length = ntohl (msg->put_path_length);
760 uint32_t get_path_length = ntohl (msg->get_path_length);
761 enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
762 bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
763 size_t meta_length;
764
765 if (truncated)
766 {
767 if (msize < sizeof (struct GNUNET_PeerIdentity))
768 {
769 GNUNET_break (0);
770 return GNUNET_SYSERR;
771 }
772 msize -= sizeof (struct GNUNET_PeerIdentity);
773 }
774 meta_length = msize / sizeof(struct GNUNET_DHT_PathElement);
775 if ( (get_path_length + put_path_length >
776 meta_length) ||
777 (get_path_length + put_path_length <
778 get_path_length) )
779 {
780 GNUNET_break (0);
781 return GNUNET_SYSERR;
782 }
783 return GNUNET_OK;
784}

References GNUNET_break, GNUNET_DHT_RO_TRUNCATED, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.

◆ process_client_result()

static enum GNUNET_GenericReturnValue process_client_result ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Process a given reply that might match the given request.

Parameters
clsthe struct GNUNET_DHT_ClientResultMessage
keyquery of the request
valuethe struct GNUNET_DHT_GetHandle of a request matching the same key
Returns
GNUNET_YES to continue to iterate over all results

Definition at line 796 of file dht_api.c.

799{
800 const struct GNUNET_DHT_ClientResultMessage *crm = cls;
802 size_t msize = ntohs (crm->header.size) - sizeof(*crm);
803 uint16_t type = ntohl (crm->type);
804 enum GNUNET_DHT_RouteOption ro = ntohl (crm->options);
805 bool truncated
806 = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
807 uint32_t put_path_length
808 = ntohl (crm->put_path_length);
809 uint32_t get_path_length
810 = ntohl (crm->get_path_length);
811 const struct GNUNET_PeerIdentity *trunc_peer
812 = truncated
813 ? (const struct GNUNET_PeerIdentity *) &crm[1]
814 : NULL;
815 const struct GNUNET_DHT_PathElement *put_path
816 = truncated
817 ? (const struct GNUNET_DHT_PathElement *) &trunc_peer[1]
818 : (const struct GNUNET_DHT_PathElement *) &crm[1];
819 const struct GNUNET_DHT_PathElement *get_path
820 = &put_path[put_path_length];
821 const void *data
822 = &get_path[get_path_length];
823 size_t meta_length
824 = sizeof(struct GNUNET_DHT_PathElement)
825 * (get_path_length + put_path_length);
826 size_t data_length
827 = msize - meta_length;
828 struct GNUNET_HashCode hc;
829
830 if (truncated)
831 data_length -= sizeof (struct GNUNET_PeerIdentity);
832 if (crm->unique_id != get_handle->unique_id)
833 {
834 /* UID mismatch */
836 "Ignoring reply for %s: UID mismatch: %llu/%llu\n",
837 GNUNET_h2s (key),
838 (unsigned long long) crm->unique_id,
839 (unsigned long long) get_handle->unique_id);
840 return GNUNET_YES;
841 }
843 (get_handle->type != type) )
844 {
845 /* type mismatch */
846 GNUNET_break (0);
847 return GNUNET_YES;
848 }
849
850 {
851 char *pp;
852 char *gp;
853
854 gp = GNUNET_DHT_pp2s (get_path,
855 get_path_length);
856 pp = GNUNET_DHT_pp2s (put_path,
857 put_path_length);
859 "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n",
860 (unsigned int) data_length,
861 GNUNET_h2s (key),
862 gp,
863 pp);
864 GNUNET_free (gp);
865 GNUNET_free (pp);
866 }
867 /* remember that we've seen this result */
869 data_length,
870 &hc);
876 /* no need to block it explicitly, service already knows about it! */
879 key,
880 trunc_peer,
881 get_path,
882 get_path_length,
883 put_path,
884 put_path_length,
885 type,
886 data_length,
887 data);
888 return GNUNET_YES;
889}
static struct GNUNET_DHT_GetHandle * get_handle
Handle for the get request.
static char * data
The data to insert into the dht.
static uint32_t type
Type string converted to DNS type value.
char * GNUNET_DHT_pp2s(const struct GNUNET_DHT_PathElement *path, unsigned int path_len)
Convert a peer path to a human-readable string.
Definition: dht_api.c:1321
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_free(ptr)
Wrapper around free.
uint32_t put_path_length
Number of peers recorded in the outgoing path from source to the storgage location of this message.
Definition: dht.h:169
uint64_t unique_id
Unique ID of the matching GET request.
Definition: dht.h:180
struct GNUNET_TIME_AbsoluteNBO expiration
When does this entry expire?
Definition: dht.h:185
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT.
Definition: dht.h:148
uint32_t type
The type for the data.
Definition: dht.h:153
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
Definition: dht.h:163
uint32_t get_path_length
The number of peer identities recorded from the storage location to this peer.
Definition: dht.h:175
GNUNET_DHT_GetIterator iter
Iterator to call on data receipt.
Definition: dht_api.c:83
void * iter_cls
Closure for iter.
Definition: dht_api.c:88
unsigned int seen_results_size
Size of the seen_results array.
Definition: dht_api.c:135

References data, GNUNET_DHT_ClientResultMessage::expiration, get_handle, GNUNET_DHT_ClientResultMessage::get_path_length, GNUNET_array_grow, GNUNET_BLOCK_TYPE_ANY, GNUNET_break, GNUNET_CRYPTO_hash(), GNUNET_DHT_pp2s(), GNUNET_DHT_RO_TRUNCATED, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_TIME_absolute_ntoh(), GNUNET_YES, GNUNET_DHT_ClientResultMessage::header, GNUNET_DHT_GetHandle::iter, GNUNET_DHT_GetHandle::iter_cls, key, LOG, GNUNET_DHT_ClientResultMessage::options, GNUNET_DHT_ClientResultMessage::put_path_length, GNUNET_DHT_GetHandle::seen_results, GNUNET_DHT_GetHandle::seen_results_end, GNUNET_DHT_GetHandle::seen_results_size, GNUNET_MessageHeader::size, type, GNUNET_DHT_ClientResultMessage::type, GNUNET_DHT_GetHandle::type, GNUNET_DHT_ClientResultMessage::unique_id, GNUNET_DHT_GetHandle::unique_id, and value.

Referenced by handle_client_result().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_client_result()

static void handle_client_result ( void *  cls,
const struct GNUNET_DHT_ClientResultMessage msg 
)
static

Process a client result message received from the service.

Parameters
clsThe DHT handle.
msgMonitor put message from the service.

Definition at line 899 of file dht_api.c.

901{
902 struct GNUNET_DHT_Handle *handle = cls;
903
905 &msg->key,
907 (void *) msg);
908}
static enum GNUNET_GenericReturnValue process_client_result(void *cls, const struct GNUNET_HashCode *key, void *value)
Process a given reply that might match the given request.
Definition: dht_api.c:796
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.

References GNUNET_CONTAINER_multihashmap_get_multiple(), handle, msg, and process_client_result().

Here is the call graph for this function:

◆ check_client_hello()

static enum GNUNET_GenericReturnValue check_client_hello ( void *  cls,
const struct GNUNET_MessageHeader hdr 
)
static

Process a client HELLO message received from the service.

Parameters
clsThe DHT handle.
hdrHELLO URL message from the service.
Returns
GNUNET_OK if hdr is well-formed

Definition at line 919 of file dht_api.c.

921{
922 uint16_t len = ntohs (hdr->size);
923 const char *buf = (const char *) &hdr[1];
924
925 (void) cls;
926 if ('\0' != buf[len - sizeof (*hdr) - 1])
927 {
928 GNUNET_break (0);
929 return GNUNET_SYSERR;
930 }
931 return GNUNET_OK;
932}

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, and GNUNET_MessageHeader::size.

◆ handle_client_hello()

static void handle_client_hello ( void *  cls,
const struct GNUNET_MessageHeader hdr 
)
static

Process a client HELLO message received from the service.

Parameters
clsThe DHT handle.
hdrHELLO URL message from the service.

Definition at line 942 of file dht_api.c.

944{
945 struct GNUNET_DHT_Handle *handle = cls;
946 const char *url = (const char *) &hdr[1];
947 struct GNUNET_DHT_HelloGetHandle *hgh;
948
949 while (NULL != (hgh = handle->hgh_head))
950 {
951 hgh->cb (hgh->cb_cls,
952 url);
954 }
955}
void GNUNET_DHT_hello_get_cancel(struct GNUNET_DHT_HelloGetHandle *hgh)
Cancel hello get operation.
Definition: dht_api.c:1459
Handle to get a HELLO URL from the DHT for manual bootstrapping.
Definition: dht_api.c:201
GNUNET_DHT_HelloGetCallback cb
Function to call with the result.
Definition: dht_api.c:216
void * cb_cls
Closure for cb.
Definition: dht_api.c:221

References GNUNET_DHT_HelloGetHandle::cb, GNUNET_DHT_HelloGetHandle::cb_cls, GNUNET_DHT_hello_get_cancel(), and handle.

Here is the call graph for this function:

◆ handle_put_cont()

static void handle_put_cont ( void *  cls)
static

Process a MQ PUT transmission notification.

Parameters
clsThe DHT handle.

Definition at line 964 of file dht_api.c.

965{
966 struct GNUNET_DHT_PutHandle *ph = cls;
968 void *cont_cls;
969
970 cont = ph->cont;
971 cont_cls = ph->cont_cls;
972 ph->env = NULL;
974 if (NULL != cont)
975 cont (cont_cls);
976}

References GNUNET_DHT_PutHandle::cont, GNUNET_DHT_PutHandle::cont_cls, GNUNET_DHT_PutHandle::env, and GNUNET_DHT_put_cancel().

Referenced by GNUNET_DHT_put().

Here is the call graph for this function:
Here is the caller graph for this function: