Helper peerstore functions. More...
Go to the source code of this file.
Functions | |
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. More... | |
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. More... | |
struct GNUNET_PEERSTORE_Record * | PEERSTORE_parse_record_message (const struct StoreRecordMessage *srm) |
Parses a message carrying a record. More... | |
void | PEERSTORE_destroy_record (struct GNUNET_PEERSTORE_Record *record) |
Free any memory allocated for this record. More... | |
Helper peerstore functions.
Definition in file peerstore_common.h.
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.
Definition at line 34 of file peerstore_common.c.
References GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, key, peer, and ret.
Referenced by GNUNET_PEERSTORE_watch(), handle_watch_record(), and watch_notifier().
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.
sub_system | sub system string |
peer | Peer identity (can be NULL) |
key | record key string (can be NULL) |
value | record value BLOB (can be NULL) |
value_size | record value size in bytes (set to 0 if value is NULL) |
expiry | time after which the record expires |
options | options specific to the storage operation |
msg_type | message type to be set in header |
Definition at line 76 of file peerstore_common.c.
References dummy, StoreRecordMessage::expiry, GNUNET_assert, GNUNET_memcpy, GNUNET_MQ_msg_extra, GNUNET_NO, GNUNET_TIME_absolute_hton(), GNUNET_YES, key, StoreRecordMessage::key_size, options, StoreRecordMessage::options, StoreRecordMessage::peer, peer, StoreRecordMessage::peer_set, StoreRecordMessage::sub_system_size, value, and StoreRecordMessage::value_size.
Referenced by GNUNET_PEERSTORE_iterate(), GNUNET_PEERSTORE_store(), reconnect(), record_iterator(), and watch_notifier_it().
struct GNUNET_PEERSTORE_Record* PEERSTORE_parse_record_message | ( | const struct StoreRecordMessage * | srm | ) |
Parses a message carrying a record.
srm | the actual message |
Definition at line 123 of file peerstore_common.c.
References dummy, StoreRecordMessage::expiry, GNUNET_break, GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_strdup, GNUNET_TIME_absolute_ntoh(), GNUNET_YES, StoreRecordMessage::header, StoreRecordMessage::key_size, StoreRecordMessage::peer, StoreRecordMessage::peer_set, record(), GNUNET_MessageHeader::size, StoreRecordMessage::sub_system_size, GNUNET_PEERSTORE_Record::value_size, and StoreRecordMessage::value_size.
Referenced by check_iterate(), check_store(), handle_iterate(), handle_iterate_result(), handle_store(), and handle_watch_record().
void PEERSTORE_destroy_record | ( | struct GNUNET_PEERSTORE_Record * | record | ) |
Free any memory allocated for this record.
record |
Definition at line 176 of file peerstore_common.c.
References GNUNET_free, and record().
Referenced by check_iterate(), check_store(), handle_iterate(), handle_iterate_result(), handle_store(), handle_watch_record(), record_iterator(), and store_record_continuation().