diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.h')
-rw-r--r-- | src/fs/gnunet-service-fs.h | 310 |
1 files changed, 0 insertions, 310 deletions
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h deleted file mode 100644 index a6b73db09..000000000 --- a/src/fs/gnunet-service-fs.h +++ /dev/null | |||
@@ -1,310 +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 | |||
78 | GNUNET_NETWORK_STRUCT_BEGIN | ||
79 | |||
80 | /** | ||
81 | * Message sent between peers asking for FS-content. | ||
82 | */ | ||
83 | struct 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 | * The content hash should be mutated using this value | ||
107 | * before checking against the bloomfilter (used to | ||
108 | * get many different filters for the same hash codes). | ||
109 | * The number should be in big-endian format when used | ||
110 | * for mingling. | ||
111 | */ | ||
112 | uint32_t filter_mutator GNUNET_PACKED; | ||
113 | |||
114 | /** | ||
115 | * Which of the optional hash codes are present at the end of the | ||
116 | * message? See GET_MESSAGE_BIT_xx constants. For each bit that is | ||
117 | * set, an additional `struct GNUNET_HashCode` with the respective content | ||
118 | * (in order of the bits) will be appended to the end of the GET | ||
119 | * message. | ||
120 | */ | ||
121 | uint32_t hash_bitmap GNUNET_PACKED; | ||
122 | |||
123 | /** | ||
124 | * Hashcodes of the file(s) we're looking for. | ||
125 | * Details depend on the query type. | ||
126 | */ | ||
127 | struct GNUNET_HashCode query; | ||
128 | |||
129 | /* this is followed by PeerIdentities as specified in the "hash_bitmap"; | ||
130 | * after that, an optional bloomfilter (with bits set for replies | ||
131 | * that should be suppressed) can be present */ | ||
132 | }; | ||
133 | |||
134 | |||
135 | /** | ||
136 | * Message send by a peer that wants to be excluded | ||
137 | * from migration for a while. | ||
138 | */ | ||
139 | struct MigrationStopMessage | ||
140 | { | ||
141 | /** | ||
142 | * Message type will be | ||
143 | * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP. | ||
144 | */ | ||
145 | struct GNUNET_MessageHeader header; | ||
146 | |||
147 | /** | ||
148 | * Always zero. | ||
149 | */ | ||
150 | uint32_t reserved GNUNET_PACKED; | ||
151 | |||
152 | /** | ||
153 | * How long should the block last? | ||
154 | */ | ||
155 | struct GNUNET_TIME_RelativeNBO duration; | ||
156 | }; | ||
157 | GNUNET_NETWORK_STRUCT_END | ||
158 | |||
159 | /** | ||
160 | * A connected peer. | ||
161 | */ | ||
162 | struct GSF_ConnectedPeer; | ||
163 | |||
164 | /** | ||
165 | * An active request. | ||
166 | */ | ||
167 | struct GSF_PendingRequest; | ||
168 | |||
169 | /** | ||
170 | * A local client. | ||
171 | */ | ||
172 | struct GSF_LocalClient; | ||
173 | |||
174 | /** | ||
175 | * Information kept per plan per request ('pe' module). | ||
176 | */ | ||
177 | struct GSF_RequestPlan; | ||
178 | |||
179 | /** | ||
180 | * Bijection between request plans and pending requests. | ||
181 | */ | ||
182 | struct GSF_PendingRequestPlanBijection; | ||
183 | |||
184 | /** | ||
185 | * Our connection to the datastore. | ||
186 | */ | ||
187 | extern struct GNUNET_DATASTORE_Handle *GSF_dsh; | ||
188 | |||
189 | /** | ||
190 | * Our configuration. | ||
191 | */ | ||
192 | extern const struct GNUNET_CONFIGURATION_Handle *GSF_cfg; | ||
193 | |||
194 | /** | ||
195 | * Handle for reporting statistics. | ||
196 | */ | ||
197 | extern struct GNUNET_STATISTICS_Handle *GSF_stats; | ||
198 | |||
199 | /** | ||
200 | * Pointer to handle to the core service (points to NULL until we've | ||
201 | * connected to it). | ||
202 | */ | ||
203 | extern struct GNUNET_CORE_Handle *GSF_core; | ||
204 | |||
205 | /** | ||
206 | * Handle for DHT operations. | ||
207 | */ | ||
208 | extern struct GNUNET_DHT_Handle *GSF_dht; | ||
209 | |||
210 | /** | ||
211 | * How long do requests typically stay in the routing table? | ||
212 | */ | ||
213 | extern struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime; | ||
214 | |||
215 | /** | ||
216 | * Running average of the observed latency to other peers (round trip). | ||
217 | */ | ||
218 | extern struct GNUNET_TIME_Relative GSF_avg_latency; | ||
219 | |||
220 | /** | ||
221 | * Handle to ATS service. | ||
222 | */ | ||
223 | extern struct GNUNET_ATS_PerformanceHandle *GSF_ats; | ||
224 | |||
225 | /** | ||
226 | * Identity of this peer. | ||
227 | */ | ||
228 | extern struct GNUNET_PeerIdentity GSF_my_id; | ||
229 | |||
230 | /** | ||
231 | * Typical priorities we're seeing from other peers right now. Since | ||
232 | * most priorities will be zero, this value is the weighted average of | ||
233 | * non-zero priorities seen "recently". In order to ensure that new | ||
234 | * values do not dramatically change the ratio, values are first | ||
235 | * "capped" to a reasonable range (+N of the current value) and then | ||
236 | * averaged into the existing value by a ratio of 1:N. Hence | ||
237 | * receiving the largest possible priority can still only raise our | ||
238 | * "current_priorities" by at most 1. | ||
239 | */ | ||
240 | extern double GSF_current_priorities; | ||
241 | |||
242 | /** | ||
243 | * How many query messages have we received 'recently' that | ||
244 | * have not yet been claimed as cover traffic? | ||
245 | */ | ||
246 | extern unsigned int GSF_cover_query_count; | ||
247 | |||
248 | /** | ||
249 | * How many content messages have we received 'recently' that | ||
250 | * have not yet been claimed as cover traffic? | ||
251 | */ | ||
252 | extern unsigned int GSF_cover_content_count; | ||
253 | |||
254 | /** | ||
255 | * Our block context. | ||
256 | */ | ||
257 | extern struct GNUNET_BLOCK_Context *GSF_block_ctx; | ||
258 | |||
259 | /** | ||
260 | * Are we introducing randomized delays for better anonymity? | ||
261 | */ | ||
262 | extern int GSF_enable_randomized_delays; | ||
263 | |||
264 | /** | ||
265 | * Size of the datastore queue we assume for common requests. | ||
266 | */ | ||
267 | extern unsigned int GSF_datastore_queue_size; | ||
268 | |||
269 | |||
270 | /** | ||
271 | * Function to be called after we're done processing | ||
272 | * replies from the local lookup. If the result status | ||
273 | * code indicates that there may be more replies, plan | ||
274 | * forwarding the request. | ||
275 | * | ||
276 | * @param cls closure (NULL) | ||
277 | * @param pr the pending request we were processing | ||
278 | * @param result final datastore lookup result | ||
279 | */ | ||
280 | void | ||
281 | GSF_consider_forwarding (void *cls, | ||
282 | struct GSF_PendingRequest *pr, | ||
283 | enum GNUNET_BLOCK_ReplyEvaluationResult result); | ||
284 | |||
285 | |||
286 | /** | ||
287 | * Test if the DATABASE (GET) load on this peer is too high | ||
288 | * to even consider processing the query at | ||
289 | * all. | ||
290 | * | ||
291 | * @return #GNUNET_YES if the load is too high to do anything (load high) | ||
292 | * #GNUNET_NO to process normally (load normal) | ||
293 | * #GNUNET_SYSERR to process for free (load low) | ||
294 | */ | ||
295 | int | ||
296 | GSF_test_get_load_too_high_ (uint32_t priority); | ||
297 | |||
298 | |||
299 | /** | ||
300 | * We've just now completed a datastore request. Update our | ||
301 | * datastore load calculations. | ||
302 | * | ||
303 | * @param start time when the datastore request was issued | ||
304 | */ | ||
305 | void | ||
306 | GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start); | ||
307 | |||
308 | |||
309 | #endif | ||
310 | /* end of gnunet-service-fs.h */ | ||