diff options
Diffstat (limited to 'src/include/gnunet_gnsrecord_lib.h')
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 98 |
1 files changed, 84 insertions, 14 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index fdbac3cf5..51dd5972d 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -44,6 +44,12 @@ extern "C" { | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * String we use to indicate an empty label (top-level | ||
48 | * entry in the zone). DNS uses "@", so do we. | ||
49 | */ | ||
50 | #define GNUNET_GNS_EMPTY_LABEL_AT "@" | ||
51 | |||
52 | /** | ||
47 | * Maximum size of a value that can be stored in a GNS block. | 53 | * Maximum size of a value that can be stored in a GNS block. |
48 | */ | 54 | */ |
49 | #define GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) | 55 | #define GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) |
@@ -299,8 +305,6 @@ struct GNUNET_GNSRECORD_ReverseRecord | |||
299 | /* followed by the name the delegator uses to refer to our namespace */ | 305 | /* followed by the name the delegator uses to refer to our namespace */ |
300 | }; | 306 | }; |
301 | 307 | ||
302 | GNUNET_NETWORK_STRUCT_END | ||
303 | |||
304 | 308 | ||
305 | /** | 309 | /** |
306 | * Process a records that were decrypted from a block. | 310 | * Process a records that were decrypted from a block. |
@@ -427,7 +431,8 @@ GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd); | |||
427 | 431 | ||
428 | 432 | ||
429 | /** | 433 | /** |
430 | * Normalize a UTF-8 string to UTF-8 NFC | 434 | * Normalize a UTF-8 string to a GNS name |
435 | * | ||
431 | * @param src source string | 436 | * @param src source string |
432 | * @return converted result | 437 | * @return converted result |
433 | */ | 438 | */ |
@@ -436,15 +441,6 @@ GNUNET_GNSRECORD_string_normalize (const char *src); | |||
436 | 441 | ||
437 | 442 | ||
438 | /** | 443 | /** |
439 | * Convert a UTF-8 string to UTF-8 lowercase | ||
440 | * @param src source string | ||
441 | * @return converted result | ||
442 | */ | ||
443 | char * | ||
444 | GNUNET_GNSRECORD_string_to_lowercase (const char *src); | ||
445 | |||
446 | |||
447 | /** | ||
448 | * Convert a zone to a string (for printing debug messages). | 444 | * Convert a zone to a string (for printing debug messages). |
449 | * This is one of the very few calls in the entire API that is | 445 | * This is one of the very few calls in the entire API that is |
450 | * NOT reentrant! | 446 | * NOT reentrant! |
@@ -616,11 +612,14 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
616 | * | 612 | * |
617 | * @param rd_count number of records given in @a rd | 613 | * @param rd_count number of records given in @a rd |
618 | * @param rd array of records | 614 | * @param rd array of records |
615 | * @param min minimum expiration time | ||
619 | * @return absolute expiration time | 616 | * @return absolute expiration time |
620 | */ | 617 | */ |
621 | struct GNUNET_TIME_Absolute | 618 | struct GNUNET_TIME_Absolute |
622 | GNUNET_GNSRECORD_record_get_expiration_time ( | 619 | GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, |
623 | unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); | 620 | const struct |
621 | GNUNET_GNSRECORD_Data *rd, | ||
622 | struct GNUNET_TIME_Absolute min); | ||
624 | 623 | ||
625 | 624 | ||
626 | /** | 625 | /** |
@@ -700,6 +699,77 @@ GNUNET_GNSRECORD_data_from_identity (const struct | |||
700 | enum GNUNET_GenericReturnValue | 699 | enum GNUNET_GenericReturnValue |
701 | GNUNET_GNSRECORD_is_zonekey_type (uint32_t type); | 700 | GNUNET_GNSRECORD_is_zonekey_type (uint32_t type); |
702 | 701 | ||
702 | /** | ||
703 | * Check if this type is a critical record. | ||
704 | * | ||
705 | * @param type the type to check | ||
706 | * @return GNUNET_YES if it is critical. | ||
707 | */ | ||
708 | enum GNUNET_GenericReturnValue | ||
709 | GNUNET_GNSRECORD_is_critical (uint32_t type); | ||
710 | |||
711 | /** | ||
712 | * Normalize namestore records: Check for consistency and | ||
713 | * expirations. Purge expired records. Returns a "clean" record set. | ||
714 | * Also returns the minimum expiration time this block should be | ||
715 | * published under. | ||
716 | * Also checks rules with respect to labels (e.g. no delegations under | ||
717 | * the empty label) | ||
718 | * | ||
719 | * @param label the label under which this set (supposed to be) stored. | ||
720 | * @param rd input records | ||
721 | * @param rd_count size of the @a rd and @a rd_public arrays | ||
722 | * @param rd_public where to write the converted records | ||
723 | * @param rd_public_count number of records written to @a rd_public | ||
724 | * @param min_expiry the minimum expiration of this set | ||
725 | * @param include_private GNUNET_YES if private records should be included. | ||
726 | * @param emsg the error message if something went wrong | ||
727 | * @return GNUNET_OK if set could be normalized and is consistent | ||
728 | */ | ||
729 | enum GNUNET_GenericReturnValue | ||
730 | GNUNET_GNSRECORD_normalize_record_set (const char *label, | ||
731 | const struct GNUNET_GNSRECORD_Data *rd, | ||
732 | unsigned int rd_count, | ||
733 | struct GNUNET_GNSRECORD_Data *rd_public, | ||
734 | unsigned int *rd_count_public, | ||
735 | struct GNUNET_TIME_Absolute *min_expiry, | ||
736 | int include_private, | ||
737 | char **emsg); | ||
738 | |||
739 | |||
740 | /** | ||
741 | * Convert namestore records from the internal format to that | ||
742 | * suitable for publication (removes private records). | ||
743 | * | ||
744 | * @param label the label under which this set is (supposed to be) published. | ||
745 | * @param rd input records | ||
746 | * @param rd_count size of the @a rd and @a rd_public arrays | ||
747 | * @param rd_public where to write the converted records | ||
748 | * @param rd_public_count number of records written to @a rd_public | ||
749 | * @param expiry the expiration of the block | ||
750 | * @param emsg the error message if something went wrong | ||
751 | * @return GNUNET_OK if set is consistent and can be exported | ||
752 | */ | ||
753 | enum GNUNET_GenericReturnValue | ||
754 | GNUNET_GNSRECORD_convert_records_for_export (const char *label, | ||
755 | const struct | ||
756 | GNUNET_GNSRECORD_Data *rd, | ||
757 | unsigned int rd_count, | ||
758 | struct GNUNET_GNSRECORD_Data * | ||
759 | rd_public, | ||
760 | unsigned int *rd_count_public, | ||
761 | struct GNUNET_TIME_Absolute *expiry, | ||
762 | char **emsg); | ||
763 | |||
764 | /** | ||
765 | * Check label for invalid characters. | ||
766 | * | ||
767 | * @param label the label to check | ||
768 | * @param emsg an error message (NULL if label is valid). Will be allocated. | ||
769 | * @return GNUNET_OK if label is valid. | ||
770 | */ | ||
771 | enum GNUNET_GenericReturnValue | ||
772 | GNUNET_GNSRECORD_label_check (const char*label, char **emsg); | ||
703 | 773 | ||
704 | #if 0 /* keep Emacsens' auto-indent happy */ | 774 | #if 0 /* keep Emacsens' auto-indent happy */ |
705 | { | 775 | { |