From 79243b3d21f1687430e969626eba6785df3df901 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Thu, 13 Feb 2020 19:36:37 +0100 Subject: [PATCH] add concept of supplemental records --- src/gns/gnunet-gns.c | 6 +++++- src/include/gnunet_gnsrecord_lib.h | 5 ++--- src/namestore/gnunet-service-namestore.c | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 37633daf1..d52761ef8 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -205,7 +205,11 @@ process_lookup_result (void *cls, if (raw) printf ("%s\n", string_val); else - printf ("Got `%s' record: %s\n", typename, string_val); + printf ("Got `%s' record: %s%s\n", + typename, + string_val, + (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL)) ? + " (supplemental)" : ""); GNUNET_free (string_val); } GNUNET_SCHEDULER_shutdown (); diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 797c71380..196ea2970 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h @@ -168,10 +168,9 @@ enum GNUNET_GNSRECORD_Flags GNUNET_GNSRECORD_RF_PRIVATE = 2, /** - * This flag is currently unused; former RF_PENDING flag - * - * GNUNET_GNSRECORD_RF_UNUSED = 4, + * This is a supplemental record. */ + GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 4, /** * This expiration time of the record is a relative diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 619cabfc7..c57f15f65 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -695,6 +695,8 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd, } /* append nick */ target[rd2_length] = *nick_rd; + /* Mark as supplemental */ + target[rd2_length].flags = nick_rd->flags | GNUNET_GNSRECORD_RF_SUPPLEMENTAL; target[rd2_length].expiration_time = latest_expiration; target[rd2_length].data = (void *) &data[data_offset]; GNUNET_memcpy (&data[data_offset], nick_rd->data, nick_rd->data_size); -- 2.25.1