diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-02-07 15:59:04 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-02-07 15:59:04 +0100 |
commit | 14b3c75ab523830f5c1744d5a0faa4168b4172a7 (patch) | |
tree | eecc64f41891b29f5c1edd42f9315a2ab2733c59 /src/include | |
parent | 1c89bfe03f45eef178a1e5a5d4d33057946ebf11 (diff) | |
download | gnunet-14b3c75ab523830f5c1744d5a0faa4168b4172a7.tar.gz gnunet-14b3c75ab523830f5c1744d5a0faa4168b4172a7.zip |
GNS: LSD0001 improvements
NAMESTORE: Better error handling. Fixed private record feature.
GNSRECORD: Record inconsistency check for delegation and redirection
records
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_gns_service.h | 6 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 61 |
2 files changed, 52 insertions, 15 deletions
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index 3f6c9b9aa..5c06f8045 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -48,12 +48,6 @@ extern "C" { | |||
48 | 48 | ||
49 | 49 | ||
50 | /** | 50 | /** |
51 | * String we use to indicate an empty label (top-level | ||
52 | * entry in the zone). DNS uses "@", so do we. | ||
53 | */ | ||
54 | #define GNUNET_GNS_EMPTY_LABEL_AT "@" | ||
55 | |||
56 | /** | ||
57 | * Connection to the GNS service. | 51 | * Connection to the GNS service. |
58 | */ | 52 | */ |
59 | struct GNUNET_GNS_Handle; | 53 | struct GNUNET_GNS_Handle; |
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index c376b1d1f..cbf7ee15c 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) |
@@ -619,7 +625,8 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
619 | */ | 625 | */ |
620 | struct GNUNET_TIME_Absolute | 626 | struct GNUNET_TIME_Absolute |
621 | GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, | 627 | GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, |
622 | const struct GNUNET_GNSRECORD_Data *rd, | 628 | const struct |
629 | GNUNET_GNSRECORD_Data *rd, | ||
623 | struct GNUNET_TIME_Absolute min); | 630 | struct GNUNET_TIME_Absolute min); |
624 | 631 | ||
625 | 632 | ||
@@ -710,21 +717,57 @@ enum GNUNET_GenericReturnValue | |||
710 | GNUNET_GNSRECORD_is_critical (uint32_t type); | 717 | GNUNET_GNSRECORD_is_critical (uint32_t type); |
711 | 718 | ||
712 | /** | 719 | /** |
720 | * Normalize namestore records: Check for consistency and | ||
721 | * expirations. Purge expired records. Returns a "clean" record set. | ||
722 | * Also returns the minimum expiration time this block should be | ||
723 | * published under. | ||
724 | * Also checks rules with respect to labels (e.g. no delegations under | ||
725 | * the empty label) | ||
726 | * | ||
727 | * @param label the label under which this set (supposed to be) stored. | ||
728 | * @param rd input records | ||
729 | * @param rd_count size of the @a rd and @a rd_public arrays | ||
730 | * @param rd_public where to write the converted records | ||
731 | * @param rd_public_count number of records written to @a rd_public | ||
732 | * @param min_expiry the minimum expiration of this set | ||
733 | * @param include_private GNUNET_YES if private records should be included. | ||
734 | * @param emsg the error message if something went wrong | ||
735 | * @return GNUNET_OK if set could be normalized and is consistent | ||
736 | */ | ||
737 | enum GNUNET_GenericReturnValue | ||
738 | GNUNET_GNSRECORD_normalize_record_set (const char *label, | ||
739 | const struct GNUNET_GNSRECORD_Data *rd, | ||
740 | unsigned int rd_count, | ||
741 | struct GNUNET_GNSRECORD_Data *rd_public, | ||
742 | unsigned int *rd_count_public, | ||
743 | struct GNUNET_TIME_Absolute *min_expiry, | ||
744 | int include_private, | ||
745 | char **emsg); | ||
746 | |||
747 | |||
748 | /** | ||
713 | * Convert namestore records from the internal format to that | 749 | * Convert namestore records from the internal format to that |
714 | * suitable for publication (removes private records, converts | 750 | * suitable for publication (removes private records). |
715 | * to absolute expiration time). | ||
716 | * | 751 | * |
752 | * @param label the label under which this set is (supposed to be) published. | ||
717 | * @param rd input records | 753 | * @param rd input records |
718 | * @param rd_count size of the @a rd and @a rd_public arrays | 754 | * @param rd_count size of the @a rd and @a rd_public arrays |
719 | * @param rd_public where to write the converted records | 755 | * @param rd_public where to write the converted records |
756 | * @param rd_public_count number of records written to @a rd_public | ||
720 | * @param expiry the expiration of the block | 757 | * @param expiry the expiration of the block |
721 | * @return number of records written to @a rd_public | 758 | * @param emsg the error message if something went wrong |
759 | * @return GNUNET_OK if set is consistent and can be exported | ||
722 | */ | 760 | */ |
723 | unsigned int | 761 | enum GNUNET_GenericReturnValue |
724 | GNUNET_GNSRECORD_convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd, | 762 | GNUNET_GNSRECORD_convert_records_for_export (const char *label, |
725 | unsigned int rd_count, | 763 | const struct |
726 | struct GNUNET_GNSRECORD_Data *rd_public, | 764 | GNUNET_GNSRECORD_Data *rd, |
727 | struct GNUNET_TIME_Absolute *expiry); | 765 | unsigned int rd_count, |
766 | struct GNUNET_GNSRECORD_Data * | ||
767 | rd_public, | ||
768 | unsigned int *rd_count_public, | ||
769 | struct GNUNET_TIME_Absolute *expiry, | ||
770 | char **emsg); | ||
728 | 771 | ||
729 | #if 0 /* keep Emacsens' auto-indent happy */ | 772 | #if 0 /* keep Emacsens' auto-indent happy */ |
730 | { | 773 | { |