#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.
*
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,
* 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
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,