30 #include "gnunet_error_codes.h"
34 #include "gnunet_signatures.h"
40 #define LOG(kind, ...) GNUNET_log_from (kind, "namestore-api", __VA_ARGS__)
46 #define NAMESTORE_DELAY_TOLERANCE GNUNET_TIME_UNIT_MINUTES
274 if (
qe->op_id == rid)
292 for (ze =
h->z_head; ze != NULL; ze = ze->
next)
293 if (ze->
op_id == rid)
312 if (NULL !=
qe->timeout_task)
376 "Received RECORD_STORE_RESPONSE with result %d\n",
405 rd_len = ntohs (
msg->rd_len);
406 msg_len = ntohs (
msg->gns_header.header.
size);
407 name_len = ntohs (
msg->name_len);
408 key_len = ntohs (
msg->key_len);
409 exp_msg_len =
sizeof(*msg) + name_len + rd_len + key_len;
410 if (0 != ntohs (
msg->reserved))
415 if (msg_len != exp_msg_len)
420 name = (
const char *) &
msg[1] + key_len;
421 if ((name_len > 0) && (
'\0' !=
name[name_len - 1]))
428 if (0 != ntohs (
msg->rd_count))
459 int16_t found = (int16_t) ntohs (
msg->found);
466 rd_len = ntohs (
msg->rd_len);
468 name_len = ntohs (
msg->name_len);
469 key_len = ntohs (
msg->key_len);
476 name = (
const char *) &
msg[1] + key_len;
480 if (NULL !=
qe->proc)
481 qe->proc (
qe->proc_cls, &private_key,
name, 0, NULL);
487 if (NULL !=
qe->error_cb)
488 qe->error_cb (
qe->error_cb_cls);
493 rd_tmp = &
name[name_len];
502 if (NULL !=
qe->proc)
503 qe->proc (
qe->proc_cls,
531 rd_len = ntohs (
msg->rd_len);
532 msg_len = ntohs (
msg->gns_header.header.
size);
533 key_len = ntohs (
msg->key_len);
534 name_len = ntohs (
msg->name_len);
541 name = (
const char *) &
msg[1] + key_len;
542 if ((0 == name_len) || (
'\0' !=
name[name_len - 1]))
579 rd_len = ntohs (
msg->rd_len);
581 name_len = ntohs (
msg->name_len);
582 key_len = ntohs (
msg->key_len);
585 if ((NULL == ze) && (NULL ==
qe))
587 if ((NULL != ze) && (NULL !=
qe))
593 name = (
const char *) &
msg[1] + key_len;
600 rd_tmp = &
name[name_len];
611 if (NULL !=
qe->proc)
612 qe->proc (
qe->proc_cls,
631 proc2 (proc_cls, &private_key,
name,
657 if ((NULL == ze) && (NULL ==
qe))
659 if ((NULL != ze) && (NULL !=
qe))
688 "Received TX_CONTROL_RESULT with result %d\n",
712 const char *name_tmp;
717 key_len = ntohs (
msg->key_len);
718 name_len = ntohs (
msg->name_len);
719 rd_ser_len = ntohs (
msg->rd_len);
720 if (ntohs (
msg->gns_header.header.
size) !=
727 name_tmp = (
const char *) &
msg[1] + key_len;
728 if ((name_len > 0) && (
'\0' != name_tmp[name_len - 1]))
733 return check_rd (rd_ser_len, &name_tmp[name_len], ntohs (
msg->rd_count));
755 const char *name_tmp;
765 "Response queue already gone...\n");
769 key_len = ntohs (
msg->key_len);
782 "Namestore has no result for zone to name mapping \n");
783 if (NULL !=
qe->proc)
784 qe->proc (
qe->proc_cls, &
zone, NULL, 0, NULL);
790 "Namestore has result for zone to name mapping \n");
791 name_len = ntohs (
msg->name_len);
793 rd_ser_len = ntohs (
msg->rd_len);
794 name_tmp = (
const char *) &
msg[1] + key_len;
795 rd_tmp = &name_tmp[name_len];
805 if (NULL !=
qe->proc)
814 "An error occurred during zone to name operation: %s\n",
819 if (NULL !=
qe->error_cb)
820 qe->error_cb (
qe->error_cb_cls);
886 for (it =
h->z_head; NULL != it; it = it->
next)
927 while (NULL != (ze =
h->z_head))
933 while (NULL != (
qe =
h->op_head))
935 if (NULL !=
qe->error_cb)
936 qe->error_cb (
qe->error_cb_cls);
959 return h->last_op_id_used++;
1000 while (NULL != (
q =
h->op_head))
1006 while (NULL != (z =
h->z_head))
1036 qe->timeout_task = NULL;
1038 "Did not receive response from namestore after %s!\n",
1061 unsigned int rds_sent;
1073 unsigned int rd_set_count,
1075 unsigned int *rds_sent,
1086 ssize_t rd_ser_len[rd_set_count];
1093 size_t rd_set_len = 0;
1102 label = record_info[i].
a_label;
1104 rd = record_info[i].
a_rd;
1105 name_len = strlen (label) + 1;
1113 if (rd_ser_len[i] < 0)
1119 if (rd_ser_len[i] > max_len)
1125 if ((rd_set_len +
sizeof (
struct RecordSet) + name_len + rd_ser_len[i]) >
1132 "Sending %u of %u records!\n", *rds_sent, rd_set_count);
1142 key_len + rd_set_len,
1146 msg->gns_header.r_id = htonl (rid);
1147 msg->key_len = htons (key_len);
1148 msg->rd_set_count = htons ((uint16_t) (*rds_sent));
1152 rd_set = (
struct RecordSet*) (((
char*) &
msg[1]) + key_len);
1153 for (
int i = 0; i < *rds_sent; i++)
1155 label = record_info[i].
a_label;
1156 rd = record_info[i].
a_rd;
1159 rd_set->
rd_count = htons (record_info[i].a_rd_count);
1160 rd_set->
rd_len = htons (rd_ser_len[i]);
1162 name_tmp = (
char *) &rd_set[1];
1166 rd, rd_ser_len[i], rd_ser);
1167 if ((0 > sret) || (sret != rd_ser_len[i]))
1177 "Sending NAMESTORE_RECORD_STORE message for name %u record sets\n",
1185 "Delaying NAMESTORE_RECORD_STORE message as namestore is not ready!\n");
1204 int is_edit_request,
1213 if (1 == (
label_len = strlen (label) + 1))
1222 qe->error_cb_cls = error_cb_cls;
1224 qe->proc_cls = rm_cls;
1232 msg->gns_header.r_id = htonl (
qe->op_id);
1319 qe->error_cb_cls = error_cb_cls;
1321 qe->proc_cls = proc_cls;
1329 msg->gns_header.r_id = htonl (rid);
1381 msg->gns_header.r_id = htonl (rid);
1430 msg->gns_header.r_id = htonl (rid);
1432 msg->filter = htons ((uint16_t)
filter);
1452 "Sending ZONE_ITERATION_NEXT message with limit %llu\n",
1453 (
unsigned long long) limit);
1455 msg->gns_header.r_id = htonl (it->
op_id);
1478 msg->gns_header.r_id = htonl (it->
op_id);
1521 msg->gns_header.r_id = htonl (rid);
1522 msg->control = htons (ctrl);
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NAMESTORE_UNKNOWN
Unknown namestore error.
@ GNUNET_EC_NAMESTORE_NO_RESULTS
No results given.
@ GNUNET_EC_NONE
No error (success).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static void error_cb(void *cls)
Function called if lookup fails.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static char * pkey
Public key of the zone to look in, in ASCII.
static char * zone
Name of the zone being managed.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
static struct GNUNET_CONTAINER_BloomFilter * filter
Bloomfilter to quickly tell if we don't have the content.
API that can be used to store naming information on a GNUnet node;.
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.
#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.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
GNUNET_NETWORK_STRUCT_END ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
GNUNET_GNSRECORD_Filter
Filter for GNUNET_GNSRECORD_normalize_record_set().
@ GNUNET_GNSRECORD_FILTER_NONE
No filter flags set.
ssize_t GNUNET_IDENTITY_write_public_key_to_buffer(const struct GNUNET_IDENTITY_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PublicKey to a compact buffer.
ssize_t GNUNET_IDENTITY_public_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
ssize_t GNUNET_IDENTITY_write_private_key_to_buffer(const struct GNUNET_IDENTITY_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PrivateKey to a compact buffer.
ssize_t GNUNET_IDENTITY_private_key_get_length(const struct GNUNET_IDENTITY_PrivateKey *key)
Get the compacted length of a GNUNET_IDENTITY_PrivateKey.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_IDENTITY_PrivateKey *key, size_t *kb_read)
Reads a GNUNET_IDENTITY_PrivateKey from a compact buffer.
#define GNUNET_log(kind,...)
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#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.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#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.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
#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)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls, enum GNUNET_GNSRECORD_Filter filter)
Lookup an item in the namestore with GNSRECORD filter.
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, enum GNUNET_ErrorCode ec)
Continuation called to notify client about result of the operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_rollback(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Begin rollback all actions in a transaction.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, unsigned int rd_set_count, const struct GNUNET_NAMESTORE_RecordInfo *record_info, unsigned int *rds_sent, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store one or more record sets in the namestore.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_begin(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
New API draft.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void(* GNUNET_NAMESTORE_RecordSetMonitor)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry)
Process a record set that was stored in the namestore.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordSetMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls, enum GNUNET_GNSRECORD_Filter filter)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT).
GNUNET_NAMESTORE_TxControl
Transaction control types.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
void(* GNUNET_NAMESTORE_RecordMonitor)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Process a record that was stored in the namestore.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the NAMESTORE service.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_commit(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Commit a namestore transaction.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *zone, const struct GNUNET_IDENTITY_PublicKey *value_zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls)
Look for an existing PKEY delegation record for a given public key.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_edit(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
@ GNUNET_NAMESTORE_TX_COMMIT
@ GNUNET_NAMESTORE_TX_ROLLBACK
@ GNUNET_NAMESTORE_TX_BEGIN
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END
Service to client: end of list of results.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL_RESULT
Return status message for control message.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
Service to client: here is a (plaintext) record you requested.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
Service to client: result of zone-to-name lookup.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
Service to client: result of store operation.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
Client to service: next record(s) in iteration please.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
Client to service: please start iteration; receives "GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPON...
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
Client to service: stop iterating.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE
Service to client: lookup label.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
Client to service: store records (as authority)
#define GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL
Message type for Begin, Commit or Rollback.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
Client to service: "reverse" lookup for zone name based on zone key.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
Client to service: lookup label.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
#define MAX_NAME_LEN
Maximum length of any name, including 0-termination.
common internal definitions for namestore service
static void handle_zone_to_name_response(void *cls, const struct ZoneToNameResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE.
static int check_lookup_result(void *cls, const struct LabelLookupResponseMessage *msg)
Check validity of an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE.
static struct GNUNET_NAMESTORE_QueueEntry * find_qe(struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
Find the queue entry that matches the rid.
#define NAMESTORE_DELAY_TOLERANCE
We grant the namestore up to 1 minute of latency, if it is slower than that, store queries will fail.
static struct GNUNET_NAMESTORE_QueueEntry * records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls, int is_edit_request, enum GNUNET_GNSRECORD_Filter filter)
static void free_qe(struct GNUNET_NAMESTORE_QueueEntry *qe)
Free qe.
static void handle_record_store_response(void *cls, const struct RecordStoreResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE.
static void handle_tx_control_result(void *cls, const struct TxControlResultMessage *msg)
static void warn_delay(void *cls)
Task launched to warn the user that the namestore is excessively slow and that a query was thus dropp...
static int check_record_result(void *cls, const struct RecordResultMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT.
static void handle_record_result_end(void *cls, const struct GNUNET_NAMESTORE_Header *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END.
static void free_ze(struct GNUNET_NAMESTORE_ZoneIterator *ze)
Free ze.
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 int check_rd(size_t rd_len, const void *rd_buf, unsigned int rd_count)
Check that rd_buf of length rd_len contains rd_count records.
static int check_zone_to_name_response(void *cls, const struct ZoneToNameResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE.
static struct GNUNET_NAMESTORE_QueueEntry * send_transaction_control_msg(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls, enum GNUNET_NAMESTORE_TxControl ctrl)
New API draft.
static void handle_lookup_result(void *cls, const struct LabelLookupResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE.
static void reconnect(struct GNUNET_NAMESTORE_Handle *h)
Reconnect to namestore service.
static void force_reconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from service and then reconnect.
static struct GNUNET_NAMESTORE_ZoneIterator * find_zi(struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
Find the zone iteration entry that matches the rid.
static uint32_t get_op_id(struct GNUNET_NAMESTORE_Handle *h)
Get a fresh operation id to distinguish between namestore requests.
static void handle_record_result(void *cls, const struct RecordResultMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT.
static void reconnect_task(void *cls)
Re-establish the connection to the service.
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).
struct GNUNET_DATASTORE_Handle * h
Handle to the master context.
struct GNUNET_MQ_Envelope * env
Envelope of the request to transmit, NULL after transmission.
struct GNUNET_DATASTORE_QueueEntry * next
This is a linked list.
GNUNET_DATASTORE_ContinuationWithStatus cont
Function to call after transmission of the request.
void * cont_cls
Closure for cont.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Handle to a message queue.
Message handler for a specific message type.
Connection to the NAMESTORE service.
uint32_t last_op_id_used
The last operation id used for a NAMESTORE operation.
struct GNUNET_NAMESTORE_ZoneIterator * z_head
Head of pending namestore zone iterator entries.
struct GNUNET_NAMESTORE_QueueEntry * op_tail
Tail of pending namestore queue entries.
struct GNUNET_SCHEDULER_Task * reconnect_task
Reconnect task.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
struct GNUNET_NAMESTORE_QueueEntry * op_head
Head of pending namestore queue entries.
struct GNUNET_TIME_Relative reconnect_delay
Delay introduced before we reconnect.
struct GNUNET_NAMESTORE_ZoneIterator * z_tail
Tail of pending namestore zone iterator entries.
int reconnect
Should we reconnect to service due to some serious error?
struct GNUNET_MQ_Handle * mq
Connection to the service (if available).
An QueueEntry used to store information for a pending NAMESTORE record operation.
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
struct GNUNET_NAMESTORE_QueueEntry * prev
Kept in a DLL.
uint32_t op_id
The operation id this zone iteration operation has.
void * error_cb_cls
Closure for error_cb.
GNUNET_NAMESTORE_RecordMonitor proc
Function to call with the records we get back; or NULL.
struct GNUNET_NAMESTORE_QueueEntry * next
Kept in a DLL.
struct GNUNET_NAMESTORE_Handle * h
Main handle to access the namestore.
GNUNET_NAMESTORE_ContinuationWithStatus cont
Continuation to call.
GNUNET_NAMESTORE_RecordSetMonitor proc2
Function to call with the records we get back; or NULL.
struct GNUNET_SCHEDULER_Task * timeout_task
Task scheduled to warn us if the namestore is way too slow.
void * cont_cls
Closure for cont.
void * proc_cls
Closure for proc.
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
A struct for record bulk import.
struct GNUNET_GNSRECORD_Data * a_rd
Handle for a zone iterator operation.
void * finish_cb_cls
Closure for error_cb.
void * error_cb_cls
Closure for error_cb.
struct GNUNET_NAMESTORE_ZoneIterator * next
Kept in a DLL.
GNUNET_NAMESTORE_RecordSetMonitor proc2
The continuation to call with the results.
struct GNUNET_NAMESTORE_Handle * h
Main handle to access the namestore.
void * proc_cls
Closure for proc.
uint32_t op_id
The operation id this zone iteration operation has.
struct GNUNET_IDENTITY_PrivateKey zone
Private key of the zone.
GNUNET_NAMESTORE_RecordMonitor proc
The continuation to call with the results.
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
struct GNUNET_NAMESTORE_ZoneIterator * prev
Kept in a DLL.
Entry in list of pending tasks.
Time for relative time used by GNUnet, in microseconds.
uint16_t key_len
Length of the zone key.
uint16_t is_edit_request
GNUNET_YES if this lookup corresponds to an edit request.
uint16_t label_len
Length of the name.
Record is returned from the namestore (as authority).
uint16_t rd_len
Length of serialized record data.
uint16_t rd_count
Number of records contained.
uint16_t reserved
Reserved for alignment.
uint16_t name_len
Name length.
Store a record to the namestore (as authority).
uint16_t rd_set_count
Number of record sets.
Response to a record storage request.
Send a transaction control message.
Result of a transaction control message.
Ask for next result of zone iteration for the given operation.
Start a zone iteration for the given zone.
uint16_t key_len
Length of the zone key.
Stop zone iteration for the given operation.
Lookup a name for a zone hash.
uint16_t pkey_len
Length of the public value zone key.
uint16_t key_len
Length of the zone key.
Respone for zone to name lookup.