30#include "gnunet_signatures.h"
36#define LOG(kind, ...) GNUNET_log_from (kind, "dht-api", __VA_ARGS__)
349 unsigned int transmission_offset_start)
356 unsigned int transmission_offset;
360 transmission_offset = transmission_offset_start;
361 while (transmission_offset < gh->seen_results_end)
376 transmission_offset +=
delta;
399 "Retransmitting request related to %s to DHT %p\n",
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);
428 m->filter_key = htons (1);
448 "Reconnecting with DHT %p\n",
455 "DHT reconnect failed!\n");
465 for (
mh =
h->monitor_head; NULL !=
mh;
mh =
mh->next)
487 "Disconnecting from DHT service, will try to reconnect in %s\n",
491 while (NULL != (ph =
h->put_head))
543 if (NULL ==
mh->get_cb)
548 if ( (NULL !=
mh->key) &&
552 mh->get_cb (
mh->cb_cls,
555 ntohl (
msg->hop_count),
556 ntohl (
msg->desired_replication_level),
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);
589 if ((getl + putl < getl) ||
610 size_t msize = ntohs (
msg->header.
size) -
sizeof(*msg);
612 uint32_t getl = ntohl (
msg->get_path_length);
613 uint32_t putl = ntohl (
msg->put_path_length);
631 if (NULL ==
mh->get_resp_cb)
636 if ( (NULL !=
mh->key) &&
640 mh->get_resp_cb (
mh->cb_cls,
649 (
const void *) &path[getl + putl],
667 size_t msize = ntohs (
msg->header.
size) -
sizeof(*msg);
668 uint32_t putl = ntohl (
msg->put_path_length);
701 size_t msize = ntohs (
msg->header.
size) -
sizeof(*msg);
702 uint32_t putl = ntohl (
msg->put_path_length);
721 if (NULL ==
mh->put_cb)
726 if ( (NULL !=
mh->key) &&
730 mh->put_cb (
mh->cb_cls,
733 ntohl (
msg->hop_count),
734 ntohl (
msg->desired_replication_level),
740 (
const void *) &path[putl],
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);
775 if ( (get_path_length + put_path_length >
777 (get_path_length + put_path_length <
802 size_t msize = ntohs (crm->
header.
size) -
sizeof(*crm);
807 uint32_t put_path_length
809 uint32_t get_path_length
820 = &put_path[put_path_length];
822 = &get_path[get_path_length];
825 * (get_path_length + put_path_length);
827 = msize - meta_length;
836 "Ignoring reply for %s: UID mismatch: %llu/%llu\n",
859 "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n",
860 (
unsigned int) data_length,
922 uint16_t len = ntohs (hdr->
size);
923 const char *buf = (
const char *) &hdr[1];
926 if (
'\0' != buf[len -
sizeof (*hdr) - 1])
946 const char *url = (
const char *) &hdr[1];
949 while (NULL != (hgh =
handle->hgh_head))
1022 "Failed to connect to the DHT service!\n");
1031 unsigned int ht_len)
1059 while (NULL != (ph =
handle->put_head))
1061 if (NULL != ph->
cont)
1070 if (NULL !=
handle->reconnect_task)
1073 handle->reconnect_task = NULL;
1083 uint32_t desired_replication_level,
1112 "Sending PUT for %s to DHT via %p\n",
1129 put_msg->
type = htonl ((uint32_t)
type);
1148 if (NULL != ph->
env)
1181 "Sending query for %s to DHT %p\n",
1210 unsigned int num_results,
1213 unsigned int needed;
1217 needed = had + num_results;
1238 "Sending STOP for %s to DHT via %p\n",
1309 m->type = htonl (
mh->type);
1310 m->get = htons (NULL !=
mh->get_cb);
1311 m->get_resp = htons (NULL !=
mh->get_resp_cb);
1312 m->put = htons (NULL !=
mh->put_cb);
1313 if (NULL !=
mh->key)
1315 m->filter_key = htons (1);
1327 unsigned int path_len)
1331 size_t plen = path_len * 5 + 1;
1336 for (
unsigned int i = 0; i < path_len; i++)
1342 (i == path_len - 1) ?
"" :
"-");
1354 unsigned int put_path_len,
1356 unsigned int get_path_len,
1362 .purpose.size = htonl (
sizeof (hs)),
1367 if (0 == get_path_len + put_path_len)
1370 "%s is verifying signatures with GPL: %u PPL: %u!\n",
1374 for (
unsigned int j = 0; j<put_path_len; j++)
1379 for (
unsigned int j = 0; j<get_path_len; j++)
1387 i = put_path_len + get_path_len;
1397 pred = (NULL == bpid) ? &
zero : bpid;
1401 unsigned int off = i - 1;
1403 pred = (off >= put_path_len)
1404 ? &get_path[off - put_path_len].
pred
1405 : &put_path[off].
pred;
1407 if (i == get_path_len + put_path_len - 1)
1413 unsigned int off = i + 1;
1415 succ = (off >= put_path_len)
1416 ? &get_path[off - put_path_len].
pred
1417 : &put_path[off].
pred;
1421 pe = (i >= put_path_len)
1422 ? &get_path[i - put_path_len]
1482 size_t slen = strlen (url) + 1;
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static void send_get(struct GNUNET_DHT_GetHandle *gh)
Send GET message for a get_handle to DHT.
static void handle_monitor_get_resp(void *cls, const struct GNUNET_DHT_MonitorGetRespMessage *msg)
Process a get response monitor message from the service.
static enum GNUNET_GenericReturnValue try_connect(struct GNUNET_DHT_Handle *h)
Try to (re)connect to the DHT service.
static void handle_client_result(void *cls, const struct GNUNET_DHT_ClientResultMessage *msg)
Process a client result message received from the service.
static void handle_client_hello(void *cls, const struct GNUNET_MessageHeader *hdr)
Process a client HELLO message received from the service.
static void try_reconnect(void *cls)
Try reconnecting to the dht service.
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.
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.
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...
static void handle_monitor_get(void *cls, const struct GNUNET_DHT_MonitorGetMessage *msg)
Process a get monitor message from the service.
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.
static enum GNUNET_GenericReturnValue check_client_hello(void *cls, const struct GNUNET_MessageHeader *hdr)
Process a client HELLO message received from the service.
static void do_disconnect(struct GNUNET_DHT_Handle *h)
Try reconnecting to the DHT service.
static void handle_put_cont(void *cls)
Process a MQ PUT transmission notification.
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...
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.
static void handle_monitor_put(void *cls, const struct GNUNET_DHT_MonitorPutMessage *msg)
Process a put monitor message from the service.
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.
static void send_monitor_start(struct GNUNET_DHT_MonitorHandle *mh)
Send GNUNET_MESSAGE_TYPE_DHT_MONITOR_START message.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
static void get_cb(void *cls, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, uint64_t uid)
Process a datum that was stored in the datastore.
static void put_cb(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the operation.
static struct GNUNET_DHT_GetHandle * get_handle
Handle for the get request.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
static unsigned int results
static const struct GNUNET_CRYPTO_PrivateKey zero
Public key of all zeros.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Constants for network protocols.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
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.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
#define GNUNET_CRYPTO_eddsa_verify(purp, ps, sig, pub)
Verify EdDSA signature.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
void GNUNET_DHT_put_cancel(struct GNUNET_DHT_PutHandle *ph)
Cancels a DHT PUT operation.
GNUNET_DHT_RouteOption
Options for routing.
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.
char * GNUNET_DHT_pp2s(const struct GNUNET_DHT_PathElement *path, unsigned int path_len)
Convert a peer path to a human-readable string.
struct GNUNET_DHT_Handle * GNUNET_DHT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int ht_len)
Initialize the connection with the DHT service.
void GNUNET_DHT_hello_get_cancel(struct GNUNET_DHT_HelloGetHandle *hgh)
Cancel hello get operation.
void GNUNET_DHT_get_stop(struct GNUNET_DHT_GetHandle *get_handle)
Stop async DHT-get.
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.
void(* GNUNET_DHT_GetIterator)(void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *query_hash, const struct GNUNET_PeerIdentity *trunc_peer, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *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.
void(* GNUNET_DHT_MonitorGetRespCB)(void *cls, enum GNUNET_BLOCK_Type type, const struct GNUNET_PeerIdentity *trunc_peer, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *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.
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, const struct GNUNET_HashCode *key)
Callback called on each GET request going through the DHT.
void(* GNUNET_DHT_HelloGetCallback)(void *cls, const char *hello_url)
Signature called with the result of a HELLO GET operation.
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.
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.
struct GNUNET_DHT_HelloGetHandle * GNUNET_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.
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
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.
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, const struct GNUNET_PeerIdentity *trunc_peer, unsigned int path_length, const struct GNUNET_DHT_PathElement *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.
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 las...
void GNUNET_DHT_monitor_stop(struct GNUNET_DHT_MonitorHandle *mh)
Stop monitoring.
@ GNUNET_DHT_RO_TRUNCATED
Flag set if the path was truncated.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
enum GNUNET_GenericReturnValue 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.
enum GNUNET_GenericReturnValue 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.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
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.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_log(kind,...)
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
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.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#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_CLIENT_PUT
Client wants to store item in DHT.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_START
Request information about transiting messages.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
Certain results are already known to the client, filter those.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
Receive information about transiting PUTs.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
Client wants to stop search in DHT.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
Service returns result to client.
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
Stop information about transiting messages.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_GET
Client requests DHT service's HELLO URL.
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL
HELLO URL send between client and service (in either direction).
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
Client wants to lookup item in DHT.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
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.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
static unsigned int size
Size of the "table".
static struct GNUNET_TIME_Relative delta
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
@ GNUNET_BLOCK_TYPE_ANY
Identifier for any block.
#define GNUNET_SIGNATURE_PURPOSE_DHT_HOP
Signature by which a peer affirms that it forwarded a message in the DHT.
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Internal representation of the hash map.
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
DHT GET message sent from clients to service.
uint64_t unique_id
Unique ID identifying this request, if 0 then the client will not expect a response.
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
struct GNUNET_HashCode key
The key to search for.
uint32_t type
The type for the data for the GET request; actually an 'enum GNUNET_BLOCK_Type'.
uint32_t desired_replication_level
Replication level for this message.
DHT GET RESULTS KNOWN message sent from clients to service.
Message which indicates the DHT should cancel outstanding requests and discard any state.
uint64_t unique_id
Unique ID identifying this request.
struct GNUNET_HashCode key
Key of this request.
uint32_t reserved
Always zero.
Message to insert data into the DHT, sent from clients to DHT service.
struct GNUNET_HashCode key
The key to store the value under.
uint32_t type
The type of data to insert.
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
uint32_t desired_replication_level
Replication level for this message.
struct GNUNET_TIME_AbsoluteNBO expiration
How long should this data persist?
Reply to a GET send from the service to a client.
uint32_t put_path_length
Number of peers recorded in the outgoing path from source to the storgage location of this message.
uint64_t unique_id
Unique ID of the matching GET request.
struct GNUNET_TIME_AbsoluteNBO expiration
When does this entry expire?
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT.
uint32_t type
The type for the data.
uint32_t options
Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
uint32_t get_path_length
The number of peer identities recorded from the storage location to this peer.
GNUNET_DHT_GetIterator iter
Iterator to call on data receipt.
enum GNUNET_BLOCK_Type type
Type of the block we are looking for.
void * iter_cls
Closure for iter.
unsigned int seen_results_end
Offset into the seen_results array marking the end of the positions that are actually used.
struct GNUNET_HashCode * seen_results
Array of hash codes over the results that we have already seen.
size_t xquery_size
Size of the extended query, allocated at the end of this struct.
uint32_t desired_replication_level
Desired replication level.
struct GNUNET_HashCode key
Key that this get request is for.
uint64_t unique_id
Unique identifier for this request (for key collisions).
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
enum GNUNET_DHT_RouteOption options
Routing options.
unsigned int seen_results_size
Size of the seen_results array.
Connection to the DHT service.
struct GNUNET_CONTAINER_MultiHashMap * active_requests
Hash map containing the current outstanding unique GET requests (values are of type struct GNUNET_DHT...
struct GNUNET_TIME_Relative retry_time
How quickly should we retry? Used for exponential back-off on connect-errors.
struct GNUNET_SCHEDULER_Task * reconnect_task
Task for trying to reconnect.
struct GNUNET_DHT_PutHandle * put_tail
Tail of active PUT requests.
struct GNUNET_DHT_MonitorHandle * monitor_tail
Tail of linked list of messages we would like to monitor.
struct GNUNET_MQ_Handle * mq
Connection to DHT service.
struct GNUNET_DHT_PutHandle * put_head
Head of active PUT requests.
struct GNUNET_DHT_MonitorHandle * monitor_head
Head of linked list of messages we would like to monitor.
struct GNUNET_DHT_HelloGetHandle * hgh_tail
DLL.
uint64_t uid_gen
Generator for unique ids.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
struct GNUNET_DHT_HelloGetHandle * hgh_head
DLL.
Handle to get a HELLO URL from the DHT for manual bootstrapping.
struct GNUNET_DHT_Handle * dht_handle
Connection to the DHT service.
GNUNET_DHT_HelloGetCallback cb
Function to call with the result.
void * cb_cls
Closure for cb.
struct GNUNET_DHT_HelloGetHandle * prev
DLL.
struct GNUNET_DHT_HelloGetHandle * next
DLL.
Message signed by a peer when doing path tracking.
struct GNUNET_HashCode h_data
Hash over the payload of the block.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Must be GNUNET_SIGNATURE_PURPOSE_DHT_HOP.
struct GNUNET_PeerIdentity pred
Previous hop the message was received from.
struct GNUNET_PeerIdentity succ
Next hop the message was forwarded to.
Message to monitor get requests going through peer, DHT service -> clients.
Message to monitor get results going through peer, DHT service -> clients.
Handle to a monitoring request.
GNUNET_DHT_MonitorGetRespCB get_resp_cb
Callback for each received message of type get response.
struct GNUNET_HashCode * key
Key being looked for, NULL == all.
struct GNUNET_DHT_MonitorHandle * prev
DLL.
struct GNUNET_DHT_MonitorHandle * next
DLL.
GNUNET_DHT_MonitorPutCB put_cb
Callback for each received message of type put.
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
GNUNET_DHT_MonitorGetCB get_cb
Callback for each received message of type get.
void * cb_cls
Closure for get_cb, put_cb and get_resp_cb.
enum GNUNET_BLOCK_Type type
Type of block looked for.
Message to monitor put requests going through peer, DHT service -> clients.
Message to request monitoring messages, clients -> DHT service.
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
struct GNUNET_PeerIdentity pred
Previous peer on the path (matches "pred" in the signed field).
struct GNUNET_CRYPTO_EddsaSignature sig
Signature affirming the hop of type GNUNET_SIGNATURE_PURPOSE_DHT_HOP.
struct GNUNET_DHT_Handle * dht_handle
Main handle to this DHT api.
struct GNUNET_DHT_PutHandle * prev
Kept in a DLL.
void * cont_cls
Closure for cont.
struct GNUNET_MQ_Envelope * env
Envelope from the PUT operation.
struct GNUNET_DHT_PutHandle * next
Kept in a DLL.
GNUNET_SCHEDULER_TaskCallback cont
Continuation to call when done.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
struct GNUNET_MQ_Handle * mq
Connection to VPN service.