stuff
authorChristian Grothoff <christian@grothoff.org>
Tue, 8 Feb 2011 22:57:06 +0000 (22:57 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 8 Feb 2011 22:57:06 +0000 (22:57 +0000)
src/fs/gnunet-service-fs_pr.c
src/fs/gnunet-service-fs_pr.h

index 343ec3ada5f9c9f94375d0939425afaad8236d1f..ad19a807e328e4b51d6f3bfb48075651e22911b2 100644 (file)
 #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,
index ee5124a9056b6bcc4feea0065b47e4959d305d63..5fb9d2a5a457119f3e0f6db77a6d8f7fb1b386c9 100644 (file)
@@ -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,