gnunet anonymity protocol implementation More...
#include "platform.h"
#include <float.h>
#include "gnunet_core_service.h"
#include "gnunet_dht_service.h"
#include "gnunet_datastore_service.h"
#include "gnunet_load_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-fs_cp.h"
#include "gnunet-service-fs_indexing.h"
#include "gnunet-service-fs_pe.h"
#include "gnunet-service-fs_pr.h"
#include "gnunet-service-fs_push.h"
#include "gnunet-service-fs_put.h"
#include "gnunet-service-fs_cadet.h"
#include "fs.h"
#include "fs_api.h"
Go to the source code of this file.
Data Structures | |
struct | ClientRequest |
Doubly-linked list of requests we are performing on behalf of the same client. More... | |
struct | ClientResponse |
Replies to be transmitted to the client. More... | |
struct | IndexStartContext |
Information we track while handling an index start request from a client. More... | |
struct | GSF_LocalClient |
A local client. More... | |
Macros | |
#define | FS_DHT_HT_SIZE 1024 |
Size for the hash map for DHT requests from the FS service. More... | |
#define | COVER_AGE_FREQUENCY |
How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are decremented by 1/16th. More... | |
#define | INSANE_STATISTICS GNUNET_NO |
Collect an instance number of statistics? May cause excessive IPC. More... | |
Functions | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) |
Creates a fresh local client handle. More... | |
static void | client_request_destroy (void *cls) |
Free the given client request. More... | |
static void | client_response_handler (void *cls, enum GNUNET_BLOCK_ReplyEvaluationResult eval, struct GSF_PendingRequest *pr, uint32_t reply_anonymity_level, struct GNUNET_TIME_Absolute expiration, struct GNUNET_TIME_Absolute last_transmission, enum GNUNET_BLOCK_Type type, const void *data, size_t data_len) |
Handle a reply to a pending request. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx) |
A client disconnected from us. More... | |
static void | age_cover_counters (void *cls) |
Task that periodically ages our cover traffic statistics. More... | |
void | GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) |
We've just now completed a datastore request. More... | |
int | GSF_test_get_load_too_high_ (uint32_t priority) |
Test if the DATABASE (GET) load on this peer is too high to even consider processing the query at all. More... | |
static int | check_p2p_put (void *cls, const struct PutMessage *put) |
Check P2P "PUT" message. More... | |
static void | consider_request_for_forwarding (void *cls, const struct GNUNET_PeerIdentity *peer, struct GSF_ConnectedPeer *cp, const struct GSF_PeerPerformanceData *ppd) |
We have a new request, consider forwarding it to the given peer. More... | |
void | GSF_consider_forwarding (void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_ReplyEvaluationResult result) |
Function to be called after we're done processing replies from the local lookup. More... | |
static int | check_p2p_get (void *cls, const struct GetMessage *gm) |
Check P2P "GET" request. More... | |
static void | start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_ReplyEvaluationResult result) |
We're done with the local lookup, now consider P2P processing (depending on request options and result status). More... | |
static int | check_client_start_search (void *cls, const struct SearchMessage *sm) |
Check GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client). More... | |
static void | handle_client_start_search (void *cls, const struct SearchMessage *sm) |
Handle GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client). More... | |
static void | handle_client_loc_sign (void *cls, const struct RequestLocSignatureMessage *msg) |
Handle request to sign a LOC URI (from client). More... | |
static int | check_client_index_start (void *cls, const struct IndexStartMessage *ism) |
Check INDEX_START-message. More... | |
static void | signal_index_ok (struct IndexStartContext *isc) |
We've validated the hash of the file we're about to index. More... | |
static void | hash_for_index_val (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over an indexed file has completed. More... | |
static void | handle_client_index_start (void *cls, const struct IndexStartMessage *ism) |
Handle INDEX_START-message. More... | |
static void | handle_client_index_list_get (void *cls, const struct GNUNET_MessageHeader *message) |
Handle INDEX_LIST_GET-message. More... | |
static void | handle_client_unindex (void *cls, const struct UnindexMessage *um) |
Handle UNINDEX-message. More... | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | peer_init_handler (void *cls, const struct GNUNET_PeerIdentity *my_identity) |
Function called after GNUNET_CORE_connect has succeeded (or failed for good). More... | |
static int | main_init (const struct GNUNET_CONFIGURATION_Handle *c) |
Process fs requests. More... | |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service) |
Process fs requests. More... | |
GNUNET_SERVICE_MAIN (GNUNET_OS_project_data_gnunet(), "fs", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(client_index_start, GNUNET_MESSAGE_TYPE_FS_INDEX_START, struct IndexStartMessage, NULL), GNUNET_MQ_hd_fixed_size(client_index_list_get, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(client_unindex, GNUNET_MESSAGE_TYPE_FS_UNINDEX, struct UnindexMessage, NULL), GNUNET_MQ_hd_var_size(client_start_search, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, struct SearchMessage, NULL), GNUNET_MQ_hd_fixed_size(client_loc_sign, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, struct RequestLocSignatureMessage, NULL), GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
struct GNUNET_DATASTORE_Handle * | GSF_dsh |
Our connection to the datastore. More... | |
const struct GNUNET_CONFIGURATION_Handle * | GSF_cfg |
Our configuration. More... | |
struct GNUNET_STATISTICS_Handle * | GSF_stats |
Handle for reporting statistics. More... | |
struct GNUNET_DHT_Handle * | GSF_dht |
Handle for DHT operations. More... | |
struct GNUNET_LOAD_Value * | GSF_rt_entry_lifetime |
How long do requests typically stay in the routing table? More... | |
struct GNUNET_TIME_Relative | GSF_avg_latency = { 500 } |
Running average of the observed latency to other peers (round trip). More... | |
double | GSF_current_priorities |
Typical priorities we're seeing from other peers right now. More... | |
unsigned int | GSF_datastore_queue_size |
Size of the datastore queue we assume for common requests. More... | |
unsigned int | GSF_cover_query_count |
How many query messages have we received 'recently' that have not yet been claimed as cover traffic? More... | |
unsigned int | GSF_cover_content_count |
How many content messages have we received 'recently' that have not yet been claimed as cover traffic? More... | |
struct GNUNET_BLOCK_Context * | GSF_block_ctx |
Our block context. More... | |
struct GNUNET_CORE_Handle * | GSF_core |
Pointer to handle to the core service (points to NULL until we've connected to it). More... | |
int | GSF_enable_randomized_delays |
Are we introducing randomized delays for better anonymity? More... | |
struct GNUNET_PeerIdentity | GSF_my_id |
Identity of this peer. More... | |
static struct GNUNET_CONFIGURATION_Handle * | block_cfg |
Configuration for block library. More... | |
static struct GNUNET_CRYPTO_EddsaPrivateKey | pk |
Private key of this peer. More... | |
static struct GNUNET_SCHEDULER_Task * | cover_age_task |
ID of our task that we use to age the cover counters. More... | |
static struct GNUNET_LOAD_Value * | datastore_get_load |
Datastore 'GET' load tracking. More... | |
gnunet anonymity protocol implementation
Definition in file gnunet-service-fs.c.
#define FS_DHT_HT_SIZE 1024 |
Size for the hash map for DHT requests from the FS service.
Should be about the number of concurrent DHT requests we plan to make.
Definition at line 51 of file gnunet-service-fs.c.
#define COVER_AGE_FREQUENCY |
How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are decremented by 1/16th.
Definition at line 59 of file gnunet-service-fs.c.
#define INSANE_STATISTICS GNUNET_NO |
Collect an instance number of statistics? May cause excessive IPC.
Definition at line 65 of file gnunet-service-fs.c.
|
static |
Creates a fresh local client handle.
cls | NULL |
client | handle of the client |
mq | message queue for client |
Definition at line 332 of file gnunet-service-fs.c.
References GSF_LocalClient::client, GNUNET_new, mq, and GSF_LocalClient::mq.
|
static |
Free the given client request.
cls | the client request to free |
Definition at line 351 of file gnunet-service-fs.c.
References GSF_LocalClient::cr_head, GSF_LocalClient::cr_tail, gettext_noop, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GSF_pending_request_cancel_(), GSF_stats, ClientRequest::kill_task, ClientRequest::lc, and ClientRequest::pr.
Referenced by client_disconnect_cb(), and client_response_handler().
|
static |
Handle a reply to a pending request.
Also called if a request expires (then with data == NULL). The handler may be called many times (depending on the request type), but will not be called during or after a call to #GSF_pending_request_cancel() and will also not be called anymore after a call signalling expiration.
cls | user-specified closure |
eval | evaluation of the result |
pr | handle to the original pending request |
reply_anonymity_level | anonymity level for the reply, UINT32_MAX for "unknown" |
expiration | when does data expire? |
last_transmission | when was the last time we've tried to download this block? (FOREVER if unknown) |
type | type of the block |
data | response data, NULL on request expiration |
data_len | number of bytes in data |
Definition at line 389 of file gnunet-service-fs.c.
References client_request_destroy(), data, env, expiration, gettext_noop, GNUNET_assert, GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_BLOCK_TYPE_ANY, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_FS_PUT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), GSF_pending_request_get_data_(), GSF_stats, ClientRequest::kill_task, ClientRequest::lc, GSF_LocalClient::mq, GSF_PendingRequestData::num_transmissions, pm, ClientRequest::pr, GSF_PendingRequestData::query, GSF_PendingRequestData::respect_offered, type, and GSF_PendingRequestData::type.
Referenced by handle_client_start_search().
|
static |
A client disconnected from us.
Tear down the local client record.
cls | unused |
client | handle of the client |
app_ctx | the struct GSF_LocalClient |
Definition at line 464 of file gnunet-service-fs.c.
References client_request_destroy(), GSF_LocalClient::cr_head, IndexStartContext::fhc, GNUNET_CONTAINER_DLL_remove, GNUNET_CRYPTO_hash_file_cancel(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, ClientRequest::kill_task, ClientResponse::lc, res, GSF_LocalClient::res_head, and GSF_LocalClient::res_tail.
|
static |
Task that periodically ages our cover traffic statistics.
cls | unused closure |
Definition at line 504 of file gnunet-service-fs.c.
References age_cover_counters(), COVER_AGE_FREQUENCY, cover_age_task, GNUNET_SCHEDULER_add_delayed(), GSF_cover_content_count, and GSF_cover_query_count.
Referenced by age_cover_counters(), and main_init().
void GSF_update_datastore_delay_ | ( | struct GNUNET_TIME_Absolute | start | ) |
We've just now completed a datastore request.
Update our datastore load calculations.
start | time when the datastore request was issued |
Definition at line 522 of file gnunet-service-fs.c.
References datastore_get_load, GNUNET_LOAD_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_Relative::rel_value_us, and start.
Referenced by process_local_reply().
int GSF_test_get_load_too_high_ | ( | uint32_t | priority | ) |
Test if the DATABASE (GET) load on this peer is too high to even consider processing the query at all.
priority | priority of the request (used as a reference point to compare with the load) |
Definition at line 542 of file gnunet-service-fs.c.
References datastore_get_load, GNUNET_LOAD_get_load(), GNUNET_NO, GNUNET_SYSERR, and GNUNET_YES.
Referenced by bound_priority(), and process_local_reply().
|
static |
Check P2P "PUT" message.
cls | closure with the struct GSF_ConnectedPeer |
put | the actual message |
Definition at line 564 of file gnunet-service-fs.c.
References GNUNET_BLOCK_TYPE_FS_ONDEMAND, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, type, and PutMessage::type.
|
static |
We have a new request, consider forwarding it to the given peer.
cls | the struct GSF_PendingRequest |
peer | identity of the peer |
cp | handle to the connected peer record |
ppd | peer performance data |
Definition at line 589 of file gnunet-service-fs.c.
References gettext_noop, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GSF_pending_request_test_target_(), GSF_plan_add_(), and GSF_stats.
Referenced by GSF_consider_forwarding().
void GSF_consider_forwarding | ( | void * | cls, |
struct GSF_PendingRequest * | pr, | ||
enum GNUNET_BLOCK_ReplyEvaluationResult | result | ||
) |
Function to be called after we're done processing replies from the local lookup.
If the result status code indicates that there may be more replies, plan forwarding the request.
cls | closure (NULL) |
pr | the pending request we were processing |
result | final datastore lookup result |
Definition at line 622 of file gnunet-service-fs.c.
References consider_request_for_forwarding(), GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_YES, GSF_iterate_connected_peers_(), GSF_pending_request_test_active_(), and result.
Referenced by handle_p2p_get(), and start_p2p_processing().
|
static |
Check P2P "GET" request.
cls | closure |
gm | the actual message |
Definition at line 645 of file gnunet-service-fs.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GetMessage::hash_bitmap, GetMessage::header, and GNUNET_MessageHeader::size.
|
static |
We're done with the local lookup, now consider P2P processing (depending on request options and result status).
Also signal that we can now receive more request information from the client.
cls | the client doing the request (struct GSF_LocalClient ) |
pr | the pending request we were processing |
result | final datastore lookup result |
Definition at line 691 of file gnunet-service-fs.c.
References GSF_PendingRequestData::anonymity_level, GSF_LocalClient::client, GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_BLOCK_TYPE_FS_DBLOCK, GNUNET_BLOCK_TYPE_FS_IBLOCK, GNUNET_BLOCK_TYPE_FS_UBLOCK, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_SERVICE_client_continue(), GSF_cadet_lookup_(), GSF_consider_forwarding(), GSF_dht_lookup_(), GSF_pending_request_get_data_(), GSF_PendingRequestData::query, result, and GSF_PendingRequestData::type.
Referenced by handle_client_start_search().
|
static |
Check GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).
cls | identification of the client |
sm | the actual message |
Definition at line 745 of file gnunet-service-fs.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, SearchMessage::header, and GNUNET_MessageHeader::size.
|
static |
Handle GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).
Responsible for creating the request entry itself and setting up reply callback and cancellation on client disconnect.
cls | identification of the client |
sm | the actual message |
Definition at line 771 of file gnunet-service-fs.c.
References SearchMessage::anonymity_level, GSF_LocalClient::client, client_response_handler(), GSF_LocalClient::cr_head, GSF_LocalClient::cr_tail, gettext_noop, GNUNET_BLOCK_TYPE_ANY, GNUNET_BLOCK_TYPE_FS_UBLOCK, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_YES, GSF_local_lookup_(), GSF_pending_request_create_(), GSF_pending_request_get_data_(), GSF_pending_request_update_(), GSF_PRO_LOCAL_ONLY, GSF_PRO_LOCAL_REQUEST, GSF_stats, GSF_PendingRequestData::has_started, SearchMessage::header, ClientRequest::lc, ClientRequest::next, options, SearchMessage::options, ClientRequest::pr, SearchMessage::query, GSF_PendingRequestData::query, sc, SEARCH_MESSAGE_OPTION_CONTINUED, SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY, GNUNET_MessageHeader::size, start_p2p_processing(), SearchMessage::target, type, SearchMessage::type, and GSF_PendingRequestData::type.
|
static |
Handle request to sign a LOC URI (from client).
cls | identification of the client |
msg | the actual message |
Definition at line 880 of file gnunet-service-fs.c.
References FileIdentifier::chk, GNUNET_FS_Uri::chk, GSF_LocalClient::client, Location::contentSignature, GNUNET_FS_Uri::data, env, ResponseLocSignatureMessage::expiration_time, Location::expirationTime, FileIdentifier::file_length, GNUNET_break, GNUNET_FS_URI_CHK, GNUNET_FS_uri_destroy(), GNUNET_FS_uri_loc_create(), GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_ntohll(), GNUNET_SERVICE_client_continue(), GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_ntoh(), GNUNET_FS_Uri::loc, GSF_LocalClient::mq, msg, ResponseLocSignatureMessage::peer, Location::peer, pk, ResponseLocSignatureMessage::purpose, ResponseLocSignatureMessage::signature, and GNUNET_FS_Uri::type.
|
static |
Check INDEX_START-message.
cls | identification of the client |
ism | the actual message |
Definition at line 920 of file gnunet-service-fs.c.
References GNUNET_break, GNUNET_free, GNUNET_MQ_check_zero_termination, GNUNET_OK, GNUNET_STRINGS_filename_expand(), GNUNET_SYSERR, and IndexStartMessage::reserved.
|
static |
We've validated the hash of the file we're about to index.
Signal success to the client and update our internal data structures.
isc | the data about the index info entry for the request |
Definition at line 949 of file gnunet-service-fs.c.
References GSF_LocalClient::client, env, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_free, GNUNET_FS_add_to_index(), GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), IndexStartContext::lc, GSF_LocalClient::mq, and msg.
Referenced by handle_client_index_start(), and hash_for_index_val().
|
static |
Function called once the hash computation over an indexed file has completed.
cls | closure, our publishing context |
res | resulting hash, NULL on error |
Definition at line 975 of file gnunet-service-fs.c.
References _, GSF_LocalClient::client, env, IndexStartContext::fhc, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, IndexStartContext::lc, GSF_LocalClient::mq, msg, res, and signal_index_ok().
Referenced by handle_client_index_start().
|
static |
Handle INDEX_START-message.
cls | identification of the client |
ism | the actual message |
Definition at line 1022 of file gnunet-service-fs.c.
References IndexStartMessage::device, IndexStartContext::fhc, IndexStartMessage::file_id, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_hash_file(), GNUNET_DISK_file_get_identifiers(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_OK, GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_STRINGS_filename_expand(), hash_for_index_val(), HASHING_BLOCKSIZE, IndexStartMessage::inode, GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, IndexStartContext::lc, and signal_index_ok().
|
static |
Handle INDEX_LIST_GET-message.
cls | closure |
message | the actual message |
Definition at line 1086 of file gnunet-service-fs.c.
References GSF_LocalClient::client, GNUNET_FS_indexing_send_list(), GNUNET_SERVICE_client_continue(), and GSF_LocalClient::mq.
|
static |
Handle UNINDEX-message.
cls | identification of the client |
um | the actual message |
Definition at line 1103 of file gnunet-service-fs.c.
References GSF_LocalClient::client, env, UnindexMessage::file_id, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_indexing_do_unindex(), GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GSF_LocalClient::mq, msg, and UnindexMessage::reserved.
|
static |
Task run during shutdown.
cls | unused |
Definition at line 1131 of file gnunet-service-fs.c.
References block_cfg, cover_age_task, datastore_get_load, GNUNET_BLOCK_context_destroy(), GNUNET_CONFIGURATION_destroy(), GNUNET_CORE_disconnect(), GNUNET_DATASTORE_disconnect(), GNUNET_DHT_disconnect(), GNUNET_FS_indexing_done(), GNUNET_LOAD_value_free, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), GSF_block_ctx, GSF_cadet_stop_server(), GSF_connected_peer_done_(), GSF_core, GSF_dht, GSF_dsh, GSF_pending_request_done_(), GSF_plan_done(), GSF_push_done_(), GSF_put_done_(), GSF_rt_entry_lifetime, and GSF_stats.
Referenced by main_init(), and run().
|
static |
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
Note that the private key of the peer is intentionally not exposed here; if you need it, your process should try to read the private key file directly (which should work if you are authorized...).
cls | closure |
my_identity | ID of this peer, NULL if we failed |
Definition at line 1179 of file gnunet-service-fs.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_memcmp, GNUNET_SCHEDULER_shutdown(), GSF_my_id, and my_identity.
Referenced by main_init().
|
static |
Process fs requests.
c | configuration to use |
Definition at line 1198 of file gnunet-service-fs.c.
References _, age_cover_counters(), COVER_AGE_FREQUENCY, cover_age_task, datastore_get_load, DATASTORE_LOAD_AUTODECLINE, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CORE_connect(), GNUNET_CRYPTO_eddsa_key_from_file(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s(), GNUNET_LOAD_value_init(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_GET, GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, GNUNET_MESSAGE_TYPE_FS_PUT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_YES, GSF_cadet_start_server(), GSF_cfg, GSF_core, GSF_my_id, GSF_peer_connect_handler(), GSF_peer_disconnect_handler(), peer_init_handler(), pk, GNUNET_PeerIdentity::public_key, and shutdown_task().
Referenced by run().
|
static |
Process fs requests.
cls | closure |
cfg | configuration to use |
service | the initialized service |
Definition at line 1295 of file gnunet-service-fs.c.
References block_cfg, cfg, FS_DHT_HT_SIZE, GNUNET_assert, GNUNET_BLOCK_context_create(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_get_value_size(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_DATASTORE_connect(), GNUNET_DHT_connect(), GNUNET_ERROR_TYPE_INFO, GNUNET_FS_indexing_init(), GNUNET_LOAD_value_init(), GNUNET_log_config_missing(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_TIME_UNIT_FOREVER_REL, GSF_block_ctx, GSF_cfg, GSF_connected_peer_init_(), GSF_datastore_queue_size, GSF_dht, GSF_dsh, GSF_enable_randomized_delays, GSF_pending_request_init_(), GSF_plan_init(), GSF_push_init_(), GSF_put_init_(), GSF_rt_entry_lifetime, GSF_stats, consensus-simulation::int, main_init(), and shutdown_task().
GNUNET_SERVICE_MAIN | ( | GNUNET_OS_project_data_gnunet() | , |
"fs" | , | ||
GNUNET_SERVICE_OPTION_NONE | , | ||
& | run, | ||
& | client_connect_cb, | ||
& | client_disconnect_cb, | ||
NULL | , | ||
GNUNET_MQ_hd_var_size(client_index_start, GNUNET_MESSAGE_TYPE_FS_INDEX_START, struct IndexStartMessage, NULL) | , | ||
GNUNET_MQ_hd_fixed_size(client_index_list_get, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, struct GNUNET_MessageHeader, NULL) | , | ||
GNUNET_MQ_hd_fixed_size(client_unindex, GNUNET_MESSAGE_TYPE_FS_UNINDEX, struct UnindexMessage, NULL) | , | ||
GNUNET_MQ_hd_var_size(client_start_search, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, struct SearchMessage, NULL) | , | ||
GNUNET_MQ_hd_fixed_size(client_loc_sign, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, struct RequestLocSignatureMessage, NULL) | , | ||
GNUNET_MQ_handler_end() | |||
) |
Define "main" method using service macro.
struct GNUNET_DATASTORE_Handle* GSF_dsh |
Our connection to the datastore.
Definition at line 221 of file gnunet-service-fs.c.
Referenced by consider_gathering(), gather_dht_put_blocks(), gather_migration_blocks(), handle_dht_reply(), handle_p2p_put(), handle_request(), process_local_reply(), run(), shutdown_task(), and start_local_query().
const struct GNUNET_CONFIGURATION_Handle* GSF_cfg |
Our configuration.
Definition at line 226 of file gnunet-service-fs.c.
Referenced by GSF_cadet_start_server(), GSF_connected_peer_init_(), GSF_pending_request_init_(), GSF_push_init_(), main_init(), and run().
struct GNUNET_STATISTICS_Handle* GSF_stats |
Handle for reporting statistics.
Definition at line 231 of file gnunet-service-fs.c.
Referenced by bound_priority(), cadet_reply_proc(), clean_request(), client_request_destroy(), client_response_handler(), connect_cb(), consider_peer_for_forwarding(), consider_request_for_forwarding(), disconnect_cb(), free_pending_request(), get_randomized_delay(), GNUNET_FS_handle_on_demand_block(), GSF_block_peer_migration_(), GSF_local_lookup_(), GSF_peer_connect_handler(), GSF_peer_disconnect_handler(), GSF_pending_request_create_(), GSF_plan_add_(), GSF_plan_notify_peer_disconnect_(), GSF_plan_notify_request_done_(), handle_client_start_search(), handle_datastore_reply(), handle_dht_reply(), handle_p2p_get(), handle_p2p_migration_stop(), handle_p2p_put(), handle_p2p_reply(), handle_reply(), handle_request(), merge_pr(), no_more_local_results(), plan(), process_local_reply(), process_reply(), put_migration_continuation(), run(), schedule_peer_transmission(), shutdown_task(), start_local_query(), test_exist_cb(), and test_put_load_too_high().
struct GNUNET_DHT_Handle* GSF_dht |
Handle for DHT operations.
Definition at line 236 of file gnunet-service-fs.c.
Referenced by GSF_dht_lookup_(), process_dht_put_content(), run(), and shutdown_task().
struct GNUNET_LOAD_Value* GSF_rt_entry_lifetime |
How long do requests typically stay in the routing table?
Definition at line 241 of file gnunet-service-fs.c.
Referenced by handle_p2p_get(), process_reply(), run(), and shutdown_task().
struct GNUNET_TIME_Relative GSF_avg_latency = { 500 } |
Running average of the observed latency to other peers (round trip).
Initialized to 5s as the initial default.
Definition at line 247 of file gnunet-service-fs.c.
Referenced by get_randomized_delay().
double GSF_current_priorities |
Typical priorities we're seeing from other peers right now.
Since most priorities will be zero, this value is the weighted average of non-zero priorities seen "recently". In order to ensure that new values do not dramatically change the ratio, values are first "capped" to a reasonable range (+N of the current value) and then averaged into the existing value by a ratio of 1:N. Hence receiving the largest possible priority can still only raise our "current_priorities" by at most 1.
Definition at line 260 of file gnunet-service-fs.c.
Referenced by bound_priority(), and plan().
unsigned int GSF_datastore_queue_size |
Size of the datastore queue we assume for common requests.
Definition at line 265 of file gnunet-service-fs.c.
Referenced by handle_request(), run(), and start_local_query().
unsigned int GSF_cover_query_count |
How many query messages have we received 'recently' that have not yet been claimed as cover traffic?
Definition at line 271 of file gnunet-service-fs.c.
Referenced by age_cover_counters(), and handle_p2p_get().
unsigned int GSF_cover_content_count |
How many content messages have we received 'recently' that have not yet been claimed as cover traffic?
Definition at line 277 of file gnunet-service-fs.c.
Referenced by age_cover_counters(), handle_p2p_put(), and handle_p2p_reply().
struct GNUNET_BLOCK_Context* GSF_block_ctx |
Our block context.
Definition at line 282 of file gnunet-service-fs.c.
Referenced by cadet_reply_proc(), GSF_pending_request_create_(), handle_p2p_put(), handle_reply(), process_local_reply(), process_reply(), refresh_bloomfilter(), run(), and shutdown_task().
struct GNUNET_CORE_Handle* GSF_core |
Pointer to handle to the core service (points to NULL until we've connected to it).
Definition at line 288 of file gnunet-service-fs.c.
Referenced by main_init(), and shutdown_task().
int GSF_enable_randomized_delays |
Are we introducing randomized delays for better anonymity?
Definition at line 293 of file gnunet-service-fs.c.
Referenced by handle_p2p_reply(), and run().
struct GNUNET_PeerIdentity GSF_my_id |
Identity of this peer.
Definition at line 298 of file gnunet-service-fs.c.
Referenced by GSF_peer_connect_handler(), main_init(), and peer_init_handler().
|
static |
Configuration for block library.
Definition at line 305 of file gnunet-service-fs.c.
Referenced by run(), and shutdown_task().
|
static |
Private key of this peer.
Used to sign LOC URI requests.
Definition at line 310 of file gnunet-service-fs.c.
Referenced by handle_client_loc_sign(), and main_init().
|
static |
ID of our task that we use to age the cover counters.
Definition at line 315 of file gnunet-service-fs.c.
Referenced by age_cover_counters(), main_init(), and shutdown_task().
|
static |
Datastore 'GET' load tracking.
Definition at line 320 of file gnunet-service-fs.c.
Referenced by GSF_test_get_load_too_high_(), GSF_update_datastore_delay_(), main_init(), and shutdown_task().