From: Miek Gieben Date: Mon, 20 Jun 2005 11:00:38 +0000 (+0000) Subject: added a zone struct. Nothing fancy at the time, will evolve over time X-Git-Tag: release-0.66~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=899b480a07471659b421e8139712e56bcfcdcd66;p=thirdparty%2Fldns.git added a zone struct. Nothing fancy at the time, will evolve over time --- diff --git a/Makefile.in b/Makefile.in index f6263192..b21a040e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,7 +26,7 @@ INSTALL = $(srcdir)/install-sh LIBDNS_SOURCES = rdata.c util.c rr.c packet.c wire2host.c \ host2str.c buffer.c str2host.c resolver.c \ net.c host2wire.c dname.c dnssec.c keys.c \ - higher.c rr_functions.c parse.c error.c + higher.c rr_functions.c parse.c error.c zone.c LIBDNS_HEADERS = ldns/error.h \ ldns/packet.h \ ldns/common.h \ @@ -46,6 +46,7 @@ LIBDNS_HEADERS = ldns/error.h \ ldns/parse.h \ ldns/rr_functions.h \ ldns/dns.h \ + ldns/zone.h \ ldns/util.h PROG_SOURCES = mx.c chaos.c keygen.c PROG_TARGETS = $(PROG_SOURCES:.c=) diff --git a/ldns/dns.h b/ldns/dns.h index 5cc04dbf..0ad9b0ae 100644 --- a/ldns/dns.h +++ b/ldns/dns.h @@ -30,6 +30,7 @@ #include #include #include +#include #define LDNS_IP4ADDRLEN (32/8) #define LDNS_IP6ADDRLEN (128/8) diff --git a/ldns/zone.h b/ldns/zone.h new file mode 100644 index 00000000..4c3c32c7 --- /dev/null +++ b/ldns/zone.h @@ -0,0 +1,40 @@ +/** + * zone.h + * + * zone definitions + * - what is it + * - get_glue function + * - search etc + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ + +#ifndef _LDNS_ZONE_H +#define _LDNS_ZONE_H + +#include +#include +#include +#include + +/** + * Zone type + * + * basicly a list of RR's with some + * extra information which comes from the SOA RR + */ +struct ldns_struct_zone +{ + /** the soa defines a zone */ + ldns_rr *_soa; + /* basicly a zone is a list of rr's */ + ldns_rr_list *_rrs; + /* we could change this to be a b-tree etc etc todo */ +}; +typedef struct ldns_struct_zone ldns_zone; + +#endif /* LDNS_ZONE_H */ diff --git a/libdns.vim b/libdns.vim index 6718bc1e..b94b9b1e 100644 --- a/libdns.vim +++ b/libdns.vim @@ -117,6 +117,9 @@ syn keyword ldnsMacro LDNS_STATUS_NULL " ldns/resolver.h syn keyword ldnsType ldns_resolver +" ldns/zone.h +syn keyword ldnsType ldns_rr_zone + " ldns/rr.h syn keyword ldnsType ldns_rr_list syn keyword ldnsType ldns_rr_descriptor diff --git a/zone.c b/zone.c new file mode 100644 index 00000000..f79ee37e --- /dev/null +++ b/zone.c @@ -0,0 +1,54 @@ +/* zone.c + * + * access functions for ldns_zone + * a Net::DNS like library for C +* + * (c) NLnet Labs, 2004 + * See the file LICENSE for the license + */ +#include + +#include + +#include +#include + +/** + * \param[in] z the zone to read from + * \return the soa record in the zone + */ +ldns_rr * +ldns_zone_soa(ldns_zone *z) +{ + return z->_soa; +} + +/** + * \param[in] z the zone to put the new soa in + * \param[in] soa the soa to set + */ +void +ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa) +{ + z->_soa = soa; +} + +/** + * \param[in] z the zone to read from + * \return the rrs from this zone + */ +ldns_rr_list * +ldns_zone_rrs(ldns_zone *z) +{ + return z->_rrs; +} + +/** + * \param[in] z the zone to put the new soa in + * \param[in] rrlist the rrlist to use + */ +void +ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist) +{ + z->_rrs = rrlist; +}