splitting 'struct GNUNET_CRYPTO_EccPublicKey' into one struct for signing and another...
[oweals/gnunet.git] / src / include / gnunet_namestore_service.h
index 1e459a850904cd10a202dd607975e761aee421b7..ab539bb35f38840675ea51146e5ec0d8c5c71a03 100644 (file)
@@ -122,9 +122,9 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h);
  * operation.
  *
  * @param cls closure
- * @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
- *                GNUNET_NO if content was already there or not found
- *                GNUNET_YES (or other positive value) on success
+ * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
+ *                #GNUNET_NO if content was already there or not found
+ *                #GNUNET_YES (or other positive value) on success
  * @param emsg NULL on success, otherwise an error message
  */
 typedef void (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls,
@@ -143,14 +143,6 @@ enum GNUNET_NAMESTORE_RecordFlags
    */
   GNUNET_NAMESTORE_RF_NONE = 0,
 
-  /**
-   * This peer is the authority for this record; it must thus
-   * not be deleted (other records can be deleted if we run
-   * out of space).
-   * @deprecated
-   */
-  GNUNET_NAMESTORE_RF_AUTHORITY = 1,
-
   /**
    * This is a private record of this peer and it should
    * thus not be handed out to other peers.
@@ -184,7 +176,7 @@ enum GNUNET_NAMESTORE_RecordFlags
    * pass the '--private' option when removing a record from
    * the namestore, hence we don't require this particular option
    * to match upon removal).  See also
-   * 'GNUNET_NAMESTORE_records_cmp'.
+   * #GNUNET_NAMESTORE_records_cmp.
    */
 #define GNUNET_NAMESTORE_RF_RCMP_FLAGS (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
 };
@@ -245,7 +237,7 @@ struct GNUNET_NAMESTORE_Block
   /**
    * Derived key used for signing; hash of this is the query.
    */
-  struct GNUNET_CRYPTO_EccPublicKey derived_key;
+  struct GNUNET_CRYPTO_EccPublicSignKey derived_key;
 
   /**
    * Number of bytes signed; also specifies the number of bytes
@@ -322,7 +314,7 @@ typedef void (*GNUNET_NAMESTORE_BlockProcessor) (void *cls,
  * @param derived_hash hash of zone key combined with name to lookup
  * @param proc function to call on the matching block, or with
  *        NULL if there is no matching block
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  * @return a handle that can be used to cancel
  */
 struct GNUNET_NAMESTORE_QueueEntry *
@@ -335,9 +327,9 @@ GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
  * Process a record that was stored in the namestore.
  *
  * @param cls closure
- * @param zone private key of the zone
- * @param label label of the records
- * @param rd_count number of entries in @a rd array
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array, 0 if label was deleted
  * @param rd array of records with data to store
  */
 typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
@@ -356,14 +348,14 @@ typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
  * @param value_zone public key of the target zone (value), never NULL
  * @param proc function to call on the matching records, or with
  *        NULL (rd_count == 0) if there are no matching records
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  * @return a handle that can be used to
  *         cancel
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 
                               const struct GNUNET_CRYPTO_EccPrivateKey *zone,
-                              const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+                              const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
                               GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls);
 
 
@@ -393,15 +385,18 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
 
 /**
  * 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 *
@@ -461,7 +456,7 @@ typedef void (*GNUNET_NAMESTORE_RecordsSynchronizedCallback)(void *cls);
  * @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 @a monitor' and @a sync_cb
+ * @param cls closure for @a monitor and @a sync_cb
  * @return handle to stop monitoring
  */
 struct GNUNET_NAMESTORE_ZoneMonitor *
@@ -609,7 +604,35 @@ GNUNET_NAMESTORE_normalize_string (const char *src);
  * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s.
  */
 const char *
-GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicKey *z);
+GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z);
+
+
+/**
+ * Convert public key to the respective absolute domain name in the
+ * ".zkey" pTLD. 
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ * 
+ * @param pkey a public key with a point on the eliptic curve 
+ * @return string "X.zkey" where X is the coordinates of the public
+ *         key in an encoding suitable for DNS labels.
+ */
+const char *
+GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey);
+
+
+/**
+ * Convert an absolute domain name in the ".zkey" pTLD to the
+ * respective public key.
+ * 
+ * @param zkey string "X.zkey" where X is the public
+ *         key in an encoding suitable for DNS labels.
+ * @param pkey set to a public key on the eliptic curve 
+ * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
+ */
+int
+GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
+                              struct GNUNET_CRYPTO_EccPublicSignKey *pkey);
 
 
 /**
@@ -633,7 +656,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe
  * @param query hash to use for the query
  */
 void
-GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicKey *pub,
+GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
                                        const char *label,
                                        struct GNUNET_HashCode *query);
 
@@ -679,7 +702,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block);
  */
 int
 GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
-                               const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
+                               const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
                                const char *label,
                                GNUNET_NAMESTORE_RecordCallback proc,
                                void *proc_cls);