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 (uint32_t rid, 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 PeerstoreRecordMessage *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.c.
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 33 of file peerstore_common.c.
References GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, key, and ret.
struct GNUNET_MQ_Envelope * PEERSTORE_create_record_mq_envelope | ( | uint32_t | rid, |
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.
rid | request ID |
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 62 of file peerstore_common.c.
References dummy, PeerstoreRecordMessage::expiry, GNUNET_assert, GNUNET_memcpy, GNUNET_MQ_msg_extra, GNUNET_TIME_absolute_hton(), key, PeerstoreRecordMessage::key_size, options, PeerstoreRecordMessage::options, PeerstoreRecordMessage::peer, PeerstoreRecordMessage::rid, PeerstoreRecordMessage::sub_system_size, value, and PeerstoreRecordMessage::value_size.
Referenced by GNUNET_PEERSTORE_store(), iterate_proc(), monitor_iterate_cb(), and watch_notifier().
struct GNUNET_PEERSTORE_Record * PEERSTORE_parse_record_message | ( | const struct PeerstoreRecordMessage * | srm | ) |
Parses a message carrying a record.
srm | the actual message |
Definition at line 106 of file peerstore_common.c.
References dummy, PeerstoreRecordMessage::expiry, GNUNET_break, GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_strdup, GNUNET_TIME_absolute_ntoh(), PeerstoreRecordMessage::header, PeerstoreRecordMessage::key_size, PeerstoreRecordMessage::peer, record(), GNUNET_MessageHeader::size, PeerstoreRecordMessage::sub_system_size, GNUNET_PEERSTORE_Record::value_size, and PeerstoreRecordMessage::value_size.
Referenced by check_store(), handle_iterate_result(), handle_result(), and handle_store().
void PEERSTORE_destroy_record | ( | struct GNUNET_PEERSTORE_Record * | record | ) |
Free any memory allocated for this record.
record |
Definition at line 156 of file peerstore_common.c.
References GNUNET_free, and record().
Referenced by check_store(), handle_iterate_result(), handle_result(), handle_store(), and store_record_continuation().