GNUnet  0.11.x
Data Structures | Macros | Typedefs | Enumerations | Functions
Peer Store service

Data Structures

struct  GNUNET_PEERSTORE_Record
 Single PEERSTORE record. More...
 

Macros

#define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY   "transport-communicator-url"
 Key used for storing addresses in URL format in the peerstore. More...
 
#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY   "transport-peer-hello"
 Key used for storing HELLOs in the peerstore. More...
 
#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME   "transport-backchannel-monotonic-time"
 Key used to store sender's monotonic time from backchannel messages. More...
 
#define GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME   "transport-dv-learn-monotonic-time"
 Key used to store sender's monotonic time from DV learn messages. More...
 

Typedefs

typedef void(* GNUNET_PEERSTORE_Continuation) (void *cls, int success)
 Continuation called with a status result. More...
 
typedef void(* GNUNET_PEERSTORE_Processor) (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
 Function called by PEERSTORE for each matching record. More...
 

Enumerations

enum  GNUNET_PEERSTORE_StoreOption { GNUNET_PEERSTORE_STOREOPTION_MULTIPLE = 0, GNUNET_PEERSTORE_STOREOPTION_REPLACE = 1 }
 Options for storing values in PEERSTORE. More...
 

Functions

struct GNUNET_PEERSTORE_HandleGNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the PEERSTORE service. More...
 
void GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first)
 Disconnect from the PEERSTORE service. More...
 
struct GNUNET_PEERSTORE_StoreContextGNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, const void *value, size_t size, struct GNUNET_TIME_Absolute expiry, enum GNUNET_PEERSTORE_StoreOption options, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
 Store a new entry in the PEERSTORE. More...
 
void GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
 Cancel a store request. More...
 
struct GNUNET_PEERSTORE_IterateContextGNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
 Iterate over records matching supplied key information. More...
 
void GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic)
 Cancel an iterate request Please do not call after the iterate request is done. More...
 
struct GNUNET_PEERSTORE_WatchContextGNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
 Request watching a given key User will be notified with any new values added to key. More...
 
void GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc)
 Cancel a watch request. More...
 

Detailed Description

See also
Documentation

Macro Definition Documentation

◆ GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY

#define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY   "transport-communicator-url"

Key used for storing addresses in URL format in the peerstore.

Definition at line 49 of file gnunet_peerstore_service.h.

Referenced by handle_suggest(), handle_validation_challenge(), and handle_validation_response().

◆ GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY

#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY   "transport-peer-hello"

Key used for storing HELLOs in the peerstore.

Definition at line 54 of file gnunet_peerstore_service.h.

Referenced by store_pi().

◆ GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME

#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME   "transport-backchannel-monotonic-time"

Key used to store sender's monotonic time from backchannel messages.

Definition at line 60 of file gnunet_peerstore_service.h.

Referenced by handle_dv_box(), and update_backtalker_monotime().

◆ GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME

#define GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME   "transport-dv-learn-monotonic-time"

Key used to store sender's monotonic time from DV learn messages.

Definition at line 67 of file gnunet_peerstore_service.h.

Referenced by handle_add_queue_message(), and handle_dv_learn().

Typedef Documentation

◆ GNUNET_PEERSTORE_Continuation

typedef void(* GNUNET_PEERSTORE_Continuation) (void *cls, int success)

Continuation called with a status result.

Parameters
clsclosure
successGNUNET_OK or GNUNET_SYSERR

Definition at line 147 of file gnunet_peerstore_service.h.

◆ GNUNET_PEERSTORE_Processor

typedef void(* GNUNET_PEERSTORE_Processor) (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)

Function called by PEERSTORE for each matching record.

Parameters
clsclosure
recordpeerstore record information
emsgerror message, or NULL if no errors

Definition at line 157 of file gnunet_peerstore_service.h.

Enumeration Type Documentation

◆ GNUNET_PEERSTORE_StoreOption

Options for storing values in PEERSTORE.

Enumerator
GNUNET_PEERSTORE_STOREOPTION_MULTIPLE 

Possibly store multiple values under given key.

GNUNET_PEERSTORE_STOREOPTION_REPLACE 

Delete any previous values for the given key before storing the given value.

Definition at line 74 of file gnunet_peerstore_service.h.

75 {
80 
86 };
Delete any previous values for the given key before storing the given value.
Possibly store multiple values under given key.

Function Documentation

◆ GNUNET_PEERSTORE_connect()

struct GNUNET_PEERSTORE_Handle* GNUNET_PEERSTORE_connect ( const struct GNUNET_CONFIGURATION_Handle cfg)

Connect to the PEERSTORE service.

Returns
NULL on error
Parameters
cfgconfiguration to use
Returns
NULL on error

Definition at line 421 of file peerstore_api.c.

References GNUNET_PEERSTORE_Handle::cfg, GNUNET_PEERSTORE_Handle::disconnecting, GNUNET_free, GNUNET_new, GNUNET_NO, h, GNUNET_PEERSTORE_Handle::mq, and reconnect().

Referenced by GSF_connected_peer_init_(), and run().

422 {
423  struct GNUNET_PEERSTORE_Handle *h;
424 
425  h = GNUNET_new (struct GNUNET_PEERSTORE_Handle);
426  h->cfg = cfg;
428  reconnect (h);
429  if (NULL == h->mq)
430  {
431  GNUNET_free (h);
432  return NULL;
433  }
434  return h;
435 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: peerstore_api.c:45
int disconnecting
Are we in the process of disconnecting but need to sync first?
Definition: peerstore_api.c:90
Handle to the PEERSTORE service.
Definition: peerstore_api.c:40
static void reconnect(void *cls)
Close the existing connection to PEERSTORE and reconnect.
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: peerstore_api.c:50
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_disconnect()

void GNUNET_PEERSTORE_disconnect ( struct GNUNET_PEERSTORE_Handle h,
int  sync_first 
)

Disconnect from the PEERSTORE service.

Any pending ITERATE and WATCH requests will be canceled. Any pending STORE requests will depend on snyc_first flag.

Parameters
hhandle to disconnect
sync_firstsend any pending STORE requests before disconnecting

Definition at line 447 of file peerstore_api.c.

Referenced by do_shutdown(), GSF_connected_peer_done_(), and shutdown_task().

448 {
451 
452  LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting.\n");
453  if (NULL != h->watches)
454  {
457  h->watches = NULL;
458  }
459  while (NULL != (ic = h->iterate_head))
460  {
461  GNUNET_break (0);
463  }
464  if (NULL != h->store_head)
465  {
466  if (GNUNET_YES == sync_first)
467  {
469  "Delaying disconnection due to pending store requests.\n");
471  return;
472  }
473  while (NULL != (sc = h->store_head))
475  }
476  final_disconnect (h);
477 }
struct GNUNET_PEERSTORE_IterateContext * iterate_head
Head of active ITERATE requests.
Definition: peerstore_api.c:65
#define LOG(kind,...)
Definition: peerstore_api.c:31
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Context for a store request.
Definition: peerstore_api.c:96
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void GNUNET_PEERSTORE_store_cancel(struct GNUNET_PEERSTORE_StoreContext *sc)
Cancel a store request.
int disconnecting
Are we in the process of disconnecting but need to sync first?
Definition: peerstore_api.c:90
static void final_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Kill the connection to the service.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static int destroy_watch(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator over watch requests to cancel them.
void GNUNET_PEERSTORE_iterate_cancel(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iterate request Please do not call after the iterate request is done.
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_PEERSTORE_StoreContext * store_head
Head of active STORE requests.
Definition: peerstore_api.c:55
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiHashMap * watches
Hashmap of watch requests.
Definition: peerstore_api.c:75
Context for a iterate request.
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_store()

struct GNUNET_PEERSTORE_StoreContext* GNUNET_PEERSTORE_store ( struct GNUNET_PEERSTORE_Handle h,
const char *  sub_system,
const struct GNUNET_PeerIdentity peer,
const char *  key,
const void *  value,
size_t  size,
struct GNUNET_TIME_Absolute  expiry,
enum GNUNET_PEERSTORE_StoreOption  options,
GNUNET_PEERSTORE_Continuation  cont,
void *  cont_cls 
)

Store a new entry in the PEERSTORE.

Note that stored entries can be lost in some cases such as power failure.

Parameters
hHandle to the PEERSTORE service
sub_systemname of the sub system
peerPeer Identity
keyentry key
valueentry value BLOB
sizesize of value
expiryabsolute time after which the entry is (possibly) deleted
optionsoptions specific to the storage operation
contContinuation function after the store request is sent
cont_clsClosure for cont

Definition at line 522 of file peerstore_api.c.

Referenced by flush_respect(), handle_dv_learn(), handle_validation_response(), store_pi(), and update_backtalker_monotime().

532 {
533  struct GNUNET_MQ_Envelope *ev;
535 
537  "Storing value (size: %lu) for subsytem `%s', peer `%s', key `%s'\n",
538  size,
539  sub_system,
540  GNUNET_i2s (peer),
541  key);
542  ev =
544  peer,
545  key,
546  value,
547  size,
548  expiry,
549  options,
552 
554  sc->peer = *peer;
555  sc->key = GNUNET_strdup (key);
556  sc->value = GNUNET_memdup (value, size);
557  sc->size = size;
558  sc->expiry = expiry;
559  sc->options = options;
560  sc->cont = cont;
561  sc->cont_cls = cont_cls;
562  sc->h = h;
563 
566  GNUNET_MQ_send (h->mq, ev);
567  return sc;
568 }
#define GNUNET_MESSAGE_TYPE_PEERSTORE_STORE
Store request message.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define LOG(kind,...)
Definition: peerstore_api.c:31
static void store_request_sent(void *cls)
Callback after MQ envelope is sent.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
char * sub_system
Which subsystem does the store?
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
Definition: mq.c:774
static char * value
Value of the record to add/remove.
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
Context for a store request.
Definition: peerstore_api.c:96
struct GNUNET_PEERSTORE_StoreContext * store_tail
Tail of active STORE requests.
Definition: peerstore_api.c:60
void * cont_cls
Closure for cont.
void * value
Contains size bytes.
char * key
Key for the store operation.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_MQ_Envelope * PEERSTORE_create_record_mq_envelope(const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, const void *value, size_t value_size, struct GNUNET_TIME_Absolute expiry, enum GNUNET_PEERSTORE_StoreOption options, uint16_t msg_type)
Creates a MQ envelope for a single record.
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: peerstore_api.c:50
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
struct GNUNET_TIME_Absolute expiry
When does the value expire?
size_t size
Number of bytes in value.
struct GNUNET_PeerIdentity peer
Peer the store is for.
GNUNET_PEERSTORE_Continuation cont
Continuation called with service response.
enum GNUNET_PEERSTORE_StoreOption options
Options for the store operation.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_PEERSTORE_StoreContext * store_head
Head of active STORE requests.
Definition: peerstore_api.c:55
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_store_cancel()

void GNUNET_PEERSTORE_store_cancel ( struct GNUNET_PEERSTORE_StoreContext sc)

Cancel a store request.

Parameters
scStore request context

Definition at line 491 of file peerstore_api.c.

Referenced by free_address_list_entry(), free_backtalker(), free_neighbour(), free_validation_state(), handle_dv_learn(), and update_backtalker_monotime().

492 {
493  struct GNUNET_PEERSTORE_Handle *h = sc->h;
494 
496  GNUNET_free (sc->sub_system);
497  GNUNET_free (sc->value);
498  GNUNET_free (sc->key);
499  GNUNET_free (sc);
500  if ((GNUNET_YES == h->disconnecting) && (NULL == h->store_head))
501  final_disconnect (h);
502 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
char * sub_system
Which subsystem does the store?
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
struct GNUNET_PEERSTORE_StoreContext * store_tail
Tail of active STORE requests.
Definition: peerstore_api.c:60
void * value
Contains size bytes.
int disconnecting
Are we in the process of disconnecting but need to sync first?
Definition: peerstore_api.c:90
Handle to the PEERSTORE service.
Definition: peerstore_api.c:40
static void final_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Kill the connection to the service.
char * key
Key for the store operation.
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_PEERSTORE_StoreContext * store_head
Head of active STORE requests.
Definition: peerstore_api.c:55
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_iterate()

struct GNUNET_PEERSTORE_IterateContext* GNUNET_PEERSTORE_iterate ( struct GNUNET_PEERSTORE_Handle h,
const char *  sub_system,
const struct GNUNET_PeerIdentity peer,
const char *  key,
GNUNET_PEERSTORE_Processor  callback,
void *  callback_cls 
)

Iterate over records matching supplied key information.

Parameters
hhandle to the PEERSTORE service
sub_systemname of sub system
peerPeer identity (can be NULL)
keyentry key string (can be NULL)
callbackfunction called with each matching record, all NULL's on end
callback_clsclosure for callback
hhandle to the PEERSTORE service
sub_systemname of sub system
peerPeer identity (can be NULL)
keyentry key string (can be NULL)
callbackfunction called with each matching record, all NULL's on end
callback_clsclosure for callback
Returns
Handle to iteration request

Definition at line 699 of file peerstore_api.c.

Referenced by GSF_peer_connect_handler(), handle_add_queue_message(), and handle_dv_box().

705 {
706  struct GNUNET_MQ_Envelope *ev;
708 
709  ev =
711  peer,
712  key,
713  NULL,
714  0,
716  0,
719  ic->callback = callback;
721  ic->h = h;
723  if (NULL != peer)
724  ic->peer = *peer;
725  if (NULL != key)
726  ic->key = GNUNET_strdup (key);
729  "Sending an iterate request for sub system `%s'\n",
730  sub_system);
731  GNUNET_MQ_send (h->mq, ev);
732  return ic;
733 }
struct GNUNET_PEERSTORE_IterateContext * iterate_head
Head of active ITERATE requests.
Definition: peerstore_api.c:65
struct GNUNET_PEERSTORE_IterateContext * iterate_tail
Tail of active ITERATE requests.
Definition: peerstore_api.c:70
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
#define LOG(kind,...)
Definition: peerstore_api.c:31
struct GNUNET_PeerIdentity peer
Peer the store is for.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE
Iteration request.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
GNUNET_PEERSTORE_Processor callback
Callback with each matching record.
void * callback_cls
Closure for callback.
char * sub_system
Which subsystem does the store?
char * key
Key for the store operation.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_MQ_Envelope * PEERSTORE_create_record_mq_envelope(const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, const void *value, size_t value_size, struct GNUNET_TIME_Absolute expiry, enum GNUNET_PEERSTORE_StoreOption options, uint16_t msg_type)
Creates a MQ envelope for a single record.
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: peerstore_api.c:50
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
Context for a iterate request.
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_iterate_cancel()

void GNUNET_PEERSTORE_iterate_cancel ( struct GNUNET_PEERSTORE_IterateContext ic)

Cancel an iterate request Please do not call after the iterate request is done.

Parameters
icIterate request context as returned by GNUNET_PEERSTORE_iterate()

Definition at line 673 of file peerstore_api.c.

References GNUNET_PEERSTORE_IterateContext::callback, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_NO, GNUNET_PEERSTORE_IterateContext::h, GNUNET_PEERSTORE_Handle::iterate_head, GNUNET_PEERSTORE_Handle::iterate_tail, GNUNET_PEERSTORE_IterateContext::iterating, GNUNET_PEERSTORE_IterateContext::key, and GNUNET_PEERSTORE_IterateContext::sub_system.

Referenced by disconnect(), free_backtalker(), free_neighbour(), GNUNET_PEERSTORE_disconnect(), GSF_peer_disconnect_handler(), handle_iterate_end(), and peer_respect_cb().

674 {
675  if (GNUNET_NO == ic->iterating)
676  {
678  GNUNET_free (ic->sub_system);
680  GNUNET_free (ic);
681  }
682  else
683  ic->callback = NULL;
684 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_PEERSTORE_IterateContext * iterate_head
Head of active ITERATE requests.
Definition: peerstore_api.c:65
struct GNUNET_PEERSTORE_IterateContext * iterate_tail
Tail of active ITERATE requests.
Definition: peerstore_api.c:70
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
GNUNET_PEERSTORE_Processor callback
Callback with each matching record.
char * sub_system
Which subsystem does the store?
char * key
Key for the store operation.
int iterating
GNUNET_YES if we are currently processing records.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_watch()

struct GNUNET_PEERSTORE_WatchContext* GNUNET_PEERSTORE_watch ( struct GNUNET_PEERSTORE_Handle h,
const char *  sub_system,
const struct GNUNET_PeerIdentity peer,
const char *  key,
GNUNET_PEERSTORE_Processor  callback,
void *  callback_cls 
)

Request watching a given key User will be notified with any new values added to key.

Parameters
hhandle to the PEERSTORE service
sub_systemname of sub system
peerPeer identity
keyentry key string
callbackfunction called with each new value
callback_clsclosure for callback
Returns
Handle to watch request

Definition at line 899 of file peerstore_api.c.

Referenced by handle_suggest(), and handle_validation_challenge().

905 {
906  struct GNUNET_MQ_Envelope *ev;
907  struct StoreKeyHashMessage *hm;
909 
911  PEERSTORE_hash_key (sub_system, peer, key, &hm->keyhash);
913  wc->callback = callback;
915  wc->h = h;
916  wc->keyhash = hm->keyhash;
917  if (NULL == h->watches)
920  h->watches,
921  &wc->keyhash,
922  wc,
925  "Sending a watch request for subsystem `%s', peer `%s', key `%s'.\n",
926  sub_system,
927  GNUNET_i2s (peer),
928  key);
929  GNUNET_MQ_send (h->mq, ev);
930  return wc;
931 }
GNUNET_PEERSTORE_Processor callback
Callback with each record received.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void * callback_cls
Closure for callback.
#define LOG(kind,...)
Definition: peerstore_api.c:31
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_HashCode keyhash
Hash of the combined key.
struct GNUNET_HashCode keyhash
Hash of a record key.
Definition: peerstore.h:104
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
Context for a watch request.
void PEERSTORE_hash_key(const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, struct GNUNET_HashCode *ret)
Creates a hash of the given key combination.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH
Watch request.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: peerstore_api.c:50
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
Allow multiple values with the same key.
Message carrying record key hash.
Definition: peerstore.h:89
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_CONTAINER_MultiHashMap * watches
Hashmap of watch requests.
Definition: peerstore_api.c:75
Here is the caller graph for this function:

◆ GNUNET_PEERSTORE_watch_cancel()

void GNUNET_PEERSTORE_watch_cancel ( struct GNUNET_PEERSTORE_WatchContext wc)

Cancel a watch request.

Parameters
wchandle to the watch request

Definition at line 869 of file peerstore_api.c.

Referenced by free_incoming_request(), and stop_peer_request().

870 {
871  struct GNUNET_PEERSTORE_Handle *h = wc->h;
872  struct GNUNET_MQ_Envelope *ev;
873  struct StoreKeyHashMessage *hm;
874 
875  LOG (GNUNET_ERROR_TYPE_DEBUG, "Canceling watch.\n");
877  hm->keyhash = wc->keyhash;
878  GNUNET_MQ_send (h->mq, ev);
879  GNUNET_assert (
880  GNUNET_YES ==
882  GNUNET_free (wc);
883 }
#define GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH_CANCEL
Watch cancel request.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define LOG(kind,...)
Definition: peerstore_api.c:31
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_HashCode keyhash
Hash of the combined key.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
struct GNUNET_HashCode keyhash
Hash of a record key.
Definition: peerstore.h:104
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:40
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: peerstore_api.c:50
Message carrying record key hash.
Definition: peerstore.h:89
#define GNUNET_YES
Definition: gnunet_common.h:77
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_CONTAINER_MultiHashMap * watches
Hashmap of watch requests.
Definition: peerstore_api.c:75
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function: