aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r--src/fs/fs.h177
1 files changed, 176 insertions, 1 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h
index c2a2e7d03..002ffb6b3 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -26,6 +26,7 @@
26#ifndef FS_H 26#ifndef FS_H
27#define FS_H 27#define FS_H
28 28
29#include "gnunet_constants.h"
29#include "gnunet_datastore_service.h" 30#include "gnunet_datastore_service.h"
30#include "gnunet_fs_service.h" 31#include "gnunet_fs_service.h"
31 32
@@ -61,6 +62,63 @@
61 */ 62 */
62#define HASHING_BLOCKSIZE (1024 * 1024) 63#define HASHING_BLOCKSIZE (1024 * 1024)
63 64
65/**
66 * Number of bits we set per entry in the bloomfilter.
67 * Do not change!
68 */
69#define BLOOMFILTER_K 16
70
71/**
72 * By how much (in ms) do we decrement the TTL
73 * at each hop?
74 */
75#define TTL_DECREMENT 5000
76
77/**
78 * How long are we willing to wait for the datastore to be ready to
79 * process a request for a query without priority?
80 */
81#define BASIC_DATASTORE_REQUEST_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
82
83
84/**
85 * How long are we willing to wait for the core to be ready to
86 * transmit a reply to the target peer (if we can not transmit
87 * until then, we will discard the reply).
88 */
89#define ACCEPTABLE_REPLY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
90
91
92/**
93 * Bandwidth value of an (effectively) 0-priority query.
94 */
95#define QUERY_BANDWIDTH_VALUE 0.001
96
97/**
98 * Bandwidth value of a 0-priority content (must be
99 * fairly high compared to query since content is
100 * typically significantly larger -- and more valueable
101 * since it can take many queries to get one piece of
102 * content).
103 */
104#define CONTENT_BANDWIDTH_VALUE 0.8
105
106/**
107 * By which amount do we decrement the TTL for simple forwarding /
108 * indirection of the query; in milli-seconds. Set somewhat in
109 * accordance to your network latency (above the time it'll take you
110 * to send a packet and get a reply).
111 */
112#define TTL_DECREMENT 5000
113
114/**
115 * Until which load do we consider the peer idle and do not
116 * charge at all? (should be larger than GNUNET_IDLE_LOAD_THRESHOLD used
117 * by the rest of the code)!
118 */
119#define IDLE_LOAD_THRESHOLD ((100 + GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD) / 2)
120
121
64 122
65/** 123/**
66 * @brief content hash key 124 * @brief content hash key
@@ -1209,7 +1267,12 @@ struct SearchMessage
1209 * SBLOCKS (aka query). 1267 * SBLOCKS (aka query).
1210 */ 1268 */
1211 GNUNET_HashCode query; 1269 GNUNET_HashCode query;
1212 1270
1271 /* this is followed by the hash codes of already-known
1272 results (which should hence be excluded from what
1273 the service returns); naturally, this only applies
1274 to queries that can have multiple results, such as
1275 those for KBLOCKS (KSK) and SBLOCKS (SKS) */
1213}; 1276};
1214 1277
1215 1278
@@ -1243,6 +1306,118 @@ struct ContentMessage
1243 1306
1244}; 1307};
1245 1308
1309/**
1310 * Only the (mandatory) query is included.
1311 */
1312#define GET_MESSAGE_BIT_QUERY_ONLY 0
1313
1314/**
1315 * The peer identity of a peer waiting for the
1316 * reply is included (used if the response
1317 * should be transmitted to someone other than
1318 * the sender of the GET).
1319 */
1320#define GET_MESSAGE_BIT_RETURN_TO 1
1321
1322/**
1323 * The hash of the public key of the target
1324 * namespace is included (for SKS queries).
1325 */
1326#define GET_MESSAGE_BIT_SKS_NAMESPACE 2
1327
1328/**
1329 * The peer identity of a peer that had claimed to have the content
1330 * previously is included (can be used if responder-anonymity is not
1331 * desired; note that the precursor presumably lacked a direct
1332 * connection to the specified peer; still, the receiver is in no way
1333 * required to limit forwarding only to the specified peer, it should
1334 * only prefer it somewhat if possible).
1335 */
1336#define GET_MESSAGE_BIT_TRANSMIT_TO 4
1337
1338
1339/**
1340 * Message sent between peers asking for FS-content.
1341 */
1342struct GetMessage
1343{
1344
1345 /**
1346 * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
1347 */
1348 struct GNUNET_MessageHeader header;
1349
1350 /**
1351 * Type of the query (block type).
1352 */
1353 uint32_t type GNUNET_PACKED;
1354
1355 /**
1356 * How important is this request (network byte order)
1357 */
1358 uint32_t priority GNUNET_PACKED;
1359
1360 /**
1361 * Relative time to live in GNUNET_CRON_MILLISECONDS (network byte order)
1362 */
1363 int32_t ttl GNUNET_PACKED;
1364
1365 /**
1366 * The content hash should be mutated using this value
1367 * before checking against the bloomfilter (used to
1368 * get many different filters for the same hash codes).
1369 * The number should be in big-endian format when used
1370 * for mingling.
1371 */
1372 int32_t filter_mutator GNUNET_PACKED;
1373
1374 /**
1375 * Which of the optional hash codes are present at the end of the
1376 * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
1377 * set, an additional GNUNET_HashCode with the respective content
1378 * (in order of the bits) will be appended to the end of the GET
1379 * message.
1380 */
1381 uint32_t hash_bitmap GNUNET_PACKED;
1382
1383 /**
1384 * Hashcodes of the file(s) we're looking for.
1385 * Details depend on the query type.
1386 */
1387 GNUNET_HashCode query GNUNET_PACKED;
1388
1389 /* this is followed by hash codes
1390 as specified in the "hash_bitmap";
1391 after that, an optional bloomfilter
1392 (with bits set for replies that should
1393 be suppressed) can be present */
1394};
1395
1396
1397/**
1398 * Message sent between peers providing FS-content.
1399 */
1400struct PutMessage
1401{
1402
1403 /**
1404 * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
1405 */
1406 struct GNUNET_MessageHeader header;
1407
1408 /**
1409 * Type of the block (in big endian).
1410 */
1411 uint32_t type GNUNET_PACKED;
1412
1413 /**
1414 * When does this result expire?
1415 */
1416 struct GNUNET_TIME_RelativeNBO expiration;
1417
1418 /* this is followed by the actual encrypted content */
1419
1420};
1246 1421
1247 1422
1248#endif 1423#endif