gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29017 - in gnunet: contrib src/include src/namestore


From: gnunet
Subject: [GNUnet-SVN] r29017 - in gnunet: contrib src/include src/namestore
Date: Thu, 5 Sep 2013 13:23:06 +0200

Author: grothoff
Date: 2013-09-05 13:23:06 +0200 (Thu, 05 Sep 2013)
New Revision: 29017

Modified:
   gnunet/contrib/gnunet-gns-import.sh
   gnunet/src/include/gnunet_namestore_plugin.h
   gnunet/src/include/gnunet_namestore_service.h
   gnunet/src/namestore/gnunet-service-namestore.c
   gnunet/src/namestore/namestore.h
   gnunet/src/namestore/namestore_api.c
   gnunet/src/namestore/plugin_namestore_sqlite.c
Log:
-allow passing NULL for zone to iterate over all of our zones

Modified: gnunet/contrib/gnunet-gns-import.sh
===================================================================
--- gnunet/contrib/gnunet-gns-import.sh 2013-09-05 11:15:34 UTC (rev 29016)
+++ gnunet/contrib/gnunet-gns-import.sh 2013-09-05 11:23:06 UTC (rev 29017)
@@ -3,7 +3,7 @@
 # namestore.
 #
 # By default, we create three GNS zones:
-gnunet-identity -C master-zone
+gnunet-identity -C master-zone 
 gnunet-identity -C short-zone
 gnunet-identity -C private-zone
 

Modified: gnunet/src/include/gnunet_namestore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_namestore_plugin.h        2013-09-05 11:15:34 UTC 
(rev 29016)
+++ gnunet/src/include/gnunet_namestore_plugin.h        2013-09-05 11:23:06 UTC 
(rev 29017)
@@ -95,7 +95,7 @@
    * @param cls closure (internal context for the plugin)
    * @param query hash of public key derived from the zone and the label
    * @param iter function to call with the result
-   * @param iter_cls closure for iter
+   * @param iter_cls closure for @a iter
    * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, 
#GNUNET_SYSERR on error
    */
   int (*lookup_block) (void *cls, 
@@ -127,10 +127,10 @@
    * datastore.  Will return at most one result to the iterator.
    *
    * @param cls closure (internal context for the plugin)
-   * @param zone private key of the zone
+   * @param zone private key of the zone, NULL for all zones
    * @param offset offset in the list of all matching records
    * @param iter function to call with the result
-   * @param iter_cls closure for iter
+   * @param iter_cls closure for @a iter
    * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, 
#GNUNET_SYSERR on error
    */
   int (*iterate_records) (void *cls, 
@@ -147,7 +147,7 @@
    * @param zone private key of the zone to look up in, never NULL
    * @param value_zone public key of the target zone (value), never NULL
    * @param iter function to call with the result
-   * @param iter_cls closure for iter
+   * @param iter_cls closure for @a iter
    * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, 
#GNUNET_SYSERR on error
    */
   int (*zone_to_name) (void *cls, 

Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h       2013-09-05 11:15:34 UTC 
(rev 29016)
+++ gnunet/src/include/gnunet_namestore_service.h       2013-09-05 11:23:06 UTC 
(rev 29017)
@@ -393,15 +393,18 @@
 
 /**
  * Starts a new zone iteration (used to periodically PUT all of our
- * records into our DHT). @a proc will be called once immediately, and
- * then again after #GNUNET_NAMESTORE_zone_iterator_next is invoked.
+ * records into our DHT). This MUST lock the struct GNUNET_NAMESTORE_Handle
+ * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next and
+ * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once
+ * immediately, and then again after
+ * #GNUNET_NAMESTORE_zone_iterator_next is invoked.
  *
  * @param h handle to the namestore
- * @param zone zone to access
+ * @param zone zone to access, NULL for all zones
  * @param proc function to call on each name from the zone; it
  *        will be called repeatedly with a value (if available)
  *        and always once at the end with a name of NULL.
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  * @return an iterator handle to use for iteration
  */
 struct GNUNET_NAMESTORE_ZoneIterator *

Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c     2013-09-05 11:15:34 UTC 
(rev 29016)
+++ gnunet/src/namestore/gnunet-service-namestore.c     2013-09-05 11:23:06 UTC 
(rev 29017)
@@ -862,7 +862,7 @@
 
 /**
  * Context for record remove operations passed from
- * 'run_zone_iteration_round' to 'zone_iteraterate_proc' as closure
+ * #run_zone_iteration_round to #zone_iteraterate_proc as closure
  */
 struct ZoneIterationProcResult
 {
@@ -934,6 +934,7 @@
 static void
 run_zone_iteration_round (struct ZoneIteration *zi)
 {
+  static struct GNUNET_CRYPTO_EccPrivateKey zero;
   struct ZoneIterationProcResult proc;
   struct RecordResultMessage rrm;
   int ret;
@@ -945,7 +946,9 @@
   {
     if (GNUNET_SYSERR ==
        (ret = GSN_database->iterate_records (GSN_database->cls, 
-                                             &zi->zone, 
+                                             (0 == memcmp (&zi->zone, &zero, 
sizeof (zero))) 
+                                             ? NULL 
+                                             : &zi->zone,
                                              zi->offset, 
                                              &zone_iteraterate_proc, &proc)))
     {
@@ -982,7 +985,7 @@
  * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START message
  *
  * @param cls unused
- * @param client GNUNET_SERVER_Client sending the message
+ * @param client the client sending the message
  * @param message message of type 'struct ZoneIterationStartMessage'
  */
 static void

Modified: gnunet/src/namestore/namestore.h
===================================================================
--- gnunet/src/namestore/namestore.h    2013-09-05 11:15:34 UTC (rev 29016)
+++ gnunet/src/namestore/namestore.h    2013-09-05 11:23:06 UTC (rev 29017)
@@ -347,7 +347,7 @@
   struct GNUNET_NAMESTORE_Header gns_header;
 
   /**
-   * Zone key.
+   * Zone key.  All zeros for "all zones".
    */
   struct GNUNET_CRYPTO_EccPrivateKey zone;
 

Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2013-09-05 11:15:34 UTC (rev 
29016)
+++ gnunet/src/namestore/namestore_api.c        2013-09-05 11:23:06 UTC (rev 
29017)
@@ -1185,18 +1185,18 @@
 
 /**
  * Starts a new zone iteration (used to periodically PUT all of our
- * records into our DHT). This MUST lock the GNUNET_NAMESTORE_Handle
- * for any other calls than GNUNET_NAMESTORE_zone_iterator_next and
- * GNUNET_NAMESTORE_zone_iteration_stop.  "proc" will be called once
+ * records into our DHT). This MUST lock the struct GNUNET_NAMESTORE_Handle
+ * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next and
+ * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once
  * immediately, and then again after
- * "GNUNET_NAMESTORE_zone_iterator_next" is invoked.
+ * #GNUNET_NAMESTORE_zone_iterator_next is invoked.
  *
  * @param h handle to the namestore
- * @param zone zone to access
+ * @param zone zone to access, NULL for all zones
  * @param proc function to call on each name from the zone; it
  *        will be called repeatedly with a value (if available)
  *        and always once at the end with a name of NULL.
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  * @return an iterator handle to use for iteration
  */
 struct GNUNET_NAMESTORE_ZoneIterator *
@@ -1218,7 +1218,8 @@
   it->proc = proc;
   it->proc_cls = proc_cls;
   it->op_id = rid;
-  it->zone = *zone;
+  if (NULL != zone)
+    it->zone = *zone;
   GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it);
 
   msg_size = sizeof (struct ZoneIterationStartMessage);
@@ -1228,7 +1229,8 @@
   msg->gns_header.header.type = htons 
(GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
   msg->gns_header.header.size = htons (msg_size);
   msg->gns_header.r_id = htonl (rid);
-  msg->zone = *zone;
+  if (NULL != zone)
+    msg->zone = *zone;
   GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
   do_transmit(h);
   return it;
@@ -1236,7 +1238,7 @@
 
 
 /**
- * Calls the record processor specified in 
GNUNET_NAMESTORE_zone_iteration_start
+ * Calls the record processor specified in 
#GNUNET_NAMESTORE_zone_iteration_start
  * for the next record.
  *
  * @param it the iterator

Modified: gnunet/src/namestore/plugin_namestore_sqlite.c
===================================================================
--- gnunet/src/namestore/plugin_namestore_sqlite.c      2013-09-05 11:15:34 UTC 
(rev 29016)
+++ gnunet/src/namestore/plugin_namestore_sqlite.c      2013-09-05 11:23:06 UTC 
(rev 29017)
@@ -762,7 +762,7 @@
   sqlite3_stmt *stmt;
 
   stmt = plugin->iterate_zone;
-
+  // FIXME: does not hanlde NULL for zone!
   if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 
                                        zone, sizeof (struct 
GNUNET_CRYPTO_EccPrivateKey),
                                        SQLITE_STATIC)) ||




reply via email to

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