Helper functions for DHT. More...
#include "gnunet_constants.h"
#include "gnunet_common.h"
#include "gnunet_signatures.h"
#include "gnunet_dht_service.h"
#include "gnunet_time_lib.h"
#include "gnunet_util_lib.h"
#include "dht.h"
#include "dht_helper.h"
Go to the source code of this file.
Functions | |
enum GNUNET_GenericReturnValue | GDS_helper_put_message_get_size (size_t *msize_out, const struct GNUNET_PeerIdentity *my_identity, enum GNUNET_DHT_RouteOption ro_in, enum GNUNET_DHT_RouteOption *ro_out, struct GNUNET_TIME_Absolute block_expiration_time, const uint8_t *block_data, size_t block_data_len, const struct GNUNET_DHT_PathElement *put_path_in, unsigned int put_path_len_in, unsigned int *put_path_len_out, const struct GNUNET_PeerIdentity *trunc_peer, struct GNUNET_PeerIdentity *trunc_peer_out, bool *truncated) |
void | GDS_helper_sign_path (const void *data, size_t data_size, const struct GNUNET_CRYPTO_EddsaPrivateKey *sk, struct GNUNET_TIME_Absolute exp_time, const struct GNUNET_PeerIdentity *pred, const struct GNUNET_PeerIdentity *succ, struct GNUNET_CRYPTO_EddsaSignature *sig) |
Sign that we are routing a message from pred to succ. More... | |
void | GDS_helper_make_put_message (struct PeerPutMessage *ppm, size_t msize, const struct GNUNET_CRYPTO_EddsaPrivateKey *sk, const struct GNUNET_PeerIdentity *target, const struct GNUNET_HashCode *target_hash, const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *block_key, enum GNUNET_DHT_RouteOption ro, enum GNUNET_BLOCK_Type block_type, struct GNUNET_TIME_Absolute block_expiration_time, const uint8_t *block_data, size_t block_data_len, const struct GNUNET_DHT_PathElement *put_path, unsigned int put_path_len, size_t hop_count, uint32_t desired_replication_level, const struct GNUNET_PeerIdentity *trunc_peer) |
Helper functions for DHT.
Definition in file dht_helper.c.
enum GNUNET_GenericReturnValue GDS_helper_put_message_get_size | ( | size_t * | msize_out, |
const struct GNUNET_PeerIdentity * | my_identity, | ||
enum GNUNET_DHT_RouteOption | ro_in, | ||
enum GNUNET_DHT_RouteOption * | ro_out, | ||
struct GNUNET_TIME_Absolute | block_expiration_time, | ||
const uint8_t * | block_data, | ||
size_t | block_data_len, | ||
const struct GNUNET_DHT_PathElement * | put_path_in, | ||
unsigned int | put_path_len_in, | ||
unsigned int * | put_path_len_out, | ||
const struct GNUNET_PeerIdentity * | trunc_peer, | ||
struct GNUNET_PeerIdentity * | trunc_peer_out, | ||
bool * | truncated | ||
) |
Definition at line 36 of file dht_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_break_op, GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE, GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_DHT_RO_TRUNCATED, GNUNET_DHT_verify_path(), GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, my_identity, and GNUNET_DHT_PathElement::pred.
Referenced by GDS_NEIGHBOURS_handle_put(), and run().
void GDS_helper_sign_path | ( | const void * | data, |
size_t | data_size, | ||
const struct GNUNET_CRYPTO_EddsaPrivateKey * | sk, | ||
struct GNUNET_TIME_Absolute | exp_time, | ||
const struct GNUNET_PeerIdentity * | pred, | ||
const struct GNUNET_PeerIdentity * | succ, | ||
struct GNUNET_CRYPTO_EddsaSignature * | sig | ||
) |
Sign that we are routing a message from pred to succ.
(So the route is $PRED->us->$SUCC).
data | payload (the block) | |
data_size | number of bytes in data | |
exp_time | expiration time of data | |
pred | predecessor peer ID | |
succ | successor peer ID | |
[out] | sig | where to write the signature (of purpose #GNUNET_SIGNATURE_PURPOSE_DHT_PUT_HOP) |
Definition at line 151 of file dht_helper.c.
References data, data_size, GNUNET_CRYPTO_eddsa_sign, GNUNET_CRYPTO_hash(), GNUNET_SIGNATURE_PURPOSE_DHT_HOP, GNUNET_TIME_absolute_hton(), GNUNET_DHT_HopSignature::h_data, GNUNET_DHT_HopSignature::pred, GNUNET_CRYPTO_EccSignaturePurpose::purpose, GNUNET_DHT_HopSignature::purpose, and GNUNET_DHT_HopSignature::succ.
Referenced by GDS_helper_make_put_message(), and GDS_NEIGHBOURS_handle_reply().
void GDS_helper_make_put_message | ( | struct PeerPutMessage * | ppm, |
size_t | msize, | ||
const struct GNUNET_CRYPTO_EddsaPrivateKey * | sk, | ||
const struct GNUNET_PeerIdentity * | target, | ||
const struct GNUNET_HashCode * | target_hash, | ||
const struct GNUNET_CONTAINER_BloomFilter * | bf, | ||
const struct GNUNET_HashCode * | block_key, | ||
enum GNUNET_DHT_RouteOption | ro, | ||
enum GNUNET_BLOCK_Type | block_type, | ||
struct GNUNET_TIME_Absolute | block_expiration_time, | ||
const uint8_t * | block_data, | ||
size_t | block_data_len, | ||
const struct GNUNET_DHT_PathElement * | put_path, | ||
unsigned int | put_path_len, | ||
size_t | hop_count, | ||
uint32_t | desired_replication_level, | ||
const struct GNUNET_PeerIdentity * | trunc_peer | ||
) |
Definition at line 178 of file dht_helper.c.
References block_type, PeerPutMessage::bloomfilter, data, PeerPutMessage::desired_replication_level, DHT_BLOOM_SIZE, PeerPutMessage::expiration_time, GDS_helper_sign_path(), GNUNET_assert, GNUNET_B2S, GNUNET_break, GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_test(), GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_DHT_RO_TRUNCATED, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_DHT_P2P_PUT, GNUNET_OK, GNUNET_TIME_absolute_hton(), GNUNET_YES, PeerPutMessage::header, PeerPutMessage::hop_count, PeerPutMessage::key, PeerPutMessage::options, PeerPutMessage::put_path_length, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and PeerPutMessage::type.
Referenced by GDS_NEIGHBOURS_handle_put(), and run().