aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_namestore_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-30 19:21:05 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-30 19:21:05 +0000
commit17de5c9d798109f55059190c886609ba377e4eb6 (patch)
tree07f2b4241f433b18baf02d5bf189307ad2308166 /src/include/gnunet_namestore_service.h
parentfd87b25438487e1215c68bdb9f1bcac2d7012bc2 (diff)
downloadgnunet-17de5c9d798109f55059190c886609ba377e4eb6.tar.gz
gnunet-17de5c9d798109f55059190c886609ba377e4eb6.zip
-towards implementing improved namestore API
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r--src/include/gnunet_namestore_service.h86
1 files changed, 73 insertions, 13 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 418813734..a1c5d6437 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -371,6 +371,17 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
371 GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls); 371 GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls);
372 372
373 373
374/**
375 * Cancel a namestore operation. The final callback from the
376 * operation must not have been done yet. Must be called on any
377 * namestore operation that has not yet completed prior to calling
378 * 'GNUNET_NAMESTORE_disconnect'.
379 *
380 * @param qe operation to cancel
381 */
382void
383GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
384
374 385
375/** 386/**
376 * Starts a new zone iteration (used to periodically PUT all of our 387 * Starts a new zone iteration (used to periodically PUT all of our
@@ -447,7 +458,13 @@ struct GNUNET_NAMESTORE_ZoneMonitor;
447 * Function called whenever the records for a given name changed. 458 * Function called whenever the records for a given name changed.
448 * 459 *
449 * @param cls closure 460 * @param cls closure
450 * @param was_removed GNUNET_NO if the record was added, GNUNET_YES if it was removed 461 * @param was_removed GNUNET_NO if the record was added, GNUNET_YES if it was removed,
462 * GNUNET_SYSERR if the communication with the namestore broke down
463 * (and thus all entries should be 'cleared' until the communication
464 * can be re-established, at which point the monitor will
465 * re-add all records that are (still) in the namestore after
466 * the reconnect); if this value is SYSERR, all other arguments
467 * will be 0/NULL.
451 * @param freshness when does the corresponding block in the DHT expire (until 468 * @param freshness when does the corresponding block in the DHT expire (until
452 * when should we never do a DHT lookup for the same name again)?; 469 * when should we never do a DHT lookup for the same name again)?;
453 * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type in the namestore, 470 * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type in the namestore,
@@ -495,18 +512,6 @@ void
495GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm); 512GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm);
496 513
497 514
498/**
499 * Cancel a namestore operation. The final callback from the
500 * operation must not have been done yet. Must be called on any
501 * namestore operation that has not yet completed prior to calling
502 * 'GNUNET_NAMESTORE_disconnect'.
503 *
504 * @param qe operation to cancel
505 */
506void
507GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
508
509
510/* convenience APIs for serializing / deserializing GNS records */ 515/* convenience APIs for serializing / deserializing GNS records */
511 516
512/** 517/**
@@ -620,6 +625,61 @@ int
620GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd); 625GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd);
621 626
622 627
628/**
629 * Convert a UTF-8 string to UTF-8 lowercase
630 * @param src source string
631 * @return converted result
632 */
633char *
634GNUNET_NAMESTORE_normalize_string (const char *src);
635
636
637/**
638 * Convert a short hash to a string (for printing debug messages).
639 * This is one of the very few calls in the entire API that is
640 * NOT reentrant!
641 *
642 * @param hc the short hash code
643 * @return string form; will be overwritten by next call to GNUNET_h2s.
644 */
645const char *
646GNUNET_NAMESTORE_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc);
647
648
649/**
650 * Sign name and records
651 *
652 * @param key the private key
653 * @param expire block expiration
654 * @param name the name
655 * @param rd record data
656 * @param rd_count number of records
657 *
658 * @return the signature
659 */
660struct GNUNET_CRYPTO_EccSignature *
661GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_EccPrivateKey *key,
662 struct GNUNET_TIME_Absolute expire,
663 const char *name,
664 const struct GNUNET_NAMESTORE_RecordData *rd,
665 unsigned int rd_count);
666
667
668/**
669 * Compares if two records are equal
670 *
671 * @param a Record a
672 * @param b Record b
673 *
674 * @return GNUNET_YES or GNUNET_NO
675 */
676int
677GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
678 const struct GNUNET_NAMESTORE_RecordData *b);
679
680
681
682
623#if 0 /* keep Emacsens' auto-indent happy */ 683#if 0 /* keep Emacsens' auto-indent happy */
624{ 684{
625#endif 685#endif