GNUnet  0.11.x
Macros | Typedefs | Enumerations | Functions
DHT service

Distributed Hash Table. More...

Macros

#define GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY
 Default republication frequency for stored data in the DHT. More...
 

Typedefs

typedef void(* GNUNET_DHT_GetIterator) (void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data)
 Iterator called on each result obtained for a DHT operation that expects a reply. More...
 
typedef void(* GNUNET_DHT_MonitorGetCB) (void *cls, enum GNUNET_DHT_RouteOption 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)
 Callback called on each GET request going through the DHT. More...
 
typedef void(* GNUNET_DHT_MonitorGetRespCB) (void *cls, 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)
 Callback called on each GET reply going through the DHT. More...
 
typedef void(* GNUNET_DHT_MonitorPutCB) (void *cls, enum GNUNET_DHT_RouteOption 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)
 Callback called on each PUT request going through the DHT. More...
 

Enumerations

enum  GNUNET_DHT_RouteOption {
  GNUNET_DHT_RO_NONE = 0, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1, GNUNET_DHT_RO_RECORD_ROUTE = 2, GNUNET_DHT_RO_FIND_PEER = 4,
  GNUNET_DHT_RO_BART = 8, GNUNET_DHT_RO_LAST_HOP = 16
}
 Options for routing. More...
 

Functions

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 *handle)
 Stop monitoring. More...
 

Detailed Description

Distributed Hash Table.

See also
Documentation

Macro Definition Documentation

◆ GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY

#define GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY
Value:
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:442

Default republication frequency for stored data in the DHT.

Definition at line 54 of file gnunet_dht_service.h.

Referenced by run(), and schedule_next_put().

Typedef Documentation

◆ GNUNET_DHT_GetIterator

typedef void(* GNUNET_DHT_GetIterator) (void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const struct GNUNET_PeerIdentity *get_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data)

Iterator called on each result obtained for a DHT operation that expects a reply.

Parameters
clsclosure
expwhen will this value expire
keykey of the result
get_pathpeers on reply path (or NULL if not recorded) [0] = datastore's first neighbor, [length - 1] = local peer
get_path_lengthnumber of entries in get_path
put_pathpeers on the PUT path (or NULL if not recorded) [0] = origin, [length - 1] = datastore
put_path_lengthnumber of entries in put_path
typetype of the result
sizenumber of bytes in data
datapointer to the result data

Definition at line 208 of file gnunet_dht_service.h.

◆ GNUNET_DHT_MonitorGetCB

typedef void(* GNUNET_DHT_MonitorGetCB) (void *cls, enum GNUNET_DHT_RouteOption 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)

Callback called on each GET request going through the DHT.

Parameters
clsClosure.
optionsOptions, for instance RecordRoute, DemultiplexEverywhere.
typeThe type of data in the request.
hop_countHop count so far.
path_lengthnumber of entries in path (or 0 if not recorded).
pathpeers on the GET path (or NULL if not recorded).
desired_replication_levelDesired replication level.
keyKey of the requested data.

Definition at line 292 of file gnunet_dht_service.h.

◆ GNUNET_DHT_MonitorGetRespCB

typedef void(* GNUNET_DHT_MonitorGetRespCB) (void *cls, 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)

Callback called on each GET reply going through the DHT.

Parameters
clsClosure.
typeThe type of data in the result.
get_pathPeers on GET path (or NULL if not recorded).
get_path_lengthnumber of entries in get_path.
put_pathpeers on the PUT path (or NULL if not recorded).
put_path_lengthnumber of entries in get_path.
expExpiration time of the data.
keyKey of the data.
dataPointer to the result data.
sizeNumber of bytes in data.

Definition at line 317 of file gnunet_dht_service.h.

◆ GNUNET_DHT_MonitorPutCB

typedef void(* GNUNET_DHT_MonitorPutCB) (void *cls, enum GNUNET_DHT_RouteOption 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)

Callback called on each PUT request going through the DHT.

Parameters
clsClosure.
optionsOptions, for instance RecordRoute, DemultiplexEverywhere.
typeThe type of data in the request.
hop_countHop count so far.
path_lengthnumber of entries in path (or 0 if not recorded).
pathpeers on the PUT path (or NULL if not recorded).
desired_replication_levelDesired replication level.
expExpiration time of the data.
keyKey under which data is to be stored.
dataPointer to the data carried.
sizeNumber of bytes in data.

Definition at line 345 of file gnunet_dht_service.h.

Enumeration Type Documentation

◆ GNUNET_DHT_RouteOption

Options for routing.

Enumerator
GNUNET_DHT_RO_NONE 

Default.

Do nothing special.

GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE 

Each peer along the way should look at 'enc' (otherwise only the k-peers closest to the key should look at it).

GNUNET_DHT_RO_RECORD_ROUTE 

We should keep track of the route that the message took in the P2P network.

GNUNET_DHT_RO_FIND_PEER 

This is a 'FIND-PEER' request, so approximate results are fine.

GNUNET_DHT_RO_BART 

Possible message option for query key randomization.

GNUNET_DHT_RO_LAST_HOP 

Flag given to monitors if this was the last hop for a GET/PUT.

Definition at line 77 of file gnunet_dht_service.h.

78 {
83 
89 
95 
100 
104  GNUNET_DHT_RO_BART = 8,
105 
110 };
We should keep track of the route that the message took in the P2P network.
Possible message option for query key randomization.
Flag given to monitors if this was the last hop for a GET/PUT.
This is a 'FIND-PEER' request, so approximate results are fine.
Each peer along the way should look at 'enc' (otherwise only the k-peers closest to the key should lo...

Function Documentation

◆ GNUNET_DHT_connect()

struct GNUNET_DHT_Handle* GNUNET_DHT_connect ( const struct GNUNET_CONFIGURATION_Handle cfg,
unsigned int  ht_len 
)

Initialize the connection with the DHT service.

Parameters
cfgconfiguration to use
ht_lensize of the internal hash table to use for processing multiple GET/FIND requests in parallel
Returns
NULL on error
Parameters
cfgconfiguration to use
ht_lensize of the internal hash table to use for processing multiple GET/FIND requests in parallel
Returns
handle to the DHT service, or NULL on error

Definition at line 890 of file dht_api.c.

References GNUNET_DHT_Handle::active_requests, cfg, GNUNET_DHT_Handle::cfg, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u64(), GNUNET_DHT_disconnect(), GNUNET_new, GNUNET_NO, GNUNET_YES, handle, try_connect(), and GNUNET_DHT_Handle::uid_gen.

Referenced by advertise_dns_exit(), dht_ca(), dht_connect(), dht_connect_adapter(), GCD_init(), and run().

892 {
893  struct GNUNET_DHT_Handle *handle;
894 
895  handle = GNUNET_new (struct GNUNET_DHT_Handle);
896  handle->cfg = cfg;
897  handle->uid_gen
899  UINT64_MAX);
900  handle->active_requests
902  GNUNET_YES);
903  if (GNUNET_NO == try_connect (handle))
904  {
905  GNUNET_DHT_disconnect (handle);
906  return NULL;
907  }
908  return handle;
909 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
struct GNUNET_CONTAINER_MultiHashMap * active_requests
Hash map containing the current outstanding unique GET requests (values are of type struct GNUNET_DHT...
Definition: dht_api.c:237
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Random on unsigned 64-bit values.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Connection to the DHT service.
Definition: dht_api.c:201
uint64_t uid_gen
Generator for unique ids.
Definition: dht_api.c:253
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: dht_api.c:206
static int try_connect(struct GNUNET_DHT_Handle *h)
Try to (re)connect to the DHT service.
Definition: dht_api.c:842
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
Definition: dht_api.c:918
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_YES
Definition: gnunet_common.h:77
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_disconnect()

void GNUNET_DHT_disconnect ( struct GNUNET_DHT_Handle handle)

Shutdown connection with the DHT service.

Parameters
handleconnection to shut down
handlehandle of the DHT connection to stop

Definition at line 918 of file dht_api.c.

References GNUNET_DHT_Handle::active_requests, GNUNET_DHT_PutHandle::cont, GNUNET_DHT_PutHandle::cont_cls, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_DHT_put_cancel(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_DHT_Handle::mq, ph, GNUNET_DHT_Handle::put_head, and GNUNET_DHT_Handle::reconnect_task.

Referenced by cleanup(), cleanup_task(), dht_da(), dht_disconnect(), dht_disconnect_adapter(), GCD_shutdown(), GNUNET_DHT_connect(), and shutdown_task().

919 {
920  struct GNUNET_DHT_PutHandle *ph;
921 
922  GNUNET_assert (0 ==
924  while (NULL != (ph = handle->put_head))
925  {
926  if (NULL != ph->cont)
927  ph->cont (ph->cont_cls);
929  }
930  if (NULL != handle->mq)
931  {
932  GNUNET_MQ_destroy (handle->mq);
933  handle->mq = NULL;
934  }
935  if (NULL != handle->reconnect_task)
936  {
938  handle->reconnect_task = NULL;
939  }
941  GNUNET_free (handle);
942 }
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_DHT_put_cancel(struct GNUNET_DHT_PutHandle *ph)
Cancels a DHT PUT operation.
Definition: dht_api.c:1035
struct GNUNET_CONTAINER_MultiHashMap * active_requests
Hash map containing the current outstanding unique GET requests (values are of type struct GNUNET_DHT...
Definition: dht_api.c:237
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
struct GNUNET_SCHEDULER_Task * reconnect_task
Task for trying to reconnect.
Definition: dht_api.c:242
GNUNET_SCHEDULER_TaskCallback cont
Continuation to call when done.
Definition: dht_api.c:58
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void * cont_cls
Closure for cont.
Definition: dht_api.c:68
struct GNUNET_DHT_PutHandle * put_head
Head of active PUT requests.
Definition: dht_api.c:226
Handle to a PUT request.
Definition: dht_api.c:43
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:824
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:966
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_put()

struct GNUNET_DHT_PutHandle* GNUNET_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.

Parameters
handlehandle to DHT service
keythe key to store under
desired_replication_levelestimate of how many nearest peers this request should reach
optionsrouting options for this message
typetype of the value
sizenumber of bytes in data; must be less than 64k
datathe data to store
expdesired expiration time for the value
contcontinuation to call when done (transmitting request to service) You must not call GNUNET_DHT_disconnect in this continuation
cont_clsclosure for cont
Returns
handle to cancel the "PUT" operation, NULL on error (size too big)

FIXME: we should change the protocol to get a confirmation for the PUT from the DHT and call 'cont' only after getting the confirmation; otherwise, the client has no good way of telling if the 'PUT' message actually got to the DHT service!

Parameters
handlehandle to DHT service
keythe key to store under
desired_replication_levelestimate of how many nearest peers this request should reach
optionsrouting options for this message
typetype of the value
sizenumber of bytes in data; must be less than 64k
datathe data to store
expdesired expiration time for the value
contcontinuation to call when done (transmitting request to service) You must not call GNUNET_DHT_disconnect in this continuation
cont_clsclosure for cont

Definition at line 966 of file dht_api.c.

References GNUNET_DHT_PutHandle::cont, GNUNET_DHT_PutHandle::cont_cls, GNUNET_DHT_ClientPutMessage::desired_replication_level, GNUNET_DHT_PutHandle::dht_handle, GNUNET_DHT_PutHandle::env, GNUNET_DHT_ClientPutMessage::expiration, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_new, GNUNET_TIME_absolute_hton(), handle, handle_put_cont(), key, GNUNET_DHT_ClientPutMessage::key, LOG, GNUNET_DHT_Handle::mq, GNUNET_DHT_ClientPutMessage::options, ph, GNUNET_DHT_Handle::put_head, GNUNET_DHT_Handle::put_tail, and GNUNET_DHT_ClientPutMessage::type.

Referenced by announce_id(), delayed_put(), do_dht_put(), message_sent_cont(), perform_dht_put(), process_dht_put_content(), regex_iterator(), and run().

976 {
977  struct GNUNET_MQ_Envelope *env;
978  struct GNUNET_DHT_ClientPutMessage *put_msg;
979  size_t msize;
980  struct GNUNET_DHT_PutHandle *ph;
981 
982  msize = sizeof(struct GNUNET_DHT_ClientPutMessage) + size;
983  if ((msize >= GNUNET_MAX_MESSAGE_SIZE) ||
985  {
986  GNUNET_break (0);
987  return NULL;
988  }
989  if (NULL == handle->mq)
990  return NULL;
992  "Sending PUT for %s to DHT via %p\n",
993  GNUNET_h2s (key),
994  handle);
995  ph = GNUNET_new (struct GNUNET_DHT_PutHandle);
996  ph->dht_handle = handle;
997  ph->cont = cont;
998  ph->cont_cls = cont_cls;
1000  handle->put_tail,
1001  ph);
1002  env = GNUNET_MQ_msg_extra (put_msg,
1003  size,
1005  GNUNET_MQ_notify_sent (env,
1006  &handle_put_cont,
1007  ph);
1008  ph->env = env;
1009  put_msg->type = htonl ((uint32_t) type);
1010  put_msg->options = htonl ((uint32_t) options);
1012  put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
1013  put_msg->key = *key;
1014  GNUNET_memcpy (&put_msg[1],
1015  data,
1016  size);
1017  GNUNET_MQ_send (handle->mq,
1018  env);
1019  return ph;
1020 }
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT
Client wants to store item in DHT.
struct GNUNET_MQ_Envelope * env
Envelope from the PUT operation.
Definition: dht_api.c:73
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:63
Message to insert data into the DHT, sent from clients to DHT service.
Definition: dht.h:189
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
uint32_t desired_replication_level
Replication level for this message.
Definition: dht.h:209
#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:52
uint32_t type
The type of data to insert.
Definition: dht.h:199
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
Definition: mq.c:774
GNUNET_SCHEDULER_TaskCallback cont
Continuation to call when done.
Definition: dht_api.c:58
void * cont_cls
Closure for cont.
Definition: dht_api.c:68
struct GNUNET_DHT_PutHandle * put_head
Head of active PUT requests.
Definition: dht_api.c:226
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_DHT_PutHandle * put_tail
Tail of active PUT requests.
Definition: dht_api.c:231
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
Definition: dht.h:204
struct GNUNET_TIME_AbsoluteNBO expiration
How long should this data persist?
Definition: dht.h:214
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
struct GNUNET_HashCode key
The key to store the value under.
Definition: dht.h:219
Handle to a PUT request.
Definition: dht_api.c:43
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
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:353
static void handle_put_cont(void *cls)
Process a MQ PUT transmission notification.
Definition: dht_api.c:820
uint32_t data
The data value.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:657
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
#define LOG(kind,...)
Definition: dht_api.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_put_cancel()

void GNUNET_DHT_put_cancel ( struct GNUNET_DHT_PutHandle ph)

Cancels a DHT PUT operation.

Note that the PUT request may still go out over the network (we can't stop that); However, if the PUT has not yet been sent to the service, cancelling the PUT will stop this from happening (but there is no way for the user of this API to tell if that is the case). The only use for this API is to prevent a later call to 'cont' from GNUNET_DHT_put (i.e. because the system is shutting down).

Parameters
phput operation to cancel ('cont' will no longer be called)

Definition at line 1035 of file dht_api.c.

References GNUNET_DHT_PutHandle::dht_handle, GNUNET_DHT_PutHandle::env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_notify_sent(), handle, GNUNET_DHT_Handle::put_head, and GNUNET_DHT_Handle::put_tail.

Referenced by cleanup(), do_dht_put(), do_disconnect(), do_shutdown(), GNUNET_DHT_disconnect(), GSF_put_done_(), handle_monitor_event(), handle_put_cont(), put_gns_record(), and shutdown_task().

1036 {
1037  struct GNUNET_DHT_Handle *handle = ph->dht_handle;
1038 
1039  if (NULL != ph->env)
1041  NULL,
1042  NULL);
1044  handle->put_tail,
1045  ph);
1046  GNUNET_free (ph);
1047 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_MQ_Envelope * env
Envelope from the PUT operation.
Definition: dht_api.c:73
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:63
Connection to the DHT service.
Definition: dht_api.c:201
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
Definition: mq.c:774
struct GNUNET_DHT_PutHandle * put_head
Head of active PUT requests.
Definition: dht_api.c:226
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_DHT_PutHandle * put_tail
Tail of active PUT requests.
Definition: dht_api.c:231
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_get_start()

struct GNUNET_DHT_GetHandle* GNUNET_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.

See also GNUNET_BLOCK_evaluate.

Parameters
handlehandle to the DHT service
typeexpected type of the response object
keythe key to look up
desired_replication_levelestimate of how many nearest peers this request should reach
optionsrouting options for this message
xqueryextended query data (can be NULL, depending on type)
xquery_sizenumber of bytes in xquery
iterfunction to call on each result
iter_clsclosure for iter
Returns
handle to stop the async get

Definition at line 1067 of file dht_api.c.

References GNUNET_DHT_Handle::active_requests, GNUNET_DHT_ClientGetMessage::desired_replication_level, GNUNET_DHT_GetHandle::desired_replication_level, GNUNET_DHT_GetHandle::dht_handle, gh, GNUNET_break, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_malloc, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, handle, GNUNET_DHT_GetHandle::iter, GNUNET_DHT_GetHandle::iter_cls, key, GNUNET_DHT_GetHandle::key, LOG, GNUNET_DHT_Handle::mq, options, GNUNET_DHT_GetHandle::options, send_get(), GNUNET_DHT_GetHandle::type, type, GNUNET_DHT_Handle::uid_gen, GNUNET_DHT_GetHandle::unique_id, and GNUNET_DHT_GetHandle::xquery_size.

Referenced by delayed_get(), GCD_search(), get_result_iterator(), GSF_dht_lookup_(), regex_find_path(), REGEX_INTERNAL_search(), regex_next_edge(), run(), and start_dht_request().

1076 {
1077  struct GNUNET_DHT_GetHandle *gh;
1078  size_t msize;
1079 
1080  msize = sizeof(struct GNUNET_DHT_ClientGetMessage) + xquery_size;
1081  if ((msize >= GNUNET_MAX_MESSAGE_SIZE) ||
1082  (xquery_size >= GNUNET_MAX_MESSAGE_SIZE))
1083  {
1084  GNUNET_break (0);
1085  return NULL;
1086  }
1088  "Sending query for %s to DHT %p\n",
1089  GNUNET_h2s (key),
1090  handle);
1091  gh = GNUNET_malloc (sizeof(struct GNUNET_DHT_GetHandle)
1092  + xquery_size);
1093  gh->iter = iter;
1094  gh->iter_cls = iter_cls;
1095  gh->dht_handle = handle;
1096  gh->key = *key;
1097  gh->unique_id = ++handle->uid_gen;
1098  gh->xquery_size = xquery_size;
1100  gh->type = type;
1101  gh->options = options;
1102  GNUNET_memcpy (&gh[1],
1103  xquery,
1104  xquery_size);
1106  &gh->key,
1107  gh,
1109  if (NULL != handle->mq)
1110  send_get (gh);
1111  return gh;
1112 }
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_CONTAINER_MultiHashMap * active_requests
Hash map containing the current outstanding unique GET requests (values are of type struct GNUNET_DHT...
Definition: dht_api.c:237
enum GNUNET_BLOCK_Type type
Type of the block we are looking for.
Definition: dht_api.c:125
GNUNET_DHT_GetIterator iter
Iterator to call on data receipt.
Definition: dht_api.c:84
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint32_t desired_replication_level
Desired replication level.
Definition: dht_api.c:120
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:94
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
uint64_t uid_gen
Generator for unique ids.
Definition: dht_api.c:253
void * iter_cls
Closure for iter.
Definition: dht_api.c:89
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_HashCode key
The key used in the DHT.
size_t xquery_size
Size of the extended query, allocated at the end of this struct.
Definition: dht_api.c:115
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
Handle to a GET request.
Definition: dht_api.c:79
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
Allow multiple values with the same key.
DHT GET message sent from clients to service.
Definition: dht.h:71
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
static void send_get(struct GNUNET_DHT_GetHandle *gh)
Send GET message for a get_handle to DHT.
Definition: dht_api.c:273
enum GNUNET_DHT_RouteOption options
Routing options.
Definition: dht_api.c:130
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_HashCode key
Key that this get request is for.
Definition: dht_api.c:105
uint32_t desired_replication_level
Replication level for this message.
Definition: dht.h:86
uint64_t unique_id
Unique identifier for this request (for key collisions).
Definition: dht_api.c:110
#define GNUNET_malloc(size)
Wrapper around malloc.
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
#define LOG(kind,...)
Definition: dht_api.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_get_filter_known_results()

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.

Parameters
get_handleget operation for which results should be filtered
num_resultsnumber of results to be blocked that are provided in this call (size of the results array)
resultsarray of hash codes over the data of the results to be blocked
get_handleget operation for which results should be filtered
num_resultsnumber of results to be blocked that are provided in this call (size of the results array)
resultsarray of hash codes over the 'data' of the results to be blocked

Definition at line 1126 of file dht_api.c.

References GNUNET_DHT_GetHandle::dht_handle, GNUNET_array_grow, GNUNET_memcpy, GNUNET_DHT_Handle::mq, GNUNET_DHT_GetHandle::seen_results, GNUNET_DHT_GetHandle::seen_results_end, GNUNET_DHT_GetHandle::seen_results_size, and send_get_known_results().

Referenced by GSF_dht_lookup_(), and GSF_pending_request_update_().

1129 {
1130  unsigned int needed;
1131  unsigned int had;
1132 
1133  had = get_handle->seen_results_end;
1134  needed = had + num_results;
1135  if (needed > get_handle->seen_results_size)
1136  GNUNET_array_grow (get_handle->seen_results,
1137  get_handle->seen_results_size,
1138  needed);
1139  GNUNET_memcpy (&get_handle->seen_results[get_handle->seen_results_end],
1140  results,
1141  num_results * sizeof(struct GNUNET_HashCode));
1142  get_handle->seen_results_end += num_results;
1143  if (NULL != get_handle->dht_handle->mq)
1144  send_get_known_results (get_handle,
1145  had);
1146 }
unsigned int seen_results_size
Size of the seen_results array.
Definition: dht_api.c:136
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:142
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:94
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:305
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
A 512-bit hashcode.
struct GNUNET_HashCode * seen_results
Array of hash codes over the results that we have already seen.
Definition: dht_api.c:100
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_get_stop()

void GNUNET_DHT_get_stop ( struct GNUNET_DHT_GetHandle get_handle)

Stop async DHT-get.

Frees associated resources.

Parameters
get_handleGET operation to stop.
get_handlehandle to the GET operation to stop

Definition at line 1155 of file dht_api.c.

References GNUNET_DHT_Handle::active_requests, GNUNET_DHT_GetHandle::dht_handle, GNUNET_DHT_PutHandle::env, GNUNET_array_grow, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_YES, handle, GNUNET_DHT_ClientGetStopMessage::key, GNUNET_DHT_GetHandle::key, LOG, GNUNET_DHT_Handle::mq, GNUNET_DHT_ClientGetStopMessage::reserved, GNUNET_DHT_GetHandle::seen_results, GNUNET_DHT_GetHandle::seen_results_end, GNUNET_DHT_ClientGetStopMessage::unique_id, and GNUNET_DHT_GetHandle::unique_id.

Referenced by cancel_get(), clean_request(), cleanup(), cleanup_task(), do_shutdown(), GCD_search_stop(), get_iter(), get_result_iterator(), GNS_resolver_lookup_cancel(), GSF_dht_lookup_(), GSF_pending_request_cancel_(), handle_dht_response(), and regex_cancel_dht_get().

1156 {
1157  struct GNUNET_DHT_Handle *handle = get_handle->dht_handle;
1158 
1160  "Sending STOP for %s to DHT via %p\n",
1161  GNUNET_h2s (&get_handle->key),
1162  handle);
1163  if (NULL != handle->mq)
1164  {
1165  struct GNUNET_MQ_Envelope *env;
1166  struct GNUNET_DHT_ClientGetStopMessage *stop_msg;
1167 
1168  env = GNUNET_MQ_msg (stop_msg,
1170  stop_msg->reserved = htonl (0);
1171  stop_msg->unique_id = get_handle->unique_id;
1172  stop_msg->key = get_handle->key;
1173  GNUNET_MQ_send (handle->mq,
1174  env);
1175  }
1178  &get_handle->key,
1179  get_handle));
1180  GNUNET_array_grow (get_handle->seen_results,
1181  get_handle->seen_results_end,
1182  0);
1183  GNUNET_free (get_handle);
1184 }
struct GNUNET_CONTAINER_MultiHashMap * active_requests
Hash map containing the current outstanding unique GET requests (values are of type struct GNUNET_DHT...
Definition: dht_api.c:237
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:142
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:94
Connection to the DHT service.
Definition: dht_api.c:201
uint64_t unique_id
Unique ID identifying this request.
Definition: dht.h:58
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
uint32_t reserved
Always zero.
Definition: dht.h:53
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_HashCode * seen_results
Array of hash codes over the results that we have already seen.
Definition: dht_api.c:100
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
Client wants to stop search in DHT.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_HashCode key
Key of this request.
Definition: dht.h:63
Message which indicates the DHT should cancel outstanding requests and discard any state...
Definition: dht.h:43
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_HashCode key
Key that this get request is for.
Definition: dht_api.c:105
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:353
uint64_t unique_id
Unique identifier for this request (for key collisions).
Definition: dht_api.c:110
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
#define GNUNET_free(ptr)
Wrapper around free.
#define LOG(kind,...)
Definition: dht_api.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_monitor_start()

struct GNUNET_DHT_MonitorHandle* GNUNET_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.

Parameters
handleHandle to the DHT service.
typeType of blocks that are of interest.
keyKey of data of interest, NULL for all.
get_cbCallback to process monitored get messages.
get_resp_cbCallback to process monitored get response messages.
put_cbCallback to process monitored put messages.
cb_clsClosure for callbacks
Returns
Handle to stop monitoring.
Parameters
handleHandle to the DHT service.
typeType of blocks that are of interest.
keyKey of data of interest, NULL for all.
get_cbCallback to process monitored get messages.
get_resp_cbCallback to process monitored get response messages.
put_cbCallback to process monitored put messages.
cb_clsClosure for callbacks.
Returns
Handle to stop monitoring.

Definition at line 1200 of file dht_api.c.

References GNUNET_DHT_MonitorHandle::cb_cls, GNUNET_DHT_MonitorHandle::dht_handle, GNUNET_DHT_MonitorHandle::get_cb, get_cb(), GNUNET_DHT_MonitorHandle::get_resp_cb, GNUNET_CONTAINER_DLL_insert, GNUNET_new, handle, key, GNUNET_DHT_MonitorHandle::key, mh, GNUNET_DHT_Handle::monitor_head, GNUNET_DHT_Handle::monitor_tail, GNUNET_DHT_Handle::mq, put_cb(), GNUNET_DHT_MonitorHandle::put_cb, send_monitor_start(), type, and GNUNET_DHT_MonitorHandle::type.

Referenced by run().

1207 {
1208  struct GNUNET_DHT_MonitorHandle *mh;
1209 
1210  mh = GNUNET_new (struct GNUNET_DHT_MonitorHandle);
1211  mh->get_cb = get_cb;
1212  mh->get_resp_cb = get_resp_cb;
1213  mh->put_cb = put_cb;
1214  mh->cb_cls = cb_cls;
1215  mh->type = type;
1216  mh->dht_handle = handle;
1217  if (NULL != key)
1218  {
1219  mh->key = GNUNET_new (struct GNUNET_HashCode);
1220  *mh->key = *key;
1221  }
1223  handle->monitor_tail,
1224  mh);
1225  if (NULL != handle->mq)
1226  send_monitor_start (mh);
1227  return mh;
1228 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
Definition: gnunet-cadet.c:92
GNUNET_DHT_MonitorGetRespCB get_resp_cb
Callback for each received message of type get response.
Definition: dht_api.c:184
static int get_cb(void *cls, const struct GNUNET_HashCode *key, void *value)
Function called during GET to find matching blocks.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_DHT_MonitorPutCB put_cb
Callback for each received message of type put.
Definition: dht_api.c:189
GNUNET_DHT_MonitorGetCB get_cb
Callback for each received message of type get.
Definition: dht_api.c:179
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_HashCode * key
Key being looked for, NULL == all.
Definition: dht_api.c:174
A 512-bit hashcode.
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:164
struct GNUNET_DHT_MonitorHandle * monitor_head
Head of linked list of messages we would like to monitor.
Definition: dht_api.c:216
struct GNUNET_DHT_MonitorHandle * monitor_tail
Tail of linked list of messages we would like to monitor.
Definition: dht_api.c:221
struct GNUNET_HashCode key
The key used in the DHT.
static void send_monitor_start(struct GNUNET_DHT_MonitorHandle *mh)
Send GNUNET_MESSAGE_TYPE_DHT_MONITOR_START message.
Definition: dht_api.c:371
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
enum GNUNET_BLOCK_Type type
Type of block looked for.
Definition: dht_api.c:169
static int put_cb(void *cls, const struct GNUNET_HashCode *key, void *value)
Function called during PUT to detect if an equivalent block already exists.
Handle to a monitoring request.
Definition: dht_api.c:149
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
void * cb_cls
Closure for get_cb, put_cb and get_resp_cb.
Definition: dht_api.c:194
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DHT_monitor_stop()

void GNUNET_DHT_monitor_stop ( struct GNUNET_DHT_MonitorHandle mh)

Stop monitoring.

On return handle will no longer be valid, caller must not use it anymore.

Parameters
handleThe handle to the monitor request returned by GNUNET_DHT_monitor_start().
mhThe handle to the monitor request returned by monitor_start.

On return get_handle will no longer be valid, caller must not use again!!!

Definition at line 1239 of file dht_api.c.

References GNUNET_DHT_MonitorHandle::dht_handle, GNUNET_DHT_PutHandle::env, GNUNET_DHT_MonitorStartStopMessage::filter_key, GNUNET_DHT_MonitorStartStopMessage::get, GNUNET_DHT_MonitorHandle::get_cb, GNUNET_DHT_MonitorStartStopMessage::get_resp, GNUNET_DHT_MonitorHandle::get_resp_cb, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_DHT_MonitorHandle::key, GNUNET_DHT_MonitorStartStopMessage::key, m, GNUNET_DHT_Handle::monitor_head, GNUNET_DHT_Handle::monitor_tail, GNUNET_DHT_Handle::mq, GNUNET_DHT_MonitorStartStopMessage::put, GNUNET_DHT_MonitorHandle::put_cb, GNUNET_DHT_MonitorHandle::type, and GNUNET_DHT_MonitorStartStopMessage::type.

Referenced by cleanup_task().

1240 {
1241  struct GNUNET_DHT_Handle *handle = mh->dht_handle;
1243  struct GNUNET_MQ_Envelope *env;
1244 
1246  handle->monitor_tail,
1247  mh);
1248  env = GNUNET_MQ_msg (m,
1250  m->type = htonl (mh->type);
1251  m->get = htons (NULL != mh->get_cb);
1252  m->get_resp = htons (NULL != mh->get_resp_cb);
1253  m->put = htons (NULL != mh->put_cb);
1254  if (NULL != mh->key)
1255  {
1256  m->filter_key = htons (1);
1257  m->key = *mh->key;
1258  }
1259  GNUNET_MQ_send (handle->mq,
1260  env);
1261  GNUNET_free_non_null (mh->key);
1262  GNUNET_free (mh);
1263 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
uint32_t type
The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
Definition: dht.h:291
GNUNET_DHT_MonitorGetRespCB get_resp_cb
Callback for each received message of type get response.
Definition: dht_api.c:184
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
int16_t get_resp
Flag whether to notify about GET_REPONSE messages.
Definition: dht.h:301
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
Stop information about transiting messages.
GNUNET_DHT_MonitorPutCB put_cb
Callback for each received message of type put.
Definition: dht_api.c:189
Connection to the DHT service.
Definition: dht_api.c:201
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
int16_t filter_key
Flag whether to use the provided key to filter messages.
Definition: dht.h:311
int16_t put
Flag whether to notify about PUT messages.
Definition: dht.h:306
Message to request monitoring messages, clients -> DHT service.
Definition: dht.h:280
GNUNET_DHT_MonitorGetCB get_cb
Callback for each received message of type get.
Definition: dht_api.c:179
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_HashCode * key
Key being looked for, NULL == all.
Definition: dht_api.c:174
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
Definition: dht_api.c:164
struct GNUNET_DHT_MonitorHandle * monitor_head
Head of linked list of messages we would like to monitor.
Definition: dht_api.c:216
struct GNUNET_DHT_MonitorHandle * monitor_tail
Tail of linked list of messages we would like to monitor.
Definition: dht_api.c:221
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
int16_t get
Flag whether to notify about GET messages.
Definition: dht.h:296
struct GNUNET_HashCode key
The key to filter messages by.
Definition: dht.h:316
enum GNUNET_BLOCK_Type type
Type of block looked for.
Definition: dht_api.c:169
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:353
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
Definition: dht_api.c:211
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: