aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/namestore_api.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-02-05 00:50:38 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-02-05 15:38:39 +0100
commitee865f851ca4b173da8d00e87a0ad446efc8037e (patch)
tree92a627afa5799d78df0fd5b09a711ca3b89a8b6b /src/namestore/namestore_api.c
parent65f9e37ce036acdfab29b25b9b6f69de1b126962 (diff)
downloadgnunet-ee865f851ca4b173da8d00e87a0ad446efc8037e.tar.gz
gnunet-ee865f851ca4b173da8d00e87a0ad446efc8037e.zip
GNS: Implement Tombstone logic
GNS: Namestore zonemaster record store processing ZONEMASTER: Do not publish records if tombstone expires in the future NAMESTORE: Purge old tombstones.
Diffstat (limited to 'src/namestore/namestore_api.c')
-rw-r--r--src/namestore/namestore_api.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index b24db9b26..935357d36 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -969,28 +969,14 @@ warn_delay (void *cls)
969 GNUNET_NAMESTORE_cancel (qe); 969 GNUNET_NAMESTORE_cancel (qe);
970} 970}
971 971
972
973/**
974 * Store an item in the namestore. If the item is already present,
975 * it is replaced with the new record. Use an empty array to
976 * remove all records under the given name.
977 *
978 * @param h handle to the namestore
979 * @param pkey private key of the zone
980 * @param label name that is being mapped (at most 255 characters long)
981 * @param rd_count number of records in the @a rd array
982 * @param rd array of records with data to store
983 * @param cont continuation to call when done
984 * @param cont_cls closure for @a cont
985 * @return handle to abort the request
986 */
987struct GNUNET_NAMESTORE_QueueEntry * 972struct GNUNET_NAMESTORE_QueueEntry *
988GNUNET_NAMESTORE_records_store ( 973GNUNET_NAMESTORE_records_store_ (
989 struct GNUNET_NAMESTORE_Handle *h, 974 struct GNUNET_NAMESTORE_Handle *h,
990 const struct GNUNET_IDENTITY_PrivateKey *pkey, 975 const struct GNUNET_IDENTITY_PrivateKey *pkey,
991 const char *label, 976 const char *label,
992 unsigned int rd_count, 977 unsigned int rd_count,
993 const struct GNUNET_GNSRECORD_Data *rd, 978 const struct GNUNET_GNSRECORD_Data *rd,
979 int is_zonemaster,
994 GNUNET_NAMESTORE_ContinuationWithStatus cont, 980 GNUNET_NAMESTORE_ContinuationWithStatus cont,
995 void *cont_cls) 981 void *cont_cls)
996{ 982{
@@ -1037,7 +1023,7 @@ GNUNET_NAMESTORE_records_store (
1037 msg->name_len = htons (name_len); 1023 msg->name_len = htons (name_len);
1038 msg->rd_count = htons (rd_count); 1024 msg->rd_count = htons (rd_count);
1039 msg->rd_len = htons (rd_ser_len); 1025 msg->rd_len = htons (rd_ser_len);
1040 msg->reserved = htons (0); 1026 msg->is_zonemaster = (GNUNET_YES == is_zonemaster) ? ntohs(1) : ntohs(0);
1041 msg->private_key = *pkey; 1027 msg->private_key = *pkey;
1042 1028
1043 name_tmp = (char *) &msg[1]; 1029 name_tmp = (char *) &msg[1];
@@ -1070,6 +1056,36 @@ GNUNET_NAMESTORE_records_store (
1070 return qe; 1056 return qe;
1071} 1057}
1072 1058
1059/**
1060 * Store an item in the namestore. If the item is already present,
1061 * it is replaced with the new record. Use an empty array to
1062 * remove all records under the given name.
1063 *
1064 * @param h handle to the namestore
1065 * @param pkey private key of the zone
1066 * @param label name that is being mapped (at most 255 characters long)
1067 * @param rd_count number of records in the @a rd array
1068 * @param rd array of records with data to store
1069 * @param cont continuation to call when done
1070 * @param cont_cls closure for @a cont
1071 * @return handle to abort the request
1072 */
1073struct GNUNET_NAMESTORE_QueueEntry *
1074GNUNET_NAMESTORE_records_store (
1075 struct GNUNET_NAMESTORE_Handle *h,
1076 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1077 const char *label,
1078 unsigned int rd_count,
1079 const struct GNUNET_GNSRECORD_Data *rd,
1080 GNUNET_NAMESTORE_ContinuationWithStatus cont,
1081 void *cont_cls)
1082{
1083 return GNUNET_NAMESTORE_records_store_ (h, pkey, label, rd_count, rd,
1084 GNUNET_NO, cont, cont_cls);
1085}
1086
1087
1088
1073 1089
1074/** 1090/**
1075 * Lookup an item in the namestore. 1091 * Lookup an item in the namestore.