GNUnet 0.21.1
peerstore_api.c File Reference

API for peerstore. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_hello_uri_lib.h"
#include "peerstore.h"
#include "peerstore_common.h"
#include "gnunet_peerstore_service.h"
Include dependency graph for peerstore_api.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_PEERSTORE_Handle
 Handle to the PEERSTORE service. More...
 
struct  GNUNET_PEERSTORE_StoreHelloContext
 Context for a add hello uri request. More...
 
struct  GNUNET_PEERSTORE_StoreContext
 Context for a store request. More...
 
struct  StoreHelloCls
 Closure for store callback when storing hello uris. More...
 
struct  GNUNET_PEERSTORE_IterateContext
 Context for a iterate request. More...
 
struct  GNUNET_PEERSTORE_NotifyContext
 Context for the info handler. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "peerstore-api", __VA_ARGS__)
 

Functions

static void reconnect (void *cls)
 Close the existing connection to PEERSTORE and reconnect. More...
 
static uint32_t get_op_id (struct GNUNET_PEERSTORE_Handle *h)
 Get a fresh operation id to distinguish between namestore requests. More...
 
static void disconnect (struct GNUNET_PEERSTORE_Handle *h)
 Disconnect from the peerstore service. More...
 
static void disconnect_and_schedule_reconnect (struct GNUNET_PEERSTORE_Handle *h)
 Function that will schedule the job that will try to connect us again to the client. More...
 
static void handle_client_error (void *cls, enum GNUNET_MQ_Error error)
 Function called when we had trouble talking to the service. More...
 
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)
 Disconnect from the PEERSTORE service. More...
 
static void destroy_storecontext (struct GNUNET_PEERSTORE_StoreContext *sc)
 
void GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
 Cancel a store request. 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...
 
static void handle_store_result (void *cls, const struct PeerstoreResultMessage *msg)
 When a response for store request is received. More...
 
static void destroy_iteratecontext (struct GNUNET_PEERSTORE_IterateContext *ic)
 
static void handle_iterate_end (void *cls, const struct PeerstoreResultMessage *msg)
 When a response for iterate request is received. More...
 
static int check_iterate_result (void *cls, const struct PeerstoreRecordMessage *msg)
 When a response for iterate request is received, check the message is well-formed. More...
 
static void handle_iterate_result (void *cls, const struct PeerstoreRecordMessage *msg)
 When a response for iterate request is received. More...
 
void GNUNET_PEERSTORE_iteration_next (struct GNUNET_PEERSTORE_IterateContext *ic, uint64_t limit)
 Cancel an iterate request Please do not call after the iterate request is done. More...
 
void GNUNET_PEERSTORE_iteration_stop (struct GNUNET_PEERSTORE_IterateContext *ic)
 Cancel an iterate request Please do not call after the iterate request is done. More...
 
struct GNUNET_PEERSTORE_IterateContextGNUNET_PEERSTORE_iteration_start (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 peerstore entries. More...
 
static void hello_store_success (void *cls, int success)
 
static void hello_add_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
 
struct GNUNET_PEERSTORE_StoreHelloContextGNUNET_PEERSTORE_hello_add (struct GNUNET_PEERSTORE_Handle *h, const struct GNUNET_MessageHeader *msg, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
 Add hello to peerstore. More...
 
void GNUNET_PEERSTORE_hello_add_cancel (struct GNUNET_PEERSTORE_StoreHelloContext *huc)
 Cancel the request to add a hello. More...
 

Detailed Description

API for peerstore.

Author
Omar Tarabai
Christian Grothoff
Martin Schanzenbach

Definition in file peerstore_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "peerstore-api", __VA_ARGS__)

Definition at line 34 of file peerstore_api.c.

Function Documentation

◆ reconnect()

static void reconnect ( void *  cls)
static

Close the existing connection to PEERSTORE and reconnect.

Parameters
clsa struct GNUNET_PEERSTORE_Handle *h
clsa struct GNUNET_PEERSTORE_Handle *

Definition at line 802 of file peerstore_api.c.

803{
804 struct GNUNET_PEERSTORE_Handle *h = cls;
805 struct GNUNET_MQ_MessageHandler mq_handlers[] = {
806 GNUNET_MQ_hd_fixed_size (iterate_end,
809 h),
810 GNUNET_MQ_hd_fixed_size (store_result,
813 h),
814 GNUNET_MQ_hd_var_size (iterate_result,
817 h),
819 };
820
821 h->reconnect_task = NULL;
822 LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting...\n");
824 "peerstore",
825 mq_handlers,
827 h);
828 if (NULL == h->mq)
829 {
831 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
832 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
833 return;
834 }
836 "Resending pending requests after reconnect.\n");
837 for (struct GNUNET_PEERSTORE_IterateContext *ic = h->iterate_head; NULL != ic;
838 ic = ic->next)
839 {
840 GNUNET_MQ_send (h->mq, ic->env);
841 }
842 for (struct GNUNET_PEERSTORE_StoreContext *sc = h->store_head; NULL != sc;
843 sc = sc->next)
844 {
845 GNUNET_MQ_send (h->mq, sc->env);
846 }
847}
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
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.
Definition: client.c:1057
@ GNUNET_ERROR_TYPE_DEBUG
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:304
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_PEERSTORE_RECORD
Record result message.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END
Iteration end message.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_STORE_RESULT
Store result message.
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:1278
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
static void handle_client_error(void *cls, enum GNUNET_MQ_Error error)
Function called when we had trouble talking to the service.
static void reconnect(void *cls)
Close the existing connection to PEERSTORE and reconnect.
#define LOG(kind,...)
Definition: peerstore_api.c:34
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
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147
Message handler for a specific message type.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:44
Context for a iterate request.
Context for a store request.
Message carrying a PEERSTORE record message.
Definition: peerstore.h:38
Message carrying a PEERSTORE result message.
Definition: peerstore.h:96

References GNUNET_ARM_Handle::cfg, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END, GNUNET_MESSAGE_TYPE_PEERSTORE_RECORD, GNUNET_MESSAGE_TYPE_PEERSTORE_STORE_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_send(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, h, handle_client_error(), LOG, GNUNET_ARM_Handle::mq, reconnect(), GNUNET_ARM_Handle::reconnect_task, and sc.

Referenced by disconnect_and_schedule_reconnect(), GNUNET_PEERSTORE_connect(), and reconnect().

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

◆ get_op_id()

static uint32_t get_op_id ( struct GNUNET_PEERSTORE_Handle h)
static

Get a fresh operation id to distinguish between namestore requests.

Parameters
hthe namestore handle
Returns
next operation id to use

Definition at line 343 of file peerstore_api.c.

344{
345 return h->last_op_id++;
346}

References h.

Referenced by GNUNET_PEERSTORE_iteration_start(), and GNUNET_PEERSTORE_store().

Here is the caller graph for this function:

◆ disconnect()

static void disconnect ( struct GNUNET_PEERSTORE_Handle h)
static

Disconnect from the peerstore service.

Parameters
hpeerstore handle to disconnect

Definition at line 355 of file peerstore_api.c.

356{
357 if (NULL != h->watches)
358 {
361 }
362 GNUNET_assert (NULL == h->iterate_head);
363 GNUNET_assert (NULL == h->store_head);
364 if (NULL != h->mq)
365 {
367 h->mq = NULL;
368 }
369}
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683

References GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_MQ_destroy(), h, and GNUNET_ARM_Handle::mq.

Referenced by disconnect_and_schedule_reconnect(), and GNUNET_PEERSTORE_disconnect().

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

◆ disconnect_and_schedule_reconnect()

static void disconnect_and_schedule_reconnect ( struct GNUNET_PEERSTORE_Handle h)
static

Function that will schedule the job that will try to connect us again to the client.

Parameters
hpeerstore to reconnect

Definition at line 379 of file peerstore_api.c.

380{
381 GNUNET_assert (NULL == h->reconnect_task);
382 disconnect (h);
384 "Scheduling task to reconnect to PEERSTORE service in %s.\n",
387 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
388 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
389}
@ GNUNET_YES
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:570
static void disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the peerstore service.

References disconnect(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, h, LOG, reconnect(), and GNUNET_ARM_Handle::reconnect_task.

Referenced by handle_client_error().

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

◆ handle_client_error()

static void handle_client_error ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Function called when we had trouble talking to the service.

Definition at line 401 of file peerstore_api.c.

402{
403 struct GNUNET_PEERSTORE_Handle *h = cls;
404
406 "Received an error notification from MQ of type: %d\n",
407 error);
409}
@ GNUNET_ERROR_TYPE_ERROR
static void disconnect_and_schedule_reconnect(struct GNUNET_PEERSTORE_Handle *h)
Function that will schedule the job that will try to connect us again to the client.

References disconnect_and_schedule_reconnect(), GNUNET_ERROR_TYPE_ERROR, h, and LOG.

Referenced by reconnect().

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

◆ destroy_storecontext()

static void destroy_storecontext ( struct GNUNET_PEERSTORE_StoreContext sc)
static

Definition at line 456 of file peerstore_api.c.

457{
458 GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc);
459 GNUNET_free (sc->sub_system);
460 GNUNET_free (sc->value);
461 GNUNET_free (sc->key);
462 GNUNET_free (sc);
463}
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_FS_Handle * h
Handle to the global FS context.
Definition: fs_api.h:1515

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_FS_SearchContext::h, and sc.

Referenced by GNUNET_PEERSTORE_store_cancel(), and handle_store_result().

Here is the caller graph for this function:

◆ handle_store_result()

static void handle_store_result ( void *  cls,
const struct PeerstoreResultMessage msg 
)
static

When a response for store request is received.

Parameters
clsa struct GNUNET_PEERSTORE_Handle *
msgmessage received

Definition at line 565 of file peerstore_api.c.

566{
567 struct GNUNET_PEERSTORE_Handle *h = cls;
568 struct GNUNET_PEERSTORE_StoreContext *sc = h->store_head;
569
570 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got PeerstoreResultMessage\n");
571 for (sc = h->store_head; NULL != sc; sc = sc->next)
572 {
573 if (sc->rid == ntohs (msg->rid))
574 break;
575 }
576 if (NULL == sc)
577 {
579 _ ("Unexpected store response.\n"));
580 return;
581 }
582 if (NULL != sc->cont)
583 sc->cont (sc->cont_cls, ntohl (msg->result));
585}
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
@ GNUNET_ERROR_TYPE_WARNING
static void destroy_storecontext(struct GNUNET_PEERSTORE_StoreContext *sc)
#define _(String)
GNU gettext support macro.
Definition: platform.h:178

References _, destroy_storecontext(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, h, LOG, msg, and sc.

Here is the call graph for this function:

◆ destroy_iteratecontext()

static void destroy_iteratecontext ( struct GNUNET_PEERSTORE_IterateContext ic)
static

Definition at line 593 of file peerstore_api.c.

594{
597 GNUNET_free (ic->key);
598 GNUNET_free (ic);
599}
struct GNUNET_PEERSTORE_IterateContext * iterate_tail
Tail of active ITERATE requests.
Definition: peerstore_api.c:73
struct GNUNET_PEERSTORE_IterateContext * iterate_head
Head of active ITERATE requests.
Definition: peerstore_api.c:68
char * sub_system
Which subsystem does the store?
char * key
Key for the store operation.
struct GNUNET_PEERSTORE_Handle * h
Handle to the PEERSTORE service.

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PEERSTORE_IterateContext::h, GNUNET_PEERSTORE_Handle::iterate_head, GNUNET_PEERSTORE_Handle::iterate_tail, GNUNET_PEERSTORE_IterateContext::key, and GNUNET_PEERSTORE_IterateContext::sub_system.

Referenced by GNUNET_PEERSTORE_iteration_stop(), and handle_iterate_end().

Here is the caller graph for this function:

◆ handle_iterate_end()

static void handle_iterate_end ( void *  cls,
const struct PeerstoreResultMessage msg 
)
static

When a response for iterate request is received.

Parameters
clsa struct GNUNET_PEERSTORE_Handle *
msgmessage received

Definition at line 609 of file peerstore_api.c.

610{
611 struct GNUNET_PEERSTORE_Handle *h = cls;
612 struct GNUNET_PEERSTORE_IterateContext *ic = h->iterate_head;
613
614 for (ic = h->iterate_head; NULL != ic; ic = ic->next)
615 if (ic->rid == ntohs (msg->rid))
616 break;
617 if (NULL == ic)
618 {
620 _ ("Unexpected iteration response.\n"));
621 return;
622 }
623 if (NULL != ic->callback)
624 ic->callback (ic->callback_cls, NULL, NULL);
625 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up iteration with rid %u\n", ic->rid);
627}
static void destroy_iteratecontext(struct GNUNET_PEERSTORE_IterateContext *ic)
void * callback_cls
Closure for callback.
GNUNET_PEERSTORE_Processor callback
Callback with each matching record.
struct GNUNET_PEERSTORE_IterateContext * next
Kept in a DLL.

References _, GNUNET_PEERSTORE_IterateContext::callback, GNUNET_PEERSTORE_IterateContext::callback_cls, destroy_iteratecontext(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, h, LOG, msg, GNUNET_PEERSTORE_IterateContext::next, and GNUNET_PEERSTORE_IterateContext::rid.

Here is the call graph for this function:

◆ check_iterate_result()

static int check_iterate_result ( void *  cls,
const struct PeerstoreRecordMessage msg 
)
static

When a response for iterate request is received, check the message is well-formed.

Parameters
clsa struct GNUNET_PEERSTORE_Handle *
msgmessage received

Definition at line 638 of file peerstore_api.c.

639{
640 /* we defer validation to #handle_iterate_result */
641 return GNUNET_OK;
642}
@ GNUNET_OK

References GNUNET_OK.

◆ handle_iterate_result()

static void handle_iterate_result ( void *  cls,
const struct PeerstoreRecordMessage msg 
)
static

When a response for iterate request is received.

Parameters
clsa struct GNUNET_PEERSTORE_Handle *
msgmessage received

Definition at line 652 of file peerstore_api.c.

653{
654 struct GNUNET_PEERSTORE_Handle *h = cls;
657
658 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received RecordMessage\n");
659 for (ic = h->iterate_head; NULL != ic; ic = ic->next)
660 if (ic->rid == ntohs (msg->rid))
661 break;
662 if (NULL == ic)
663 {
665 _ (
666 "Unexpected iteration response, no iterating client found, discarding message.\n"));
667 return;
668 }
669 if (NULL == ic->callback)
670 return;
672 if (NULL == record)
673 {
674 ic->callback (ic->callback_cls,
675 NULL,
676 _ ("Received a malformed response from service."));
677 }
678 else
679 {
680 ic->callback (ic->callback_cls, record, NULL);
682 }
683}
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
struct GNUNET_PEERSTORE_Record * PEERSTORE_parse_record_message(const struct PeerstoreRecordMessage *srm)
Parses a message carrying a record.
void PEERSTORE_destroy_record(struct GNUNET_PEERSTORE_Record *record)
Free any memory allocated for this record.
Single PEERSTORE record.

References _, GNUNET_PEERSTORE_IterateContext::callback, GNUNET_PEERSTORE_IterateContext::callback_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, h, LOG, msg, GNUNET_PEERSTORE_IterateContext::next, PEERSTORE_destroy_record(), PEERSTORE_parse_record_message(), record(), and GNUNET_PEERSTORE_IterateContext::rid.

Here is the call graph for this function:

◆ hello_store_success()

static void hello_store_success ( void *  cls,
int  success 
)
static

Definition at line 851 of file peerstore_api.c.

852{
853 struct GNUNET_PEERSTORE_StoreHelloContext *huc = cls;
854
855 huc->sc = NULL;
856 if (GNUNET_OK != success)
857 {
859 "Storing hello uri failed\n");
860 huc->cont (huc->cont_cls, success);
861 GNUNET_free (huc->hello);
862 GNUNET_free (huc);
863 return;
864 }
865 huc->cont (huc->cont_cls, GNUNET_OK);
866 GNUNET_free (huc->hello);
867 GNUNET_free (huc);
868}
Context for a add hello uri request.
struct GNUNET_MessageHeader * hello
Hello uri which was request for storing.
GNUNET_PEERSTORE_Continuation cont
Function to call with information.
struct GNUNET_PEERSTORE_StoreContext * sc
Store operation for the merge.
void * cont_cls
Closure for callback.

References GNUNET_PEERSTORE_StoreHelloContext::cont, GNUNET_PEERSTORE_StoreHelloContext::cont_cls, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_OK, GNUNET_PEERSTORE_StoreHelloContext::hello, LOG, and GNUNET_PEERSTORE_StoreHelloContext::sc.

Referenced by hello_add_iter().

Here is the caller graph for this function:

◆ hello_add_iter()

static void hello_add_iter ( void *  cls,
const struct GNUNET_PEERSTORE_Record record,
const char *  emsg 
)
static

If we ever get here, we are newer than the existing record or the only/first record.

Definition at line 872 of file peerstore_api.c.

874{
875 struct GNUNET_PEERSTORE_StoreHelloContext *huc = cls;
876 struct GNUNET_TIME_Absolute hello_exp =
878 if ((NULL == record) && (NULL == emsg))
879 {
883 huc->sc = GNUNET_PEERSTORE_store (huc->h,
884 "peerstore",
885 &huc->pid,
887 huc->hello,
888 ntohs (huc->hello->size),
889 hello_exp,
892 huc);
893 return;
894 }
895 if (NULL != emsg)
896 {
897 LOG (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
899 return;
900 }
901 if (GNUNET_TIME_absolute_cmp (record->expiry, >, hello_exp))
902 {
904 "Not storing hello for %s since we seem to have a newer version on record.\n",
905 GNUNET_i2s (&huc->pid));
906 huc->cont (huc->cont_cls, GNUNET_OK);
908 GNUNET_free (huc->hello);
909 GNUNET_free (huc);
910 return;
911 }
913}
struct GNUNET_TIME_Absolute GNUNET_HELLO_builder_get_expiration_time(const struct GNUNET_MessageHeader *msg)
Get the expiration time for this HELLO.
Definition: hello-uri.c:470
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
void GNUNET_PEERSTORE_iteration_next(struct GNUNET_PEERSTORE_IterateContext *ic, uint64_t limit)
Cancel an iterate request Please do not call after the iterate request is done.
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.
void GNUNET_PEERSTORE_iteration_stop(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iterate request Please do not call after the iterate request is done.
#define GNUNET_PEERSTORE_HELLO_KEY
Key used for storing HELLO in the peerstore.
@ GNUNET_PEERSTORE_STOREOPTION_REPLACE
Delete any previous values for the given key before storing the given value.
#define GNUNET_TIME_absolute_cmp(t1, op, t2)
Compare two absolute times.
static void hello_store_success(void *cls, int success)
struct GNUNET_PEERSTORE_Handle * h
Peerstore handle.
struct GNUNET_PEERSTORE_IterateContext * ic
The iteration for the merge.
struct GNUNET_PeerIdentity pid
The peer id for the hello.
Time for absolute times used by GNUnet, in microseconds.

References GNUNET_PEERSTORE_StoreHelloContext::cont, GNUNET_PEERSTORE_StoreHelloContext::cont_cls, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_HELLO_builder_get_expiration_time(), GNUNET_i2s(), GNUNET_OK, GNUNET_PEERSTORE_HELLO_KEY, GNUNET_PEERSTORE_iteration_next(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_PEERSTORE_store(), GNUNET_PEERSTORE_STOREOPTION_REPLACE, GNUNET_TIME_absolute_cmp, GNUNET_PEERSTORE_StoreHelloContext::h, GNUNET_PEERSTORE_StoreHelloContext::hello, hello_store_success(), GNUNET_PEERSTORE_StoreHelloContext::ic, LOG, GNUNET_PEERSTORE_StoreHelloContext::pid, record(), GNUNET_PEERSTORE_StoreHelloContext::sc, and GNUNET_MessageHeader::size.

Referenced by GNUNET_PEERSTORE_hello_add().

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