Helper functions for DHT. More...
#include "gnunet-service-dht.h"#include "gnunet_constants.h"#include "gnunet_common.h"#include "gnunet_signatures.h"#include "gnunet_dht_service.h"#include "gnunet_pils_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.
Data Structures | |
| struct | GDS_HelperOperation |
| struct | GDS_HelperMsgData |
Functions | |
| static void | cleanup_helper_operation (struct GDS_HelperOperation *op, bool free_data) |
| void | GDS_helper_cleanup_operations (void) |
| 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) |
| static void | cb_sign_result (void *cls, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
| bool | 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, GDS_HelperCallback cb, size_t cb_data_size, void *cb_data) |
| Sign that we are routing a message from pred to succ. | |
| static bool | cb_path_signed (void *cls, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
| bool | 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, GDS_HelperMsgCallback cb, size_t cb_data_size, void *cb_data) |
Variables | |
| static struct GDS_HelperOperation * | op_head |
| static struct GDS_HelperOperation * | op_tail |
Helper functions for DHT.
Definition in file dht_helper.c.
|
static |
Definition at line 68 of file dht_helper.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PILS_cancel(), op, op_head, and op_tail.
Referenced by cb_sign_result(), GDS_helper_cleanup_operations(), and GDS_helper_sign_path().
| void GDS_helper_cleanup_operations | ( | void | ) |
Definition at line 81 of file dht_helper.c.
References cleanup_helper_operation(), op, and op_head.
Referenced by run(), and shutdown_task().
| 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 96 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 print_put_message().
|
static |
Definition at line 211 of file dht_helper.c.
References cleanup_helper_operation(), and op.
Referenced by GDS_helper_sign_path().
| bool 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, | ||
| GDS_HelperCallback | cb, | ||
| size_t | cb_data_size, | ||
| void * | cb_data | ||
| ) |
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 226 of file dht_helper.c.
References GDS_HelperOperation::cb, GDS_HelperOperation::cb_data, cb_sign_result(), cleanup_helper_operation(), data, data_size, GDS_pils, GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_eddsa_sign, GNUNET_CRYPTO_hash(), GNUNET_memdup, GNUNET_new, GNUNET_PILS_sign_by_peer_identity(), GNUNET_SIGNATURE_PURPOSE_DHT_HOP, GNUNET_TIME_absolute_hton(), GNUNET_DHT_HopSignature::h_data, op, op_head, op_tail, GNUNET_DHT_HopSignature::pred, GNUNET_CRYPTO_SignaturePurpose::purpose, GNUNET_DHT_HopSignature::purpose, and GNUNET_DHT_HopSignature::succ.
Referenced by GDS_helper_make_put_message(), and GDS_NEIGHBOURS_handle_reply().
|
static |
Definition at line 292 of file dht_helper.c.
References GDS_HelperMsgData::cb, GDS_HelperMsgData::cb_data, GNUNET_B2S, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GDS_HelperMsgData::heap, GDS_HelperMsgData::heap_msg, GDS_HelperMsgData::msize, GDS_HelperMsgData::ppm, PeerPutMessage::put_path_length, and GDS_HelperMsgData::sig.
Referenced by GDS_helper_make_put_message().
| bool 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, | ||
| GDS_HelperMsgCallback | cb, | ||
| size_t | cb_data_size, | ||
| void * | cb_data | ||
| ) |
Definition at line 326 of file dht_helper.c.
References block_type, PeerPutMessage::bloomfilter, GDS_HelperMsgData::cb, GDS_HelperMsgData::cb_data, cb_path_signed(), data, PeerPutMessage::desired_replication_level, DHT_BLOOM_SIZE, PeerPutMessage::expiration_time, GDS_helper_sign_path(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_test(), GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_DHT_RO_TRUNCATED, GNUNET_memcpy, GNUNET_memdup, GNUNET_MESSAGE_TYPE_DHT_P2P_PUT, GNUNET_OK, GNUNET_TIME_absolute_hton(), GNUNET_YES, PeerPutMessage::header, GDS_HelperMsgData::heap, GDS_HelperMsgData::heap_msg, PeerPutMessage::hop_count, PeerPutMessage::key, GDS_HelperMsgData::msize, PeerPutMessage::options, GDS_HelperMsgData::ppm, GNUNET_DHT_PathElement::pred, PeerPutMessage::put_path_length, GDS_HelperMsgData::sig, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and PeerPutMessage::type.
Referenced by GDS_NEIGHBOURS_handle_put(), and print_put_message().
|
static |
Definition at line 50 of file dht_helper.c.
Referenced by cleanup_helper_operation(), GDS_helper_cleanup_operations(), and GDS_helper_sign_path().
|
static |
Definition at line 51 of file dht_helper.c.
Referenced by cleanup_helper_operation(), and GDS_helper_sign_path().