rdatasetiter.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: rdatasetiter.c,v 1.16 2007/06/19 23:47:16 tbox Exp $ */
00019 
00020 /*! \file */
00021 
00022 #include <config.h>
00023 
00024 #include <stddef.h>
00025 
00026 #include <isc/util.h>
00027 
00028 #include <dns/rdataset.h>
00029 #include <dns/rdatasetiter.h>
00030 
00031 void
00032 dns_rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
00033         /*
00034          * Destroy '*iteratorp'.
00035          */
00036 
00037         REQUIRE(iteratorp != NULL);
00038         REQUIRE(DNS_RDATASETITER_VALID(*iteratorp));
00039 
00040         (*iteratorp)->methods->destroy(iteratorp);
00041 
00042         ENSURE(*iteratorp == NULL);
00043 }
00044 
00045 isc_result_t
00046 dns_rdatasetiter_first(dns_rdatasetiter_t *iterator) {
00047         /*
00048          * Move the rdataset cursor to the first rdataset at the node (if any).
00049          */
00050 
00051         REQUIRE(DNS_RDATASETITER_VALID(iterator));
00052 
00053         return (iterator->methods->first(iterator));
00054 }
00055 
00056 isc_result_t
00057 dns_rdatasetiter_next(dns_rdatasetiter_t *iterator) {
00058         /*
00059          * Move the rdataset cursor to the next rdataset at the node (if any).
00060          */
00061 
00062         REQUIRE(DNS_RDATASETITER_VALID(iterator));
00063 
00064         return (iterator->methods->next(iterator));
00065 }
00066 
00067 void
00068 dns_rdatasetiter_current(dns_rdatasetiter_t *iterator,
00069                          dns_rdataset_t *rdataset)
00070 {
00071         /*
00072          * Return the current rdataset.
00073          */
00074 
00075         REQUIRE(DNS_RDATASETITER_VALID(iterator));
00076         REQUIRE(DNS_RDATASET_VALID(rdataset));
00077         REQUIRE(! dns_rdataset_isassociated(rdataset));
00078 
00079         iterator->methods->current(iterator, rdataset);
00080 }

Generated on Tue Apr 28 17:41:00 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha