-fix off-by-1
[oweals/gnunet.git] / src / dht / gnunet-service-wdht_datacache.h
index 818138a87a85789133f6d8faa8b8d2e0200a1327..ba9b55a0c55b981cadcf038b48152a343d90e99e 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2011, 2015 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -29,6 +29,7 @@
 
 #include "gnunet_util_lib.h"
 #include "gnunet_block_lib.h"
+#include "gnunet_dht_service.h"
 
 /**
  * Handle a datum we've received from another peer.  Cache if
@@ -38,6 +39,8 @@
  * @param key the query this reply is for
  * @param put_path_length number of peers in @a put_path
  * @param put_path path the reply took on put
+ * @param get_path_length number of peers in @a get_path
+ * @param get_path path the reply took on get
  * @param type type of the reply
  * @param data_size number of bytes in @a data
  * @param data application payload data
@@ -47,13 +50,18 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
                           const struct GNUNET_HashCode *key,
                           unsigned int put_path_length,
                           const struct GNUNET_PeerIdentity *put_path,
-                          enum GNUNET_BLOCK_Type type, size_t data_size,
+                          unsigned int get_path_length,
+                          const struct GNUNET_PeerIdentity *get_path,
+                          enum GNUNET_BLOCK_Type type,
+                          size_t data_size,
                           const void *data);
 
 
 /**
  * Handle a GET request we've received from another peer.
  *
+ * @param trail_id trail where the reply needs to be send to
+ * @param options routing options (to be passed along)
  * @param key the query
  * @param type requested data type
  * @param xquery extended query
@@ -61,18 +69,18 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
  * @param reply_bf where the reply bf is (to be) stored, possibly updated!, can be NULL
  * @param reply_bf_mutator mutation value for @a reply_bf
  * @return evaluation result for the local replies
+ *
+ * FIXME: also pass options, so we know to record paths or not...
  */
 enum GNUNET_BLOCK_EvaluationResult
-GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
+GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *trail_id,
+                          enum GNUNET_DHT_RouteOption options,
+                          const struct GNUNET_HashCode *key,
                           enum GNUNET_BLOCK_Type type,
                           const void *xquery,
                           size_t xquery_size,
                           struct GNUNET_CONTAINER_BloomFilter **reply_bf,
-                          uint32_t reply_bf_mutator,
-                          uint32_t get_path_length,
-                          struct GNUNET_PeerIdentity *get_path,
-                          struct GNUNET_PeerIdentity *next_hop,
-                          struct GNUNET_PeerIdentity *source_peer);
+                          uint32_t reply_bf_mutator);
 
 
 /**
@@ -91,10 +99,12 @@ GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key);
  * Handle a request for data close to a key that we have received from
  * another peer.
  *
+ * @param trail_id trail where the reply needs to be send to
  * @param key the location at which the peer is looking for data that is close
  */
 void
-GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key);
+GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *trail_id,
+                              const struct GNUNET_HashCode *key);
 
 
 /**