]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
added a zone struct. Nothing fancy at the time, will evolve over time
authorMiek Gieben <miekg@NLnetLabs.nl>
Mon, 20 Jun 2005 11:00:38 +0000 (11:00 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Mon, 20 Jun 2005 11:00:38 +0000 (11:00 +0000)
Makefile.in
ldns/dns.h
ldns/zone.h [new file with mode: 0644]
libdns.vim
zone.c [new file with mode: 0644]

index f6263192f2d0c56a1f4ad9db35383287b4a8cfaf..b21a040ec2054f97574224b7e445705e2a4e6dc5 100644 (file)
@@ -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=)
index 5cc04dbfdd7b075f6320868e16daa62d7cd53aa4..0ad9b0aeae84f05f9aafdf74b1a41138cb4a669a 100644 (file)
@@ -30,6 +30,7 @@
 #include <ldns/rr_functions.h>
 #include <ldns/keys.h>
 #include <ldns/parse.h>
+#include <ldns/zone.h>
 
 #define LDNS_IP4ADDRLEN      (32/8)
 #define LDNS_IP6ADDRLEN      (128/8)
diff --git a/ldns/zone.h b/ldns/zone.h
new file mode 100644 (file)
index 0000000..4c3c32c
--- /dev/null
@@ -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 <ldns/common.h>
+#include <ldns/rdata.h>
+#include <ldns/rr.h>
+#include <ldns/error.h>
+
+/** 
+ * 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 */
index 6718bc1ea087e260edf5a2aa8a644c3560bb7888..b94b9b1eaa055d639011c5db63805c40d0c72c7f 100644 (file)
@@ -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 (file)
index 0000000..f79ee37
--- /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 <ldns/config.h>
+
+#include <ldns/dns.h>
+
+#include <strings.h>
+#include <limits.h>
+
+/**
+ * \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;
+}