GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-service-fs.c File Reference

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"
Include dependency graph for gnunet-service-fs.c:

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   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
 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_HandleGSF_dsh
 Our connection to the datastore. More...
 
const struct GNUNET_CONFIGURATION_HandleGSF_cfg
 Our configuration. More...
 
struct GNUNET_STATISTICS_HandleGSF_stats
 Handle for reporting statistics. More...
 
struct GNUNET_DHT_HandleGSF_dht
 Handle for DHT operations. More...
 
struct GNUNET_LOAD_ValueGSF_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_PerformanceHandleGSF_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_ContextGSF_block_ctx
 Our block context. More...
 
struct GNUNET_CORE_HandleGSF_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_Handleblock_cfg
 Configuration for block library. More...
 
static struct GNUNET_CRYPTO_EddsaPrivateKeypk
 Private key of this peer. More...
 
static struct GNUNET_SCHEDULER_Taskcover_age_task
 ID of our task that we use to age the cover counters. More...
 
static struct GNUNET_LOAD_Valuedatastore_get_load
 Datastore 'GET' load tracking. More...
 

Detailed Description

gnunet anonymity protocol implementation

Author
Christian Grothoff

Definition in file gnunet-service-fs.c.

Macro Definition Documentation

◆ FS_DHT_HT_SIZE

#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().

◆ COVER_AGE_FREQUENCY

#define COVER_AGE_FREQUENCY   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)

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().

◆ INSANE_STATISTICS

#define INSANE_STATISTICS   GNUNET_NO

Collect an instane number of statistics? May cause excessive IPC.

Definition at line 67 of file gnunet-service-fs.c.

Function Documentation

◆ client_connect_cb()

static void* client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Creates a fresh local client handle.

Parameters
clsNULL
clienthandle of the client
mqmessage queue for client
Returns
handle to local client entry

Definition at line 346 of file gnunet-service-fs.c.

References GSF_LocalClient::client, GNUNET_new, mq, and GSF_LocalClient::mq.

Referenced by run().

349 {
350  struct GSF_LocalClient *pos;
351 
352  pos = GNUNET_new (struct GSF_LocalClient);
353  pos->client = client;
354  pos->mq = mq;
355  return pos;
356 }
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A local client.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_SERVICE_Client * client
ID of the client.
Here is the caller graph for this function:

◆ client_request_destroy()

static void client_request_destroy ( void *  cls)
static

Free the given client request.

Parameters
clsthe client request to free

Definition at line 365 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().

366 {
367  struct ClientRequest *cr = cls;
368  struct GSF_LocalClient *lc = cr->lc;
369 
370  cr->kill_task = NULL;
372  lc->cr_tail,
373  cr);
375  GNUNET_YES);
377  gettext_noop ("# client searches active"),
378  -1,
379  GNUNET_NO);
380  GNUNET_free (cr);
381 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GSF_PendingRequest * pr
Request this entry represents.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_SCHEDULER_Task * kill_task
Task scheduled to destroy the request.
A local client.
struct GSF_LocalClient * lc
Client list this request belongs to.
Doubly-linked list of requests we are performing on behalf of the same client.
struct ClientRequest * cr_head
Head of list of requests performed on behalf of this client right now.
struct ClientRequest * cr_tail
Tail of list of requests performed on behalf of this client right now.
#define GNUNET_YES
Definition: gnunet_common.h:80
void GSF_pending_request_cancel_(struct GSF_PendingRequest *pr, int full_cleanup)
Explicitly cancel a pending request.
#define GNUNET_free(ptr)
Wrapper around free.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_response_handler()

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 
)
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.

Parameters
clsuser-specified closure
evalevaluation of the result
prhandle to the original pending request
reply_anonymity_levelanonymity level for the reply, UINT32_MAX for "unknown"
expirationwhen does data expire?
last_transmissionwhen was the last time we've tried to download this block? (FOREVER if unknown)
typetype of the block
dataresponse data, NULL on request expiration
data_lennumber of bytes in data

Definition at line 403 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().

412 {
413  struct ClientRequest *cr = cls;
414  struct GSF_LocalClient *lc;
415  struct GNUNET_MQ_Envelope *env;
416  struct ClientPutMessage *pm;
417  const struct GSF_PendingRequestData *prd;
418 
419  if (NULL == data)
420  {
421  /* local-only request, with no result, clean up. */
422  if (NULL == cr->kill_task)
424  cr);
425  return;
426  }
429  if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY))
430  {
431  GNUNET_break (0);
432  return;
433  }
436  ("# replies received for local clients"), 1,
437  GNUNET_NO);
438  GNUNET_assert (pr == cr->pr);
439  lc = cr->lc;
440  env = GNUNET_MQ_msg_extra (pm,
441  data_len,
443  pm->type = htonl (type);
444  pm->expiration = GNUNET_TIME_absolute_hton (expiration);
445  pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
446  pm->num_transmissions = htonl (prd->num_transmissions);
447  pm->respect_offered = htonl (prd->respect_offered);
448  GNUNET_memcpy (&pm[1],
449  data,
450  data_len);
451  GNUNET_MQ_send (lc->mq,
452  env);
454  "Queued reply to query `%s' for local client\n",
455  GNUNET_h2s (&prd->query));
457  {
459  "Evaluation %d - keeping query alive\n",
460  (int) eval);
461  return;
462  }
463  if (NULL == cr->kill_task)
465  cr);
466 }
Any type of block, used as a wildcard when searching.
uint32_t num_transmissions
Counter for how often this request has been transmitted (estimate, because we might have the same req...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GSF_PendingRequest * pr
Request this entry represents.
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_TIME_AbsoluteNBO last_transmission
When was the last time we&#39;ve tried to download this block? (FOREVER if unknown/not relevant) ...
Definition: fs.h:386
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_SCHEDULER_Task * kill_task
Task scheduled to destroy the request.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_HashCode query
Primary query hash for this request.
A local client.
struct GNUNET_TIME_AbsoluteNBO expiration
When does this result expire?
Definition: fs.h:380
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
#define GNUNET_memcpy(dst, src, n)
struct GSF_LocalClient * lc
Client list this request belongs to.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
Last possible valid result.
uint32_t respect_offered
How much respect did we (in total) offer for this request so far (estimate, because we might have the...
enum GNUNET_BLOCK_Type type
Type of the requested block.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
uint32_t respect_offered
How much respect did we offer (in total) before getting an answer (estimate).
Definition: fs.h:398
Response from FS service with a result for a previous FS search.
Definition: fs.h:364
uint32_t type
Type of the block (in big endian).
Definition: fs.h:375
Doubly-linked list of requests we are performing on behalf of the same client.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
static void client_request_destroy(void *cls)
Free the given client request.
uint32_t data
The data value.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:654
#define GNUNET_MESSAGE_TYPE_FS_PUT
P2P response with content or active migration of content.
uint32_t num_transmissions
How often did we transmit this query before getting an answer (estimate).
Definition: fs.h:392
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

A client disconnected from us.

Tear down the local client record.

Parameters
clsunused
clienthandle of the client
app_ctxthe struct GSF_LocalClient

Definition at line 478 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().

481 {
482  struct GSF_LocalClient *lc = app_ctx;
483  struct IndexStartContext *isc;
484  struct ClientRequest *cr;
485  struct ClientResponse *res;
486 
487  while (NULL != (cr = lc->cr_head))
488  {
489  if (NULL != cr->kill_task)
492  }
493  while (NULL != (res = lc->res_head))
494  {
496  lc->res_tail,
497  res);
498  GNUNET_free (res);
499  }
500  while (NULL != (isc = lc->isc_head))
501  {
503  lc->isc_tail,
504  isc);
506  GNUNET_free (isc);
507  }
508  GNUNET_free (lc);
509 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Replies to be transmitted to the client.
struct IndexStartContext * isc_head
This is a doubly linked list.
struct IndexStartContext * isc_tail
This is a doubly linked list.
struct GNUNET_SCHEDULER_Task * kill_task
Task scheduled to destroy the request.
Information we track while handling an index start request from a client.
A local client.
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
static int res
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
struct ClientResponse * res_tail
Tail of linked list of responses.
Doubly-linked list of requests we are performing on behalf of the same client.
struct ClientResponse * res_head
Head of linked list of responses.
struct ClientRequest * cr_head
Head of list of requests performed on behalf of this client right now.
static void client_request_destroy(void *cls)
Free the given client request.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ age_cover_counters()

static void age_cover_counters ( void *  cls)
static

Task that periodically ages our cover traffic statistics.

Parameters
clsunused closure

Definition at line 521 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().

522 {
528  NULL);
529 }
#define COVER_AGE_FREQUENCY
How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are...
unsigned int GSF_cover_query_count
How many query messages have we received &#39;recently&#39; that have not yet been claimed as cover traffic...
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
static void age_cover_counters(void *cls)
Task that periodically ages our cover traffic statistics.
static struct GNUNET_SCHEDULER_Task * cover_age_task
ID of our task that we use to age the cover counters.
unsigned int GSF_cover_content_count
How many content messages have we received &#39;recently&#39; that have not yet been claimed as cover traffic...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_update_datastore_delay_()

void GSF_update_datastore_delay_ ( struct GNUNET_TIME_Absolute  start)

We've just now completed a datastore request.

Update our datastore load calculations.

Parameters
starttime when the datastore request was issued

Definition at line 539 of file gnunet-service-fs.c.

References GNUNET_LOAD_update(), and GNUNET_TIME_absolute_get_duration().

Referenced by process_local_reply().

540 {
542 
544  GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us);
545 }
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore &#39;GET&#39; load tracking.
void GNUNET_LOAD_update(struct GNUNET_LOAD_Value *load, uint64_t data)
Update the current load.
Definition: load.c:238
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:373
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_test_get_load_too_high_()

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.

Parameters
prioritypriority of the request (used as a reference point to compare with the load)
Returns
GNUNET_YES if the load is too high to do anything (load high) GNUNET_NO to process normally (load normal) GNUNET_SYSERR to process for free (load low)

Definition at line 559 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().

560 {
561  double ld;
562 
564  if (ld < 1)
565  return GNUNET_SYSERR;
566  if (ld <= priority)
567  return GNUNET_NO;
568  return GNUNET_YES;
569 }
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore &#39;GET&#39; load tracking.
double GNUNET_LOAD_get_load(struct GNUNET_LOAD_Value *load)
Get the current load.
Definition: load.c:202
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_YES
Definition: gnunet_common.h:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_latencies()

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 
)
static

We've received peer performance information.

Update our running average for the P2P latency.

Parameters
clsclosure
addressthe address
activeis this address in active use
bandwidth_outassigned outbound bandwidth for the connection
bandwidth_inassigned inbound bandwidth for the connection
propperformance data for the address (as far as known)

Definition at line 584 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().

590 {
591  if (NULL == address)
592  {
593  /* ATS service temporarily disconnected */
594  return;
595  }
596 
597  if (GNUNET_YES != active)
598  return;
599  GSF_update_peer_latency_ (&address->peer,
600  prop->delay);
603  GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32;
605  gettext_noop ("# running average P2P latency (ms)"),
606  GSF_avg_latency.rel_value_us / 1000LL,
607  GNUNET_NO);
608 }
uint64_t rel_value_us
The actual value.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GSF_update_peer_latency_(const struct GNUNET_PeerIdentity *id, struct GNUNET_TIME_Relative latency)
Update the latency information kept for the given peer.
#define GNUNET_MIN(a, b)
Definition: gnunet_common.h:83
struct GNUNET_TIME_Relative delay
Delay.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GNUNET_PeerIdentity peer
For which peer is this an address?
struct GNUNET_TIME_Relative GSF_avg_latency
Running average of the observed latency to other peers (round trip).
#define GNUNET_YES
Definition: gnunet_common.h:80
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_p2p_put()

static int check_p2p_put ( void *  cls,
const struct PutMessage put 
)
static

Check P2P "PUT" message.

Parameters
clsclosure with the struct GSF_ConnectedPeer
messagethe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 620 of file gnunet-service-fs.c.

References GNUNET_BLOCK_TYPE_FS_ONDEMAND, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, type, and PutMessage::type.

622 {
623  enum GNUNET_BLOCK_Type type;
624 
625  type = ntohl (put->type);
626  if (GNUNET_BLOCK_TYPE_FS_ONDEMAND == type)
627  {
628  GNUNET_break_op (0);
629  return GNUNET_SYSERR;
630  }
631  return GNUNET_OK;
632 }
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Type of a block representing a block to be encoded on demand from disk.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t type
Type of the block (in big endian).
Definition: fs.h:347
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model

◆ consider_request_for_forwarding()

static void consider_request_for_forwarding ( void *  cls,
const struct GNUNET_PeerIdentity peer,
struct GSF_ConnectedPeer cp,
const struct GSF_PeerPerformanceData ppd 
)
static

We have a new request, consider forwarding it to the given peer.

Parameters
clsthe struct GSF_PendingRequest
peeridentity of the peer
cphandle to the connected peer record
ppdpeer performance data

Definition at line 645 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().

649 {
650  struct GSF_PendingRequest *pr = cls;
651 
652  if (GNUNET_YES !=
654  {
655 #if INSANE_STATISTICS
657  gettext_noop ("# Loopback routes suppressed"), 1,
658  GNUNET_NO);
659 #endif
660  return;
661  }
662  GSF_plan_add_ (cp,
663  pr);
664 }
void GSF_plan_add_(struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr)
Create a new query plan entry.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
int GSF_pending_request_test_target_(struct GSF_PendingRequest *pr, const struct GNUNET_PeerIdentity *target)
Is the given target a legitimate peer for forwarding the given request?
#define GNUNET_YES
Definition: gnunet_common.h:80
An active request.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
clsclosure (NULL)
prthe pending request we were processing
resultfinal datastore lookup result

Definition at line 678 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().

681 {
683  return; /* we're done... */
684  if (GNUNET_YES !=
686  return; /* request is not actually active, skip! */
688  pr);
689 }
void GSF_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
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.
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
Last possible valid result.
static int result
Global testing status.
#define GNUNET_YES
Definition: gnunet_common.h:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_p2p_get()

static int check_p2p_get ( void *  cls,
const struct GetMessage gm 
)
static

Check P2P "GET" request.

Parameters
clsclosure
gmthe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 701 of file gnunet-service-fs.c.

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GetMessage::hash_bitmap, GetMessage::header, and GNUNET_MessageHeader::size.

703 {
704  size_t msize;
705  unsigned int bm;
706  unsigned int bits;
707  size_t bfsize;
708 
709  msize = ntohs (gm->header.size);
710  bm = ntohl (gm->hash_bitmap);
711  bits = 0;
712  while (bm > 0)
713  {
714  if (1 == (bm & 1))
715  bits++;
716  bm >>= 1;
717  }
718  if (msize < sizeof (struct GetMessage) + bits * sizeof (struct GNUNET_PeerIdentity))
719  {
720  GNUNET_break_op (0);
721  return GNUNET_SYSERR;
722  }
723  bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (struct GNUNET_PeerIdentity);
724  /* bfsize must be power of 2, check! */
725  if (0 != ((bfsize - 1) & bfsize))
726  {
727  GNUNET_break_op (0);
728  return GNUNET_SYSERR;
729  }
730  return GNUNET_OK;
731 }
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET.
Definition: datastore.h:148
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
Message to the datastore service asking about specific content.
Definition: datastore.h:143
uint32_t hash_bitmap
Which of the optional hash codes are present at the end of the message? See GET_MESSAGE_BIT_xx consta...
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
The identity of the host (wraps the signing key of the peer).

◆ start_p2p_processing()

static void start_p2p_processing ( void *  cls,
struct GSF_PendingRequest pr,
enum GNUNET_BLOCK_EvaluationResult  result 
)
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.

Parameters
clsthe client doing the request (struct GSF_LocalClient)
prthe pending request we were processing
resultfinal datastore lookup result

Definition at line 745 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().

748 {
749  struct GSF_LocalClient *lc = cls;
750  struct GSF_PendingRequestData *prd;
751 
754  return; /* we're done, 'pr' was already destroyed... */
757  "Finished database lookup for local request `%s' with result %d\n",
758  GNUNET_h2s (&prd->query),
759  result);
760  if (0 == prd->anonymity_level)
761  {
762  switch (prd->type)
763  {
766  /* the above block types MAY be available via 'cadet' */
768  "Considering cadet-based download for block\n");
769  GSF_cadet_lookup_ (pr);
770  break;
772  /* the above block types are in the DHT */
774  "Considering DHT-based search for block\n");
775  GSF_dht_lookup_ (pr);
776  break;
777  default:
778  GNUNET_break (0);
779  break;
780  }
781  }
783  pr,
784  result);
785 }
uint32_t anonymity_level
Desired anonymity level.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_HashCode query
Primary query hash for this request.
A local client.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
Inner block in the CHK tree.
Last possible valid result.
static int result
Global testing status.
enum GNUNET_BLOCK_Type type
Type of the requested block.
Type of a block representing any type of search result (universal).
void GSF_cadet_lookup_(struct GSF_PendingRequest *pr)
Consider downloading via cadet (if possible)
void GSF_consider_forwarding(void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_EvaluationResult result)
Function to be called after we&#39;re done processing replies from the local lookup.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
void GSF_dht_lookup_(struct GSF_PendingRequest *pr)
Consider looking up the data in the DHT (anonymity-level permitting).
#define GNUNET_log(kind,...)
Data block (leaf) in the CHK tree.
struct GNUNET_SERVICE_Client * client
ID of the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_client_start_search()

static int check_client_start_search ( void *  cls,
const struct SearchMessage sm 
)
static

Check GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).

Parameters
clsidentification of the client
smthe actual message
Returns
GNUNET_OK if sm is well-formed

Definition at line 797 of file gnunet-service-fs.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, SearchMessage::header, and GNUNET_MessageHeader::size.

799 {
800  uint16_t msize;
801 
802  msize = ntohs (sm->header.size) - sizeof (struct SearchMessage);
803  if (0 != msize % sizeof (struct GNUNET_HashCode))
804  {
805  GNUNET_break (0);
806  return GNUNET_SYSERR;
807  }
808  return GNUNET_OK;
809 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
A 512-bit hashcode.
struct GNUNET_MessageHeader header
Message type will be GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
Definition: fs.h:281
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Message sent from a GNUnet (fs) search activity to the gnunet-service-fs to start a search...
Definition: fs.h:275

◆ handle_client_start_search()

static void handle_client_start_search ( void *  cls,
const struct SearchMessage sm 
)
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.

Parameters
clsidentification of the client
smthe actual message

Definition at line 823 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.

825 {
826  static struct GNUNET_PeerIdentity all_zeros;
827  struct GSF_LocalClient *lc = cls;
828  struct ClientRequest *cr;
829  struct GSF_PendingRequestData *prd;
830  uint16_t msize;
831  unsigned int sc;
832  enum GNUNET_BLOCK_Type type;
834 
836  gettext_noop ("# client searches received"),
837  1,
838  GNUNET_NO);
839  msize = ntohs (sm->header.size) - sizeof (struct SearchMessage);
840  sc = msize / sizeof (struct GNUNET_HashCode);
841  type = ntohl (sm->type);
843  "Received request for `%s' of type %u from local client\n",
844  GNUNET_h2s (&sm->query),
845  (unsigned int) type);
846  cr = NULL;
847  /* detect duplicate UBLOCK requests */
848  if ((type == GNUNET_BLOCK_TYPE_FS_UBLOCK) ||
849  (type == GNUNET_BLOCK_TYPE_ANY))
850  {
851  cr = lc->cr_head;
852  while (NULL != cr)
853  {
854  prd = GSF_pending_request_get_data_ (cr->pr);
855  /* only unify with queries that hae not yet started local processing
856  (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a
857  matching query and type */
858  if ((GNUNET_YES != prd->has_started) &&
859  (0 != memcmp (&prd->query,
860  &sm->query,
861  sizeof (struct GNUNET_HashCode))) &&
862  (prd->type == type))
863  break;
864  cr = cr->next;
865  }
866  }
867  if (NULL != cr)
868  {
870  "Have existing request, merging content-seen lists.\n");
872  (const struct GNUNET_HashCode *) &sm[1],
873  sc);
875  gettext_noop ("# client searches updated (merged content seen list)"),
876  1,
877  GNUNET_NO);
878  }
879  else
880  {
882  gettext_noop ("# client searches active"),
883  1,
884  GNUNET_NO);
885  cr = GNUNET_new (struct ClientRequest);
886  cr->lc = lc;
888  lc->cr_tail,
889  cr);
890  options = GSF_PRO_LOCAL_REQUEST;
891  if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
892  options |= GSF_PRO_LOCAL_ONLY;
893  cr->pr = GSF_pending_request_create_ (options, type,
894  &sm->query,
895  (0 !=
896  memcmp (&sm->target,
897  &all_zeros,
898  sizeof (struct GNUNET_PeerIdentity)))
899  ? &sm->target : NULL, NULL, 0,
900  0 /* bf */ ,
901  ntohl (sm->anonymity_level),
902  0 /* priority */ ,
903  0 /* ttl */ ,
904  0 /* sender PID */ ,
905  0 /* origin PID */ ,
906  (const struct GNUNET_HashCode *) &sm[1], sc,
908  cr);
909  }
910  if (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options)))
911  {
913  return;
914  }
916  GSF_local_lookup_ (cr->pr,
918  lc);
919 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
Any type of block, used as a wildcard when searching.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
struct GSF_PendingRequest * pr
Request this entry represents.
uint32_t options
Bitmask with options.
Definition: fs.h:292
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
struct ClientRequest * next
This is a doubly-linked list.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_PeerIdentity target
If the request is for a DBLOCK or IBLOCK, this is the identity of the peer that is known to have a re...
Definition: fs.h:314
void GSF_pending_request_update_(struct GSF_PendingRequest *pr, const struct GNUNET_HashCode *replies_seen, unsigned int replies_seen_count)
Update a given pending request with additional replies that have been seen.
struct GNUNET_HashCode query
Primary query hash for this request.
struct GNUNET_HashCode query
Hash of the public key for UBLOCKs; Hash of the CHK-encoded block for DBLOCKS and IBLOCKS...
Definition: fs.h:320
A local client.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
static void start_p2p_processing(void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_EvaluationResult result)
We&#39;re done with the local lookup, now consider P2P processing (depending on request options and resul...
struct GSF_LocalClient * lc
Client list this request belongs to.
void GSF_local_lookup_(struct GSF_PendingRequest *pr, GSF_LocalLookupContinuation cont, void *cont_cls)
Look up the request in the local datastore.
uint32_t type
Type of the content that we&#39;re looking for.
Definition: fs.h:297
enum GNUNET_BLOCK_Type type
Type of the requested block.
Request must only be processed locally.
Type of a block representing any type of search result (universal).
A 512-bit hashcode.
struct GNUNET_MessageHeader header
Message type will be GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
Definition: fs.h:281
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static struct GNUNET_PeerIdentity all_zeros
Peer identity that is all zeros, used as a way to indicate "all peers".
Doubly-linked list of requests we are performing on behalf of the same client.
The identity of the host (wraps the signing key of the peer).
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
Option mask for typical local requests.
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.
#define GNUNET_log(kind,...)
#define SEARCH_MESSAGE_OPTION_CONTINUED
Request is too large to fit in 64k format.
Definition: fs.h:268
struct ClientRequest * cr_head
Head of list of requests performed on behalf of this client right now.
struct ClientRequest * cr_tail
Tail of list of requests performed on behalf of this client right now.
struct GSF_PendingRequest * GSF_pending_request_create_(enum GSF_PendingRequestOptions options, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *query, const struct GNUNET_PeerIdentity *target, const char *bf_data, size_t bf_size, uint32_t mingle, uint32_t anonymity_level, uint32_t priority, int32_t ttl, GNUNET_PEER_Id sender_pid, GNUNET_PEER_Id origin_pid, const struct GNUNET_HashCode *replies_seen, unsigned int replies_seen_count, GSF_PendingRequestReplyHandler rh, void *rh_cls)
Create a new pending request.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_SERVICE_Client * client
ID of the client.
#define SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY
Only search the local datastore (no network)
Definition: fs.h:260
Message sent from a GNUnet (fs) search activity to the gnunet-service-fs to start a search...
Definition: fs.h:275
uint32_t anonymity_level
Desired anonymity level, big-endian.
Definition: fs.h:302
int has_started
Has this request been started yet (local/p2p operations)? Or are we still constructing it...
GSF_PendingRequestOptions
Options for pending requests (bits to be ORed).
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

◆ handle_client_loc_sign()

static void handle_client_loc_sign ( void *  cls,
const struct RequestLocSignatureMessage msg 
)
static

Handle request to sign a LOC URI (from client).

Parameters
clsidentification of the client
msgthe actual message

Definition at line 929 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, RequestLocSignatureMessage::purpose, ResponseLocSignatureMessage::purpose, ResponseLocSignatureMessage::signature, and GNUNET_FS_Uri::type.

931 {
932  struct GSF_LocalClient *lc = cls;
933  struct GNUNET_FS_Uri base;
934  struct GNUNET_FS_Uri *loc;
935  struct GNUNET_MQ_Envelope *env;
936  struct ResponseLocSignatureMessage *resp;
937 
939  ntohl (msg->purpose));
940  base.type = GNUNET_FS_URI_CHK;
941  base.data.chk.chk = msg->chk;
942  base.data.chk.file_length = GNUNET_ntohll (msg->file_length);
943  loc = GNUNET_FS_uri_loc_create (&base,
944  pk,
946  env = GNUNET_MQ_msg (resp,
950  resp->signature = loc->data.loc.contentSignature;
951  resp->peer = loc->data.loc.peer;
952  GNUNET_FS_uri_destroy (loc);
953  GNUNET_MQ_send (lc->mq,
954  env);
956 }
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:670
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_create(const struct GNUNET_FS_Uri *base_uri, const struct GNUNET_CRYPTO_EddsaPrivateKey *sign_key, struct GNUNET_TIME_Absolute expiration_time)
Construct a location URI (this peer will be used for the location).
Definition: fs_uri.c:867
uint32_t purpose
Requested signature purpose.
Definition: fs.h:86
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
uint64_t file_length
Size of the shared file (to be signed).
Definition: fs.h:101
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs_api.h:123
#define GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE
Reply sent by fs service with LOC signature.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
A local client.
#define GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT
Signature by which a peer affirms that it is providing a certain bit of content (used in LOCation URI...
union GNUNET_FS_Uri::@16 data
struct GNUNET_TIME_AbsoluteNBO expiration_time
Expiration time that was actually used (rounded!).
Definition: fs.h:126
uint32_t purpose
Purpose of the generated signature.
Definition: fs.h:121
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
Definition: fs_uri.c:670
Content-hash-key (simple file).
Definition: fs_api.h:146
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs.h:136
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_TIME_Absolute expirationTime
Time when this location URI expires.
Definition: fs_api.h:128
struct ContentHashKey chk
Information about the shared file (to be signed).
Definition: fs.h:96
Message sent from the service with the signed LOC URI.
Definition: fs.h:108
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:168
struct GNUNET_CRYPTO_EddsaSignature signature
The requested signature.
Definition: fs.h:131
struct GNUNET_CRYPTO_EddsaSignature contentSignature
Signature over the GNUNET_EC_FileIdentifier, peer identity and expiration time.
Definition: fs_api.h:134
struct GNUNET_TIME_AbsoluteNBO expiration_time
Requested expiration time.
Definition: fs.h:91
struct Location loc
Information needed to retrieve a file including signed location (identity of a peer) of the content...
Definition: fs_api.h:221
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_SERVICE_Client * client
ID of the client.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:654
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Here is the call graph for this function:

◆ check_client_index_start()

static int check_client_index_start ( void *  cls,
const struct IndexStartMessage ism 
)
static

Check INDEX_START-message.

Parameters
clsidentification of the client
ismthe actual message
Returns
GNUNET_OK if ism is well-formed

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.

969 {
970  char *fn;
971 
973  if (0 != ism->reserved)
974  {
975  GNUNET_break (0);
976  return GNUNET_SYSERR;
977  }
978  fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
979  if (NULL == fn)
980  {
981  GNUNET_break (0);
982  return GNUNET_SYSERR;
983  }
984  GNUNET_free (fn);
985  return GNUNET_OK;
986 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_MQ_check_zero_termination(m)
Insert code for a "check_" function that verifies that a given variable-length message received over ...
static char * fn
Filename of the unique file.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:602
uint32_t reserved
For alignment.
Definition: fs.h:164
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ signal_index_ok()

static void signal_index_ok ( struct IndexStartContext isc)
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.

Parameters
iscthe 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().

997 {
998  struct GSF_LocalClient *lc = isc->lc;
999  struct GNUNET_MQ_Envelope *env;
1000  struct GNUNET_MessageHeader *msg;
1001 
1003  &isc->file_id);
1004  env = GNUNET_MQ_msg (msg,
1006  GNUNET_MQ_send (lc->mq,
1007  env);
1008  GNUNET_free (isc->filename);
1009  GNUNET_free (isc);
1011 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
char * filename
Name of the indexed file.
#define GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK
Affirmative response to a request for start indexing.
A local client.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_HashCode file_id
Hash of the contents of the file.
struct GSF_LocalClient * lc
Context for transmitting confirmation to client.
Header for all communications.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_SERVICE_Client * client
ID of the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
void GNUNET_FS_add_to_index(const char *filename, const struct GNUNET_HashCode *file_id)
Add the given file to the list of indexed files.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_for_index_val()

static void hash_for_index_val ( void *  cls,
const struct GNUNET_HashCode res 
)
static

Function called once the hash computation over an indexed file has completed.

Parameters
clsclosure, our publishing context
resresulting 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().

1024 {
1025  struct IndexStartContext *isc = cls;
1026  struct GSF_LocalClient *lc = isc->lc;
1027  struct GNUNET_MQ_Envelope *env;
1028  struct GNUNET_MessageHeader *msg;
1029 
1031  lc->isc_tail,
1032  isc);
1033  isc->fhc = NULL;
1034  if ( (NULL == res) ||
1035  (0 != memcmp (res,
1036  &isc->file_id,
1037  sizeof (struct GNUNET_HashCode))))
1038  {
1040  _("Hash mismatch trying to index file `%s' which does not have hash `%s'\n"),
1041  isc->filename,
1042  GNUNET_h2s (&isc->file_id));
1043  env = GNUNET_MQ_msg (msg,
1045  GNUNET_MQ_send (lc->mq,
1046  env);
1048  GNUNET_free (isc);
1049  return;
1050  }
1051  signal_index_ok (isc);
1052 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct IndexStartContext * isc_head
This is a doubly linked list.
#define GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED
Response to a request for start indexing that refuses.
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
char * filename
Name of the indexed file.
struct IndexStartContext * isc_tail
This is a doubly linked list.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
Information we track while handling an index start request from a client.
A local client.
A 512-bit hashcode.
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_HashCode file_id
Hash of the contents of the file.
#define GNUNET_log(kind,...)
struct GSF_LocalClient * lc
Context for transmitting confirmation to client.
static void signal_index_ok(struct IndexStartContext *isc)
We&#39;ve validated the hash of the file we&#39;re about to index.
Header for all communications.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_SERVICE_Client * client
ID of the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_client_index_start()

static void handle_client_index_start ( void *  cls,
const struct IndexStartMessage ism 
)
static

Handle INDEX_START-message.

Parameters
clsidentification of the client
messagethe actual message

Definition at line 1062 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().

1064 {
1065  struct GSF_LocalClient *lc = cls;
1066  struct IndexStartContext *isc;
1067  char *fn;
1068  uint64_t dev;
1069  uint64_t ino;
1070  uint64_t mydev;
1071  uint64_t myino;
1072 
1073  fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
1074  GNUNET_assert (NULL != fn);
1075  dev = GNUNET_ntohll (ism->device);
1076  ino = GNUNET_ntohll (ism->inode);
1077  isc = GNUNET_new (struct IndexStartContext);
1078  isc->filename = fn;
1079  isc->file_id = ism->file_id;
1081  "Received START_INDEX message for file `%s'\n",
1082  isc->filename);
1083  isc->lc = lc;
1084  mydev = 0;
1085  myino = 0;
1086  if ( ( (dev != 0) ||
1087  (ino != 0) ) &&
1089  &mydev,
1090  &myino)) &&
1091  (dev == mydev) &&
1092  (ino == myino) )
1093  {
1094  /* fast validation OK! */
1095  signal_index_ok (isc);
1096  return;
1097  }
1099  "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n",
1100  (unsigned long long) ino,
1101  (unsigned long long) myino,
1102  (unsigned int) dev,
1103  (unsigned int) mydev);
1104  /* slow validation, need to hash full file (again) */
1106  lc->isc_tail,
1107  isc);
1109  isc->filename,
1112  isc);
1113  if (NULL == isc->fhc)
1114  hash_for_index_val (isc,
1115  NULL);
1116 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct IndexStartContext * isc_head
This is a doubly linked list.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
char * filename
Name of the indexed file.
int GNUNET_DISK_file_get_identifiers(const char *filename, uint64_t *dev, uint64_t *ino)
Obtain some unique identifiers for the given file that can be used to identify it in the local system...
Definition: disk.c:323
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct IndexStartContext * isc_tail
This is a doubly linked list.
struct GNUNET_CRYPTO_FileHashContext * GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, const char *filename, size_t blocksize, GNUNET_CRYPTO_HashCompletedCallback callback, void *callback_cls)
Compute the hash of an entire file.
Information we track while handling an index start request from a client.
A local client.
static char * fn
Filename of the unique file.
uint64_t device
ID of device containing the file, as seen by the client.
Definition: fs.h:173
Run when otherwise idle.
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
struct GNUNET_HashCode file_id
Hash of the file that we would like to index.
Definition: fs.h:186
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:602
uint64_t inode
Inode of the file on the given device, as seen by the client ("st_ino" field from "struct stat")...
Definition: fs.h:181
#define HASHING_BLOCKSIZE
Blocksize to use when hashing files for indexing (blocksize for IO, not for the DBlocks).
Definition: fs.h:47
struct GNUNET_HashCode file_id
Hash of the contents of the file.
#define GNUNET_log(kind,...)
struct GSF_LocalClient * lc
Context for transmitting confirmation to client.
static void signal_index_ok(struct IndexStartContext *isc)
We&#39;ve validated the hash of the file we&#39;re about to index.
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.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Here is the call graph for this function:

◆ handle_client_index_list_get()

static void handle_client_index_list_get ( void *  cls,
const struct GNUNET_MessageHeader message 
)
static

Handle INDEX_LIST_GET-message.

Parameters
clsclosure
messagethe actual message

Definition at line 1126 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.

1128 {
1129  struct GSF_LocalClient *lc = cls;
1130 
1133 }
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
void GNUNET_FS_indexing_send_list(struct GNUNET_MQ_Handle *mq)
Transmit information about indexed files to mq.
A local client.
struct GNUNET_SERVICE_Client * client
ID of the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
Here is the call graph for this function:

◆ handle_client_unindex()

static void handle_client_unindex ( void *  cls,
const struct UnindexMessage um 
)
static

Handle UNINDEX-message.

Parameters
clsidentification of the client
messagethe actual message

Definition at line 1143 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.

1145 {
1146  struct GSF_LocalClient *lc = cls;
1147  struct GNUNET_MQ_Envelope *env;
1148  struct GNUNET_MessageHeader *msg;
1149  int found;
1150 
1151  GNUNET_break (0 == um->reserved);
1152  found = GNUNET_FS_indexing_do_unindex (&um->file_id);
1154  "Client requested unindexing of file `%s': %s\n",
1155  GNUNET_h2s (&um->file_id),
1156  found ? "found" : "not found");
1157  env = GNUNET_MQ_msg (msg,
1159  GNUNET_MQ_send (lc->mq,
1160  env);
1162 }
int GNUNET_FS_indexing_do_unindex(const struct GNUNET_HashCode *fid)
Remove a file from the index.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
uint32_t reserved
Always zero.
Definition: fs.h:242
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
A local client.
struct GNUNET_HashCode file_id
Hash of the file that we will unindex.
Definition: fs.h:247
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK
Reply to client indicating unindex receipt.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_log(kind,...)
Header for all communications.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_SERVICE_Client * client
ID of the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
Here is the call graph for this function:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsunused

Definition at line 1171 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().

1172 {
1174  if (NULL != GSF_core)
1175  {
1177  GSF_core = NULL;
1178  }
1179  if (NULL != GSF_ats)
1180  {
1182  GSF_ats = NULL;
1183  }
1184  GSF_put_done_ ();
1185  GSF_push_done_ ();
1187  GSF_plan_done ();
1190  GNUNET_NO);
1191  GSF_dsh = NULL;
1193  GSF_dht = NULL;
1195  GSF_block_ctx = NULL;
1197  block_cfg = NULL;
1199  GSF_stats = NULL;
1200  if (NULL != cover_age_task)
1201  {
1203  cover_age_task = NULL;
1204  }
1207  datastore_get_load = NULL;
1209  GSF_rt_entry_lifetime = NULL;
1210 }
void GSF_plan_done()
Shutdown plan subsystem.
void GNUNET_FS_indexing_done()
Shutdown the module.
void GSF_put_done_()
Shutdown the module.
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore &#39;GET&#39; load tracking.
void GSF_cadet_stop_server(void)
Shutdown subsystem for non-anonymous file-sharing.
struct GNUNET_ATS_PerformanceHandle * GSF_ats
Handle to ATS service.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
struct GNUNET_DHT_Handle * GSF_dht
Handle for DHT operations.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
struct GNUNET_BLOCK_Context * GSF_block_ctx
Our block context.
static struct GNUNET_CONFIGURATION_Handle * block_cfg
Configuration for block library.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
struct GNUNET_CORE_Handle * GSF_core
Pointer to handle to the core service (points to NULL until we&#39;ve connected to it).
struct GNUNET_DATASTORE_Handle * GSF_dsh
Our connection to the datastore.
void GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx)
Destroy the block context.
Definition: block.c:152
void GSF_pending_request_done_()
Shutdown the subsystem.
static struct GNUNET_SCHEDULER_Task * cover_age_task
ID of our task that we use to age the cover counters.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:732
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
Definition: dht_api.c:923
struct GNUNET_LOAD_Value * GSF_rt_entry_lifetime
How long do requests typically stay in the routing table?
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
#define GNUNET_LOAD_value_free(lv)
Free a load value.
void GSF_push_done_()
Shutdown the module.
void GSF_connected_peer_done_()
Shutdown peer management subsystem.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peer_init_handler()

static void peer_init_handler ( void *  cls,
const struct GNUNET_PeerIdentity my_identity 
)
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...).

Parameters
clsclosure
my_identityID of this peer, NULL if we failed

Definition at line 1224 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().

1226 {
1227  if (0 != GNUNET_memcmp (&GSF_my_id,
1228  my_identity))
1229  {
1231  "Peer identity mismatch, refusing to start!\n");
1233  }
1234 }
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
struct GNUNET_PeerIdentity GSF_my_id
Identity of this peer.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main_init()

static int main_init ( const struct GNUNET_CONFIGURATION_Handle c)
static

Process fs requests.

Parameters
cconfiguration to use

Definition at line 1243 of file gnunet-service-fs.c.

References _, age_cover_counters(), COVER_AGE_FREQUENCY, DATASTORE_LOAD_AUTODECLINE, GNUNET_assert, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CORE_connect(), GNUNET_CRYPTO_eddsa_key_create_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(), GNUNET_PeerIdentity::public_key, and shutdown_task().

Referenced by run().

1244 {
1245  struct GNUNET_MQ_MessageHandler no_p2p_handlers[] = {
1247  };
1248  struct GNUNET_MQ_MessageHandler p2p_handlers[] = {
1249  GNUNET_MQ_hd_var_size (p2p_get,
1251  struct GetMessage,
1252  NULL),
1253  GNUNET_MQ_hd_var_size (p2p_put,
1255  struct PutMessage,
1256  NULL),
1257  GNUNET_MQ_hd_fixed_size (p2p_migration_stop,
1259  struct MigrationStopMessage,
1260  NULL),
1262  };
1263  int anon_p2p_off;
1264  char *keyfile;
1265 
1266  /* this option is really only for testcases that need to disable
1267  _anonymous_ file-sharing for some reason */
1268  anon_p2p_off = (GNUNET_YES ==
1270  "fs",
1271  "DISABLE_ANON_TRANSFER"));
1272 
1273  if (GNUNET_OK !=
1275  "PEER",
1276  "PRIVATE_KEY",
1277  &keyfile))
1278  {
1280  _("FS service is lacking HOSTKEY configuration setting. Exiting.\n"));
1282  return GNUNET_SYSERR;
1283  }
1285  GNUNET_free (keyfile);
1286  GNUNET_assert (NULL != pk);
1289 
1291  "I am peer %s\n",
1292  GNUNET_i2s (&GSF_my_id));
1293  GSF_core
1295  NULL,
1299  (GNUNET_YES == anon_p2p_off)
1300  ? no_p2p_handlers
1301  : p2p_handlers);
1302  if (NULL == GSF_core)
1303  {
1305  _("Failed to connect to `%s' service.\n"),
1306  "core");
1307  return GNUNET_SYSERR;
1308  }
1309  cover_age_task =
1312  NULL);
1316  NULL);
1317  return GNUNET_OK;
1318 }
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
struct GNUNET_LOAD_Value * GNUNET_LOAD_value_init(struct GNUNET_TIME_Relative autodecline)
Create a new load value.
Definition: load.c:125
Response from FS service with a result for a previous FS search.
Definition: fs.h:336
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
void GSF_peer_disconnect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
A peer disconnected from us.
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore &#39;GET&#39; load tracking.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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).
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define COVER_AGE_FREQUENCY
How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are...
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
const struct GNUNET_CONFIGURATION_Handle * GSF_cfg
Our configuration.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
Message to the datastore service asking about specific content.
Definition: datastore.h:143
struct GNUNET_PeerIdentity GSF_my_id
Identity of this peer.
static void age_cover_counters(void *cls)
Task that periodically ages our cover traffic statistics.
struct GNUNET_CORE_Handle * GSF_core
Pointer to handle to the core service (points to NULL until we&#39;ve connected to it).
Message handler for a specific message type.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Connect to the core service.
Definition: core_api.c:694
static struct GNUNET_SCHEDULER_Task * cover_age_task
ID of our task that we use to age the cover counters.
Message send by a peer that wants to be excluded from migration for a while.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:272
void * GSF_peer_connect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
A peer connected to us.
#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP
Peer asks us to stop migrating content towards it for a while.
static void shutdown_task(void *cls)
Task run during shutdown.
#define GNUNET_log(kind,...)
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_file(const char *filename)
Create a new private key by reading it from a file.
int GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
#define GNUNET_YES
Definition: gnunet_common.h:80
void GSF_cadet_start_server(void)
Initialize subsystem for non-anonymous file-sharing.
int GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
#define GNUNET_MESSAGE_TYPE_FS_PUT
P2P response with content or active migration of content.
#define GNUNET_MESSAGE_TYPE_FS_GET
P2P request for content (one FS to another).
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define DATASTORE_LOAD_AUTODECLINE
At what frequency should our datastore load decrease automatically (since if we don&#39;t use it...
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Process fs requests.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized service

Definition at line 1329 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().

1332 {
1333  unsigned long long dqs;
1334 
1335  GSF_cfg = cfg;
1336  if (GNUNET_OK !=
1338  "fs",
1339  "DATASTORE_QUEUE_SIZE",
1340  &dqs))
1341  {
1343  "fs",
1344  "DATASTORE_QUEUE_SIZE");
1345  dqs = 32;
1346  }
1347  GSF_datastore_queue_size = (unsigned int) dqs;
1349  GNUNET_CONFIGURATION_get_value_yesno (cfg, "fs", "DELAY");
1351  if (NULL == GSF_dsh)
1352  {
1354  return;
1355  }
1357  GSF_stats = GNUNET_STATISTICS_create ("fs", cfg);
1360  GNUNET_assert (NULL != GSF_block_ctx);
1362  GSF_plan_init ();
1367  NULL);
1368  GSF_push_init_ ();
1369  GSF_put_init_ ();
1370  if ( (GNUNET_OK != GNUNET_FS_indexing_init (cfg,
1371  GSF_dsh)) ||
1372  (GNUNET_OK != main_init (cfg)) )
1373  {
1375  shutdown_task (NULL);
1376  return;
1377  }
1378 }
struct GNUNET_BLOCK_Context * GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a block context.
Definition: block.c:132
int GSF_enable_randomized_delays
Are we introducing randomized delays for better anonymity?
struct GNUNET_LOAD_Value * GNUNET_LOAD_value_init(struct GNUNET_TIME_Relative autodecline)
Create a new load value.
Definition: load.c:125
void GSF_connected_peer_init_()
Initialize peer management subsystem.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_ATS_PerformanceHandle * GSF_ats
Handle to ATS service.
struct GNUNET_DHT_Handle * GSF_dht
Handle for DHT operations.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
static int main_init(const struct GNUNET_CONFIGURATION_Handle *c)
Process fs requests.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
const struct GNUNET_CONFIGURATION_Handle * GSF_cfg
Our configuration.
void GSF_pending_request_init_()
Setup the subsystem.
int GNUNET_FS_indexing_init(const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_DATASTORE_Handle *d)
Initialize the indexing submodule.
void GSF_push_init_()
Setup the module.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
void GSF_plan_init()
Initialize plan subsystem.
unsigned int GSF_datastore_queue_size
Size of the datastore queue we assume for common requests.
struct GNUNET_BLOCK_Context * GSF_block_ctx
Our block context.
static struct GNUNET_CONFIGURATION_Handle * block_cfg
Configuration for block library.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
int GNUNET_CONFIGURATION_get_value_size(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size)
Get a configuration value that should be a size in bytes.
struct GNUNET_DATASTORE_Handle * GSF_dsh
Our connection to the datastore.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
struct GNUNET_DHT_Handle * GNUNET_DHT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int ht_len)
Initialize the connection with the DHT service.
Definition: dht_api.c:895
struct GNUNET_ATS_PerformanceHandle * GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls)
Get handle to access performance API of the ATS subsystem.
struct GNUNET_LOAD_Value * GSF_rt_entry_lifetime
How long do requests typically stay in the routing table?
static void shutdown_task(void *cls)
Task run during shutdown.
#define FS_DHT_HT_SIZE
Size for the hash map for DHT requests from the FS service.
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&#39;ve received peer performance information.
int GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
void GSF_put_init_()
Setup the module.
Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

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().

Here is the caller graph for this function:

Variable Documentation

◆ GSF_dsh

struct GNUNET_DATASTORE_Handle* GSF_dsh

◆ GSF_cfg

const struct GNUNET_CONFIGURATION_Handle* GSF_cfg

◆ GSF_stats

struct GNUNET_STATISTICS_Handle* GSF_stats

◆ GSF_dht

struct GNUNET_DHT_Handle* GSF_dht

Handle for DHT operations.

Definition at line 245 of file gnunet-service-fs.c.

Referenced by GSF_dht_lookup_(), and process_dht_put_content().

◆ GSF_rt_entry_lifetime

struct GNUNET_LOAD_Value* GSF_rt_entry_lifetime

How long do requests typically stay in the routing table?

Definition at line 250 of file gnunet-service-fs.c.

Referenced by handle_p2p_get(), and process_reply().

◆ GSF_avg_latency

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 256 of file gnunet-service-fs.c.

Referenced by get_randomized_delay().

◆ GSF_ats

Handle to ATS service.

Definition at line 261 of file gnunet-service-fs.c.

Referenced by GSF_peer_connect_handler(), retry_reservation(), and schedule_transmission().

◆ GSF_current_priorities

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 274 of file gnunet-service-fs.c.

Referenced by bound_priority(), and plan().

◆ GSF_datastore_queue_size

unsigned int GSF_datastore_queue_size

Size of the datastore queue we assume for common requests.

Definition at line 279 of file gnunet-service-fs.c.

Referenced by handle_request(), run(), and start_local_query().

◆ GSF_cover_query_count

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 285 of file gnunet-service-fs.c.

Referenced by age_cover_counters(), and handle_p2p_get().

◆ GSF_cover_content_count

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 291 of file gnunet-service-fs.c.

Referenced by age_cover_counters(), handle_p2p_put(), and handle_p2p_reply().

◆ GSF_block_ctx

struct GNUNET_BLOCK_Context* GSF_block_ctx

◆ GSF_core

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 302 of file gnunet-service-fs.c.

◆ GSF_enable_randomized_delays

int GSF_enable_randomized_delays

Are we introducing randomized delays for better anonymity?

Definition at line 307 of file gnunet-service-fs.c.

Referenced by handle_p2p_reply(), and run().

◆ GSF_my_id

struct GNUNET_PeerIdentity GSF_my_id

Identity of this peer.

Definition at line 312 of file gnunet-service-fs.c.

Referenced by GSF_peer_connect_handler(), main_init(), and peer_init_handler().

◆ block_cfg

struct GNUNET_CONFIGURATION_Handle* block_cfg
static

Configuration for block library.

Definition at line 319 of file gnunet-service-fs.c.

◆ pk

struct GNUNET_CRYPTO_EddsaPrivateKey* pk
static

◆ cover_age_task

struct GNUNET_SCHEDULER_Task* cover_age_task
static

ID of our task that we use to age the cover counters.

Definition at line 329 of file gnunet-service-fs.c.

◆ datastore_get_load

struct GNUNET_LOAD_Value* datastore_get_load
static

Datastore 'GET' load tracking.

Definition at line 334 of file gnunet-service-fs.c.