GNUnet  0.11.x
Typedefs | Functions
Name Store service

Store naming information on a GNUnet node. More...

Typedefs

typedef void(* GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, int32_t success, const char *emsg)
 Continuation called to notify client about result of the operation. More...
 
typedef 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. More...
 

Functions

struct GNUNET_NAMESTORE_HandleGNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the namestore service. More...
 
void GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h)
 Disconnect from the namestore service (and free associated resources). More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_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. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_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, int is_zonemaster, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
 Store an item in the namestore. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_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. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_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. More...
 
void GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe)
 Cancel a namestore operation. More...
 
struct GNUNET_NAMESTORE_ZoneIteratorGNUNET_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)
 Starts a new zone iteration (used to periodically PUT all of our records into our DHT). More...
 
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. More...
 
void GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it)
 Stops iteration and releases the namestore handle for further calls. More...
 
struct GNUNET_NAMESTORE_ZoneMonitorGNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_IDENTITY_PrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls)
 Begin monitoring a zone for changes. More...
 
void GNUNET_NAMESTORE_zone_monitor_next (struct GNUNET_NAMESTORE_ZoneMonitor *zm, uint64_t limit)
 Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s). More...
 
void GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm)
 Stop monitoring a zone for changes. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_NAMESTORE_transaction_begin (struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
 New API draft. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_NAMESTORE_transaction_abort (struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
 Begin rollback all actions in a transaction. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_NAMESTORE_transaction_commit (struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
 Commit a namestore transaction. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_NAMESTORE_records_select (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. More...
 
struct GNUNET_NAMESTORE_QueueEntryGNUNET_NAMESTORE_records_replace (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)
 Creates, deletes or updates an item in the namestore. More...
 

Detailed Description

Store naming information on a GNUnet node.

Naming information can either be records for which this peer/user is authoritative, or blocks which are cached, encrypted naming data from other peers.

See also
Documentation

Typedef Documentation

◆ GNUNET_NAMESTORE_ContinuationWithStatus

typedef void(* GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, int32_t success, const char *emsg)

Continuation called to notify client about result of the operation.

Parameters
clsclosure
successGNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) GNUNET_NO if content was already there or not found GNUNET_YES (or other positive value) on success
emsgNULL on success, otherwise an error message

Definition at line 102 of file gnunet_namestore_service.h.

◆ GNUNET_NAMESTORE_RecordMonitor

typedef 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.

Parameters
clsclosure
zoneprivate key of the zone
labellabel of the records
rd_countnumber of entries in rd array, 0 if label was deleted
rdarray of records with data to store

Definition at line 180 of file gnunet_namestore_service.h.

Function Documentation

◆ GNUNET_NAMESTORE_connect()

struct GNUNET_NAMESTORE_Handle* GNUNET_NAMESTORE_connect ( const struct GNUNET_CONFIGURATION_Handle cfg)

Connect to the namestore service.

Parameters
cfgconfiguration to use
Returns
handle to use to access the service

Connect to the namestore service.

Parameters
cfgconfiguration to use
Returns
handle to the GNS service, or NULL on error

Definition at line 937 of file namestore_api.c.

938 {
939  struct GNUNET_NAMESTORE_Handle *h;
940 
942  h->cfg = cfg;
943  reconnect (h);
944  if (NULL == h->mq)
945  {
946  GNUNET_free (h);
947  return NULL;
948  }
949  return h;
950 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static void reconnect(struct GNUNET_NAMESTORE_Handle *h)
Reconnect to namestore service.
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Connection to the NAMESTORE service.

References cfg, GNUNET_ARM_Handle::cfg, GNUNET_free, GNUNET_new, h, GNUNET_ARM_Handle::mq, and reconnect().

Referenced by GNUNET_CONVERSATION_phone_create(), libgnunet_plugin_rest_namestore_init(), RECLAIM_TICKETS_init(), run(), run_service(), run_with_zone_pkey(), and store_cb().

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

◆ GNUNET_NAMESTORE_disconnect()

void GNUNET_NAMESTORE_disconnect ( struct GNUNET_NAMESTORE_Handle h)

Disconnect from the namestore service (and free associated resources).

Must not be called from within operation callbacks of the API.

Parameters
hhandle to the namestore
hhandle to the namestore

Definition at line 960 of file namestore_api.c.

961 {
964 
965  LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
966  GNUNET_break (NULL == h->op_head);
967  while (NULL != (q = h->op_head))
968  {
969  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, q);
970  GNUNET_free (q);
971  }
972  GNUNET_break (NULL == h->z_head);
973  while (NULL != (z = h->z_head))
974  {
975  GNUNET_CONTAINER_DLL_remove (h->z_head, h->z_tail, z);
976  GNUNET_free (z);
977  }
978  if (NULL != h->mq)
979  {
981  h->mq = NULL;
982  }
983  if (NULL != h->reconnect_task)
984  {
986  h->reconnect_task = NULL;
987  }
988  GNUNET_free (h);
989 }
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:685
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
#define LOG(kind,...)
Definition: namestore_api.c:41
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:54
Handle for a zone iterator operation.

References GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, LOG, GNUNET_ARM_Handle::mq, q, and GNUNET_ARM_Handle::reconnect_task.

Referenced by cleanup(), do_shutdown(), GNUNET_CONVERSATION_phone_destroy(), libgnunet_plugin_rest_namestore_done(), RECLAIM_TICKETS_deinit(), and shutdown_task().

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

◆ GNUNET_NAMESTORE_records_store()

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.

If the item is already present, it is replaced with the new record. Use an empty array to remove all records under the given name.

The continuation is called after the value has been stored in the database. Monitors may be notified asynchronously (basically with a buffer). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up.

Parameters
hhandle to the namestore
pkeyprivate key of the zone
labelname that is being mapped
rd_countnumber of records in the 'rd' array
rdarray of records with data to store
contcontinuation to call when done
cont_clsclosure for cont
Returns
handle to abort the request

Definition at line 1018 of file namestore_api.c.

1026 {
1028  struct GNUNET_MQ_Envelope *env;
1029  char *name_tmp;
1030  char *rd_ser;
1031  ssize_t rd_ser_len;
1032  size_t name_len;
1033  uint32_t rid;
1034  struct RecordStoreMessage *msg;
1035  ssize_t sret;
1036 
1037  name_len = strlen (label) + 1;
1038  if (name_len > MAX_NAME_LEN)
1039  {
1040  GNUNET_break (0);
1041  return NULL;
1042  }
1043  rd_ser_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1044  if (rd_ser_len < 0)
1045  {
1046  GNUNET_break (0);
1047  return NULL;
1048  }
1049  if (rd_ser_len > UINT16_MAX)
1050  {
1051  GNUNET_break (0);
1052  return NULL;
1053  }
1054  rid = get_op_id (h);
1056  qe->h = h;
1057  qe->cont = cont;
1058  qe->cont_cls = cont_cls;
1059  qe->op_id = rid;
1060  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1061 
1062  /* setup msg */
1064  name_len + rd_ser_len,
1066  msg->gns_header.r_id = htonl (rid);
1067  msg->name_len = htons (name_len);
1068  msg->rd_count = htons (rd_count);
1069  msg->rd_len = htons (rd_ser_len);
1070  msg->reserved = ntohs (0);
1071  msg->private_key = *pkey;
1072 
1073  name_tmp = (char *) &msg[1];
1074  GNUNET_memcpy (name_tmp, label, name_len);
1075  rd_ser = &name_tmp[name_len];
1076  sret = GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_ser);
1077  if ((0 > sret) || (sret != rd_ser_len))
1078  {
1079  GNUNET_break (0);
1080  GNUNET_free (env);
1081  return NULL;
1082  }
1083  GNUNET_assert (rd_ser_len == sret);
1085  "Sending NAMESTORE_RECORD_STORE message for name `%s' with %u records\n",
1086  label,
1087  rd_count);
1088  qe->timeout_task =
1090  if (NULL == h->mq)
1091  {
1092  qe->env = env;
1094  "Delaying NAMESTORE_RECORD_STORE message as namestore is not ready!\n");
1095  }
1096  else
1097  {
1098  GNUNET_MQ_send (h->mq, env);
1099  }
1100  return qe;
1101 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static char * pkey
Public key of the zone to look in, in ASCII.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
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.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_WARNING
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:302
#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
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
Client to service: store records (as authority)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1269
#define MAX_NAME_LEN
Maximum length of any name, including 0-termination.
Definition: namecache.h:33
#define NAMESTORE_DELAY_TOLERANCE
We grant the namestore up to 1 minute of latency, if it is slower than that, store queries will fail.
Definition: namestore_api.c:47
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 uint32_t get_op_id(struct GNUNET_NAMESTORE_Handle *h)
Get a fresh operation id to distinguish between namestore requests.
struct GNUNET_DATASTORE_Handle * h
Handle to the master context.
struct GNUNET_MQ_Envelope * env
Envelope of the request to transmit, NULL after transmission.
GNUNET_DATASTORE_ContinuationWithStatus cont
Function to call after transmission of the request.
void * cont_cls
Closure for cont.
Store a record to the namestore (as authority).
Definition: namestore.h:59
uint16_t rd_count
Number of records contained.
Definition: namestore.h:83
uint16_t name_len
Name length.
Definition: namestore.h:73

References GNUNET_DATASTORE_QueueEntry::cont, GNUNET_DATASTORE_QueueEntry::cont_cls, env, GNUNET_DATASTORE_QueueEntry::env, get_op_id(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_SCHEDULER_add_delayed(), h, GNUNET_DATASTORE_QueueEntry::h, LOG, MAX_NAME_LEN, GNUNET_ARM_Handle::mq, msg, RecordStoreMessage::name_len, NAMESTORE_DELAY_TOLERANCE, pkey, qe, RecordStoreMessage::rd_count, and warn_delay().

Referenced by attr_store_task(), create_did_store(), cred_add_cb(), del_monitor(), get_existing_record(), GNUNET_NAMESTORE_records_replace(), handle_attribute_delete_message(), handle_credential_delete_message(), issue_ticket(), move_attr_finished(), namestore_delete(), ns_lookup_cb(), process_result(), process_tickets(), purge_attributes(), register_do_cb(), remove_did_document_ego_lookup_cb(), revoke_attrs_cb(), run_with_zone_pkey(), rvk_move_attr_cb(), and update_tickets().

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

◆ GNUNET_NAMESTORE_records_store_()

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,
int  is_zonemaster,
GNUNET_NAMESTORE_ContinuationWithStatus  cont,
void *  cont_cls 
)

Store an item in the namestore.

If the item is already present, it is replaced with the new record. Use an empty array to remove all records under the given name.

The continuation is called after the value has been stored in the database. Monitors may be notified asynchronously (basically with a buffer). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up.

Parameters
hhandle to the namestore
pkeyprivate key of the zone
labelname that is being mapped
rd_countnumber of records in the 'rd' array
rdarray of records with data to store
is_zonemasterupdate tombstones, do not process monitors
contcontinuation to call when done
cont_clsclosure for cont
Returns
handle to abort the request

◆ GNUNET_NAMESTORE_records_lookup()

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.

Parameters
hhandle to the namestore
pkeyprivate key of the zone
labelname that is being mapped
error_cbfunction to call on error (i.e. disconnect) the handle is afterwards invalid
error_cb_clsclosure for error_cb
rmfunction to call with the result (with 0 records if we don't have that label); the handle is afterwards invalid
rm_clsclosure for rm
Returns
handle to abort the request

Definition at line 1121 of file namestore_api.c.

1129 {
1131  struct GNUNET_MQ_Envelope *env;
1132  struct LabelLookupMessage *msg;
1133  size_t label_len;
1134 
1135  if (1 == (label_len = strlen (label) + 1))
1136  {
1137  GNUNET_break (0);
1138  return NULL;
1139  }
1140 
1142  qe->h = h;
1143  qe->error_cb = error_cb;
1144  qe->error_cb_cls = error_cb_cls;
1145  qe->proc = rm;
1146  qe->proc_cls = rm_cls;
1147  qe->op_id = get_op_id (h);
1148  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1149 
1151  label_len,
1153  msg->gns_header.r_id = htonl (qe->op_id);
1154  msg->zone = *pkey;
1155  msg->label_len = htonl (label_len);
1156  GNUNET_memcpy (&msg[1], label, label_len);
1157  if (NULL == h->mq)
1158  qe->env = env;
1159  else
1160  GNUNET_MQ_send (h->mq, env);
1161  return qe;
1162 }
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:479
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
Client to service: lookup label.
Lookup a label.
Definition: namestore.h:137
uint32_t label_len
Length of the name.
Definition: namestore.h:146

References env, GNUNET_DATASTORE_QueueEntry::env, error_cb(), get_op_id(), GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_DATASTORE_QueueEntry::h, LabelLookupMessage::label_len, GNUNET_ARM_Handle::mq, msg, pkey, and qe.

Referenced by create_response(), cred_store_task(), GNUNET_NAMESTORE_records_select(), handle_collect(), move_attrs(), namestore_add_or_update(), namestore_get(), RECLAIM_TICKETS_revoke(), run_with_zone_pkey(), and store_cb().

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

◆ GNUNET_NAMESTORE_zone_to_name()

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.

Returns at most one result to the processor.

Parameters
hhandle to the namestore
zoneprivate key of the zone to look up in, never NULL
value_zonepublic key of the target zone (value), never NULL
error_cbfunction to call on error (i.e. disconnect) the handle is afterwards invalid
error_cb_clsclosure for error_cb
procfunction to call on the matching records, or with NULL (rd_count == 0) if there are no matching records; the handle is afterwards invalid
proc_clsclosure for proc
Returns
a handle that can be used to cancel

Definition at line 1184 of file namestore_api.c.

1192 {
1194  struct GNUNET_MQ_Envelope *env;
1195  struct ZoneToNameMessage *msg;
1196  uint32_t rid;
1197 
1198  rid = get_op_id (h);
1200  qe->h = h;
1201  qe->error_cb = error_cb;
1202  qe->error_cb_cls = error_cb_cls;
1203  qe->proc = proc;
1204  qe->proc_cls = proc_cls;
1205  qe->op_id = rid;
1206  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1207 
1209  msg->gns_header.r_id = htonl (rid);
1210  msg->zone = *zone;
1211  msg->value_zone = *value_zone;
1212  if (NULL == h->mq)
1213  qe->env = env;
1214  else
1215  GNUNET_MQ_send (h->mq, env);
1216  return qe;
1217 }
static char * zone
Name of the zone being managed.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
Client to service: "reverse" lookup for zone name based on zone key.
Lookup a name for a zone hash.
Definition: namestore.h:206
struct GNUNET_IDENTITY_PublicKey value_zone
The public key of the target zone.
Definition: namestore.h:220

References env, GNUNET_DATASTORE_QueueEntry::env, error_cb(), get_op_id(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_DATASTORE_QueueEntry::h, GNUNET_ARM_Handle::mq, msg, qe, ZoneToNameMessage::value_zone, and zone.

Referenced by iterate_done_cb(), and run_with_zone_pkey().

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

◆ GNUNET_NAMESTORE_cancel()

void GNUNET_NAMESTORE_cancel ( struct GNUNET_NAMESTORE_QueueEntry qe)

Cancel a namestore operation.

The final callback from the operation must not have been done yet. Must be called on any namestore operation that has not yet completed prior to calling GNUNET_NAMESTORE_disconnect.

Parameters
qeoperation to cancel

The final callback from the operation must not have been done yet.

Parameters
qeoperation to cancel

Definition at line 1338 of file namestore_api.c.

1339 {
1340  free_qe (qe);
1341 }
static void free_qe(struct GNUNET_NAMESTORE_QueueEntry *qe)
Free qe.

References free_qe(), and qe.

Referenced by cleanup_adh(), cleanup_as_handle(), cleanup_handle(), cleanup_issue_handle(), cleanup_rvk(), completed_cb(), do_shutdown(), and warn_delay().

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

◆ GNUNET_NAMESTORE_zone_iteration_start()

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 
)

Starts a new zone iteration (used to periodically PUT all of our records into our DHT).

This MUST lock the struct GNUNET_NAMESTORE_Handle for any other calls than GNUNET_NAMESTORE_zone_iterator_next() and GNUNET_NAMESTORE_zone_iteration_stop. proc will be called once immediately, and then again after GNUNET_NAMESTORE_zone_iterator_next() is invoked.

On error (disconnect), error_cb will be invoked. On normal completion, finish_cb proc will be invoked.

Parameters
hhandle to the namestore
zonezone to access, NULL for all zones
error_cbfunction to call on error (i.e. disconnect), the handle is afterwards invalid
error_cb_clsclosure for error_cb
procfunction to call on each name from the zone; it will be called repeatedly with a value (if available)
proc_clsclosure for proc
finish_cbfunction to call on completion the handle is afterwards invalid
finish_cb_clsclosure for finish_cb
Returns
an iterator handle to use for iteration

This MUST lock the struct GNUNET_NAMESTORE_Handle for any other calls than GNUNET_NAMESTORE_zone_iterator_next and GNUNET_NAMESTORE_zone_iteration_stop. proc will be called once immediately, and then again after GNUNET_NAMESTORE_zone_iterator_next is invoked.

Parameters
hhandle to the namestore
zonezone to access, NULL for all zones
error_cbfunction to call on error (i.e. disconnect)
error_cb_clsclosure for error_cb
procfunction to call on each name from the zone; it will be called repeatedly with a value (if available)
proc_clsclosure for proc
finish_cbfunction to call on completion
finish_cb_clsclosure for finish_cb
Returns
an iterator handle to use for iteration

Definition at line 1240 of file namestore_api.c.

1249 {
1250  struct GNUNET_NAMESTORE_ZoneIterator *it;
1251  struct GNUNET_MQ_Envelope *env;
1253  uint32_t rid;
1254 
1255  LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ZONE_ITERATION_START message\n");
1256  rid = get_op_id (h);
1258  it->h = h;
1259  it->error_cb = error_cb;
1260  it->error_cb_cls = error_cb_cls;
1261  it->finish_cb = finish_cb;
1262  it->finish_cb_cls = finish_cb_cls;
1263  it->proc = proc;
1264  it->proc_cls = proc_cls;
1265  it->op_id = rid;
1266  if (NULL != zone)
1267  it->zone = *zone;
1268  GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it);
1270  msg->gns_header.r_id = htonl (rid);
1271  if (NULL != zone)
1272  msg->zone = *zone;
1273  if (NULL == h->mq)
1274  it->env = env;
1275  else
1276  GNUNET_MQ_send (h->mq, env);
1277  return it;
1278 }
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
Client to service: please start iteration; receives "GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPON...
void * finish_cb_cls
Closure for error_cb.
void * error_cb_cls
Closure for error_cb.
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.
Start a zone iteration for the given zone.
Definition: namestore.h:360

References env, GNUNET_NAMESTORE_ZoneIterator::env, error_cb(), GNUNET_NAMESTORE_ZoneIterator::error_cb, GNUNET_NAMESTORE_ZoneIterator::error_cb_cls, GNUNET_NAMESTORE_ZoneIterator::finish_cb, GNUNET_NAMESTORE_ZoneIterator::finish_cb_cls, get_op_id(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_NAMESTORE_ZoneIterator::h, LOG, GNUNET_ARM_Handle::mq, msg, GNUNET_NAMESTORE_ZoneIterator::op_id, GNUNET_NAMESTORE_ZoneIterator::proc, GNUNET_NAMESTORE_ZoneIterator::proc_cls, zone, and GNUNET_NAMESTORE_ZoneIterator::zone.

Referenced by create_response(), get_ego(), handle_credential_iteration_start(), handle_iteration_start(), iterate_zones(), move_attrs(), namestore_get(), publish_zone_dht_start(), RECLAIM_TICKETS_issue(), RECLAIM_TICKETS_iteration_start(), run_with_zone_pkey(), and start_consistency_update().

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

◆ GNUNET_NAMESTORE_zone_iterator_next()

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.

Parameters
itthe iterator
limitnumber of records to return to the iterator in one shot (before GNUNET_NAMESTORE_zone_iterator_next is to be called again)

Definition at line 1290 of file namestore_api.c.

1292 {
1293  struct GNUNET_NAMESTORE_Handle *h = it->h;
1294  struct ZoneIterationNextMessage *msg;
1295  struct GNUNET_MQ_Envelope *env;
1296 
1298  "Sending ZONE_ITERATION_NEXT message with limit %llu\n",
1299  (unsigned long long) limit);
1301  msg->gns_header.r_id = htonl (it->op_id);
1302  msg->limit = GNUNET_htonll (limit);
1303  GNUNET_MQ_send (h->mq, env);
1304 }
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:36
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
Client to service: next record(s) in iteration please.
Ask for next result of zone iteration for the given operation.
Definition: namestore.h:377

References env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_NAMESTORE_ZoneIterator::h, LOG, GNUNET_ARM_Handle::mq, msg, and GNUNET_NAMESTORE_ZoneIterator::op_id.

Referenced by attr_iter_cb(), collect_tickets_cb(), consistency_iter(), cred_iter_cb(), display_record(), display_record_iterator(), filter_tickets_cb(), handle_credential_iteration_next(), handle_iteration_next(), iterate_do_cb(), namestore_list_iteration(), ns_lookup_result_cb(), publish_zone_namestore_next(), RECLAIM_TICKETS_iteration_next(), rvk_ticket_update(), and zone_iterator().

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

◆ GNUNET_NAMESTORE_zone_iteration_stop()

void GNUNET_NAMESTORE_zone_iteration_stop ( struct GNUNET_NAMESTORE_ZoneIterator it)

Stops iteration and releases the namestore handle for further calls.

Must be called on any iteration that has not yet completed prior to calling GNUNET_NAMESTORE_disconnect.

Parameters
itthe iterator
itthe iterator

Definition at line 1313 of file namestore_api.c.

1314 {
1315  struct GNUNET_NAMESTORE_Handle *h = it->h;
1316  struct GNUNET_MQ_Envelope *env;
1317  struct ZoneIterationStopMessage *msg;
1318 
1319  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ZONE_ITERATION_STOP message\n");
1320  if (NULL != h->mq)
1321  {
1322  env =
1324  msg->gns_header.r_id = htonl (it->op_id);
1325  GNUNET_MQ_send (h->mq, env);
1326  }
1327  free_ze (it);
1328 }
#define GNUNET_log(kind,...)
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
Client to service: stop iterating.
static void free_ze(struct GNUNET_NAMESTORE_ZoneIterator *ze)
Free ze.
Stop zone iteration for the given operation.
Definition: namestore.h:396

References env, free_ze(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_NAMESTORE_ZoneIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_NAMESTORE_ZoneIterator::op_id.

Referenced by cleanup_adh(), cleanup_handle(), cleanup_iter(), cleanup_rvk(), completed_cb(), do_shutdown(), filter_tickets_cb(), iterate_do_cb(), RECLAIM_TICKETS_iteration_stop(), and shutdown_task().

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

◆ GNUNET_NAMESTORE_zone_monitor_start()

struct GNUNET_NAMESTORE_ZoneMonitor* GNUNET_NAMESTORE_zone_monitor_start ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_IDENTITY_PrivateKey zone,
int  iterate_first,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls,
GNUNET_NAMESTORE_RecordMonitor  monitor,
void *  monitor_cls,
GNUNET_SCHEDULER_TaskCallback  sync_cb,
void *  sync_cb_cls 
)

Begin monitoring a zone for changes.

Will first call the monitor function on all existing records in the selected zone(s) if iterate_first is GNUNET_YES. In any case, we will then call sync_cb, and then afterwards call the monitor whenever a record changes. If the namestore disconnects, the error_cb function is called with a disconnect event. Once the connection is re-established, the process begins from the start (depending on iterate_first, we will again first do all existing records, then sync, then updates).

Parameters
cfgconfiguration to use to connect to namestore
zonezone to monitor, NULL for all zones
iterate_firstGNUNET_YES to first iterate over all existing records, GNUNET_NO to only return changes that happen from now on
error_cbfunction to call on error (i.e. disconnect); note that unlike the other error callbacks in this API, a call to this function does NOT destroy the monitor handle, it merely signals that monitoring is down. You need to still explicitly call GNUNET_NAMESTORE_zone_monitor_stop().
error_cb_clsclosure for error_cb
monitorfunction to call on zone changes, with an initial limit of 1
monitor_clsclosure for monitor
sync_cbfunction called when we're in sync with the namestore
sync_cb_clsclosure for sync_cb
Returns
handle to stop monitoring

If iterate_first is set, we Will first call the monitor function on all existing records in the selected zone(s). In any case, we will call sync and afterwards call monitor whenever a record changes.

Parameters
cfgconfiguration to use to connect to namestore
zonezone to monitor
iterate_firstGNUNET_YES to first iterate over all existing records, GNUNET_NO to only return changes that happen from now on
error_cbfunction to call on error (i.e. disconnect); note that unlike the other error callbacks in this API, a call to this function does NOT destroy the monitor handle, it merely signals that monitoring is down. You need to still explicitly call GNUNET_NAMESTORE_zone_monitor_stop().
error_cb_clsclosure for error_cb
monitorfunction to call on zone changes
monitor_clsclosure for monitor
sync_cbfunction called when we're in sync with the namestore
clsclosure for sync_cb
Returns
handle to stop monitoring

Definition at line 303 of file namestore_api_monitor.c.

313 {
315 
317  if (NULL != zone)
318  zm->zone = *zone;
320  zm->error_cb = error_cb;
322  zm->monitor = monitor;
324  zm->sync_cb = sync_cb;
326  zm->cfg = cfg;
327  reconnect (zm);
328  if (NULL == zm->mq)
329  {
330  GNUNET_free (zm);
331  return NULL;
332  }
333  return zm;
334 }
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:64
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
static struct GNUNET_NAMESTORE_ZoneMonitor * zm
Monitor handle.
static void reconnect(struct GNUNET_NAMESTORE_ZoneMonitor *zm)
Reconnect to the namestore service.
Handle for a monitoring activity.
GNUNET_SCHEDULER_TaskCallback sync_cb
Function called when we've synchronized.
void * monitor_cls
Closure for monitor.
void * sync_cb_cls
Closure for sync_cb.
struct GNUNET_IDENTITY_PrivateKey zone
Monitored zone.
struct GNUNET_MQ_Handle * mq
Handle to namestore service.
GNUNET_NAMESTORE_RecordMonitor monitor
Function to call on events.
void * error_cb_cls
Closure for error_cb.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration (to reconnect).
int iterate_first
Do we first iterate over all existing records?
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.

References cfg, GNUNET_NAMESTORE_ZoneMonitor::cfg, error_cb(), GNUNET_NAMESTORE_ZoneMonitor::error_cb, GNUNET_NAMESTORE_ZoneMonitor::error_cb_cls, GNUNET_free, GNUNET_new, GNUNET_NAMESTORE_ZoneMonitor::iterate_first, monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor_cls, GNUNET_NAMESTORE_ZoneMonitor::mq, reconnect(), sync_cb(), GNUNET_NAMESTORE_ZoneMonitor::sync_cb, GNUNET_NAMESTORE_ZoneMonitor::sync_cb_cls, zm, zone, and GNUNET_NAMESTORE_ZoneMonitor::zone.

Referenced by run(), and run_with_zone_pkey().

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

◆ GNUNET_NAMESTORE_zone_monitor_next()

void GNUNET_NAMESTORE_zone_monitor_next ( struct GNUNET_NAMESTORE_ZoneMonitor zm,
uint64_t  limit 
)

Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s).

This function is used to allow clients that merely monitor the NAMESTORE to still throttle namestore operations, so we can be sure that the monitors can keep up.

Note that GNUNET_NAMESTORE_records_store() only waits for this call if the previous limit set by the client was already reached. Thus, by using a limit greater than 1, monitors basically enable a queue of notifications to be processed asynchronously with some delay. Note that even with a limit of 1 the GNUNET_NAMESTORE_records_store() function will run asynchronously and the continuation may be invoked before the monitors completed (or even started) processing the notification. Thus, monitors will only closely track the current state of the namestore, but not be involved in the transactions.

Parameters
zmthe monitor
limitnumber of records to return to the iterator in one shot (before GNUNET_NAMESTORE_zone_monitor_next is to be called again)

Definition at line 359 of file namestore_api_monitor.c.

361 {
362  struct GNUNET_MQ_Envelope *env;
363  struct ZoneMonitorNextMessage *nm;
364 
366  nm->limit = GNUNET_htonll (limit);
367  GNUNET_MQ_send (zm->mq, env);
368 }
#define GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT
Client to service: I am now ready for the next (set of) monitor events.
Ask for next result of zone iteration for the given operation.
Definition: namestore.h:336
uint64_t limit
Number of records to return to the iterator in one shot (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_M...
Definition: namestore.h:352

References env, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), ZoneMonitorNextMessage::limit, GNUNET_NAMESTORE_ZoneMonitor::mq, and zm.

Referenced by dht_put_monitor_continuation(), display_record_monitor(), handle_monitor_event(), and run().

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

◆ GNUNET_NAMESTORE_zone_monitor_stop()

void GNUNET_NAMESTORE_zone_monitor_stop ( struct GNUNET_NAMESTORE_ZoneMonitor zm)

Stop monitoring a zone for changes.

Parameters
zmhandle to the monitor activity to stop

Definition at line 377 of file namestore_api_monitor.c.

378 {
379  if (NULL != zm->mq)
380  {
382  zm->mq = NULL;
383  }
384  GNUNET_free (zm);
385 }

References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_NAMESTORE_ZoneMonitor::mq, and zm.

Referenced by do_shutdown(), and shutdown_task().

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

◆ GNUNET_NAMESTORE_transaction_begin()

struct GNUNET_NAMESTORE_QueueEntry* GNUNET_NAMESTORE_transaction_begin ( struct GNUNET_NAMESTORE_Handle h,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls 
)

New API draft.

Experimental Begin a namestore transaction.

Parameters
hhandle to the namestore
error_cbfunction to call on error (i.e. disconnect or unable to get lock) the handle is afterwards invalid
error_cb_clsclosure for error_cb
Returns
handle to abort the request

Experimental

Definition at line 1348 of file namestore_api.c.

1351 {
1352  GNUNET_break (0);
1353  return NULL;
1354 }

References GNUNET_break.

◆ GNUNET_NAMESTORE_transaction_abort()

struct GNUNET_NAMESTORE_QueueEntry* GNUNET_NAMESTORE_transaction_abort ( struct GNUNET_NAMESTORE_Handle h,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls 
)

Begin rollback all actions in a transaction.

Reverts all actions performed since GNUNET_NAMESTORE_transaction_begin

Parameters
hhandle to the namestore
error_cbfunction to call on error (i.e. disconnect or unable to get lock) the handle is afterwards invalid
error_cb_clsclosure for error_cb
Returns
handle to abort the request

Definition at line 1358 of file namestore_api.c.

1361 {
1362  GNUNET_break (0);
1363  return NULL;
1364 }

References GNUNET_break.

◆ GNUNET_NAMESTORE_transaction_commit()

struct GNUNET_NAMESTORE_QueueEntry* GNUNET_NAMESTORE_transaction_commit ( struct GNUNET_NAMESTORE_Handle h,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls 
)

Commit a namestore transaction.

Saves all actions performed since GNUNET_NAMESTORE_transaction_begin

Parameters
hhandle to the namestore
error_cbfunction to call on error (i.e. disconnect or unable to get lock) the handle is afterwards invalid
error_cb_clsclosure for error_cb
Returns
handle to abort the request

Definition at line 1378 of file namestore_api.c.

1381 {
1382  GNUNET_break (0);
1383  return NULL;
1384 }

References GNUNET_break.

◆ GNUNET_NAMESTORE_records_select()

struct GNUNET_NAMESTORE_QueueEntry* GNUNET_NAMESTORE_records_select ( 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.

Parameters
hhandle to the namestore
pkeyprivate key of the zone
labelname that is being mapped
error_cbfunction to call on error (i.e. disconnect) the handle is afterwards invalid
error_cb_clsclosure for error_cb
rmfunction to call with the result (with 0 records if we don't have that label); the handle is afterwards invalid
rm_clsclosure for rm
Returns
handle to abort the request

Lookup an item in the namestore.

Will replace old API above.

Definition at line 1169 of file namestore_api.c.

1177 {
1178  return GNUNET_NAMESTORE_records_lookup (h, pkey, label,
1179  error_cb, error_cb_cls,
1180  rm, rm_cls);
1181 }
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.

References error_cb(), GNUNET_NAMESTORE_QueueEntry::error_cb_cls, GNUNET_NAMESTORE_records_lookup(), h, and pkey.

Here is the call graph for this function:

◆ GNUNET_NAMESTORE_records_replace()

struct GNUNET_NAMESTORE_QueueEntry* GNUNET_NAMESTORE_records_replace ( 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 
)

Creates, deletes or updates an item in the namestore.

If the item is already present, it is replaced with the new record set. Use an empty array to remove all records under the given name.

The continuation is called after the value has been stored in the database. Monitors may be notified asynchronously (basically with a buffer). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up.

Parameters
hhandle to the namestore
pkeyprivate key of the zone
labelname that is being mapped
rd_countnumber of records in the 'rd' array
rdarray of records with data to store
contcontinuation to call when done
cont_clsclosure for cont
Returns
handle to abort the request

Creates, deletes or updates an item in the namestore.

Definition at line 1107 of file namestore_api.c.

1115 {
1116  return GNUNET_NAMESTORE_records_store (h, pkey, label, rd_count, rd,
1117  cont, cont_cls);
1118 }
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.

References GNUNET_NAMESTORE_QueueEntry::cont, GNUNET_NAMESTORE_QueueEntry::cont_cls, GNUNET_NAMESTORE_records_store(), h, and pkey.

Here is the call graph for this function: