aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.h')
-rw-r--r--src/fs/gnunet-service-fs_pr.h141
1 files changed, 77 insertions, 64 deletions
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index 1e71aa7ee..2f89f6e73 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -33,38 +33,38 @@
33 * Options for pending requests (bits to be ORed). 33 * Options for pending requests (bits to be ORed).
34 */ 34 */
35enum GSF_PendingRequestOptions 35enum GSF_PendingRequestOptions
36 { 36{
37 /** 37 /**
38 * Request must only be processed locally. 38 * Request must only be processed locally.
39 */ 39 */
40 GSF_PRO_LOCAL_ONLY = 1, 40 GSF_PRO_LOCAL_ONLY = 1,
41 41
42 /** 42 /**
43 * Request must only be forwarded (no routing) 43 * Request must only be forwarded (no routing)
44 */ 44 */
45 GSF_PRO_FORWARD_ONLY = 2, 45 GSF_PRO_FORWARD_ONLY = 2,
46 46
47 /** 47 /**
48 * Request persists indefinitely (no expiration). 48 * Request persists indefinitely (no expiration).
49 */ 49 */
50 GSF_PRO_REQUEST_EXPIRES = 4, 50 GSF_PRO_REQUEST_EXPIRES = 4,
51 51
52 /** 52 /**
53 * Request is allowed to refresh bloomfilter and change mingle value. 53 * Request is allowed to refresh bloomfilter and change mingle value.
54 */ 54 */
55 GSF_PRO_BLOOMFILTER_FULL_REFRESH = 8, 55 GSF_PRO_BLOOMFILTER_FULL_REFRESH = 8,
56 56
57 /** 57 /**
58 * Request priority is allowed to be exceeded. 58 * Request priority is allowed to be exceeded.
59 */ 59 */
60 GSF_PRO_PRIORITY_UNLIMITED = 16, 60 GSF_PRO_PRIORITY_UNLIMITED = 16,
61 61
62 /** 62 /**
63 * Option mask for typical local requests. 63 * Option mask for typical local requests.
64 */ 64 */
65 GSF_PRO_LOCAL_REQUEST = (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) 65 GSF_PRO_LOCAL_REQUEST =
66 66 (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED)
67 }; 67};
68 68
69 69
70/** 70/**
@@ -84,7 +84,7 @@ struct GSF_PendingRequestData
84 * Namespace to query, only set if the type is SBLOCK. 84 * Namespace to query, only set if the type is SBLOCK.
85 */ 85 */
86 GNUNET_HashCode namespace; 86 GNUNET_HashCode namespace;
87 87
88 /** 88 /**
89 * Identity of a peer hosting the content, only set if 89 * Identity of a peer hosting the content, only set if
90 * 'has_target' is GNUNET_YES. 90 * 'has_target' is GNUNET_YES.
@@ -130,7 +130,7 @@ struct GSF_PendingRequestData
130 * Options for the request. 130 * Options for the request.
131 */ 131 */
132 enum GSF_PendingRequestOptions options; 132 enum GSF_PendingRequestOptions options;
133 133
134 /** 134 /**
135 * Type of the requested block. 135 * Type of the requested block.
136 */ 136 */
@@ -166,14 +166,17 @@ struct GSF_PendingRequestData
166 * @param data response data, NULL on request expiration 166 * @param data response data, NULL on request expiration
167 * @param data_len number of bytes in data 167 * @param data_len number of bytes in data
168 */ 168 */
169typedef void (*GSF_PendingRequestReplyHandler)(void *cls, 169typedef void (*GSF_PendingRequestReplyHandler) (void *cls,
170 enum GNUNET_BLOCK_EvaluationResult eval, 170 enum
171 struct GSF_PendingRequest *pr, 171 GNUNET_BLOCK_EvaluationResult
172 uint32_t reply_anonymity_level, 172 eval,
173 struct GNUNET_TIME_Absolute expiration, 173 struct GSF_PendingRequest * pr,
174 enum GNUNET_BLOCK_Type type, 174 uint32_t reply_anonymity_level,
175 const void *data, 175 struct GNUNET_TIME_Absolute
176 size_t data_len); 176 expiration,
177 enum GNUNET_BLOCK_Type type,
178 const void *data,
179 size_t data_len);
177 180
178 181
179/** 182/**
@@ -198,23 +201,33 @@ typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
198 * @param rh_cls closure for rh 201 * @param rh_cls closure for rh
199 * @return handle for the new pending request 202 * @return handle for the new pending request
200 */ 203 */
201struct GSF_PendingRequest * 204struct GSF_PendingRequest *GSF_pending_request_create_ (enum
202GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, 205 GSF_PendingRequestOptions
203 enum GNUNET_BLOCK_Type type, 206 options,
204 const GNUNET_HashCode *query, 207 enum GNUNET_BLOCK_Type
205 const GNUNET_HashCode *namespace, 208 type,
206 const struct GNUNET_PeerIdentity *target, 209 const GNUNET_HashCode *
207 const char *bf_data, 210 query,
208 size_t bf_size, 211 const GNUNET_HashCode *
209 uint32_t mingle, 212 namespace,
210 uint32_t anonymity_level, 213 const struct
211 uint32_t priority, 214 GNUNET_PeerIdentity
212 int32_t ttl, 215 *target,
213 GNUNET_PEER_Id sender_pid, 216 const char *bf_data,
214 const GNUNET_HashCode *replies_seen, 217 size_t bf_size,
215 unsigned int replies_seen_count, 218 uint32_t mingle,
216 GSF_PendingRequestReplyHandler rh, 219 uint32_t
217 void *rh_cls); 220 anonymity_level,
221 uint32_t priority,
222 int32_t ttl,
223 GNUNET_PEER_Id
224 sender_pid,
225 const GNUNET_HashCode *
226 replies_seen,
227 unsigned int
228 replies_seen_count,
229 GSF_PendingRequestReplyHandler
230 rh, void *rh_cls);
218 231
219 232
220/** 233/**
@@ -227,8 +240,8 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
227 */ 240 */
228void 241void
229GSF_pending_request_update_ (struct GSF_PendingRequest *pr, 242GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
230 const GNUNET_HashCode *replies_seen, 243 const GNUNET_HashCode * replies_seen,
231 unsigned int replies_seen_count); 244 unsigned int replies_seen_count);
232 245
233 246
234/** 247/**
@@ -237,8 +250,9 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
237 * @param pr pending request 250 * @param pr pending request
238 * @return associated public data 251 * @return associated public data
239 */ 252 */
240struct GSF_PendingRequestData * 253struct GSF_PendingRequestData *GSF_pending_request_get_data_ (struct
241GSF_pending_request_get_data_ (struct GSF_PendingRequest *pr); 254 GSF_PendingRequest
255 *pr);
242 256
243 257
244/** 258/**
@@ -252,7 +266,7 @@ GSF_pending_request_get_data_ (struct GSF_PendingRequest *pr);
252 */ 266 */
253int 267int
254GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra, 268GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra,
255 struct GSF_PendingRequest *prb); 269 struct GSF_PendingRequest *prb);
256 270
257 271
258/** 272/**
@@ -265,9 +279,14 @@ GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra,
265 * @return number of bytes needed (if buf_size too small) or used 279 * @return number of bytes needed (if buf_size too small) or used
266 */ 280 */
267size_t 281size_t
282
283
284
285
286
287
268GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, 288GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
269 size_t buf_size, 289 size_t buf_size, void *buf);
270 void *buf);
271 290
272 291
273/** 292/**
@@ -277,8 +296,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
277 * @param full_cleanup fully purge the request 296 * @param full_cleanup fully purge the request
278 */ 297 */
279void 298void
280GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, 299GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup);
281 int full_cleanup);
282 300
283 301
284/** 302/**
@@ -290,9 +308,9 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr,
290 * @param pr handle to the pending request 308 * @param pr handle to the pending request
291 * @return GNUNET_YES to continue to iterate 309 * @return GNUNET_YES to continue to iterate
292 */ 310 */
293typedef int (*GSF_PendingRequestIterator)(void *cls, 311typedef int (*GSF_PendingRequestIterator) (void *cls,
294 const GNUNET_HashCode *key, 312 const GNUNET_HashCode * key,
295 struct GSF_PendingRequest *pr); 313 struct GSF_PendingRequest * pr);
296 314
297 315
298/** 316/**
@@ -301,9 +319,7 @@ typedef int (*GSF_PendingRequestIterator)(void *cls,
301 * @param it function to call for each request 319 * @param it function to call for each request
302 * @param cls closure for it 320 * @param cls closure for it
303 */ 321 */
304void 322void GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls);
305GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it,
306 void *cls);
307 323
308 324
309/** 325/**
@@ -321,7 +337,7 @@ GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it,
321 */ 337 */
322int 338int
323GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, 339GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
324 const struct GNUNET_MessageHeader *message); 340 const struct GNUNET_MessageHeader *message);
325 341
326 342
327/** 343/**
@@ -329,8 +345,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
329 * 345 *
330 * @param pr the pending request to process 346 * @param pr the pending request to process
331 */ 347 */
332void 348void GSF_dht_lookup_ (struct GSF_PendingRequest *pr);
333GSF_dht_lookup_ (struct GSF_PendingRequest *pr);
334 349
335 350
336/** 351/**
@@ -341,9 +356,10 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr);
341 * @param pr the pending request we were processing 356 * @param pr the pending request we were processing
342 * @param result final datastore lookup result 357 * @param result final datastore lookup result
343 */ 358 */
344typedef void (*GSF_LocalLookupContinuation)(void *cls, 359typedef void (*GSF_LocalLookupContinuation) (void *cls,
345 struct GSF_PendingRequest *pr, 360 struct GSF_PendingRequest * pr,
346 enum GNUNET_BLOCK_EvaluationResult result); 361 enum GNUNET_BLOCK_EvaluationResult
362 result);
347 363
348 364
349/** 365/**
@@ -355,22 +371,19 @@ typedef void (*GSF_LocalLookupContinuation)(void *cls,
355 */ 371 */
356void 372void
357GSF_local_lookup_ (struct GSF_PendingRequest *pr, 373GSF_local_lookup_ (struct GSF_PendingRequest *pr,
358 GSF_LocalLookupContinuation cont, 374 GSF_LocalLookupContinuation cont, void *cont_cls);
359 void *cont_cls);
360 375
361 376
362/** 377/**
363 * Setup the subsystem. 378 * Setup the subsystem.
364 */ 379 */
365void 380void GSF_pending_request_init_ (void);
366GSF_pending_request_init_ (void);
367 381
368 382
369/** 383/**
370 * Shutdown the subsystem. 384 * Shutdown the subsystem.
371 */ 385 */
372void 386void GSF_pending_request_done_ (void);
373GSF_pending_request_done_ (void);
374 387
375 388
376#endif 389#endif