GNUnet 0.21.0
gnunet-service-fs.h File Reference

shared data structures of gnunet-service-fs.c More...

#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_core_service.h"
#include "gnunet_block_lib.h"
#include "fs.h"
Include dependency graph for gnunet-service-fs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GetMessage
 Message to the datastore service asking about specific content. More...
 
struct  MigrationStopMessage
 Message send by a peer that wants to be excluded from migration for a while. More...
 

Macros

#define TTL_DECREMENT   5000
 By which amount do we decrement the TTL for simple forwarding / indirection of the query; in milli-seconds. More...
 
#define DATASTORE_LOAD_AUTODECLINE
 At what frequency should our datastore load decrease automatically (since if we don't use it, clearly the load must be going down). More...
 
#define GET_MESSAGE_BIT_QUERY_ONLY   0
 Only the (mandatory) query is included. More...
 
#define GET_MESSAGE_BIT_RETURN_TO   1
 The peer identity of a peer waiting for the reply is included (used if the response should be transmitted to someone other than the sender of the GET). More...
 
#define GET_MESSAGE_BIT_TRANSMIT_TO   4
 The peer identity of a peer that had claimed to have the content previously is included (can be used if responder-anonymity is not desired; note that the precursor presumably lacked a direct connection to the specified peer; still, the receiver is in no way required to limit forwarding only to the specified peer, it should only prefer it somewhat if possible). More...
 

Functions

void GSF_consider_forwarding (void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_ReplyEvaluationResult result)
 Function to be called after we're done processing replies from the local lookup. More...
 
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...
 
void GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start)
 We've just now completed a datastore request. 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_CORE_HandleGSF_core
 Pointer to handle to the core service (points to NULL until we've connected to it). 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
 Running average of the observed latency to other peers (round trip). More...
 
struct GNUNET_ATS_PerformanceHandle * GSF_ats
 Handle to ATS service. More...
 
struct GNUNET_PeerIdentity GSF_my_id
 Identity of this peer. More...
 
double GSF_current_priorities
 Typical priorities we're seeing from other peers right now. 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...
 
int GSF_enable_randomized_delays
 Are we introducing randomized delays for better anonymity? More...
 
unsigned int GSF_datastore_queue_size
 Size of the datastore queue we assume for common requests. More...
 

Detailed Description

shared data structures of gnunet-service-fs.c

Author
Christian Grothoff

Definition in file gnunet-service-fs.h.

Macro Definition Documentation

◆ TTL_DECREMENT

#define TTL_DECREMENT   5000

By which amount do we decrement the TTL for simple forwarding / indirection of the query; in milli-seconds.

Set somewhat in accordance to your network latency (above the time it'll take you to send a packet and get a reply).

Definition at line 42 of file gnunet-service-fs.h.

◆ DATASTORE_LOAD_AUTODECLINE

#define DATASTORE_LOAD_AUTODECLINE
Value:
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:484

At what frequency should our datastore load decrease automatically (since if we don't use it, clearly the load must be going down).

Definition at line 49 of file gnunet-service-fs.h.

◆ GET_MESSAGE_BIT_QUERY_ONLY

#define GET_MESSAGE_BIT_QUERY_ONLY   0

Only the (mandatory) query is included.

Definition at line 55 of file gnunet-service-fs.h.

◆ GET_MESSAGE_BIT_RETURN_TO

#define GET_MESSAGE_BIT_RETURN_TO   1

The peer identity of a peer waiting for the reply is included (used if the response should be transmitted to someone other than the sender of the GET).

Definition at line 63 of file gnunet-service-fs.h.

◆ GET_MESSAGE_BIT_TRANSMIT_TO

#define GET_MESSAGE_BIT_TRANSMIT_TO   4

The peer identity of a peer that had claimed to have the content previously is included (can be used if responder-anonymity is not desired; note that the precursor presumably lacked a direct connection to the specified peer; still, the receiver is in no way required to limit forwarding only to the specified peer, it should only prefer it somewhat if possible).

Definition at line 73 of file gnunet-service-fs.h.

Function Documentation

◆ GSF_consider_forwarding()

void GSF_consider_forwarding ( void *  cls,
struct GSF_PendingRequest pr,
enum GNUNET_BLOCK_ReplyEvaluationResult  result 
)

Function to be called after we're done processing replies from the local lookup.

If the result status code indicates that there may be more replies, plan forwarding the request.

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

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

626{
628 return; /* we're done... */
629 if (GNUNET_YES !=
631 return; /* request is not actually active, skip! */
633 pr);
634}
static int result
Global testing status.
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.
void GSF_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
@ GNUNET_BLOCK_REPLY_OK_LAST
Last possible valid result.
@ GNUNET_YES

References consider_request_for_forwarding(), GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_YES, GSF_iterate_connected_peers_(), GSF_pending_request_test_active_(), and result.

Referenced by handle_p2p_get(), and start_p2p_processing().

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.

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

544{
545 double ld;
546
548 if (ld < 1)
549 return GNUNET_SYSERR;
550 if (ld <= priority)
551 return GNUNET_NO;
552 return GNUNET_YES;
553}
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore 'GET' load tracking.
@ GNUNET_NO
@ GNUNET_SYSERR
double GNUNET_LOAD_get_load(struct GNUNET_LOAD_Value *load)
Get the current load.
Definition: load.c:201

References datastore_get_load, GNUNET_LOAD_get_load(), GNUNET_NO, GNUNET_SYSERR, and GNUNET_YES.

Referenced by bound_priority(), and process_local_reply().

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

524{
525 struct GNUNET_TIME_Relative delay;
526
528 GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us);
529}
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
void GNUNET_LOAD_update(struct GNUNET_LOAD_Value *load, uint64_t data)
Update the current load.
Definition: load.c:237
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:436
Time for relative time used by GNUnet, in microseconds.

References datastore_get_load, GNUNET_LOAD_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_Relative::rel_value_us, and start.

Referenced by process_local_reply().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GSF_dsh

◆ GSF_cfg

const struct GNUNET_CONFIGURATION_Handle* GSF_cfg
extern

◆ GSF_stats

◆ GSF_core

struct GNUNET_CORE_Handle* GSF_core
extern

Pointer to handle to the core service (points to NULL until we've connected to it).

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

Referenced by main_init(), and shutdown_task().

◆ GSF_dht

struct GNUNET_DHT_Handle* GSF_dht
extern

Handle for DHT operations.

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

Referenced by GSF_dht_lookup_(), process_dht_put_content(), run(), and shutdown_task().

◆ GSF_rt_entry_lifetime

struct GNUNET_LOAD_Value* GSF_rt_entry_lifetime
extern

How long do requests typically stay in the routing table?

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

Referenced by handle_p2p_get(), process_reply(), run(), and shutdown_task().

◆ GSF_avg_latency

struct GNUNET_TIME_Relative GSF_avg_latency
extern

Running average of the observed latency to other peers (round trip).

Initialized to 5s as the initial default.

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

Referenced by get_randomized_delay().

◆ GSF_ats

struct GNUNET_ATS_PerformanceHandle* GSF_ats
extern

Handle to ATS service.

◆ GSF_my_id

struct GNUNET_PeerIdentity GSF_my_id
extern

Identity of this peer.

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

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

◆ GSF_current_priorities

double GSF_current_priorities
extern

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

Referenced by bound_priority(), and plan().

◆ GSF_cover_query_count

unsigned int GSF_cover_query_count
extern

How many query messages have we received 'recently' that have not yet been claimed as cover traffic?

Definition at line 272 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
extern

How many content messages have we received 'recently' that have not yet been claimed as cover traffic?

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

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

◆ GSF_block_ctx

◆ GSF_enable_randomized_delays

int GSF_enable_randomized_delays
extern

Are we introducing randomized delays for better anonymity?

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

Referenced by handle_p2p_reply(), and run().

◆ GSF_datastore_queue_size

unsigned int GSF_datastore_queue_size
extern

Size of the datastore queue we assume for common requests.

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

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