gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28645 - in gnunet/src: include namestore
Date: Thu, 15 Aug 2013 12:25:25 +0200

Author: grothoff
Date: 2013-08-15 12:25:25 +0200 (Thu, 15 Aug 2013)
New Revision: 28645

Modified:
   gnunet/src/include/gnunet_namestore_plugin.h
   gnunet/src/include/gnunet_namestore_service.h
   gnunet/src/namestore/gnunet-service-namestore.c
Log:
-fixing #2993

Modified: gnunet/src/include/gnunet_namestore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_namestore_plugin.h        2013-08-15 10:09:43 UTC 
(rev 28644)
+++ gnunet/src/include/gnunet_namestore_plugin.h        2013-08-15 10:25:25 UTC 
(rev 28645)
@@ -77,7 +77,7 @@
   void *cls;
 
   /**
-   * Cache a block in the datastore. Overwrites (older) existing blocks
+   * Cache a block in the datastore. Overwrites existing blocks
    * for the same zone and label.
    *
    * @param cls closure (internal context for the plugin)

Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h       2013-08-15 10:09:43 UTC 
(rev 28644)
+++ gnunet/src/include/gnunet_namestore_service.h       2013-08-15 10:25:25 UTC 
(rev 28645)
@@ -272,7 +272,7 @@
  * @param h handle to the namestore
  * @param block block to store
  * @param cont continuation to call when done
- * @param cont_cls closure for cont
+ * @param cont_cls closure for @a cont
  * @return handle to abort the request
  */
 struct GNUNET_NAMESTORE_QueueEntry *
@@ -293,7 +293,7 @@
  * @param rd_count number of records in the 'rd' array
  * @param rd array of records with data to store
  * @param cont continuation to call when done
- * @param cont_cls closure for 'cont'
+ * @param cont_cls closure for @a cont
  * @return handle to abort the request
  */
 struct GNUNET_NAMESTORE_QueueEntry *
@@ -339,7 +339,7 @@
  * @param cls closure
  * @param zone private key of the zone
  * @param label label of the records
- * @param rd_count number of entries in 'rd' array
+ * @param rd_count number of entries in @a rd array
  * @param rd array of records with data to store
  */
 typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
@@ -414,7 +414,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
@@ -452,10 +452,10 @@
 
 
 /**
- * Begin monitoring a zone for changes.  Will first call the 'monitor' function
- * on all existing records in the selected zone(s), then calls 'sync_cb',
- * and then calls the 'monitor' whenever a record changes.  If the namestore
- * disconnects, the 'monitor' function is called with a disconnect event; if
+ * Begin monitoring a zone for changes.  Will first call the @a monitor 
function
+ * on all existing records in the selected zone(s), then calls @a sync_cb,
+ * and then calls the @a monitor whenever a record changes.  If the namestore
+ * disconnects, the @a monitor function is called with a disconnect event; if
  * the connection is re-established, the process begins from the start (all
  * existing records, sync, then updates).
  *
@@ -463,7 +463,7 @@
  * @param zone zone to monitor
  * @param monitor function to call on zone changes
  * @param sync_cb function called when we're in sync with the namestore
- * @param cls closure for 'monitor' and 'sync_cb'
+ * @param cls closure for @a monitor' and @a sync_cb
  * @return handle to stop monitoring
  */
 struct GNUNET_NAMESTORE_ZoneMonitor *
@@ -489,11 +489,9 @@
  * Calculate how many bytes we will need to serialize the given
  * records.
  *
- * @param rd_count number of records in the rd array
+ * @param rd_count number of records in the @a rd array
  * @param rd array of #GNUNET_NAMESTORE_RecordData with @a rd_count elements
- *
  * @return the required size to serialize
- *
  */
 size_t
 GNUNET_NAMESTORE_records_get_size (unsigned int rd_count,
@@ -503,9 +501,9 @@
 /**
  * Serialize the given records to the given destination buffer.
  *
- * @param rd_count number of records in the rd array
+ * @param rd_count number of records in the @a rd array
  * @param rd array of #GNUNET_NAMESTORE_RecordData with @a rd_count elements
- * @param dest_size size of the destination array
+ * @param dest_size size of the destination array @a dst
  * @param dest where to write the result
  * @return the size of serialized records, -1 if records do not fit
  */
@@ -521,10 +519,9 @@
  *
  * @param len size of the serialized record data
  * @param src the serialized record data
- * @param rd_count number of records in the rd array
+ * @param rd_count number of records in the @a dest array
  * @param dest where to put the data
- *
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GNUNET_NAMESTORE_records_deserialize (size_t len,
@@ -534,11 +531,12 @@
 
 
 /**
- * Convert the 'value' of a record to a string.
+ * Convert the binary value @a data of a record of 
+ * type @a type to a human-readable string.
  *
  * @param type type of the record
  * @param data value in binary encoding
- * @param data_size number of bytes in data
+ * @param data_size number of bytes in @a data
  * @return NULL on error, otherwise human-readable representation of the value
  */
 char *
@@ -548,14 +546,14 @@
 
 
 /**
- * Convert human-readable version of a 'value' of a record to the binary
- * representation.
+ * Convert human-readable version of the value @a s of a record
+ * of type @a type to the respective binary representation.
  *
  * @param type type of the record
  * @param s human-readable string
  * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in data
- * @return GNUNET_OK on success
+ * @param data_size set to number of bytes in @a data
+ * @return #GNUNET_OK on success
  */
 int
 GNUNET_NAMESTORE_string_to_value (uint32_t type,
@@ -649,7 +647,7 @@
  * @param expire block expiration
  * @param label the name for the records
  * @param rd record data
- * @param rd_count number of records
+ * @param rd_count number of records in @a rd
  */
 struct GNUNET_NAMESTORE_Block *
 GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key,
@@ -706,8 +704,8 @@
  * expiration time is the expiration time of the block with smallest
  * expiration time.
  *
- * @param rd_count number of records given in 'rd'
- * @param rd array of records
+ * @param rd_count number of records given in @a rd
+ * @param rd array of records 
  * @return absolute expiration time
  */
 struct GNUNET_TIME_Absolute

Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c     2013-08-15 10:09:43 UTC 
(rev 28644)
+++ gnunet/src/namestore/gnunet-service-namestore.c     2013-08-15 10:25:25 UTC 
(rev 28645)
@@ -23,13 +23,6 @@
  * @brief namestore for the GNUnet naming system
  * @author Matthias Wachs
  * @author Christian Grothoff
- *
- * TODO:
- * - private records can currently not be used for resolving
- *   our own queries as our lookup only goes for the encrypted
- *   records; we need a way to ensure that the records available
- *   in our own zone can actually always be used for our own
- *   resolutions! (#2993)
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
@@ -163,8 +156,8 @@
    * Offset of the zone iteration used to address next result of the zone
    * iteration in the store
    *
-   * Initialy set to 0 in handle_iteration_start
-   * Incremented with by every call to handle_iteration_next
+   * Initialy set to 0.
+   * Incremented with by every call to #handle_iteration_next
    */
   uint32_t offset;
 
@@ -443,7 +436,7 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE message
  *
  * @param cls unused
  * @param client GNUNET_SERVER_Client sending the message
@@ -507,7 +500,7 @@
  * @param request_id request ID to use
  * @param zone_key zone key of the zone
  * @param name name
- * @param rd_count number of records
+ * @param rd_count number of records in @a rd
  * @param rd array of records
  */
 static void
@@ -555,7 +548,7 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE message
  *
  * @param cls unused
  * @param client client sending the message
@@ -649,10 +642,25 @@
     res = GSN_database->store_records (GSN_database->cls,
                                       &rp_msg->private_key,
                                       conv_name,                               
       
-                                      rd_count, rd);
+                                      rd_count, rd);    
     if (GNUNET_OK == res)
     {
       struct ZoneMonitor *zm;
+      struct GNUNET_NAMESTORE_Block *block;
+
+      block = GNUNET_NAMESTORE_block_create (&rp_msg->private_key,
+                                            GNUNET_TIME_UNIT_FOREVER_ABS,
+                                            conv_name,
+                                            rd, rd_count);
+      if (GNUNET_OK !=
+         GSN_database->cache_block (GSN_database->cls,
+                                    block))
+      {
+       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                   _("Failed to cache encrypted block of my own zone!\n"));
+       res = GNUNET_SYSERR;
+      }
+      GNUNET_free (block);
       
       for (zm = monitor_head; NULL != zm; zm = zm->next)    
        if (0 == memcmp (&rp_msg->private_key,
@@ -684,8 +692,8 @@
 
 
 /**
- * Context for record remove operations passed from 'handle_zone_to_name' to
- * 'handle_zone_to_name_it' as closure
+ * Context for record remove operations passed from #handle_zone_to_name to
+ * #handle_zone_to_name_it as closure
  */
 struct ZoneToNameCtx
 {
@@ -700,7 +708,7 @@
   uint32_t rid;
 
   /**
-   * Set to GNUNET_OK on success, GNUNET_SYSERR on error.  Note that
+   * Set to #GNUNET_OK on success, #GNUNET_SYSERR on error.  Note that
    * not finding a name for the zone still counts as a 'success' here,
    * as this field is about the success of executing the IPC protocol.
    */
@@ -714,7 +722,7 @@
  * @param cls struct ZoneToNameCtx *
  * @param zone_key the zone key
  * @param name name
- * @param rd_count number of records
+ * @param rd_count number of records in @a rd
  * @param rd record data
  */
 static void
@@ -769,10 +777,10 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME message
  *
  * @param cls unused
- * @param client GNUNET_SERVER_Client sending the message
+ * @param client client sending the message
  * @param message message of type 'struct ZoneToNameMessage'
  */
 static void
@@ -858,10 +866,10 @@
 
   /**
    * Iteration result: iteration done?
-   * IT_SUCCESS_MORE_AVAILABLE:  if there may be more results overall but
+   * #IT_SUCCESS_MORE_AVAILABLE:  if there may be more results overall but
    * we got one for now and have sent it to the client
-   * IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE: if there are no further results,
-   * IT_ALL_RECORDS_FILTERED: if all results were filtered so far.
+   * #IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE: if there are no further results,
+   * #IT_START: if we are still trying to find a result.
    */
   int res_iteration_finished;
 
@@ -964,7 +972,7 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START message
  *
  * @param cls unused
  * @param client GNUNET_SERVER_Client sending the message
@@ -999,7 +1007,7 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP message
  *
  * @param cls unused
  * @param client GNUNET_SERVER_Client sending the message
@@ -1042,7 +1050,7 @@
 
 
 /**
- * Handles a 'GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT' message
+ * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT message
  *
  * @param cls unused
  * @param client GNUNET_SERVER_Client sending the message
@@ -1112,12 +1120,12 @@
 
 
 /**
- * A 'GNUNET_NAMESTORE_RecordIterator' for monitors.
+ * A #GNUNET_NAMESTORE_RecordIterator for monitors.
  *
  * @param cls a 'struct ZoneMonitor *' with information about the monitor
  * @param zone_key zone key of the zone
  * @param name name
- * @param rd_count number of records
+ * @param rd_count number of records in @a rd
  * @param rd array of records
  */
 static void




reply via email to

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