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... | |
#define | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE "transport-tcp-communicator-handshake" |
Key used to store sender's monotonic time from handshake message. More... | |
#define | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK "transport-tcp-communicator-handshake-ack" |
Key used to store sender's monotonic time from handshake ack message. More... | |
#define | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY "transport-tcp-communicator-rekey" |
Key used to store sender's monotonic time from rekey message. 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_Handle * | GNUNET_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_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. More... | |
void | GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc) |
Cancel a store request. More... | |
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. 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_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. More... | |
void | GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc) |
Cancel a watch request. More... | |
#define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY "transport-communicator-url" |
Key used for storing addresses in URL format in the peerstore.
Definition at line 53 of file gnunet_peerstore_service.h.
#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello" |
Key used for storing HELLOs in the peerstore.
Definition at line 58 of file gnunet_peerstore_service.h.
#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME "transport-backchannel-monotonic-time" |
Key used to store sender's monotonic time from backchannel messages.
Definition at line 64 of file gnunet_peerstore_service.h.
#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 71 of file gnunet_peerstore_service.h.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE "transport-tcp-communicator-handshake" |
Key used to store sender's monotonic time from handshake message.
Definition at line 77 of file gnunet_peerstore_service.h.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK "transport-tcp-communicator-handshake-ack" |
Key used to store sender's monotonic time from handshake ack message.
Definition at line 83 of file gnunet_peerstore_service.h.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY "transport-tcp-communicator-rekey" |
Key used to store sender's monotonic time from rekey message.
Definition at line 89 of file gnunet_peerstore_service.h.
typedef void(* GNUNET_PEERSTORE_Continuation) (void *cls, int success) |
Continuation called with a status result.
cls | closure |
success | GNUNET_OK or GNUNET_SYSERR |
Definition at line 169 of file gnunet_peerstore_service.h.
typedef void(* GNUNET_PEERSTORE_Processor) (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) |
Function called by PEERSTORE for each matching record.
cls | closure |
record | peerstore record information |
emsg | error message, or NULL if no errors |
Definition at line 179 of file gnunet_peerstore_service.h.
Options for storing values in PEERSTORE.
Definition at line 96 of file gnunet_peerstore_service.h.
struct GNUNET_PEERSTORE_Handle* GNUNET_PEERSTORE_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Connect to the PEERSTORE service.
cfg | configuration to use |
Definition at line 424 of file peerstore_api.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_free, GNUNET_new, GNUNET_NO, h, GNUNET_ARM_Handle::mq, and reconnect().
Referenced by GNUNET_TRANSPORT_TESTING_start_peer(), GSF_connected_peer_init_(), run(), and start_peer_run().
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.
h | handle to disconnect |
sync_first | send any pending STORE requests before disconnecting |
Definition at line 450 of file peerstore_api.c.
References destroy_watch(), final_disconnect(), GNUNET_break, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_PEERSTORE_iterate_cancel(), GNUNET_PEERSTORE_store_cancel(), GNUNET_YES, h, LOG, and sc.
Referenced by do_shutdown(), GNUNET_TRANSPORT_TESTING_stop_peer(), GSF_connected_peer_done_(), shutdown_task(), and stop_peer_run().
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.
h | Handle to the PEERSTORE service |
sub_system | name of the sub system |
peer | Peer Identity |
key | entry key |
value | entry value BLOB |
size | size of value |
expiry | absolute time after which the entry is (possibly) deleted |
options | options specific to the storage operation |
cont | Continuation function after the store request is sent |
cont_cls | Closure for cont |
Definition at line 531 of file peerstore_api.c.
References GNUNET_PEERSTORE_StoreContext::cont, GNUNET_PEERSTORE_StoreContext::cont_cls, GNUNET_PEERSTORE_StoreContext::expiry, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memdup, GNUNET_MESSAGE_TYPE_PEERSTORE_STORE, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, h, GNUNET_FS_SearchContext::h, key, LOG, GNUNET_ARM_Handle::mq, options, GNUNET_FS_SearchContext::options, peer, PEERSTORE_create_record_mq_envelope(), sc, size, store_request_sent(), GNUNET_PEERSTORE_StoreContext::sub_system, and value.
Referenced by flush_respect(), handle_dv_learn(), handle_validation_response(), handshake_ack_monotime_cb(), handshake_monotime_cb(), rekey_monotime_cb(), store_pi(), and update_backtalker_monotime().
void GNUNET_PEERSTORE_store_cancel | ( | struct GNUNET_PEERSTORE_StoreContext * | sc | ) |
Cancel a store request.
sc | Store request context |
Definition at line 494 of file peerstore_api.c.
References final_disconnect(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_YES, h, GNUNET_FS_SearchContext::h, and sc.
Referenced by free_address_list_entry(), free_backtalker(), free_neighbour(), free_validation_state(), handle_dv_learn(), and queue_destroy().
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.
h | handle to the PEERSTORE service |
sub_system | name of sub system |
peer | Peer identity (can be NULL) |
key | entry key string (can be NULL) |
callback | function called with each matching record, all NULL's on end |
callback_cls | closure for callback |
Definition at line 698 of file peerstore_api.c.
References GNUNET_PEERSTORE_IterateContext::callback, GNUNET_PEERSTORE_IterateContext::callback_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE, GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, GNUNET_TIME_UNIT_FOREVER_ABS, h, GNUNET_PEERSTORE_IterateContext::h, key, GNUNET_PEERSTORE_IterateContext::key, LOG, GNUNET_ARM_Handle::mq, GNUNET_PEERSTORE_IterateContext::peer, peer, PEERSTORE_create_record_mq_envelope(), and GNUNET_PEERSTORE_IterateContext::sub_system.
Referenced by decrypt_and_check_tc(), do_rekey(), GNUNET_TRANSPORT_TESTING_restart_peer(), GSF_peer_connect_handler(), handle_add_queue_message(), handle_dv_box(), retrieve_hello(), and try_handle_plaintext().
void GNUNET_PEERSTORE_iterate_cancel | ( | struct GNUNET_PEERSTORE_IterateContext * | ic | ) |
Cancel an iterate request Please do not call after the iterate request is done.
ic | Iterate request context as returned by GNUNET_PEERSTORE_iterate() |
Definition at line 683 of file peerstore_api.c.
References GNUNET_PEERSTORE_IterateContext::callback, GNUNET_CONTAINER_DLL_remove, GNUNET_free, 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(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GSF_peer_disconnect_handler(), handle_iterate_end(), hello_iter_cb(), peer_respect_cb(), queue_destroy(), and stop_peer_run().
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.
h | handle to the PEERSTORE service |
sub_system | name of sub system |
peer | Peer identity |
key | entry key string |
callback | function called with each new value |
callback_cls | closure for callback |
Definition at line 903 of file peerstore_api.c.
References GNUNET_PEERSTORE_WatchContext::callback, GNUNET_PEERSTORE_WatchContext::callback_cls, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_OK, h, GNUNET_PEERSTORE_WatchContext::h, key, StoreKeyHashMessage::keyhash, GNUNET_PEERSTORE_WatchContext::keyhash, LOG, GNUNET_ARM_Handle::mq, peer, and PEERSTORE_hash_key().
Referenced by handle_suggest(), and handle_validation_challenge().
void GNUNET_PEERSTORE_watch_cancel | ( | struct GNUNET_PEERSTORE_WatchContext * | wc | ) |
Cancel a watch request.
wc | handle to the watch request |
Definition at line 873 of file peerstore_api.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_YES, h, GNUNET_PEERSTORE_WatchContext::h, StoreKeyHashMessage::keyhash, GNUNET_PEERSTORE_WatchContext::keyhash, LOG, and GNUNET_ARM_Handle::mq.
Referenced by free_incoming_request(), and stop_peer_request().