GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
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_transport_service.h"
#include "gnunet_core_service.h"
#include "gnunet_block_lib.h"
#include "gnunet_ats_service.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   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
 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_EvaluationResult 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_PerformanceHandleGSF_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 44 of file gnunet-service-fs.h.

Referenced by bound_ttl(), handle_p2p_get(), and plan().

◆ DATASTORE_LOAD_AUTODECLINE

#define DATASTORE_LOAD_AUTODECLINE   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)

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 51 of file gnunet-service-fs.h.

Referenced by GSF_pending_request_init_(), and main_init().

◆ GET_MESSAGE_BIT_QUERY_ONLY

#define GET_MESSAGE_BIT_QUERY_ONLY   0

Only the (mandatory) query is included.

Definition at line 56 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 64 of file gnunet-service-fs.h.

Referenced by GSF_pending_request_get_message_(), and handle_p2p_get().

◆ 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 74 of file gnunet-service-fs.h.

Referenced by GSF_pending_request_get_message_(), and handle_p2p_get().

Function Documentation

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

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

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

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_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_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

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

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