1999-03-11 00:43:43 +00:00
|
|
|
/*
|
2004-03-05 05:14:21 +00:00
|
|
|
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
|
2001-01-09 22:01:04 +00:00
|
|
|
* Copyright (C) 1999-2001 Internet Software Consortium.
|
2000-08-01 01:33:37 +00:00
|
|
|
*
|
1999-03-11 00:43:43 +00:00
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
2000-08-01 01:33:37 +00:00
|
|
|
*
|
2004-03-05 05:14:21 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
1999-03-11 00:43:43 +00:00
|
|
|
*/
|
|
|
|
|
2005-04-27 04:57:32 +00:00
|
|
|
/* $Id: rdatasetiter.c,v 1.13 2005/04/27 04:56:50 sra Exp $ */
|
|
|
|
|
|
|
|
/*! \file */
|
2000-06-22 22:00:42 +00:00
|
|
|
|
1999-03-11 00:43:43 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2000-04-28 01:12:23 +00:00
|
|
|
#include <isc/util.h>
|
1999-03-11 00:43:43 +00:00
|
|
|
|
1999-03-11 05:59:40 +00:00
|
|
|
#include <dns/rdataset.h>
|
1999-03-11 00:43:43 +00:00
|
|
|
#include <dns/rdatasetiter.h>
|
|
|
|
|
|
|
|
void
|
|
|
|
dns_rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
|
|
|
|
/*
|
|
|
|
* Destroy '*iteratorp'.
|
|
|
|
*/
|
|
|
|
|
|
|
|
REQUIRE(iteratorp != NULL);
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(*iteratorp));
|
|
|
|
|
|
|
|
(*iteratorp)->methods->destroy(iteratorp);
|
|
|
|
|
|
|
|
ENSURE(*iteratorp == NULL);
|
|
|
|
}
|
|
|
|
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t
|
1999-03-11 00:43:43 +00:00
|
|
|
dns_rdatasetiter_first(dns_rdatasetiter_t *iterator) {
|
|
|
|
/*
|
|
|
|
* Move the rdataset cursor to the first rdataset at the node (if any).
|
|
|
|
*/
|
|
|
|
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
|
|
|
|
|
|
return (iterator->methods->first(iterator));
|
|
|
|
}
|
|
|
|
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t
|
1999-03-11 00:43:43 +00:00
|
|
|
dns_rdatasetiter_next(dns_rdatasetiter_t *iterator) {
|
|
|
|
/*
|
|
|
|
* Move the rdataset cursor to the next rdataset at the node (if any).
|
|
|
|
*/
|
|
|
|
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
|
|
|
|
|
|
return (iterator->methods->next(iterator));
|
|
|
|
}
|
|
|
|
|
1999-03-11 05:59:40 +00:00
|
|
|
void
|
2000-04-28 23:46:43 +00:00
|
|
|
dns_rdatasetiter_current(dns_rdatasetiter_t *iterator,
|
1999-03-11 00:43:43 +00:00
|
|
|
dns_rdataset_t *rdataset)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Return the current rdataset.
|
|
|
|
*/
|
|
|
|
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
|
|
REQUIRE(DNS_RDATASET_VALID(rdataset));
|
2000-04-28 23:46:43 +00:00
|
|
|
REQUIRE(! dns_rdataset_isassociated(rdataset));
|
1999-03-11 00:43:43 +00:00
|
|
|
|
1999-03-11 05:59:40 +00:00
|
|
|
iterator->methods->current(iterator, rdataset);
|
1999-03-11 00:43:43 +00:00
|
|
|
}
|