aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs.h')
-rw-r--r--src/fs/gnunet-service-fs.h306
1 files changed, 0 insertions, 306 deletions
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h
deleted file mode 100644
index 56d102673..000000000
--- a/src/fs/gnunet-service-fs.h
+++ /dev/null
@@ -1,306 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file fs/gnunet-service-fs.h
23 * @brief shared data structures of gnunet-service-fs.c
24 * @author Christian Grothoff
25 */
26#ifndef GNUNET_SERVICE_FS_H
27#define GNUNET_SERVICE_FS_H
28
29#include "gnunet_util_lib.h"
30#include "gnunet_statistics_service.h"
31#include "gnunet_transport_service.h"
32#include "gnunet_core_service.h"
33#include "gnunet_block_lib.h"
34#include "gnunet_ats_service.h"
35#include "fs.h"
36
37
38/**
39 * By which amount do we decrement the TTL for simple forwarding /
40 * indirection of the query; in milli-seconds. Set somewhat in
41 * accordance to your network latency (above the time it'll take you
42 * to send a packet and get a reply).
43 */
44#define TTL_DECREMENT 5000
45
46/**
47 * At what frequency should our datastore load decrease
48 * automatically (since if we don't use it, clearly the
49 * load must be going down).
50 */
51#define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply ( \
52 GNUNET_TIME_UNIT_MILLISECONDS, 250)
53
54/**
55 * Only the (mandatory) query is included.
56 */
57#define GET_MESSAGE_BIT_QUERY_ONLY 0
58
59/**
60 * The peer identity of a peer waiting for the
61 * reply is included (used if the response
62 * should be transmitted to someone other than
63 * the sender of the GET).
64 */
65#define GET_MESSAGE_BIT_RETURN_TO 1
66
67/**
68 * The peer identity of a peer that had claimed to have the content
69 * previously is included (can be used if responder-anonymity is not
70 * desired; note that the precursor presumably lacked a direct
71 * connection to the specified peer; still, the receiver is in no way
72 * required to limit forwarding only to the specified peer, it should
73 * only prefer it somewhat if possible).
74 */
75#define GET_MESSAGE_BIT_TRANSMIT_TO 4
76
77
78GNUNET_NETWORK_STRUCT_BEGIN
79
80/**
81 * Message sent between peers asking for FS-content.
82 */
83struct GetMessage
84{
85 /**
86 * Message type will be #GNUNET_MESSAGE_TYPE_FS_GET.
87 */
88 struct GNUNET_MessageHeader header;
89
90 /**
91 * Type of the query (block type).
92 */
93 uint32_t type GNUNET_PACKED;
94
95 /**
96 * How important is this request (network byte order)
97 */
98 uint32_t priority GNUNET_PACKED;
99
100 /**
101 * Relative time to live in MILLISECONDS (network byte order)
102 */
103 int32_t ttl GNUNET_PACKED;
104
105 /**
106 * These days not used.
107 */
108 uint32_t reserved GNUNET_PACKED;
109
110 /**
111 * Which of the optional hash codes are present at the end of the
112 * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
113 * set, an additional `struct GNUNET_HashCode` with the respective content
114 * (in order of the bits) will be appended to the end of the GET
115 * message.
116 */
117 uint32_t hash_bitmap GNUNET_PACKED;
118
119 /**
120 * Hashcodes of the file(s) we're looking for.
121 * Details depend on the query type.
122 */
123 struct GNUNET_HashCode query;
124
125 /* this is followed by PeerIdentities as specified in the "hash_bitmap";
126 * after that, an optional bloomfilter (with bits set for replies
127 * that should be suppressed) can be present */
128};
129
130
131/**
132 * Message send by a peer that wants to be excluded
133 * from migration for a while.
134 */
135struct MigrationStopMessage
136{
137 /**
138 * Message type will be
139 * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP.
140 */
141 struct GNUNET_MessageHeader header;
142
143 /**
144 * Always zero.
145 */
146 uint32_t reserved GNUNET_PACKED;
147
148 /**
149 * How long should the block last?
150 */
151 struct GNUNET_TIME_RelativeNBO duration;
152};
153GNUNET_NETWORK_STRUCT_END
154
155/**
156 * A connected peer.
157 */
158struct GSF_ConnectedPeer;
159
160/**
161 * An active request.
162 */
163struct GSF_PendingRequest;
164
165/**
166 * A local client.
167 */
168struct GSF_LocalClient;
169
170/**
171 * Information kept per plan per request ('pe' module).
172 */
173struct GSF_RequestPlan;
174
175/**
176 * Bijection between request plans and pending requests.
177 */
178struct GSF_PendingRequestPlanBijection;
179
180/**
181 * Our connection to the datastore.
182 */
183extern struct GNUNET_DATASTORE_Handle *GSF_dsh;
184
185/**
186 * Our configuration.
187 */
188extern const struct GNUNET_CONFIGURATION_Handle *GSF_cfg;
189
190/**
191 * Handle for reporting statistics.
192 */
193extern struct GNUNET_STATISTICS_Handle *GSF_stats;
194
195/**
196 * Pointer to handle to the core service (points to NULL until we've
197 * connected to it).
198 */
199extern struct GNUNET_CORE_Handle *GSF_core;
200
201/**
202 * Handle for DHT operations.
203 */
204extern struct GNUNET_DHT_Handle *GSF_dht;
205
206/**
207 * How long do requests typically stay in the routing table?
208 */
209extern struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime;
210
211/**
212 * Running average of the observed latency to other peers (round trip).
213 */
214extern struct GNUNET_TIME_Relative GSF_avg_latency;
215
216/**
217 * Handle to ATS service.
218 */
219extern struct GNUNET_ATS_PerformanceHandle *GSF_ats;
220
221/**
222 * Identity of this peer.
223 */
224extern struct GNUNET_PeerIdentity GSF_my_id;
225
226/**
227 * Typical priorities we're seeing from other peers right now. Since
228 * most priorities will be zero, this value is the weighted average of
229 * non-zero priorities seen "recently". In order to ensure that new
230 * values do not dramatically change the ratio, values are first
231 * "capped" to a reasonable range (+N of the current value) and then
232 * averaged into the existing value by a ratio of 1:N. Hence
233 * receiving the largest possible priority can still only raise our
234 * "current_priorities" by at most 1.
235 */
236extern double GSF_current_priorities;
237
238/**
239 * How many query messages have we received 'recently' that
240 * have not yet been claimed as cover traffic?
241 */
242extern unsigned int GSF_cover_query_count;
243
244/**
245 * How many content messages have we received 'recently' that
246 * have not yet been claimed as cover traffic?
247 */
248extern unsigned int GSF_cover_content_count;
249
250/**
251 * Our block context.
252 */
253extern struct GNUNET_BLOCK_Context *GSF_block_ctx;
254
255/**
256 * Are we introducing randomized delays for better anonymity?
257 */
258extern int GSF_enable_randomized_delays;
259
260/**
261 * Size of the datastore queue we assume for common requests.
262 */
263extern unsigned int GSF_datastore_queue_size;
264
265
266/**
267 * Function to be called after we're done processing
268 * replies from the local lookup. If the result status
269 * code indicates that there may be more replies, plan
270 * forwarding the request.
271 *
272 * @param cls closure (NULL)
273 * @param pr the pending request we were processing
274 * @param result final datastore lookup result
275 */
276void
277GSF_consider_forwarding (void *cls,
278 struct GSF_PendingRequest *pr,
279 enum GNUNET_BLOCK_ReplyEvaluationResult result);
280
281
282/**
283 * Test if the DATABASE (GET) load on this peer is too high
284 * to even consider processing the query at
285 * all.
286 *
287 * @return #GNUNET_YES if the load is too high to do anything (load high)
288 * #GNUNET_NO to process normally (load normal)
289 * #GNUNET_SYSERR to process for free (load low)
290 */
291int
292GSF_test_get_load_too_high_ (uint32_t priority);
293
294
295/**
296 * We've just now completed a datastore request. Update our
297 * datastore load calculations.
298 *
299 * @param start time when the datastore request was issued
300 */
301void
302GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start);
303
304
305#endif
306/* end of gnunet-service-fs.h */