36#define LOG(kind, ...) GNUNET_log_from (kind, "namestore-api", __VA_ARGS__)
42#define NAMESTORE_DELAY_TOLERANCE GNUNET_TIME_UNIT_MINUTES
275 if (
qe->op_id == rid)
293 for (ze =
h->z_head; ze != NULL; ze = ze->
next)
294 if (ze->
op_id == rid)
313 if (NULL !=
qe->timeout_task)
378 "Received GENERIC_RESPONSE with result %s\n",
407 rd_len = ntohs (
msg->rd_len);
408 msg_len = ntohs (
msg->gns_header.header.
size);
409 name_len = ntohs (
msg->name_len);
410 key_len = ntohs (
msg->key_len);
411 exp_msg_len =
sizeof(*msg) + name_len + rd_len + key_len;
412 if (0 != ntohs (
msg->reserved))
417 if (msg_len != exp_msg_len)
422 name = (
const char *) &
msg[1] + key_len;
423 if ((name_len > 0) && (
'\0' !=
name[name_len - 1]))
430 if (0 != ntohs (
msg->rd_count))
461 int16_t found = (int16_t) ntohs (
msg->found);
468 rd_len = ntohs (
msg->rd_len);
470 name_len = ntohs (
msg->name_len);
471 key_len = ntohs (
msg->key_len);
478 name = (
const char *) &
msg[1] + key_len;
482 if (NULL !=
qe->proc)
483 qe->proc (
qe->proc_cls, &private_key,
name, 0, NULL);
489 if (NULL !=
qe->error_cb)
490 qe->error_cb (
qe->error_cb_cls);
495 rd_tmp = &
name[name_len];
504 if (NULL !=
qe->proc)
505 qe->proc (
qe->proc_cls,
527 const char *editor_hint;
529 size_t editor_hint_len;
533 rd_len = ntohs (
msg->rd_len);
534 msg_len = ntohs (
msg->gns_header.header.
size);
535 editor_hint_len = ntohs (
msg->editor_hint_len);
542 editor_hint = (
const char *) &
msg[1];
543 if ((0 == editor_hint_len) || (
'\0' != editor_hint[editor_hint_len - 1]))
548 return check_rd (rd_len, &editor_hint[editor_hint_len], ntohs (
566 const char *editor_hint;
569 size_t editor_hint_len;
573 rd_len = ntohs (
msg->rd_len);
575 editor_hint_len = ntohs (
msg->editor_hint_len);
579 editor_hint = (
const char *) &
msg[1];
580 rd_tmp = &editor_hint[editor_hint_len];
587 if (0 == editor_hint_len)
589 if (NULL !=
qe->edit_proc)
590 qe->edit_proc (
qe->proc_cls,
620 rd_len = ntohs (
msg->rd_len);
621 msg_len = ntohs (
msg->gns_header.header.
size);
622 key_len = ntohs (
msg->key_len);
623 name_len = ntohs (
msg->name_len);
630 name = (
const char *) &
msg[1] + key_len;
631 if ((0 == name_len) || (
'\0' !=
name[name_len - 1]))
668 rd_len = ntohs (
msg->rd_len);
670 name_len = ntohs (
msg->name_len);
671 key_len = ntohs (
msg->key_len);
674 if ((NULL == ze) && (NULL ==
qe))
676 if ((NULL != ze) && (NULL !=
qe))
682 name = (
const char *) &
msg[1] + key_len;
689 rd_tmp = &
name[name_len];
700 if (NULL !=
qe->proc)
701 qe->proc (
qe->proc_cls,
720 proc2 (proc_cls, &private_key,
name,
746 if ((NULL == ze) && (NULL ==
qe))
748 if ((NULL != ze) && (NULL !=
qe))
782 const char *name_tmp;
787 key_len = ntohs (
msg->key_len);
788 name_len = ntohs (
msg->name_len);
789 rd_ser_len = ntohs (
msg->rd_len);
790 if (ntohs (
msg->gns_header.header.
size) !=
797 name_tmp = (
const char *) &
msg[1] + key_len;
798 if ((name_len > 0) && (
'\0' != name_tmp[name_len - 1]))
803 return check_rd (rd_ser_len, &name_tmp[name_len], ntohs (
msg->rd_count));
825 const char *name_tmp;
835 "Response queue already gone...\n");
839 key_len = ntohs (
msg->key_len);
852 "Namestore has no result for zone to name mapping \n");
853 if (NULL !=
qe->proc)
854 qe->proc (
qe->proc_cls, &zone, NULL, 0, NULL);
860 "Namestore has result for zone to name mapping \n");
861 name_len = ntohs (
msg->name_len);
863 rd_ser_len = ntohs (
msg->rd_len);
864 name_tmp = (
const char *) &
msg[1] + key_len;
865 rd_tmp = &name_tmp[name_len];
875 if (NULL !=
qe->proc)
884 "An error occurred during zone to name operation: %s\n",
889 if (NULL !=
qe->error_cb)
890 qe->error_cb (
qe->error_cb_cls);
956 for (it =
h->z_head; NULL != it; it = it->
next)
997 while (NULL != (ze =
h->z_head))
1003 while (NULL != (
qe =
h->op_head))
1005 if (NULL !=
qe->error_cb)
1006 qe->error_cb (
qe->error_cb_cls);
1029 return h->last_op_id_used++;
1070 while (NULL != (
q =
h->op_head))
1076 while (NULL != (z =
h->z_head))
1106 qe->timeout_task = NULL;
1108 "Did not receive response from namestore after %s!\n",
1131 unsigned int rds_sent;
1144 unsigned int rd_set_count,
1146 unsigned int *rds_sent,
1157 ssize_t rd_ser_len[rd_set_count];
1164 size_t rd_set_len = 0;
1176 name_len = strlen (label) + 1;
1184 if (rd_ser_len[i] < 0)
1190 if (rd_ser_len[i] > max_len)
1196 if ((rd_set_len +
sizeof (
struct RecordSet) + name_len + rd_ser_len[i]) >
1203 "Sending %u of %u records!\n", *rds_sent, rd_set_count);
1213 key_len + rd_set_len,
1217 msg->gns_header.r_id = htonl (rid);
1218 msg->key_len = htons (key_len);
1220 msg->rd_set_count = htons ((uint16_t) (*rds_sent));
1224 rd_set = (
struct RecordSet*) (((
char*) &
msg[1]) + key_len);
1225 for (i = 0; i < *rds_sent; i++)
1232 rd_set->
rd_len = htons (rd_ser_len[i]);
1234 name_tmp = (
char *) &rd_set[1];
1238 rd, rd_ser_len[i], rd_ser);
1239 if ((0 > sret) || (sret != rd_ser_len[i]))
1249 "Sending NAMESTORE_RECORD_STORE message for name %u record sets\n",
1257 "Delaying NAMESTORE_RECORD_STORE message as namestore is not ready!\n");
1284 if (1 == (
label_len = strlen (label) + 1))
1293 qe->error_cb_cls = error_cb_cls;
1295 qe->proc_cls = rm_cls;
1303 msg->gns_header.r_id = htonl (
qe->op_id);
1376 qe->error_cb_cls = error_cb_cls;
1378 qe->proc_cls = proc_cls;
1386 msg->gns_header.r_id = htonl (rid);
1438 msg->gns_header.r_id = htonl (rid);
1488 msg->gns_header.r_id = htonl (rid);
1490 msg->filter = htons ((uint16_t)
filter);
1510 "Sending ZONE_ITERATION_NEXT message with limit %llu\n",
1511 (
unsigned long long) limit);
1513 msg->gns_header.r_id = htonl (it->
op_id);
1536 msg->gns_header.r_id = htonl (it->
op_id);
1565 const char *editor_hint,
1577 if (1 == (
label_len = strlen (label) + 1))
1586 qe->edit_proc = edit_cb;
1587 qe->proc_cls = edit_cb_cls;
1595 msg->gns_header.r_id = htonl (
qe->op_id);
1619 const char *editor_hint,
1620 const char *editor_hint_replacement,
1632 if (1 == (
label_len = strlen (label) + 1))
1653 msg->gns_header.r_id = htonl (
qe->op_id);
1666 editor_hint_replacement,
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static void error_cb(void *cls)
Function called if lookup fails.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void finished_cb(void *cls, enum GNUNET_GenericReturnValue rv)
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static char * pkey
Public key of the zone to look in, in ASCII.
static char * name
Name (label) of the records to list.
static unsigned int rd_count
Number of records for currently parsed set.
static char * res
Currently read line or NULL on EOF.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static struct GNUNET_NAMESTORE_RecordInfo * record_info
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.
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_NO_RESULTS
No results given.
@ GNUNET_EC_NONE
No error (success).
@ GNUNET_EC_NAMESTORE_UNKNOWN
Unknown namestore error.
API that can be used to store naming information on a GNUnet node;.
Constants for network protocols.
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.
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_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
#define GNUNET_log(kind,...)
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer(const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer.
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#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.
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, enum GNUNET_ErrorCode ec)
Continuation called to notify client about result of the operation.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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).
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void(* GNUNET_NAMESTORE_RecordMonitor)(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Process a record that was stored in the namestore.
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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *zone, const struct GNUNET_CRYPTO_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_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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)
void(* GNUNET_NAMESTORE_RecordSetMonitor)(void *cls, const struct GNUNET_CRYPTO_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_QueueEntry * GNUNET_NAMESTORE_record_set_edit_cancel(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, const char *editor_hint, const char *editor_hint_replacement, GNUNET_NAMESTORE_ContinuationWithStatus finished_cb, void *finished_cls)
If the current advisory lock is set to the provided editor hint, this API cancels the editing of a re...
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_edit_begin(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, const char *editor_hint, GNUNET_NAMESTORE_EditRecordSetBeginCallback edit_cb, void *edit_cb_cls)
New API draft.
void(* GNUNET_NAMESTORE_EditRecordSetBeginCallback)(void *cls, enum GNUNET_ErrorCode ec, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, const char *editor_hint)
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.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END
Service to client: end of list of results.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
Service to client: here is a (plaintext) record you requested.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT
Message type for start of record edit with advisory lock.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
Service to client: result of zone-to-name lookup.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_GENERIC_RESPONSE
Service to client: result of store operation.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT_CANCEL
Message type for cancellation/reset of editor hint/advisory lock.
#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_SET_EDIT_RESPONSE
Return record set to edit with previous editor hint/advisory lock.
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
Client to service: store records (as authority)
#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_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.
#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 int check_edit_record_set_response(void *cls, const struct EditRecordSetResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT_RESPONSE.
#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 void free_qe(struct GNUNET_NAMESTORE_QueueEntry *qe)
Free qe.
static void handle_edit_record_set_response(void *cls, const struct EditRecordSetResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT_RESPONSE.
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 struct GNUNET_NAMESTORE_QueueEntry * find_qe(struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
Find the queue entry that matches the rid.
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 void handle_generic_response(void *cls, const struct NamestoreResponseMessage *msg)
Handle an incoming message of type GNUNET_MESSAGE_TYPE_NAMESTORE_GENERIC_RESPONSE.
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 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 struct GNUNET_NAMESTORE_QueueEntry * records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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)
static void reconnect_task(void *cls)
Re-establish the connection to the service.
static struct GNUNET_NAMESTORE_ZoneIterator * find_zi(struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
Find the zone iteration entry that matches the rid.
Edit a record set and set editor hint/advisory lock.
uint16_t editor_hint_replacement_len
Unused.
uint16_t editor_hint_len
Unused.
uint16_t label_len
Length of the name.
uint16_t key_len
Length of the zone key.
Edit a record set and set editor hint/advisory lock.
uint16_t editor_hint_len
Unused.
uint16_t label_len
Length of the name.
uint16_t key_len
Length of the zone key.
Response to RecordSetEditMessage.
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).
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
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.
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.
GNUNET_NAMESTORE_EditRecordSetBeginCallback edit_proc
Function to call with the records we get back including optional editor hint.
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_CRYPTO_PrivateKey zone
Private key of the zone.
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.
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 label_len
Length of the name.
Response to a record storage request.
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.
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.
Response for zone to name lookup.