![]() |
GNUnet
0.11.x
|
gnunet anonymity protocol implementation More...
#include "platform.h"
#include <float.h>
#include "gnunet_constants.h"
#include "gnunet_core_service.h"
#include "gnunet_dht_service.h"
#include "gnunet_datastore_service.h"
#include "gnunet_load_lib.h"
#include "gnunet_peer_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_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 instane 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_EvaluationResult 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 void | update_latencies (void *cls, const struct GNUNET_HELLO_Address *address, int active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop) |
We've received peer performance information. 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_EvaluationResult 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_EvaluationResult 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 ("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... | |
struct GNUNET_ATS_PerformanceHandle * | GSF_ats |
Handle to ATS service. 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 54 of file gnunet-service-fs.c.
Referenced by run().
#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 62 of file gnunet-service-fs.c.
Referenced by age_cover_counters(), and main_init().
#define INSANE_STATISTICS GNUNET_NO |
Collect an instane number of statistics? May cause excessive IPC.
Definition at line 68 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 340 of file gnunet-service-fs.c.
References GSF_LocalClient::client, GNUNET_new, mq, and GSF_LocalClient::mq.
Referenced by run().
|
static |
Free the given client request.
cls | the client request to free |
Definition at line 359 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_(), 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 397 of file gnunet-service-fs.c.
References client_request_destroy(), env, ClientPutMessage::expiration, gettext_noop, GNUNET_assert, GNUNET_BLOCK_EVALUATION_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_(), ClientRequest::kill_task, ClientPutMessage::last_transmission, ClientRequest::lc, GSF_LocalClient::mq, GSF_PendingRequestData::num_transmissions, ClientPutMessage::num_transmissions, pm, ClientRequest::pr, GSF_PendingRequestData::query, GSF_PendingRequestData::respect_offered, ClientPutMessage::respect_offered, GSF_PendingRequestData::type, and ClientPutMessage::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 472 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, ClientRequest::lc, res, GSF_LocalClient::res_head, and GSF_LocalClient::res_tail.
Referenced by run().
|
static |
Task that periodically ages our cover traffic statistics.
cls | unused closure |
Definition at line 512 of file gnunet-service-fs.c.
References COVER_AGE_FREQUENCY, GNUNET_SCHEDULER_add_delayed(), GSF_cover_content_count, and GSF_cover_query_count.
Referenced by 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 530 of file gnunet-service-fs.c.
References GNUNET_LOAD_update(), and GNUNET_TIME_absolute_get_duration().
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 550 of file gnunet-service-fs.c.
References GNUNET_LOAD_get_load(), GNUNET_NO, GNUNET_SYSERR, and GNUNET_YES.
Referenced by bound_priority(), and process_local_reply().
|
static |
We've received peer performance information.
Update our running average for the P2P latency.
cls | closure |
address | the address |
active | is this address in active use |
bandwidth_out | assigned outbound bandwidth for the connection |
bandwidth_in | assigned inbound bandwidth for the connection |
prop | performance data for the address (as far as known) |
Definition at line 575 of file gnunet-service-fs.c.
References GNUNET_ATS_Properties::delay, gettext_noop, GNUNET_MIN, GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_YES, GSF_update_peer_latency_(), GNUNET_HELLO_Address::peer, and GNUNET_TIME_Relative::rel_value_us.
Referenced by run().
|
static |
Check P2P "PUT" message.
cls | closure with the struct GSF_ConnectedPeer |
message | the actual message |
Definition at line 611 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 636 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 ClientRequest::pr.
Referenced by GSF_consider_forwarding().
void GSF_consider_forwarding | ( | void * | cls, |
struct GSF_PendingRequest * | pr, | ||
enum GNUNET_BLOCK_EvaluationResult | 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 669 of file gnunet-service-fs.c.
References consider_request_for_forwarding(), GNUNET_BLOCK_EVALUATION_OK_LAST, GNUNET_YES, GSF_iterate_connected_peers_(), and GSF_pending_request_test_active_().
Referenced by handle_p2p_get(), and start_p2p_processing().
|
static |
Check P2P "GET" request.
cls | closure |
gm | the actual message |
Definition at line 692 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 738 of file gnunet-service-fs.c.
References GSF_PendingRequestData::anonymity_level, GSF_LocalClient::client, GNUNET_BLOCK_EVALUATION_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_(), ClientRequest::lc, GSF_PendingRequestData::query, 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 792 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 818 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_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, GSF_PendingRequestData::type, and SearchMessage::type.
|
static |
Handle request to sign a LOC URI (from client).
cls | identification of the client |
msg | the actual message |
Definition at line 927 of file gnunet-service-fs.c.
References RequestLocSignatureMessage::chk, FileIdentifier::chk, GNUNET_FS_Uri::chk, GSF_LocalClient::client, Location::contentSignature, GNUNET_FS_Uri::data, env, RequestLocSignatureMessage::expiration_time, ResponseLocSignatureMessage::expiration_time, Location::expirationTime, FileIdentifier::file_length, RequestLocSignatureMessage::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(), ClientRequest::lc, GNUNET_FS_Uri::loc, GSF_LocalClient::mq, Location::peer, ResponseLocSignatureMessage::peer, pk, RequestLocSignatureMessage::purpose, 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 967 of file gnunet-service-fs.c.
References fn, 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 996 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(), ClientRequest::lc, 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 1022 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, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, ClientRequest::lc, IndexStartContext::lc, GSF_LocalClient::mq, msg, and signal_index_ok().
Referenced by handle_client_index_start().
|
static |
Handle INDEX_START-message.
cls | identification of the client |
message | the actual message |
Definition at line 1063 of file gnunet-service-fs.c.
References IndexStartContext::fhc, IndexStartContext::file_id, IndexStartContext::filename, fn, 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, GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, ClientRequest::lc, IndexStartContext::lc, and signal_index_ok().
|
static |
Handle INDEX_LIST_GET-message.
cls | closure |
message | the actual message |
Definition at line 1127 of file gnunet-service-fs.c.
References GSF_LocalClient::client, GNUNET_FS_indexing_send_list(), GNUNET_SERVICE_client_continue(), ClientRequest::lc, and GSF_LocalClient::mq.
|
static |
Handle UNINDEX-message.
cls | identification of the client |
message | the actual message |
Definition at line 1144 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(), ClientRequest::lc, GSF_LocalClient::mq, msg, and UnindexMessage::reserved.
|
static |
Task run during shutdown.
cls | unused |
Definition at line 1172 of file gnunet-service-fs.c.
References GNUNET_ATS_performance_done(), 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_cadet_stop_server(), GSF_connected_peer_done_(), GSF_pending_request_done_(), GSF_plan_done(), GSF_push_done_(), and GSF_put_done_().
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 1225 of file gnunet-service-fs.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_memcmp, GNUNET_SCHEDULER_shutdown(), and GSF_my_id.
Referenced by main_init().
|
static |
Process fs requests.
c | configuration to use |
Definition at line 1244 of file gnunet-service-fs.c.
References _, age_cover_counters(), COVER_AGE_FREQUENCY, 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_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 1340 of file gnunet-service-fs.c.
References cfg, client_connect_cb(), client_disconnect_cb(), FS_DHT_HT_SIZE, GNUNET_assert, GNUNET_ATS_performance_init(), 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_MESSAGE_TYPE_FS_INDEX_LIST_GET, GNUNET_MESSAGE_TYPE_FS_INDEX_START, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, GNUNET_MESSAGE_TYPE_FS_UNINDEX, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, GNUNET_STATISTICS_create(), GNUNET_TIME_UNIT_FOREVER_REL, GSF_connected_peer_init_(), GSF_datastore_queue_size, GSF_enable_randomized_delays, GSF_pending_request_init_(), GSF_plan_init(), GSF_push_init_(), GSF_put_init_(), main_init(), shutdown_task(), and update_latencies().
GNUNET_SERVICE_MAIN | ( | "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.
Referenced by run().
struct GNUNET_DATASTORE_Handle* GSF_dsh |
Our connection to the datastore.
Definition at line 224 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(), and start_local_query().
const struct GNUNET_CONFIGURATION_Handle* GSF_cfg |
Our configuration.
Definition at line 229 of file gnunet-service-fs.c.
Referenced by GSF_cadet_start_server(), GSF_connected_peer_init_(), GSF_pending_request_init_(), and GSF_push_init_().
struct GNUNET_STATISTICS_Handle* GSF_stats |
Handle for reporting statistics.
Definition at line 234 of file gnunet-service-fs.c.
Referenced by bound_priority(), cadet_reply_proc(), clean_request(), connect_cb(), consider_peer_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_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(), schedule_peer_transmission(), 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 239 of file gnunet-service-fs.c.
Referenced by GSF_dht_lookup_(), and process_dht_put_content().
struct GNUNET_LOAD_Value* GSF_rt_entry_lifetime |
How long do requests typically stay in the routing table?
Definition at line 244 of file gnunet-service-fs.c.
Referenced by handle_p2p_get(), and process_reply().
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 250 of file gnunet-service-fs.c.
Referenced by get_randomized_delay().
struct GNUNET_ATS_PerformanceHandle* GSF_ats |
Handle to ATS service.
Definition at line 255 of file gnunet-service-fs.c.
Referenced by GSF_peer_connect_handler(), retry_reservation(), and schedule_transmission().
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 268 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 273 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 279 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 285 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 290 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(), and refresh_bloomfilter().
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 296 of file gnunet-service-fs.c.
int GSF_enable_randomized_delays |
Are we introducing randomized delays for better anonymity?
Definition at line 301 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 306 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 313 of file gnunet-service-fs.c.
|
static |
Private key of this peer.
Used to sign LOC URI requests.
Definition at line 318 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 323 of file gnunet-service-fs.c.
|
static |
Datastore 'GET' load tracking.
Definition at line 328 of file gnunet-service-fs.c.