1 /* $NetBSD: rdatasetiter.c,v 1.4 2014/12/10 04:37:58 christos Exp $ */
4 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: rdatasetiter.c,v 1.16 2007/06/19 23:47:16 tbox Exp */
30 #include <dns/rdataset.h>
31 #include <dns/rdatasetiter.h>
34 dns_rdatasetiter_destroy(dns_rdatasetiter_t
**iteratorp
) {
36 * Destroy '*iteratorp'.
39 REQUIRE(iteratorp
!= NULL
);
40 REQUIRE(DNS_RDATASETITER_VALID(*iteratorp
));
42 (*iteratorp
)->methods
->destroy(iteratorp
);
44 ENSURE(*iteratorp
== NULL
);
48 dns_rdatasetiter_first(dns_rdatasetiter_t
*iterator
) {
50 * Move the rdataset cursor to the first rdataset at the node (if any).
53 REQUIRE(DNS_RDATASETITER_VALID(iterator
));
55 return (iterator
->methods
->first(iterator
));
59 dns_rdatasetiter_next(dns_rdatasetiter_t
*iterator
) {
61 * Move the rdataset cursor to the next rdataset at the node (if any).
64 REQUIRE(DNS_RDATASETITER_VALID(iterator
));
66 return (iterator
->methods
->next(iterator
));
70 dns_rdatasetiter_current(dns_rdatasetiter_t
*iterator
,
71 dns_rdataset_t
*rdataset
)
74 * Return the current rdataset.
77 REQUIRE(DNS_RDATASETITER_VALID(iterator
));
78 REQUIRE(DNS_RDATASET_VALID(rdataset
));
79 REQUIRE(! dns_rdataset_isassociated(rdataset
));
81 iterator
->methods
->current(iterator
, rdataset
);