From: Christian Grothoff Date: Tue, 8 Feb 2011 22:57:06 +0000 (+0000) Subject: stuff X-Git-Tag: initial-import-from-subversion-38251~19148 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6cf52d591c8a72c1fd5b71850e3abe85ffe3433a;p=oweals%2Fgnunet.git stuff --- diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 343ec3ada..ad19a807e 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -27,6 +27,38 @@ #include "gnunet-service-fs_pr.h" +/** + * An active request. + */ +struct GSF_PendingRequest +{ + /** + * Public data for the request. + */ + struct GSF_PendingRequestData public_data; + + GSF_PendingRequestReplyHandler rh; + + void *rh_cls; + + const GNUNET_HashCode *replies_seen; + + struct GNUNET_CONTAINER_BloomFilter *bf; + + unsigned int replies_seen_count; + + int32_t mingle; + +}; + + +/** + * All pending requests, ordered by the query. Entries + * are of type 'struct GSF_PendingRequest*'. + */ +static struct GNUNET_CONTAINER_MultiHashMap *requests; + + /** * Create a new pending request. * @@ -51,7 +83,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, const GNUNET_HashCode *query, const GNUNET_HashCode *namespace, const struct GNUNET_PeerIdentity *target, - struct GNUNET_CONTAINER_BloomFilter *bf, + const struct GNUNET_CONTAINER_BloomFilter *bf, int32_t mingle, uint32_t anonymity_level, uint32_t priority, diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index ee5124a90..5fb9d2a5a 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h @@ -63,9 +63,60 @@ enum GSF_PendingRequestOptions * Option mask for typical local requests. */ GSF_PRO_LOCAL_REQUEST = (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) + }; +/** + * Public data associated with each pending request. + */ +struct GSF_PendingRequestData +{ + + /** + * Primary query hash for this request. + */ + GNUNET_HashCode query; + + /** + * Namespace to query, only set if the type is SBLOCK. + */ + GNUNET_HashCode namespace; + + /** + * Identity of a peer hosting the content, only set if + * 'has_target' is GNUNET_YES. + */ + struct GNUNET_PeerIdentity target; + + /** + * Desired anonymity level. + */ + uint32_t anonymity_level; + + /** + * Priority that this request (still) has for us. + */ + uint32_t priority; + + /** + * Options for the request. + */ + enum GSF_PendingRequestOptions options; + + /** + * Type of the requested block. + */ + enum GNUNET_BLOCK_Type type; + + /** + * Is the 'target' value set to a valid peer identity? + */ + int has_target; + +}; + + /** * Handle a reply to a pending request. Also called if a request * expires (then with data == NULL). The handler may be called @@ -109,7 +160,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, const GNUNET_HashCode *query, const GNUNET_HashCode *namespace, const struct GNUNET_PeerIdentity *target, - struct GNUNET_CONTAINER_BloomFilter *bf, + const struct GNUNET_CONTAINER_BloomFilter *bf, int32_t mingle, uint32_t anonymity_level, uint32_t priority,