X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ffs%2Fgnunet-service-fs.h;h=0c796bf9cc10f2d321fd2b2a8611e3f493dd277c;hb=6a3aa5797d49178e806fc5cc5713806647cbd040;hp=ed7cd2e7b287d5460adc102a0184a31fe362f431;hpb=4cb7e23cef8a149ac1334519ff898cc05811ac66;p=oweals%2Fgnunet.git diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index ed7cd2e7b..0c796bf9c 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h @@ -33,30 +33,14 @@ #include "gnunet_block_lib.h" #include "fs.h" -#define DEBUG_FS GNUNET_YES - -#define DEBUG_FS_CLIENT GNUNET_NO - /** - * Should we introduce random latency in processing? Required for proper - * implementation of GAP, but can be disabled for performance evaluation of - * the basic routing algorithm. - * - * Note that with delays enabled, performance can be significantly lower - * (several orders of magnitude in 2-peer test runs); if you want to - * measure throughput of other components, set this to NO. Also, you - * might want to consider changing 'RETRY_PROBABILITY_INV' to 1 for - * a rather wasteful mode of operation (that might still get the highest - * throughput overall). - * - * Performance measurements (for 50 MB file, 2 peers): - * - * - Without delays: 3300 kb/s - * - With delays: 101 kb/s + * 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). */ -#define SUPPORT_DELAYS GNUNET_NO - +#define TTL_DECREMENT 5000 /** * At what frequency should our datastore load decrease @@ -65,8 +49,119 @@ */ #define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) +/** + * Only the (mandatory) query is included. + */ +#define GET_MESSAGE_BIT_QUERY_ONLY 0 + +/** + * 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). + */ +#define GET_MESSAGE_BIT_RETURN_TO 1 + +/** + * The hash of the public key of the target + * namespace is included (for SKS queries). + */ +#define GET_MESSAGE_BIT_SKS_NAMESPACE 2 + +/** + * 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). + */ +#define GET_MESSAGE_BIT_TRANSMIT_TO 4 + + +GNUNET_NETWORK_STRUCT_BEGIN + +/** + * Message sent between peers asking for FS-content. + */ +struct GetMessage +{ + + /** + * Message type will be GNUNET_MESSAGE_TYPE_FS_GET. + */ + struct GNUNET_MessageHeader header; + + /** + * Type of the query (block type). + */ + uint32_t type GNUNET_PACKED; + + /** + * How important is this request (network byte order) + */ + uint32_t priority GNUNET_PACKED; + + /** + * Relative time to live in MILLISECONDS (network byte order) + */ + int32_t ttl GNUNET_PACKED; + + /** + * The content hash should be mutated using this value + * before checking against the bloomfilter (used to + * get many different filters for the same hash codes). + * The number should be in big-endian format when used + * for mingling. + */ + uint32_t filter_mutator GNUNET_PACKED; + + /** + * Which of the optional hash codes are present at the end of the + * message? See GET_MESSAGE_BIT_xx constants. For each bit that is + * set, an additional GNUNET_HashCode with the respective content + * (in order of the bits) will be appended to the end of the GET + * message. + */ + uint32_t hash_bitmap GNUNET_PACKED; + + /** + * Hashcodes of the file(s) we're looking for. + * Details depend on the query type. + */ + GNUNET_HashCode query; + + /* this is followed by hash codes as specified in the "hash_bitmap"; + * after that, an optional bloomfilter (with bits set for replies + * that should be suppressed) can be present */ +}; +/** + * Message send by a peer that wants to be excluded + * from migration for a while. + */ +struct MigrationStopMessage +{ + /** + * Message type will be + * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP. + */ + struct GNUNET_MessageHeader header; + + /** + * Always zero. + */ + uint32_t reserved GNUNET_PACKED; + + /** + * How long should the block last? + */ + struct GNUNET_TIME_RelativeNBO duration; + +}; +GNUNET_NETWORK_STRUCT_END + /** * A connected peer. */ @@ -87,6 +182,12 @@ struct GSF_LocalClient; */ struct GSF_RequestPlan; +/** + * DLL of request plans a particular pending request is + * involved with. + */ +struct GSF_RequestPlanReference; + /** * Our connection to the datastore. */ @@ -118,6 +219,11 @@ extern struct GNUNET_DHT_Handle *GSF_dht; */ extern struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime; +/** + * Running average of the observed latency to other peers (round trip). + */ +extern struct GNUNET_TIME_Relative GSF_avg_latency; + /** * Typical priorities we're seeing from other peers right now. Since * most priorities will be zero, this value is the weighted average of @@ -131,13 +237,13 @@ extern struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime; extern double GSF_current_priorities; /** - * How many query messages have we received 'recently' that + * How many query messages have we received 'recently' that * have not yet been claimed as cover traffic? */ extern unsigned int GSF_cover_query_count; /** - * How many content messages have we received 'recently' that + * How many content messages have we received 'recently' that * have not yet been claimed as cover traffic? */ extern unsigned int GSF_cover_content_count; @@ -155,8 +261,8 @@ extern int GSF_enable_randomized_delays; /** * Test if the DATABASE (GET) load on this peer is too high * to even consider processing the query at - * all. - * + * all. + * * @return 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)