[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19963 - in gnunet/src: gns include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19963 - in gnunet/src: gns include |
Date: |
Thu, 23 Feb 2012 11:35:45 +0100 |
Author: schanzen
Date: 2012-02-23 11:35:45 +0100 (Thu, 23 Feb 2012)
New Revision: 19963
Modified:
gnunet/src/gns/gnunet-service-gns.c
gnunet/src/gns/namestore_stub_api.c
gnunet/src/include/gnunet_namestore_service.h
Log:
-new api
Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-02-23 10:28:25 UTC (rev 19962)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-02-23 10:35:45 UTC (rev 19963)
@@ -317,7 +317,6 @@
const char *name, uint32_t record_type,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_NAMESTORE_RecordFlags flags,
- const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
size_t size, const void *data)
{
struct GNUNET_GNS_PendingQuery *query;
@@ -344,7 +343,7 @@
*/
if (GNUNET_CRYPTO_hash_cmp(zone, &zone_hash))
{
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "NX record\n");
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Authority unknown\n");
//FIXME return NX answer
return;
}
@@ -420,10 +419,10 @@
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
"Answering DNS request\n");
- //GNUNET_DNS_request_answer(answer->request_handle,
- // len,
- // buf);
- GNUNET_free(answer);
+ GNUNET_DNS_request_answer(answer->request_handle,
+ len,
+ buf);
+ //GNUNET_free(answer);
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Answered DNS request\n");
//FIXME return code, free datastructures
}
@@ -454,7 +453,6 @@
const char *name, uint32_t record_type,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_NAMESTORE_RecordFlags flags,
- const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
size_t size, const void *data)
{
struct GNUNET_GNS_PendingQuery *query;
@@ -621,7 +619,7 @@
if (is_canonical(query->name))
{
//We only need to check this zone's ns
- GNUNET_NAMESTORE_lookup_name(namestore_handle,
+ GNUNET_NAMESTORE_lookup_record(namestore_handle,
zone,
query->name,
query->type,
@@ -632,7 +630,7 @@
{
//We have to resolve the authoritative entity
char *new_authority = move_up(query->name);
- GNUNET_NAMESTORE_lookup_name(namestore_handle,
+ GNUNET_NAMESTORE_lookup_record(namestore_handle,
zone,
new_authority,
GNUNET_GNS_RECORD_PKEY,
@@ -761,7 +759,6 @@
GNUNET_GNS_RECORD_TYPE_A,
GNUNET_TIME_absolute_get_forever(),
GNUNET_NAMESTORE_RF_AUTHORITY,
- NULL, //sig loc
sizeof(struct in_addr),
alice,
NULL,
@@ -772,7 +769,6 @@
GNUNET_GNS_RECORD_TYPE_A,
GNUNET_TIME_absolute_get_forever(),
GNUNET_NAMESTORE_RF_AUTHORITY,
- NULL, //sig loc
sizeof(struct in_addr),
bob,
NULL,
@@ -802,7 +798,6 @@
put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
uint32_t record_type, struct GNUNET_TIME_Absolute expiration,
enum GNUNET_NAMESTORE_RecordFlags flags,
- const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
size_t size, const void *record_data)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Putting a record into the DHT\n");
@@ -814,9 +809,6 @@
exp_nbo = GNUNET_TIME_absolute_hton (expiration);
uint32_t namelen = htonl(strlen(name));
uint16_t flags_nbo = htons(flags);
- uint64_t offset = GNUNET_htonll(sig_loc->offset);
- uint32_t depth = htonl(sig_loc->depth);
- uint32_t revision = htonl(sig_loc->revision);
GNUNET_HashCode name_hash;
GNUNET_HashCode xor_hash;
@@ -826,7 +818,6 @@
*/
size_t record_len = sizeof(size_t) + sizeof(uint32_t) +
sizeof(uint16_t) +
- sizeof(struct GNUNET_NAMESTORE_SignatureLocation) +
sizeof(uint32_t) + strlen(name) + size;
record_type = htonl(record_type);
@@ -850,15 +841,6 @@
memcpy(data_ptr, &flags_nbo, sizeof(uint16_t));
data_ptr += sizeof(uint16_t);
- memcpy(data_ptr, &offset, sizeof(uint64_t));
- data_ptr += sizeof(uint64_t);
-
- memcpy(data_ptr, &depth, sizeof(uint32_t));
- data_ptr += sizeof(uint32_t);
-
- memcpy(data_ptr, &revision, sizeof(uint32_t));
- data_ptr += sizeof(uint32_t);
-
memcpy(data_ptr, &size, sizeof(uint32_t));
data_ptr += sizeof(uint32_t);
Modified: gnunet/src/gns/namestore_stub_api.c
===================================================================
--- gnunet/src/gns/namestore_stub_api.c 2012-02-23 10:28:25 UTC (rev 19962)
+++ gnunet/src/gns/namestore_stub_api.c 2012-02-23 10:35:45 UTC (rev 19963)
@@ -69,6 +69,11 @@
};
+struct GNUNET_NAMESTORE_ZoneIterator
+{
+ struct GNUNET_NAMESTORE_Handle *handle;
+};
+
struct GNUNET_NAMESTORE_SimpleRecord
{
/**
@@ -119,111 +124,6 @@
}
/**
- * Sign a record. This function is used by the authority of the zone
- * to add a record.
- *
- * @param h handle to the namestore
- * @param zone_privkey private key of the zone
- * @param record_hash hash of the record to be signed
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_extend (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_RsaPrivateKey *zone_privkey,
- const GNUNET_HashCode *record_hash,
- GNUNET_NAMESTORE_ContinuationWithSignature cont,
- void *cont_cls)
-{
- struct GNUNET_NAMESTORE_QueueEntry *qe;
- qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
- return qe;
-}
-
-/**
- * Rebalance the signature tree of our zone. This function should
- * be called "rarely" to rebalance the tree.
- *
- * @param h handle to the namestore
- * @param zone_privkey private key for the zone to rebalance
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_rebalance (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_RsaPrivateKey *zone_privkey,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls)
-{
- struct GNUNET_NAMESTORE_QueueEntry *qe;
- qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
- return qe;
-}
-
-/**
- * Provide the root of a signature tree. This function is
- * used by non-authorities as the first operation when
- * adding a foreign zone.
- *
- * @param h handle to the namestore
- * @param zone_key public key of the zone
- * @param signature signature of the top-level entry of the zone
- * @param revision revision number of the zone
- * @param top_hash top-level hash of the zone
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_start (struct GNUNET_NAMESTORE_Handle *h,
- const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- const struct GNUNET_CRYPTO_RsaSignature
*signature,
- uint32_t revision,
- const GNUNET_HashCode *top_hash,
- GNUNET_NAMESTORE_ContinuationWithSignature cont,
- void *cont_cls)
-{
- struct GNUNET_NAMESTORE_QueueEntry *qe;
- qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
- return qe;
-}
-
-/**
- * Store part of a signature B-tree in the namestore. This function
- * is used by non-authorities to cache parts of a zone's signature tree.
- * Note that the tree must be build top-down. This function must check
- * that the nodes being added are valid, and if not refuse the operation.
- *
- * @param h handle to the namestore
- * @param zone_key public key of the zone
- * @param loc location in the B-tree
- * @param ploc parent's location in the B-tree (must have depth = loc.depth -
1), NULL for root
- * @param top_sig signature at the top, NULL if 'loc.depth > 0'
- * @param num_entries number of entries at this node in the B-tree
- * @param entries the 'num_entries' entries to store (hashes over the
- * records)
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_put (struct GNUNET_NAMESTORE_Handle *h,
- const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- const struct GNUNET_NAMESTORE_SignatureLocation
*loc,
- const struct GNUNET_NAMESTORE_SignatureLocation
*ploc,
- unsigned int num_entries,
- const GNUNET_HashCode *entries,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls)
-{
- struct GNUNET_NAMESTORE_QueueEntry *qe;
- qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
- return qe;
-}
-
-/**
* Store an item in the namestore. If the item is already present,
* the expiration time is updated to the max of the existing time and
* the new time. The operation must fail if there is no matching
@@ -235,7 +135,6 @@
* @param record_type type of the record (A, AAAA, PKEY, etc.)
* @param expiration expiration time for the content
* @param flags flags for the content
- * @param sig_loc where is the information about the signature for this record
stored?
* @param data_size number of bytes in data
* @param data value, semantics depend on 'record_type' (see RFCs for DNS and
* GNS specification for GNS extensions)
@@ -250,7 +149,6 @@
uint32_t record_type,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_NAMESTORE_RecordFlags flags,
- const struct GNUNET_NAMESTORE_SignatureLocation
*sig_loc,
size_t data_size,
const void *data,
GNUNET_NAMESTORE_ContinuationWithStatus cont,
@@ -272,6 +170,36 @@
}
/**
+ * Store a signature in the namestore.
+ *
+ * @param h handle to the namestore
+ * @param zone hash of the public key of the zone
+ * @param name name that is being mapped (at most 255 characters long)
+ * @param record_type type of the record (A, AAAA, PKEY, etc.)
+ * @param expiration expiration time for the content
+ * @param flags flags for the content
+ * @param data_size number of bytes in data
+ * @param data value, semantics depend on 'record_type' (see RFCs for DNS and
+ * GNS specification for GNS extensions)
+ * @param cont continuation to call when done
+ * @param cont_cls closure for cont
+ * @return handle to abort the request
+ */
+struct GNUNET_NAMESTORE_QueueEntry *
+GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h,
+ const GNUNET_HashCode *zone,
+ const char *name,
+ struct GNUNET_CRYPTO_RsaSignature sig,
+ GNUNET_NAMESTORE_ContinuationWithStatus cont,
+ void *cont_cls)
+{
+ struct GNUNET_NAMESTORE_QueueEntry *qe;
+ qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
+
+ return qe;
+}
+
+/**
* Explicitly remove some content from the database. The
* "cont"inuation will be called with status "GNUNET_OK" if content
* was removed, "GNUNET_NO" if no matching entry was found and
@@ -331,7 +259,7 @@
* cancel
*/
struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_lookup_name (struct GNUNET_NAMESTORE_Handle *h,
+GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
const GNUNET_HashCode *zone,
const char *name,
uint32_t record_type,
@@ -352,17 +280,26 @@
proc(proc_cls, iter->zone, iter->name, iter->record_type,
iter->expiration,
iter->flags,
- NULL /*sig loc*/,
iter->data_size /*size*/,
iter->data /* data */);
}
proc(proc_cls, zone, name, record_type,
- GNUNET_TIME_absolute_get_forever(), 0, NULL, 0, NULL); /*TERMINATE*/
+ GNUNET_TIME_absolute_get_forever(), 0, 0, NULL); /*TERMINATE*/
return qe;
}
+struct GNUNET_NAMESTORE_QueueEntry *
+GNUNET_NAMESTORE_lookup_signature (struct GNUNET_NAMESTORE_Handle *h,
+ const GNUNET_HashCode *zone,
+ const char* name,
+ GNUNET_NAMESTORE_SignatureProcessor proc,
+ void *proc_cls)
+{
+ return NULL;
+}
+
/**
* Get the hash of a record (what will be signed in the Stree for
* the record).
@@ -392,31 +329,7 @@
GNUNET_CRYPTO_hash(teststring, strlen(teststring), record_hash);
}
-/**
- * Obtain part of a signature B-tree. The processor
- * will only be called once.
- *
- * @param h handle to the namestore
- * @param zone zone to look up a record from
- * @param sig_loc location to look up
- * @param proc function to call on each matching value;
- * will be called once with a NULL value at the end
- * @param proc_cls closure for proc
- * @return a handle that can be used to
- * cancel
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
- const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
- GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls)
-{
- struct GNUNET_NAMESTORE_QueueEntry *qe;
- qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
- return qe;
-}
-
/**
* Get all records of a zone.
*
@@ -440,9 +353,22 @@
return qe;
}
+struct GNUNET_NAMESTORE_ZoneIterator *
+GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h,
+ const GNUNET_HashCode *zone,
+ GNUNET_NAMESTORE_RecordProcessor proc,
+ void *proc_cls);
+int
+GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it);
+void
+GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it);
+void
+GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
+
+
/**
* Cancel a namestore operation. The final callback from the
* operation must not have been done yet.
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2012-02-23 10:28:25 UTC
(rev 19962)
+++ gnunet/src/include/gnunet_namestore_service.h 2012-02-23 10:35:45 UTC
(rev 19963)
@@ -54,6 +54,11 @@
struct GNUNET_NAMESTORE_Handle;
/**
+ * Handle to the namestore zone iterator.
+ */
+struct GNUNET_NAMESTORE_ZoneIterator;
+
+/**
* Maximum size of a value that can be stored in the namestore.
*/
#define GNUNET_NAMESTORE_MAX_VALUE_SIZE (63 * 1024)
@@ -122,46 +127,8 @@
/**
- * We formally store records in a B-tree for signing. This struct
- * identifies the location of a record in the B-tree.
- */
-struct GNUNET_NAMESTORE_SignatureLocation
-{
- /**
- * Offset in the B-tree.
- */
- uint64_t offset;
-
- /**
- * Depth in the B-tree.
- */
- uint32_t depth;
-
- /**
- * Revision of the B-tree.
- */
- uint32_t revision;
-};
-
-
-/**
- * Continuation called to notify client about result of the
- * signing operation.
+ * Get the hash of a record
*
- * @param cls closure
- * @param sig where the signature is now located in the S-tree
- */
-typedef void (*GNUNET_NAMESTORE_ContinuationWithSignature) (void *cls,
- const struct
GNUNET_NAMESTORE_SignatureLocation *sig);
-
-
-
-
-
-/**
- * Get the hash of a record (what will be signed in the Stree for
- * the record).
- *
* @param zone hash of the public key of the zone
* @param name name that is being mapped (at most 255 characters long)
* @param record_type type of the record (A, AAAA, PKEY, etc.)
@@ -185,125 +152,9 @@
/**
- * Sign a record. This function is used by the authority of the zone
- * to add a record.
- *
- * @param h handle to the namestore
- * @param zone_privkey private key of the zone
- * @param record_hash hash of the record to be signed
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_extend (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_RsaPrivateKey
*zone_privkey,
- const GNUNET_HashCode *record_hash,
- GNUNET_NAMESTORE_ContinuationWithSignature cont,
- void *cont_cls);
-
-
-/**
- * Rebalance the signature tree of our zone. This function should
- * be called "rarely" to rebalance the tree.
- *
- * @param h handle to the namestore
- * @param zone_privkey private key for the zone to rebalance
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_rebalance (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_CRYPTO_RsaPrivateKey
*zone_privkey,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls);
-
-
-/**
- * Provide the root of a signature tree. This function is
- * used by non-authorities as the first operation when
- * adding a foreign zone.
- *
- * @param h handle to the namestore
- * @param zone_key public key of the zone
- * @param signature signature of the top-level entry of the zone
- * @param revision revision number of the zone
- * @param top_hash top-level hash of the zone
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_start (struct GNUNET_NAMESTORE_Handle *h,
- const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- const struct GNUNET_CRYPTO_RsaSignature
*signature,
- uint32_t revision,
- const GNUNET_HashCode *top_hash,
- GNUNET_NAMESTORE_ContinuationWithSignature cont,
- void *cont_cls);
-
-
-/**
- * Store part of a signature B-tree in the namestore. This function
- * is used by non-authorities to cache parts of a zone's signature tree.
- * Note that the tree must be build top-down. This function must check
- * that the nodes being added are valid, and if not refuse the operation.
- *
- * @param h handle to the namestore
- * @param zone_key public key of the zone
- * @param loc location in the B-tree
- * @param ploc parent's location in the B-tree (must have depth = loc.depth -
1)
- * @param num_entries number of entries at this node in the B-tree
- * @param entries the 'num_entries' entries to store (hashes over the
- * records)
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_stree_put (struct GNUNET_NAMESTORE_Handle *h,
- const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- const struct GNUNET_NAMESTORE_SignatureLocation
*loc,
- const struct GNUNET_NAMESTORE_SignatureLocation
*ploc,
- unsigned int num_entries,
- const GNUNET_HashCode *entries,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls);
-
-
-/**
- * Store current zone signature in the namestore. This function
- * is used by non-authorities to cache the top of a zone's signature tree.
- * Note that the tree must be build top-down, so this function is called
- * first for a given zone and revision.
- *
- * @param h handle to the namestore
- * @param zone_key public key of the zone
- * @param loc identifies the top of the B-tree (depth and revision)
- * @param time time of the signature creation
- * @param top_sig signature at the top
- * @param root_hash top level hash code in the Merkle-tree / stree
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h,
- const struct
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- const struct GNUNET_NAMESTORE_SignatureLocation
*loc,
- struct GNUNET_TIME_Absolute time,
- const struct GNUNET_CRYPTO_RsaSignature
*top_sig,
- const GNUNET_HashCode *root_hash,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls);
-
-
-/**
* Store an item in the namestore. If the item is already present,
* the expiration time is updated to the max of the existing time and
- * the new time. The operation must fail if there is no matching
- * entry in the signature tree.
+ * the new time.
*
* @param h handle to the namestore
* @param zone hash of the public key of the zone
@@ -311,7 +162,6 @@
* @param record_type type of the record (A, AAAA, PKEY, etc.)
* @param expiration expiration time for the content
* @param flags flags for the content
- * @param sig_loc where is the information about the signature for this record
stored?
* @param data_size number of bytes in data
* @param data value, semantics depend on 'record_type' (see RFCs for DNS and
* GNS specification for GNS extensions)
@@ -326,13 +176,32 @@
uint32_t record_type,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_NAMESTORE_RecordFlags flags,
- const struct GNUNET_NAMESTORE_SignatureLocation
*sig_loc,
size_t data_size,
const void *data,
GNUNET_NAMESTORE_ContinuationWithStatus cont,
void *cont_cls);
+/**
+ * Store a signature for 'name' in the namestore.
+ * Used by non-authorities to store signatures for cached name records.
+ *
+ * @param h handle to the namestore
+ * @param zone hash of the public key of the zone
+ * @param name name that is being mapped (at most 255 characters long)
+ * @param sig the signature
+ * @param cont continuation to call when done
+ * @param cont_cls closure for cont
+ * @return handle to abort the request
+ */
+struct GNUNET_NAMESTORE_QueueEntry *
+GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h,
+ const GNUNET_HashCode *zone,
+ const char *name,
+ struct GNUNET_CRYPTO_RsaSignature sig,
+ GNUNET_NAMESTORE_ContinuationWithStatus cont,
+ void *cont_cls);
+
/**
* Explicitly remove some content from the database. The
* "cont"inuation will be called with status "GNUNET_OK" if content
@@ -369,7 +238,6 @@
* @param record_type type of the record (A, AAAA, PKEY, etc.)
* @param expiration expiration time for the content
* @param flags flags for the content
- * @param sig_loc where is the information about the signature for this record
stored?
* @param size number of bytes in data
* @param data content stored
*/
@@ -379,10 +247,23 @@
uint32_t record_type,
struct GNUNET_TIME_Absolute
expiration,
enum
GNUNET_NAMESTORE_RecordFlags flags,
- const struct
GNUNET_NAMESTORE_SignatureLocation *sig_loc,
size_t size, const void *data);
+/**
+ * Process a signature for a given name
+ *
+ * @param cls closure
+ * @param zone hash of the public key of the zone
+ * @param name name of the records that were signed
+ * @param sig the signature
+ */
+typedef void (*GNUNET_NAMESTORE_SignatureProcessor) (void *cls,
+ const GNUNET_HashCode *zone,
+ const char *name,
+ struct GNUNET_CRYPTO_RsaSignature
sig);
+
+
/**
* Get a result for a particular key from the namestore. The processor
* will only be called once.
@@ -398,58 +279,20 @@
* cancel
*/
struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_lookup_name (struct GNUNET_NAMESTORE_Handle *h,
+GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
const GNUNET_HashCode *zone,
const char *name,
uint32_t record_type,
GNUNET_NAMESTORE_RecordProcessor proc, void
*proc_cls);
-
/**
- * Get the hash of a subtree in the STree (what will be signed in the parent
- * location). FIXME naming conflict!
- *
- * @param zone hash of the public key of the zone
- * @param loc where we are in the signature tree
- * @param num_entries number of entries being stored here
- * @param entries the entries themselves
- * @param st_hash hash of the stree node (set)
- */
-void
-GNUNET_NAMESTORE_record_hash_dup (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
- const struct GNUNET_NAMESTORE_SignatureLocation
*loc,
- unsigned int num_entries,
- const GNUNET_HashCode *entries,
- GNUNET_HashCode *st_hash);
-
-
-/**
- * Process a Stree node that was stored in the namestore.
- *
- * @param cls closure
- * @param zone hash of the public key of the zone
- * @param loc where we are in the signature tree
- * @param ploc location of our parent in the signature tree
- * @param num_entries number of entries being stored here
- * @param entries the entries themselves
- */
-typedef void (*GNUNET_NAMESTORE_StreeProcessor) (void *cls,
- const GNUNET_HashCode *zone,
- const struct
GNUNET_NAMESTORE_SignatureLocation *loc,
- const struct
GNUNET_NAMESTORE_SignatureLocation *ploc,
- unsigned int num_entries,
- const GNUNET_HashCode
*entries);
-
-
-/**
- * Obtain part of a signature B-tree. The processor
+ * Obtain latest/current signature of a zone's name. The processor
* will only be called once.
*
* @param h handle to the namestore
- * @param zone zone to look up a record from
- * @param sig_loc location to look up
+ * @param zone zone to look up a signature from
+ * @param the common name of the records the signature is for
* @param proc function to call on each matching value;
* will be called once with a NULL value at the end
* @param proc_cls closure for proc
@@ -457,44 +300,9 @@
* cancel
*/
struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
- const struct GNUNET_NAMESTORE_SignatureLocation
*sig_loc,
- GNUNET_NAMESTORE_StreeProcessor proc, void
*proc_cls);
-
-/**
- * Process zone signature information that was stored in the namestore.
- *
- * @param cls closure
- * @param zone hash of the public key of the zone
- * @param loc where we are in the signature tree (identifies top)
- * @param top_sig signature at the root
- * @param time timestamp of the signature
- * @param top_hash hash at the top of the tree
- */
-typedef void (*GNUNET_NAMESTORE_SignatureProcessor) (void *cls,
- const GNUNET_HashCode
*zone,
- const struct
GNUNET_NAMESTORE_SignatureLocation *loc,
- const struct
GNUNET_CRYPTO_RsaSignature *top_sig,
- struct
GNUNET_TIME_Absolute time,
- const GNUNET_HashCode
*top_hash);
-
-
-/**
- * Obtain latest/current signature of a zone. The processor
- * will only be called once.
- *
- * @param h handle to the namestore
- * @param zone zone to look up a record from
- * @param proc function to call on each matching value;
- * will be called once with a NULL value at the end
- * @param proc_cls closure for proc
- * @return a handle that can be used to
- * cancel
- */
-struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_lookup_signature (struct GNUNET_NAMESTORE_Handle *h,
const GNUNET_HashCode *zone,
+ const char* name,
GNUNET_NAMESTORE_SignatureProcessor proc,
void *proc_cls);
@@ -517,9 +325,47 @@
void *proc_cls);
+/**
+ * Starts a new zone iteration. This MUST lock the GNUNET_NAMESTORE_Handle
+ * for any other calls than
+ * GNUNET_NAMESTORE_zone_iterator_next
+ * and
+ * GNUNET_NAMESTORE_zone_iteration_stop
+ *
+ * @param h handle to the namestore
+ * @param zone zone to access
+ * @param proc function to call on a random value; it
+ * will be called repeatedly with a value (if available)
+ * and always once at the end with a zone and name of NULL.
+ * @param proc_cls closure for proc
+ * @return an iterator handle to use for iteration
+ */
+struct GNUNET_NAMESTORE_ZoneIterator *
+GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h,
+ const GNUNET_HashCode *zone,
+ GNUNET_NAMESTORE_RecordProcessor proc,
+ void *proc_cls);
+/**
+ * Calls the record processor specified in
GNUNET_NAMESTORE_zone_iteration_start
+ * for the next record.
+ *
+ * @param it the iterator
+ * @return 0 if no more records are available to iterate
+ */
+int
+GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it);
/**
+ * Stops iteration and releases the namestore handle for further calls.
+ *
+ * @param it the iterator
+ */
+void
+GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it);
+
+
+/**
* Cancel a namestore operation. The final callback from the
* operation must not have been done yet.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19963 - in gnunet/src: gns include,
gnunet <=