gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17081 - in gnunet/src: fs include mesh vpn


From: gnunet
Subject: [GNUnet-SVN] r17081 - in gnunet/src: fs include mesh vpn
Date: Tue, 27 Sep 2011 23:06:11 +0200

Author: grothoff
Date: 2011-09-27 23:06:11 +0200 (Tue, 27 Sep 2011)
New Revision: 17081

Modified:
   gnunet/src/fs/gnunet-service-fs_pr.c
   gnunet/src/fs/gnunet-service-fs_put.c
   gnunet/src/include/gnunet_dht_service.h
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/vpn/gnunet-service-dns.c
Log:
DHT api switch adjustments

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2011-09-27 20:55:20 UTC (rev 
17080)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2011-09-27 21:06:11 UTC (rev 
17081)
@@ -941,10 +941,10 @@
  * @param cls closure
  * @param exp when will this value expire
  * @param key key of the result
- * @param get_path NULL-terminated array of pointers
- *                 to the peers on reverse GET path (or NULL if not recorded)
- * @param put_path NULL-terminated array of pointers
- *                 to the peers on the PUT path (or NULL if not recorded)
+ * @param get_path peers on reply path (or NULL if not recorded)
+ * @param get_path_length number of entries in get_path
+ * @param put_path peers on the PUT path (or NULL if not recorded)
+ * @param put_path_length number of entries in get_path
  * @param type type of the result
  * @param size number of bytes in data
  * @param data pointer to the result data
@@ -952,8 +952,10 @@
 static void
 handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp,
                   const GNUNET_HashCode * key,
-                  const struct GNUNET_PeerIdentity *const *get_path,
-                  const struct GNUNET_PeerIdentity *const *put_path,
+                  const struct GNUNET_PeerIdentity *get_path,
+                 unsigned int get_path_length,
+                  const struct GNUNET_PeerIdentity *put_path,
+                 unsigned int put_path_length,
                   enum GNUNET_BLOCK_Type type, size_t size, const void *data)
 {
   struct GSF_PendingRequest *pr = cls;
@@ -1032,9 +1034,10 @@
   pr->gh =
       GNUNET_DHT_get_start (GSF_dht, GNUNET_TIME_UNIT_FOREVER_REL,
                             pr->public_data.type, &pr->public_data.query,
-                            DEFAULT_GET_REPLICATION,
-                            GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, pr->bf,
-                            pr->mingle, xquery, xquery_size, &handle_dht_reply,
+                            5 /* DEFAULT_GET_REPLICATION */,
+                            GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 
+                           /* FIXME: can no longer pass pr->bf/pr->mingle... */
+                            xquery, xquery_size, &handle_dht_reply,
                             pr);
 }
 

Modified: gnunet/src/fs/gnunet-service-fs_put.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_put.c       2011-09-27 20:55:20 UTC (rev 
17080)
+++ gnunet/src/fs/gnunet-service-fs_put.c       2011-09-27 21:06:11 UTC (rev 
17081)
@@ -161,7 +161,7 @@
               "Retrieved block `%s' of type %u for DHT PUT\n", GNUNET_h2s 
(key),
               type);
 #endif
-  GNUNET_DHT_put (GSF_dht, key, DEFAULT_PUT_REPLICATION, GNUNET_DHT_RO_NONE,
+  GNUNET_DHT_put (GSF_dht, key, 5 /* DEFAULT_PUT_REPLICATION */, 
GNUNET_DHT_RO_NONE,
                   type, size, data, expiration, GNUNET_TIME_UNIT_FOREVER_REL,
                   &delay_dht_put_blocks, po);
 }

Modified: gnunet/src/include/gnunet_dht_service.h
===================================================================
--- gnunet/src/include/gnunet_dht_service.h     2011-09-27 20:55:20 UTC (rev 
17080)
+++ gnunet/src/include/gnunet_dht_service.h     2011-09-27 21:06:11 UTC (rev 
17081)
@@ -41,6 +41,13 @@
 
 
 /**
+ * Default republication frequency for stored data in the DHT.
+ */
+#define GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 60)
+
+
+
+/**
  * Connection to the DHT service.
  */
 struct GNUNET_DHT_Handle;

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-09-27 20:55:20 UTC (rev 
17080)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-09-27 21:06:11 UTC (rev 
17081)
@@ -577,10 +577,6 @@
  * @param cls closure
  * @param exp when will this value expire
  * @param key key of the result
- * @param get_path NULL-terminated array of pointers
- *                 to the peers on reverse GET path (or NULL if not recorded)
- * @param put_path NULL-terminated array of pointers
- *                 to the peers on the PUT path (or NULL if not recorded)
  * @param type type of the result
  * @param size number of bytes in data
  * @param data pointer to the result data
@@ -588,8 +584,10 @@
 static void
 dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
                     const GNUNET_HashCode * key,
-                    const struct GNUNET_PeerIdentity *const *get_path,
-                    const struct GNUNET_PeerIdentity *const *put_path,
+                    const struct GNUNET_PeerIdentity *get_path,
+                   unsigned int get_path_length,
+                    const struct GNUNET_PeerIdentity *put_path,
+                   unsigned int put_path_length,
                     enum GNUNET_BLOCK_Type type, size_t size, const void 
*data);
 
 
@@ -759,11 +757,9 @@
                                             &id.hashPubKey,   /*key to search 
*/
                                             4,        /* replication level */
                                             GNUNET_DHT_RO_RECORD_ROUTE,
-                                            NULL,     /* bloom filter */
-                                            0,        /* mutator */
                                             NULL,     /* xquery */
                                             0,        /* xquery bits */
-                                            dht_get_id_handler,
+                                            &dht_get_id_handler,
                                             (void *) path_info);
     }
   }
@@ -839,27 +835,24 @@
  * Build a PeerPath from the paths returned from the DHT, reversing the paths
  * to obtain a local peer -> destination path and interning the peer ids.
  *
- * @param get_path NULL-terminated array of pointers
- *                 to the peers on reverse GET path (or NULL if not recorded)
- * @param put_path NULL-terminated array of pointers
- *                 to the peers on the PUT path (or NULL if not recorded)
- *
  * @return Newly allocated and created path
  */
 static struct MeshPeerPath *
-path_build_from_dht (const struct GNUNET_PeerIdentity *const *get_path,
-                     const struct GNUNET_PeerIdentity *const *put_path)
+path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
+                    unsigned int get_path_length,
+                     const struct GNUNET_PeerIdentity *put_path,
+                    unsigned int put_path_length)
 {
   struct MeshPeerPath *p;
   GNUNET_PEER_Id id;
   int i;
 
   p = path_new (0);
-  for (i = 0; get_path[i] != NULL; i++) ;
+  i = get_path_length;
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH:    GET has %d hops.\n", i);
   for (i--; i >= 0; i--)
   {
-    id = GNUNET_PEER_intern (get_path[i]);
+    id = GNUNET_PEER_intern (&get_path[i]);
     if (p->length > 0 && id == p->peers[p->length - 1])
     {
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH:    Optimizing 1 hop out.\n");
@@ -873,11 +866,11 @@
       p->length++;
     }
   }
-  for (i = 0; put_path[i] != NULL; i++) ;
+  i = put_path_length;
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH:    PUT has %d hops.\n", i);
   for (i--; i >= 0; i--)
   {
-    id = GNUNET_PEER_intern (put_path[i]);
+    id = GNUNET_PEER_intern (&put_path[i]);
     if (p->length > 0 && id == p->peers[p->length - 1])
     {
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH:    Optimizing 1 hop out.\n");
@@ -894,10 +887,10 @@
 #if MESH_DEBUG
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "MESH:    (first of GET: %s)\n",
-              GNUNET_h2s_full(&get_path[0]->hashPubKey));
+              GNUNET_h2s_full(&get_path[0].hashPubKey));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "MESH:    (first of PUT: %s)\n",
-              GNUNET_h2s_full(&put_path[0]->hashPubKey));
+              GNUNET_h2s_full(&put_path[0].hashPubKey));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "MESH:    In total: %d hops\n",
               p->length);
@@ -2046,10 +2039,6 @@
  * @param cls closure
  * @param exp when will this value expire
  * @param key key of the result
- * @param get_path NULL-terminated array of pointers
- *                 to the peers on reverse GET path (or NULL if not recorded)
- * @param put_path NULL-terminated array of pointers
- *                 to the peers on the PUT path (or NULL if not recorded)
  * @param type type of the result
  * @param size number of bytes in data
  * @param data pointer to the result data
@@ -2059,8 +2048,10 @@
 static void
 dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
                     const GNUNET_HashCode * key,
-                    const struct GNUNET_PeerIdentity *const *get_path,
-                    const struct GNUNET_PeerIdentity *const *put_path,
+                    const struct GNUNET_PeerIdentity *get_path,
+                   unsigned int get_path_length,
+                    const struct GNUNET_PeerIdentity *put_path,
+                   unsigned int put_path_length,
                     enum GNUNET_BLOCK_Type type, size_t size, const void *data)
 {
   struct MeshPathInfo *path_info = cls;
@@ -2080,17 +2071,16 @@
                                                       GNUNET_BLOCK_TYPE_TEST,  
 /* type */
                                                       &pi.hashPubKey,   /*key 
to search */
                                                       4,        /* replication 
level */
-                                                      
GNUNET_DHT_RO_RECORD_ROUTE, NULL, /* bloom filter */
-                                                      0,        /* mutator */
+                                                      
GNUNET_DHT_RO_RECORD_ROUTE, 
                                                       NULL,     /* xquery */
                                                       0,        /* xquery bits 
*/
-                                                      dht_get_id_handler,
+                                                      &dht_get_id_handler,
                                                       (void *) path_info);
       return;
     }
   }
 
-  p = path_build_from_dht (get_path, put_path);
+  p = path_build_from_dht (get_path, get_path_length, put_path, 
put_path_length);
   path_add_to_peer (path_info->peer, p);
   for (i = 0; i < path_info->peer->ntunnels; i++)
   {
@@ -2110,10 +2100,6 @@
  * @param cls closure
  * @param exp when will this value expire
  * @param key key of the result
- * @param get_path NULL-terminated array of pointers
- *                 to the peers on reverse GET path (or NULL if not recorded)
- * @param put_path NULL-terminated array of pointers
- *                 to the peers on the PUT path (or NULL if not recorded)
  * @param type type of the result
  * @param size number of bytes in data
  * @param data pointer to the result data
@@ -2121,8 +2107,10 @@
 static void
 dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
                       const GNUNET_HashCode * key,
-                      const struct GNUNET_PeerIdentity *const *get_path,
-                      const struct GNUNET_PeerIdentity *const *put_path,
+                      const struct GNUNET_PeerIdentity *get_path,
+                     unsigned int get_path_length,
+                      const struct GNUNET_PeerIdentity *put_path,
+                     unsigned int put_path_length,
                       enum GNUNET_BLOCK_Type type, size_t size,
                       const void *data)
 {
@@ -2162,8 +2150,6 @@
                                               /* replication level */
                                               GNUNET_DHT_RO_RECORD_ROUTE,
                                               /* option to dht: record route */
-                                              NULL,     /* bloom filter */
-                                              0,        /* mutator */
                                               NULL,     /* xquery */
                                               0,        /* xquery bits */
                                               dht_get_id_handler,
@@ -2171,7 +2157,7 @@
                                               peer_info);       /* closure */
   }
 
-  p = path_build_from_dht (get_path, put_path);
+  p = path_build_from_dht (get_path, get_path_length, put_path, 
put_path_length);
   path_add_to_peer (peer_info, p);
   tunnel_add_peer(t, peer_info);
   p = tree_get_path_to_peer(t->tree, peer_info->id);
@@ -2595,17 +2581,15 @@
     path_info->peer = peer_info;
     path_info->t = t;
     peer_info->dhtget = GNUNET_DHT_get_start(dht_handle,       /* handle */
-                                            GNUNET_TIME_UNIT_FOREVER_REL,     
/* timeout */
-                                            GNUNET_BLOCK_TYPE_TEST,   /* type 
*/
-                                            &peer_msg->peer.hashPubKey,   
/*key to search */
-                                            4,        /* replication level */
-                                            GNUNET_DHT_RO_RECORD_ROUTE,
-                                            NULL,     /* bloom filter */
-                                            0,        /* mutator */
-                                            NULL,     /* xquery */
-                                            0,        /* xquery bits */
-                                            dht_get_id_handler,
-                                            (void *) path_info);
+                                            GNUNET_TIME_UNIT_FOREVER_REL,     
/* timeout */
+                                            GNUNET_BLOCK_TYPE_TEST,   /* type 
*/
+                                            &peer_msg->peer.hashPubKey,   
/*key to search */
+                                            4,        /* replication level */
+                                            GNUNET_DHT_RO_RECORD_ROUTE,
+                                            NULL,     /* xquery */
+                                            0,        /* xquery bits */
+                                            &dht_get_id_handler,
+                                            (void *) path_info);
   }
   if (NULL != peer_info->path_head)
   {
@@ -2761,7 +2745,7 @@
   c->dht_get_type =
       GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL,
                             GNUNET_BLOCK_TYPE_TEST, &hash, 10U,
-                            GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0, NULL, 0,
+                            GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0,
                             &dht_get_type_handler, t);
 
   GNUNET_SERVER_receive_done (client, GNUNET_OK);

Modified: gnunet/src/vpn/gnunet-service-dns.c
===================================================================
--- gnunet/src/vpn/gnunet-service-dns.c 2011-09-27 20:55:20 UTC (rev 17080)
+++ gnunet/src/vpn/gnunet-service-dns.c 2011-09-27 21:06:11 UTC (rev 17081)
@@ -641,10 +641,11 @@
 receive_dht (void *cls, struct GNUNET_TIME_Absolute exp
              __attribute__ ((unused)), const GNUNET_HashCode * key
              __attribute__ ((unused)),
-             const struct GNUNET_PeerIdentity *const *get_path
-             __attribute__ ((unused)),
-             const struct GNUNET_PeerIdentity *const *put_path
-             __attribute__ ((unused)), enum GNUNET_BLOCK_Type type, size_t 
size,
+             const struct GNUNET_PeerIdentity *get_path __attribute__ 
((unused)),
+            unsigned int get_path_length __attribute__ ((unused)),
+             const struct GNUNET_PeerIdentity *put_path __attribute__ 
((unused)),
+            unsigned int put_path_length __attribute__ ((unused)),
+             enum GNUNET_BLOCK_Type type, size_t size,
              const void *data)
 {
 
@@ -806,8 +807,8 @@
     cls->handle =
         GNUNET_DHT_get_start (dht, GNUNET_TIME_UNIT_MINUTES,
                               GNUNET_BLOCK_TYPE_DNS, &key,
-                              DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, 
NULL,
-                              0, NULL, 0, receive_dht, cls);
+                              5 /* DEFAULT_GET_REPLICATION */, 
GNUNET_DHT_RO_NONE, NULL,
+                              0, &receive_dht, cls);
 
     goto outfree;
   }
@@ -1251,7 +1252,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting with key %08x, size = %d\n",
               *((unsigned int *) &data.service_descriptor), size);
 
-  GNUNET_DHT_put (dht, &data.service_descriptor, DEFAULT_PUT_REPLICATION,
+  GNUNET_DHT_put (dht, &data.service_descriptor, 5 /* DEFAULT_PUT_REPLICATION 
*/,
                   GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_DNS, size,
                   (char *) &data,
                   GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]