confrrset.c revision 292031c9fc4d26bfff35d3cbb9b77217c66c39cd
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley/*
a7038d1a0513c8e804937ebc95fc9cb3a46c04f5Mark Andrews * Copyright (C) 1999 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Permission to use, copy, modify, and distribute this software for any
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * purpose with or without fee is hereby granted, provided that the above
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15a44745412679c30a6d022733925af70a38b715David Lawrence * SOFTWARE.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley */
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews#include <config.h>
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
e419f613d8591885df608cb73065921be07dd12eBob Halley#include <isc/assertions.h>
e419f613d8591885df608cb73065921be07dd12eBob Halley
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <dns/confrrset.h>
fca5f81ad69098ea8abba130c7f841c951ef91c2Bob Halley#include <dns/confcommon.h>
e419f613d8591885df608cb73065921be07dd12eBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halley
9695ae1c24b168996e3a267855dc754971ccb32cBob Halleyisc_result_t
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleydns_c_rrsolist_clear(isc_log_t *lctx, dns_c_rrsolist_t *olist)
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews{
1c776a2909632bc755f3fddd3b53addd792ab4d0Brian Wellington dns_c_rrso_t *elem;
e419f613d8591885df608cb73065921be07dd12eBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(olist != NULL);
1b1e1fda4638334b484aa38c15f53a131c0b0fdfAndreas Gustafsson
e83cae7fa837e4757c687035d6f6c0900f152749Brian Wellington elem = ISC_LIST_HEAD(olist->elements);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews while (elem != NULL) {
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews ISC_LIST_UNLINK(olist->elements, elem, next);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_c_rrso_delete(lctx, &elem);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington elem = ISC_LIST_HEAD(olist->elements);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley }
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (ISC_R_SUCCESS);
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence}
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence
e419f613d8591885df608cb73065921be07dd12eBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halleyisc_result_t
92ef1a9b9dbd48ecb507b42ac62c15afefdaf838David Lawrencedns_c_rrsolist_append(isc_log_t *lctx, dns_c_rrsolist_t *dest,
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews dns_c_rrsolist_t *src)
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley{
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews dns_c_rrso_t *oldelem;
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews dns_c_rrso_t *newelem;
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews isc_result_t res;
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews REQUIRE(dest != NULL);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews REQUIRE(src != NULL);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews oldelem = ISC_LIST_HEAD(src->elements);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews while (oldelem != NULL) {
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews res = dns_c_rrso_copy(lctx, dest->mem, &newelem, oldelem);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews if (res != ISC_R_SUCCESS) {
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews return (res);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews }
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews ISC_LIST_APPEND(dest->elements, newelem, next);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews oldelem = ISC_LIST_NEXT(oldelem, next);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews }
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (ISC_R_SUCCESS);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley}
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrenceisc_result_t
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellingtondns_c_rrsolist_new(isc_log_t *lctx, isc_mem_t *mem, dns_c_rrsolist_t **rval)
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews{
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence dns_c_rrsolist_t *ro;
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington (void)lctx;
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence ro = isc_mem_get(mem, sizeof *ro);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (ro == NULL) {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews return (ISC_R_NOMEMORY);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews }
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews ISC_LIST_INIT(ro->elements);
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence ro->mem = mem;
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence *rval = ro;
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington return (ISC_R_SUCCESS);
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington}
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellingtonisc_result_t
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrencedns_c_rrso_new(isc_log_t *lctx, isc_mem_t *mem, dns_c_rrso_t **res,
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson dns_rdataclass_t oclass,
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson dns_rdatatype_t otype, char *name, dns_c_ordering_t ordering)
1b1e1fda4638334b484aa38c15f53a131c0b0fdfAndreas Gustafsson{
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_rrso_t *newo;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews (void)lctx;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews REQUIRE(mem != NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(res != NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (name == NULL) {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley name = "*";
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington }
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley newo = isc_mem_get(mem, sizeof *newo);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (newo == NULL) {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (ISC_R_NOMEMORY);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley }
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington newo->mem = mem;
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff newo->otype = otype;
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff newo->oclass = oclass;
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff newo->ordering = ordering;
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff ISC_LINK_INIT(newo, next);
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley newo->name = isc_mem_strdup(mem, name);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (newo->name == NULL) {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_mem_put(mem, newo, sizeof *newo);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews return (ISC_R_NOMEMORY);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews }
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews *res = newo;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews return (ISC_R_SUCCESS);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews}
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsisc_result_t
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsdns_c_rrsolist_delete(isc_log_t *lctx, dns_c_rrsolist_t **list)
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews{
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_rrso_t *elem, *q;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_rrsolist_t *l;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews isc_result_t r;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington REQUIRE(list != NULL);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington REQUIRE(*list != NULL);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington l = *list;
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington elem = ISC_LIST_HEAD(l->elements);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington while (elem != NULL) {
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington q = ISC_LIST_NEXT(elem, next);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington ISC_LIST_UNLINK(l->elements, elem, next);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington r = dns_c_rrso_delete(lctx, &elem);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington if (r != ISC_R_SUCCESS) {
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington return (r);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington }
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington elem = q;
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington }
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington isc_mem_put(l->mem, l, sizeof *l);
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington *list = NULL;
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington
98d010a24a9f1b4b45ce9791845941ef90426d0cBrian Wellington return (ISC_R_SUCCESS);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews}
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrewsisc_result_t
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrewsdns_c_rrso_delete(isc_log_t *lctx, dns_c_rrso_t **order)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews{
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews dns_c_rrso_t *oldo;
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (void)lctx;
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews REQUIRE(order != NULL);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews REQUIRE(*order != NULL);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews oldo = *order;
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews REQUIRE(oldo->name != NULL);
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews isc_mem_free(oldo->mem, oldo->name);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews isc_mem_put(oldo->mem, oldo, sizeof *oldo);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews *order = NULL;
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews return (ISC_R_SUCCESS);
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews}
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrewsisc_result_t
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrewsdns_c_rrso_copy(isc_log_t *lctx, isc_mem_t *mem, dns_c_rrso_t **dest,
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews dns_c_rrso_t *source)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews{
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews dns_c_rrso_t *newo;
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews isc_result_t res;
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(mem != NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(dest != NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(source != NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington res = dns_c_rrso_new(lctx, mem, &newo, source->oclass,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews source->otype, source->name,
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington source->ordering);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington if (res == ISC_R_SUCCESS) {
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington *dest = newo;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington } else {
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff *dest = NULL;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington }
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington return (res);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington}
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellingtonisc_result_t
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtondns_c_rrsolist_copy(isc_log_t *lctx, isc_mem_t *mem, dns_c_rrsolist_t **dest,
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington dns_c_rrsolist_t *source)
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson{
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington dns_c_rrsolist_t *nlist;
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington dns_c_rrso_t *elem;
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson dns_c_rrso_t *newe;
5c6117688525d0e8d247f50c63364f66bd8d4185Brian Wellington dns_result_t res;
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington res = dns_c_rrsolist_new(lctx, mem, &nlist);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington if (res != DNS_R_SUCCESS) {
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington return (res);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington }
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington elem = ISC_LIST_HEAD(source->elements);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington while (elem != NULL) {
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellington res = dns_c_rrso_copy(lctx, mem, &newe, elem);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (res != DNS_R_SUCCESS) {
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_c_rrsolist_delete(lctx, &nlist);
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington return (res);
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson }
1b1e1fda4638334b484aa38c15f53a131c0b0fdfAndreas Gustafsson
18b7133679efa8f60fd4e396c628576f3f416b3eBrian Wellington ISC_LIST_APPEND(nlist->elements, newe, next);
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington elem = ISC_LIST_NEXT(elem, next);
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington }
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington *dest = nlist;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington return (ISC_R_SUCCESS);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews}
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtonvoid
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellingtondns_c_rrsolist_print(isc_log_t *lctx, FILE *fp, int indent,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_rrsolist_t *rrlist)
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington{
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington dns_c_rrso_t *or;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (rrlist == NULL) {
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington return;
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington }
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington if (ISC_LIST_EMPTY(rrlist->elements)) {
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington return;
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington }
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington dns_c_printtabs(lctx, fp, indent);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington fprintf(fp, "rrset-order {\n");
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews or = ISC_LIST_HEAD(rrlist->elements);
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington while (or != NULL) {
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington dns_c_rrso_print(lctx, fp, indent + 1, or);
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington or = ISC_LIST_NEXT(or, next);
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington }
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington dns_c_printtabs(lctx, fp, indent);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington fprintf(fp, "};\n");
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews}
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsvoid
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsdns_c_rrso_print(isc_log_t *lctx, FILE *fp, int indent, dns_c_rrso_t *order)
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews{
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_printtabs(lctx, fp, indent);
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fputs("class ", fp);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (order->oclass == dns_rdataclass_any) {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fputc('*', fp);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews } else {
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington dns_c_dataclass_tostream(lctx, fp, order->oclass);
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington }
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fputs(" type ", fp);
18b7133679efa8f60fd4e396c628576f3f416b3eBrian Wellington if (order->otype == dns_rdatatype_any) {
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington fputc('*', fp);
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington } else {
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington dns_c_datatype_tostream(lctx, fp, order->otype);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews }
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fprintf(fp, " name %s", order->name);
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fprintf(fp, " order %s",
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews dns_c_ordering2string(lctx, order->ordering, ISC_TRUE));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews fputs(";\n", fp);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews}
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews