aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.c')
-rw-r--r--src/fs/gnunet-service-fs_pr.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 8ca4121a5..0914ca4d2 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -74,7 +74,7 @@ struct GSF_PendingRequest
74 /** 74 /**
75 * Array of hash codes of replies we've already seen. 75 * Array of hash codes of replies we've already seen.
76 */ 76 */
77 GNUNET_HashCode *replies_seen; 77 struct GNUNET_HashCode *replies_seen;
78 78
79 /** 79 /**
80 * Bloomfilter masking replies we've already seen. 80 * Bloomfilter masking replies we've already seen.
@@ -263,15 +263,15 @@ refresh_bloomfilter (struct GSF_PendingRequest *pr)
263struct GSF_PendingRequest * 263struct GSF_PendingRequest *
264GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, 264GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
265 enum GNUNET_BLOCK_Type type, 265 enum GNUNET_BLOCK_Type type,
266 const GNUNET_HashCode * query, 266 const struct GNUNET_HashCode * query,
267 const GNUNET_HashCode * namespace, 267 const struct GNUNET_HashCode * namespace,
268 const struct GNUNET_PeerIdentity *target, 268 const struct GNUNET_PeerIdentity *target,
269 const char *bf_data, size_t bf_size, 269 const char *bf_data, size_t bf_size,
270 uint32_t mingle, uint32_t anonymity_level, 270 uint32_t mingle, uint32_t anonymity_level,
271 uint32_t priority, int32_t ttl, 271 uint32_t priority, int32_t ttl,
272 GNUNET_PEER_Id sender_pid, 272 GNUNET_PEER_Id sender_pid,
273 GNUNET_PEER_Id origin_pid, 273 GNUNET_PEER_Id origin_pid,
274 const GNUNET_HashCode * replies_seen, 274 const struct GNUNET_HashCode * replies_seen,
275 unsigned int replies_seen_count, 275 unsigned int replies_seen_count,
276 GSF_PendingRequestReplyHandler rh, void *rh_cls) 276 GSF_PendingRequestReplyHandler rh, void *rh_cls)
277{ 277{
@@ -324,9 +324,9 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
324 { 324 {
325 pr->replies_seen_size = replies_seen_count; 325 pr->replies_seen_size = replies_seen_count;
326 pr->replies_seen = 326 pr->replies_seen =
327 GNUNET_malloc (sizeof (GNUNET_HashCode) * pr->replies_seen_size); 327 GNUNET_malloc (sizeof (struct GNUNET_HashCode) * pr->replies_seen_size);
328 memcpy (pr->replies_seen, replies_seen, 328 memcpy (pr->replies_seen, replies_seen,
329 replies_seen_count * sizeof (GNUNET_HashCode)); 329 replies_seen_count * sizeof (struct GNUNET_HashCode));
330 pr->replies_seen_count = replies_seen_count; 330 pr->replies_seen_count = replies_seen_count;
331 } 331 }
332 if (NULL != bf_data) 332 if (NULL != bf_data)
@@ -398,11 +398,11 @@ GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra,
398 if ((pra->public_data.type != prb->public_data.type) || 398 if ((pra->public_data.type != prb->public_data.type) ||
399 (0 != 399 (0 !=
400 memcmp (&pra->public_data.query, &prb->public_data.query, 400 memcmp (&pra->public_data.query, &prb->public_data.query,
401 sizeof (GNUNET_HashCode))) || 401 sizeof (struct GNUNET_HashCode))) ||
402 ((pra->public_data.type == GNUNET_BLOCK_TYPE_FS_SBLOCK) && 402 ((pra->public_data.type == GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
403 (0 != 403 (0 !=
404 memcmp (&pra->public_data.namespace, &prb->public_data.namespace, 404 memcmp (&pra->public_data.namespace, &prb->public_data.namespace,
405 sizeof (GNUNET_HashCode))))) 405 sizeof (struct GNUNET_HashCode)))))
406 return GNUNET_NO; 406 return GNUNET_NO;
407 return GNUNET_OK; 407 return GNUNET_OK;
408} 408}
@@ -419,11 +419,11 @@ GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra,
419 */ 419 */
420void 420void
421GSF_pending_request_update_ (struct GSF_PendingRequest *pr, 421GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
422 const GNUNET_HashCode * replies_seen, 422 const struct GNUNET_HashCode * replies_seen,
423 unsigned int replies_seen_count) 423 unsigned int replies_seen_count)
424{ 424{
425 unsigned int i; 425 unsigned int i;
426 GNUNET_HashCode mhash; 426 struct GNUNET_HashCode mhash;
427 427
428 if (replies_seen_count + pr->replies_seen_count < pr->replies_seen_count) 428 if (replies_seen_count + pr->replies_seen_count < pr->replies_seen_count)
429 return; /* integer overflow */ 429 return; /* integer overflow */
@@ -434,7 +434,7 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
434 GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size, 434 GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size,
435 replies_seen_count + pr->replies_seen_count); 435 replies_seen_count + pr->replies_seen_count);
436 memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen, 436 memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen,
437 sizeof (GNUNET_HashCode) * replies_seen_count); 437 sizeof (struct GNUNET_HashCode) * replies_seen_count);
438 pr->replies_seen_count += replies_seen_count; 438 pr->replies_seen_count += replies_seen_count;
439 refresh_bloomfilter (pr); 439 refresh_bloomfilter (pr);
440 } 440 }
@@ -477,7 +477,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
477{ 477{
478 char lbuf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; 478 char lbuf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
479 struct GetMessage *gm; 479 struct GetMessage *gm;
480 GNUNET_HashCode *ext; 480 struct GNUNET_HashCode *ext;
481 size_t msize; 481 size_t msize;
482 unsigned int k; 482 unsigned int k;
483 uint32_t bm; 483 uint32_t bm;
@@ -515,7 +515,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
515 k++; 515 k++;
516 } 516 }
517 bf_size = GNUNET_CONTAINER_bloomfilter_get_size (pr->bf); 517 bf_size = GNUNET_CONTAINER_bloomfilter_get_size (pr->bf);
518 msize = sizeof (struct GetMessage) + bf_size + k * sizeof (GNUNET_HashCode); 518 msize = sizeof (struct GetMessage) + bf_size + k * sizeof (struct GNUNET_HashCode);
519 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); 519 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
520 if (buf_size < msize) 520 if (buf_size < msize)
521 return msize; 521 return msize;
@@ -537,13 +537,13 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
537 gm->filter_mutator = htonl (pr->mingle); 537 gm->filter_mutator = htonl (pr->mingle);
538 gm->hash_bitmap = htonl (bm); 538 gm->hash_bitmap = htonl (bm);
539 gm->query = pr->public_data.query; 539 gm->query = pr->public_data.query;
540 ext = (GNUNET_HashCode *) & gm[1]; 540 ext = (struct GNUNET_HashCode *) & gm[1];
541 k = 0; 541 k = 0;
542 if (!do_route) 542 if (!do_route)
543 GNUNET_PEER_resolve (pr->sender_pid, 543 GNUNET_PEER_resolve (pr->sender_pid,
544 (struct GNUNET_PeerIdentity *) &ext[k++]); 544 (struct GNUNET_PeerIdentity *) &ext[k++]);
545 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type) 545 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type)
546 memcpy (&ext[k++], &pr->public_data.namespace, sizeof (GNUNET_HashCode)); 546 memcpy (&ext[k++], &pr->public_data.namespace, sizeof (struct GNUNET_HashCode));
547 if (GNUNET_YES == pr->public_data.has_target) 547 if (GNUNET_YES == pr->public_data.has_target)
548 ext[k++] = pr->public_data.target.hashPubKey; 548 ext[k++] = pr->public_data.target.hashPubKey;
549 if (pr->bf != NULL) 549 if (pr->bf != NULL)
@@ -565,7 +565,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
565 * @return GNUNET_YES (we should continue to iterate) 565 * @return GNUNET_YES (we should continue to iterate)
566 */ 566 */
567static int 567static int
568clean_request (void *cls, const GNUNET_HashCode * key, void *value) 568clean_request (void *cls, const struct GNUNET_HashCode * key, void *value)
569{ 569{
570 struct GSF_PendingRequest *pr = value; 570 struct GSF_PendingRequest *pr = value;
571 GSF_LocalLookupContinuation cont; 571 GSF_LocalLookupContinuation cont;
@@ -763,11 +763,11 @@ update_request_performance_data (struct ProcessReplyClosure *prq,
763 * @return GNUNET_YES (we should continue to iterate) 763 * @return GNUNET_YES (we should continue to iterate)
764 */ 764 */
765static int 765static int
766process_reply (void *cls, const GNUNET_HashCode * key, void *value) 766process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
767{ 767{
768 struct ProcessReplyClosure *prq = cls; 768 struct ProcessReplyClosure *prq = cls;
769 struct GSF_PendingRequest *pr = value; 769 struct GSF_PendingRequest *pr = value;
770 GNUNET_HashCode chash; 770 struct GNUNET_HashCode chash;
771 struct GNUNET_TIME_Absolute last_transmission; 771 struct GNUNET_TIME_Absolute last_transmission;
772 772
773 if (NULL == pr->rh) 773 if (NULL == pr->rh)
@@ -783,7 +783,7 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value)
783 &pr->public_data.namespace, 783 &pr->public_data.namespace,
784 (prq->type == 784 (prq->type ==
785 GNUNET_BLOCK_TYPE_FS_SBLOCK) ? 785 GNUNET_BLOCK_TYPE_FS_SBLOCK) ?
786 sizeof (GNUNET_HashCode) : 0, prq->data, 786 sizeof (struct GNUNET_HashCode) : 0, prq->data,
787 prq->size); 787 prq->size);
788 switch (prq->eval) 788 switch (prq->eval)
789 { 789 {
@@ -1000,7 +1000,7 @@ test_put_load_too_high (uint32_t priority)
1000 */ 1000 */
1001static void 1001static void
1002handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp, 1002handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp,
1003 const GNUNET_HashCode * key, 1003 const struct GNUNET_HashCode * key,
1004 const struct GNUNET_PeerIdentity *get_path, 1004 const struct GNUNET_PeerIdentity *get_path,
1005 unsigned int get_path_length, 1005 unsigned int get_path_length,
1006 const struct GNUNET_PeerIdentity *put_path, 1006 const struct GNUNET_PeerIdentity *put_path,
@@ -1057,7 +1057,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1057 const void *xquery; 1057 const void *xquery;
1058 size_t xquery_size; 1058 size_t xquery_size;
1059 struct GNUNET_PeerIdentity pi; 1059 struct GNUNET_PeerIdentity pi;
1060 char buf[sizeof (GNUNET_HashCode) * 2] GNUNET_ALIGN; 1060 char buf[sizeof (struct GNUNET_HashCode) * 2] GNUNET_ALIGN;
1061 1061
1062 if (0 != pr->public_data.anonymity_level) 1062 if (0 != pr->public_data.anonymity_level)
1063 return; 1063 return;
@@ -1071,8 +1071,8 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1071 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type) 1071 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type)
1072 { 1072 {
1073 xquery = buf; 1073 xquery = buf;
1074 memcpy (buf, &pr->public_data.namespace, sizeof (GNUNET_HashCode)); 1074 memcpy (buf, &pr->public_data.namespace, sizeof (struct GNUNET_HashCode));
1075 xquery_size = sizeof (GNUNET_HashCode); 1075 xquery_size = sizeof (struct GNUNET_HashCode);
1076 } 1076 }
1077 if (0 != (pr->public_data.options & GSF_PRO_FORWARD_ONLY)) 1077 if (0 != (pr->public_data.options & GSF_PRO_FORWARD_ONLY))
1078 { 1078 {
@@ -1151,7 +1151,7 @@ odc_warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1151 * maybe 0 if no unique identifier is available 1151 * maybe 0 if no unique identifier is available
1152 */ 1152 */
1153static void 1153static void
1154process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, 1154process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size,
1155 const void *data, enum GNUNET_BLOCK_Type type, 1155 const void *data, enum GNUNET_BLOCK_Type type,
1156 uint32_t priority, uint32_t anonymity, 1156 uint32_t priority, uint32_t anonymity,
1157 struct GNUNET_TIME_Absolute expiration, uint64_t uid) 1157 struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -1159,7 +1159,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size,
1159 struct GSF_PendingRequest *pr = cls; 1159 struct GSF_PendingRequest *pr = cls;
1160 GSF_LocalLookupContinuation cont; 1160 GSF_LocalLookupContinuation cont;
1161 struct ProcessReplyClosure prq; 1161 struct ProcessReplyClosure prq;
1162 GNUNET_HashCode query; 1162 struct GNUNET_HashCode query;
1163 unsigned int old_rf; 1163 unsigned int old_rf;
1164 1164
1165 GNUNET_SCHEDULER_cancel (pr->warn_task); 1165 GNUNET_SCHEDULER_cancel (pr->warn_task);
@@ -1477,7 +1477,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1477 size_t dsize; 1477 size_t dsize;
1478 enum GNUNET_BLOCK_Type type; 1478 enum GNUNET_BLOCK_Type type;
1479 struct GNUNET_TIME_Absolute expiration; 1479 struct GNUNET_TIME_Absolute expiration;
1480 GNUNET_HashCode query; 1480 struct GNUNET_HashCode query;
1481 struct ProcessReplyClosure prq; 1481 struct ProcessReplyClosure prq;
1482 struct GNUNET_TIME_Relative block_time; 1482 struct GNUNET_TIME_Relative block_time;
1483 double putl; 1483 double putl;