diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-21 15:38:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-21 15:38:00 +0000 |
commit | 53e8b875ee273ad37840bca8499fff655f0d6e47 (patch) | |
tree | 8e6bacdcb82c91731819f3cdd9f5fa790d09ff60 /src/include/gnunet_namestore_service.h | |
parent | 39895e8a886613dc0df246023aba2f85a0fe9071 (diff) | |
download | gnunet-53e8b875ee273ad37840bca8499fff655f0d6e47.tar.gz gnunet-53e8b875ee273ad37840bca8499fff655f0d6e47.zip |
-DB API updates, creating tables and preparing statements
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r-- | src/include/gnunet_namestore_service.h | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 1c9fb18e0..10316594b 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -253,8 +253,7 @@ GNUNET_NAMESTORE_stree_start (struct GNUNET_NAMESTORE_Handle *h, | |||
253 | * @param h handle to the namestore | 253 | * @param h handle to the namestore |
254 | * @param zone_key public key of the zone | 254 | * @param zone_key public key of the zone |
255 | * @param loc location in the B-tree | 255 | * @param loc location in the B-tree |
256 | * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1), NULL for root | 256 | * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1) |
257 | * @param top_sig signature at the top, NULL if 'loc.depth > 0' | ||
258 | * @param num_entries number of entries at this node in the B-tree | 257 | * @param num_entries number of entries at this node in the B-tree |
259 | * @param entries the 'num_entries' entries to store (hashes over the | 258 | * @param entries the 'num_entries' entries to store (hashes over the |
260 | * records) | 259 | * records) |
@@ -267,7 +266,6 @@ GNUNET_NAMESTORE_stree_put (struct GNUNET_NAMESTORE_Handle *h, | |||
267 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 266 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, |
268 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, | 267 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, |
269 | const struct GNUNET_NAMESTORE_SignatureLocation *ploc, | 268 | const struct GNUNET_NAMESTORE_SignatureLocation *ploc, |
270 | const struct GNUNET_CRYPTO_RsaSignature *sig, | ||
271 | unsigned int num_entries, | 269 | unsigned int num_entries, |
272 | const GNUNET_HashCode *entries, | 270 | const GNUNET_HashCode *entries, |
273 | GNUNET_NAMESTORE_ContinuationWithStatus cont, | 271 | GNUNET_NAMESTORE_ContinuationWithStatus cont, |
@@ -275,6 +273,33 @@ GNUNET_NAMESTORE_stree_put (struct GNUNET_NAMESTORE_Handle *h, | |||
275 | 273 | ||
276 | 274 | ||
277 | /** | 275 | /** |
276 | * Store current zone signature in the namestore. This function | ||
277 | * is used by non-authorities to cache the top of a zone's signature tree. | ||
278 | * Note that the tree must be build top-down, so this function is called | ||
279 | * first for a given zone and revision. | ||
280 | * | ||
281 | * @param h handle to the namestore | ||
282 | * @param zone_key public key of the zone | ||
283 | * @param loc identifies the top of the B-tree (depth and revision) | ||
284 | * @param time time of the signature creation | ||
285 | * @param top_sig signature at the top | ||
286 | * @param root_hash top level hash code in the Merkle-tree / stree | ||
287 | * @param cont continuation to call when done | ||
288 | * @param cont_cls closure for cont | ||
289 | * @return handle to abort the request | ||
290 | */ | ||
291 | struct GNUNET_NAMESTORE_QueueEntry * | ||
292 | GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h, | ||
293 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | ||
294 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, | ||
295 | struct GNUNET_TIME_Absolute time, | ||
296 | const struct GNUNET_CRYPTO_RsaSignature *top_sig, | ||
297 | const GNUNET_HashCode *root_hash, | ||
298 | GNUNET_NAMESTORE_ContinuationWithStatus cont, | ||
299 | void *cont_cls); | ||
300 | |||
301 | |||
302 | /** | ||
278 | * Store an item in the namestore. If the item is already present, | 303 | * Store an item in the namestore. If the item is already present, |
279 | * the expiration time is updated to the max of the existing time and | 304 | * the expiration time is updated to the max of the existing time and |
280 | * the new time. The operation must fail if there is no matching | 305 | * the new time. The operation must fail if there is no matching |
@@ -406,8 +431,7 @@ GNUNET_NAMESTORE_record_hash_dup (struct GNUNET_NAMESTORE_Handle *h, | |||
406 | * @param cls closure | 431 | * @param cls closure |
407 | * @param zone hash of the public key of the zone | 432 | * @param zone hash of the public key of the zone |
408 | * @param loc where we are in the signature tree | 433 | * @param loc where we are in the signature tree |
409 | * @param ploc location of our parent in the signature tree (NULL if 'loc.depth == 0') | 434 | * @param ploc location of our parent in the signature tree |
410 | * @param top_sig signature at the root (NULL if 'loc.depth > 0') | ||
411 | * @param num_entries number of entries being stored here | 435 | * @param num_entries number of entries being stored here |
412 | * @param entries the entries themselves | 436 | * @param entries the entries themselves |
413 | */ | 437 | */ |
@@ -415,7 +439,6 @@ typedef void (*GNUNET_NAMESTORE_StreeProcessor) (void *cls, | |||
415 | const GNUNET_HashCode *zone, | 439 | const GNUNET_HashCode *zone, |
416 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, | 440 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, |
417 | const struct GNUNET_NAMESTORE_SignatureLocation *ploc, | 441 | const struct GNUNET_NAMESTORE_SignatureLocation *ploc, |
418 | const struct GNUNET_CRYPTO_RsaSignature *top_sig, | ||
419 | unsigned int num_entries, | 442 | unsigned int num_entries, |
420 | const GNUNET_HashCode *entries); | 443 | const GNUNET_HashCode *entries); |
421 | 444 | ||
@@ -439,6 +462,41 @@ GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h, | |||
439 | const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc, | 462 | const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc, |
440 | GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls); | 463 | GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls); |
441 | 464 | ||
465 | /** | ||
466 | * Process zone signature information that was stored in the namestore. | ||
467 | * | ||
468 | * @param cls closure | ||
469 | * @param zone hash of the public key of the zone | ||
470 | * @param loc where we are in the signature tree (identifies top) | ||
471 | * @param top_sig signature at the root | ||
472 | * @param time timestamp of the signature | ||
473 | * @param top_hash hash at the top of the tree | ||
474 | */ | ||
475 | typedef void (*GNUNET_NAMESTORE_SignatureProcessor) (void *cls, | ||
476 | const GNUNET_HashCode *zone, | ||
477 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, | ||
478 | const struct GNUNET_CRYPTO_RsaSignature *top_sig, | ||
479 | struct GNUNET_TIME_Absolute time, | ||
480 | const GNUNET_HashCode *top_hash); | ||
481 | |||
482 | |||
483 | /** | ||
484 | * Obtain latest/current signature of a zone. The processor | ||
485 | * will only be called once. | ||
486 | * | ||
487 | * @param h handle to the namestore | ||
488 | * @param zone zone to look up a record from | ||
489 | * @param proc function to call on each matching value; | ||
490 | * will be called once with a NULL value at the end | ||
491 | * @param proc_cls closure for proc | ||
492 | * @return a handle that can be used to | ||
493 | * cancel | ||
494 | */ | ||
495 | struct GNUNET_NAMESTORE_QueueEntry * | ||
496 | GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h, | ||
497 | const GNUNET_HashCode *zone, | ||
498 | GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls); | ||
499 | |||
442 | 500 | ||
443 | /** | 501 | /** |
444 | * Get all records of a zone. | 502 | * Get all records of a zone. |