From c90fafa45dba4493517a7805cf1b967f59e5db7e Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 17 Feb 2023 11:57:05 -0800 Subject: [PATCH] remove rdatalist_p.h make the private isc__rdatalist_* functions public dns_rdatalist functions so that all the rdatalist primitives can be used by callers to libdns. (this will be needed later for moving SDB and SDLZ out of libdns.) --- lib/dns/Makefile.am | 1 - lib/dns/include/dns/rdatalist.h | 38 ++++++++++++++++++++ lib/dns/rdatalist.c | 54 ++++++++++++++-------------- lib/dns/rdatalist_p.h | 62 --------------------------------- lib/dns/sdb.c | 18 +++++----- lib/dns/sdlz.c | 18 +++++----- 6 files changed, 80 insertions(+), 111 deletions(-) delete mode 100644 lib/dns/rdatalist_p.h diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am index c15de0d57a..3edbf210a5 100644 --- a/lib/dns/Makefile.am +++ b/lib/dns/Makefile.am @@ -239,7 +239,6 @@ libdns_la_SOURCES = \ zonekey.c \ zt.c \ client.c \ - rdatalist_p.h \ tsig_p.h \ zone_p.h diff --git a/lib/dns/include/dns/rdatalist.h b/lib/dns/include/dns/rdatalist.h index 68709b1933..602c0696be 100644 --- a/lib/dns/include/dns/rdatalist.h +++ b/lib/dns/include/dns/rdatalist.h @@ -111,4 +111,42 @@ dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, *\li 'rdatalist' is pointed to the rdatalist in rdataset. */ +void +dns_rdatalist_disassociate(dns_rdataset_t *rdatasetp); + +isc_result_t +dns_rdatalist_first(dns_rdataset_t *rdataset); + +isc_result_t +dns_rdatalist_next(dns_rdataset_t *rdataset); + +void +dns_rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); + +void +dns_rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target); + +unsigned int +dns_rdatalist_count(dns_rdataset_t *rdataset); + +isc_result_t +dns_rdatalist_addnoqname(dns_rdataset_t *rdataset, const dns_name_t *name); + +isc_result_t +dns_rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, + dns_rdataset_t *neg, dns_rdataset_t *negsig); + +isc_result_t +dns_rdatalist_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name); + +isc_result_t +dns_rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, + dns_rdataset_t *neg, dns_rdataset_t *negsig); + +void +dns_rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name); + +void +dns_rdatalist_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name); + ISC_LANG_ENDDECLS diff --git a/lib/dns/rdatalist.c b/lib/dns/rdatalist.c index 87e2429acf..27bd650bbd 100644 --- a/lib/dns/rdatalist.c +++ b/lib/dns/rdatalist.c @@ -24,24 +24,22 @@ #include #include -#include "rdatalist_p.h" - static dns_rdatasetmethods_t methods = { - isc__rdatalist_disassociate, - isc__rdatalist_first, - isc__rdatalist_next, - isc__rdatalist_current, - isc__rdatalist_clone, - isc__rdatalist_count, - isc__rdatalist_addnoqname, - isc__rdatalist_getnoqname, - isc__rdatalist_addclosest, - isc__rdatalist_getclosest, + dns_rdatalist_disassociate, + dns_rdatalist_first, + dns_rdatalist_next, + dns_rdatalist_current, + dns_rdatalist_clone, + dns_rdatalist_count, + dns_rdatalist_addnoqname, + dns_rdatalist_getnoqname, + dns_rdatalist_addclosest, + dns_rdatalist_getclosest, NULL, /* settrust */ NULL, /* expire */ NULL, /* clearprefetch */ - isc__rdatalist_setownercase, - isc__rdatalist_getownercase, + dns_rdatalist_setownercase, + dns_rdatalist_getownercase, NULL /* addglue */ }; @@ -100,12 +98,12 @@ dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, } void -isc__rdatalist_disassociate(dns_rdataset_t *rdataset) { +dns_rdatalist_disassociate(dns_rdataset_t *rdataset) { UNUSED(rdataset); } isc_result_t -isc__rdatalist_first(dns_rdataset_t *rdataset) { +dns_rdatalist_first(dns_rdataset_t *rdataset) { dns_rdatalist_t *rdatalist; rdatalist = rdataset->private1; @@ -119,7 +117,7 @@ isc__rdatalist_first(dns_rdataset_t *rdataset) { } isc_result_t -isc__rdatalist_next(dns_rdataset_t *rdataset) { +dns_rdatalist_next(dns_rdataset_t *rdataset) { dns_rdata_t *rdata; REQUIRE(rdataset != NULL); @@ -139,7 +137,7 @@ isc__rdatalist_next(dns_rdataset_t *rdataset) { } void -isc__rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) { +dns_rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) { dns_rdata_t *list_rdata; REQUIRE(rdataset != NULL); @@ -151,7 +149,7 @@ isc__rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) { } void -isc__rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target) { +dns_rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target) { REQUIRE(source != NULL); REQUIRE(target != NULL); @@ -164,7 +162,7 @@ isc__rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target) { } unsigned int -isc__rdatalist_count(dns_rdataset_t *rdataset) { +dns_rdatalist_count(dns_rdataset_t *rdataset) { dns_rdatalist_t *rdatalist; dns_rdata_t *rdata; unsigned int count; @@ -184,7 +182,7 @@ isc__rdatalist_count(dns_rdataset_t *rdataset) { } isc_result_t -isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, const dns_name_t *name) { +dns_rdatalist_addnoqname(dns_rdataset_t *rdataset, const dns_name_t *name) { dns_rdataset_t *neg = NULL; dns_rdataset_t *negsig = NULL; dns_rdataset_t *rdset; @@ -238,8 +236,8 @@ isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, const dns_name_t *name) { } isc_result_t -isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig) { +dns_rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, + dns_rdataset_t *neg, dns_rdataset_t *negsig) { dns_rdataclass_t rdclass; dns_rdataset_t *tneg = NULL; dns_rdataset_t *tnegsig = NULL; @@ -289,7 +287,7 @@ isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, } isc_result_t -isc__rdatalist_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name) { +dns_rdatalist_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name) { dns_rdataset_t *neg = NULL; dns_rdataset_t *negsig = NULL; dns_rdataset_t *rdset; @@ -343,8 +341,8 @@ isc__rdatalist_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name) { } isc_result_t -isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig) { +dns_rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, + dns_rdataset_t *neg, dns_rdataset_t *negsig) { dns_rdataclass_t rdclass; dns_rdataset_t *tneg = NULL; dns_rdataset_t *tnegsig = NULL; @@ -394,7 +392,7 @@ isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, } void -isc__rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name) { +dns_rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name) { dns_rdatalist_t *rdatalist; unsigned int i; @@ -419,7 +417,7 @@ isc__rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name) { } void -isc__rdatalist_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name) { +dns_rdatalist_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name) { dns_rdatalist_t *rdatalist; unsigned int i; diff --git a/lib/dns/rdatalist_p.h b/lib/dns/rdatalist_p.h deleted file mode 100644 index f27a084dfb..0000000000 --- a/lib/dns/rdatalist_p.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * SPDX-License-Identifier: MPL-2.0 - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#pragma once - -/*! \file */ - -#include - -#include - -ISC_LANG_BEGINDECLS - -void -isc__rdatalist_disassociate(dns_rdataset_t *rdatasetp); - -isc_result_t -isc__rdatalist_first(dns_rdataset_t *rdataset); - -isc_result_t -isc__rdatalist_next(dns_rdataset_t *rdataset); - -void -isc__rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); - -void -isc__rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target); - -unsigned int -isc__rdatalist_count(dns_rdataset_t *rdataset); - -isc_result_t -isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, const dns_name_t *name); - -isc_result_t -isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig); - -isc_result_t -isc__rdatalist_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name); - -isc_result_t -isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig); - -void -isc__rdatalist_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name); - -void -isc__rdatalist_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name); - -ISC_LANG_ENDDECLS diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index d987cbfe63..aacc96b088 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -41,8 +41,6 @@ #include #include -#include "rdatalist_p.h" - struct dns_sdbimplementation { const dns_sdbmethods_t *methods; void *driverdata; @@ -1382,7 +1380,7 @@ disassociate(dns_rdataset_t *rdataset) { dns_db_t *db = (dns_db_t *)sdbnode->sdb; detachnode(db, &node); - isc__rdatalist_disassociate(rdataset); + dns_rdatalist_disassociate(rdataset); } static void @@ -1392,20 +1390,20 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) { dns_db_t *db = (dns_db_t *)sdbnode->sdb; dns_dbnode_t *tempdb = NULL; - isc__rdatalist_clone(source, target); + dns_rdatalist_clone(source, target); attachnode(db, node, &tempdb); source->private5 = tempdb; } static dns_rdatasetmethods_t sdb_rdataset_methods = { disassociate, - isc__rdatalist_first, - isc__rdatalist_next, - isc__rdatalist_current, + dns_rdatalist_first, + dns_rdatalist_next, + dns_rdatalist_current, rdataset_clone, - isc__rdatalist_count, - isc__rdatalist_addnoqname, - isc__rdatalist_getnoqname, + dns_rdatalist_count, + dns_rdatalist_addnoqname, + dns_rdatalist_getnoqname, NULL, /* addclosest */ NULL, /* getclosest */ NULL, /* settrust */ diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index 40b8ea87c1..85aefae02d 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -80,8 +80,6 @@ #include #include -#include "rdatalist_p.h" - /* * Private Types */ @@ -1381,7 +1379,7 @@ disassociate(dns_rdataset_t *rdataset) { dns_db_t *db = (dns_db_t *)sdlznode->sdlz; detachnode(db, &node); - isc__rdatalist_disassociate(rdataset); + dns_rdatalist_disassociate(rdataset); } static void @@ -1391,20 +1389,20 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) { dns_db_t *db = (dns_db_t *)sdlznode->sdlz; dns_dbnode_t *tempdb = NULL; - isc__rdatalist_clone(source, target); + dns_rdatalist_clone(source, target); attachnode(db, node, &tempdb); source->private5 = tempdb; } static dns_rdatasetmethods_t rdataset_methods = { disassociate, - isc__rdatalist_first, - isc__rdatalist_next, - isc__rdatalist_current, + dns_rdatalist_first, + dns_rdatalist_next, + dns_rdatalist_current, rdataset_clone, - isc__rdatalist_count, - isc__rdatalist_addnoqname, - isc__rdatalist_getnoqname, + dns_rdatalist_count, + dns_rdatalist_addnoqname, + dns_rdatalist_getnoqname, NULL, /* addclosest */ NULL, /* getclosest */ NULL, /* settrust */