diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-11-10 13:54:58 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-11-10 13:54:58 +0900 |
commit | 4775f9e5e8e4f1aaad51ce54aa0c8174ac52f80d (patch) | |
tree | a33204854d18f44aa12aea6ced854f4ac511e282 /src/gnsrecord | |
parent | a117a9eb8926dd5b566bcf8a5c605939490f851f (diff) | |
download | gnunet-4775f9e5e8e4f1aaad51ce54aa0c8174ac52f80d.tar.gz gnunet-4775f9e5e8e4f1aaad51ce54aa0c8174ac52f80d.zip |
GNS: Use flags as defined and generated from GANA
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/gnsrecord_crypto.c | 12 | ||||
-rw-r--r-- | src/gnsrecord/gnsrecord_misc.c | 2 | ||||
-rw-r--r-- | src/gnsrecord/json_gnsrecord.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index d794c9cb4..a62304c40 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c | |||
@@ -793,7 +793,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block, | |||
793 | continue; | 793 | continue; |
794 | } | 794 | } |
795 | 795 | ||
796 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) | 796 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW)) |
797 | { | 797 | { |
798 | int include_record = GNUNET_YES; | 798 | int include_record = GNUNET_YES; |
799 | /* Shadow record, figure out if we have a not expired active record */ | 799 | /* Shadow record, figure out if we have a not expired active record */ |
@@ -805,7 +805,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block, | |||
805 | include_record = GNUNET_NO; /* Shadow record is expired */ | 805 | include_record = GNUNET_NO; /* Shadow record is expired */ |
806 | if ((rd[k].record_type == rd[i].record_type) && | 806 | if ((rd[k].record_type == rd[i].record_type) && |
807 | (rd[k].expiration_time >= now.abs_value_us) && | 807 | (rd[k].expiration_time >= now.abs_value_us) && |
808 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD))) | 808 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW))) |
809 | { | 809 | { |
810 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ | 810 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ |
811 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 811 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -815,7 +815,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block, | |||
815 | } | 815 | } |
816 | if (GNUNET_YES == include_record) | 816 | if (GNUNET_YES == include_record) |
817 | { | 817 | { |
818 | rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW_RECORD; /* Remove Flag */ | 818 | rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW; /* Remove Flag */ |
819 | if (j != i) | 819 | if (j != i) |
820 | rd[j] = rd[i]; | 820 | rd[j] = rd[i]; |
821 | j++; | 821 | j++; |
@@ -919,7 +919,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block, | |||
919 | continue; | 919 | continue; |
920 | } | 920 | } |
921 | 921 | ||
922 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) | 922 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW)) |
923 | { | 923 | { |
924 | int include_record = GNUNET_YES; | 924 | int include_record = GNUNET_YES; |
925 | /* Shadow record, figure out if we have a not expired active record */ | 925 | /* Shadow record, figure out if we have a not expired active record */ |
@@ -931,7 +931,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block, | |||
931 | include_record = GNUNET_NO; /* Shadow record is expired */ | 931 | include_record = GNUNET_NO; /* Shadow record is expired */ |
932 | if ((rd[k].record_type == rd[i].record_type) && | 932 | if ((rd[k].record_type == rd[i].record_type) && |
933 | (rd[k].expiration_time >= now.abs_value_us) && | 933 | (rd[k].expiration_time >= now.abs_value_us) && |
934 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD))) | 934 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW))) |
935 | { | 935 | { |
936 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ | 936 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ |
937 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 937 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -941,7 +941,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block, | |||
941 | } | 941 | } |
942 | if (GNUNET_YES == include_record) | 942 | if (GNUNET_YES == include_record) |
943 | { | 943 | { |
944 | rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW_RECORD; /* Remove Flag */ | 944 | rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW; /* Remove Flag */ |
945 | if (j != i) | 945 | if (j != i) |
946 | rd[j] = rd[i]; | 946 | rd[j] = rd[i]; |
947 | j++; | 947 | j++; |
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 97ca7b135..e225bcc7f 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -173,7 +173,7 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, | |||
173 | /* Check for shadow record */ | 173 | /* Check for shadow record */ |
174 | if ((c == c2) || | 174 | if ((c == c2) || |
175 | (rd[c].record_type != rd[c2].record_type) || | 175 | (rd[c].record_type != rd[c2].record_type) || |
176 | (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD))) | 176 | (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW))) |
177 | continue; | 177 | continue; |
178 | /* We have a shadow record */ | 178 | /* We have a shadow record */ |
179 | if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | 179 | if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) |
diff --git a/src/gnsrecord/json_gnsrecord.c b/src/gnsrecord/json_gnsrecord.c index 2b840ab30..0725cb1a1 100644 --- a/src/gnsrecord/json_gnsrecord.c +++ b/src/gnsrecord/json_gnsrecord.c | |||
@@ -168,7 +168,7 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd) | |||
168 | if (1 == supplemental) | 168 | if (1 == supplemental) |
169 | rd->flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL; | 169 | rd->flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL; |
170 | if (1 == shadow) | 170 | if (1 == shadow) |
171 | rd->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; | 171 | rd->flags |= GNUNET_GNSRECORD_RF_SHADOW; |
172 | return GNUNET_OK; | 172 | return GNUNET_OK; |
173 | } | 173 | } |
174 | 174 | ||
@@ -353,7 +353,7 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname, | |||
353 | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, | 353 | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, |
354 | rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL, | 354 | rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL, |
355 | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, | 355 | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, |
356 | rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD); | 356 | rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW); |
357 | GNUNET_free (value_str); | 357 | GNUNET_free (value_str); |
358 | if (NULL == record) | 358 | if (NULL == record) |
359 | { | 359 | { |