]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
add zone push function. Moved ldns_status stuff to simple booleans
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 23 Jun 2005 10:05:45 +0000 (10:05 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 23 Jun 2005 10:05:45 +0000 (10:05 +0000)
ldns/rr.h
ldns/zone.h
rr.c
zone.c

index be6b49890b54e3a03d228baa53a598bb5d17d5be..a00ab757856203bb3a80dd891b4f33ce2be7a441 100644 (file)
--- a/ldns/rr.h
+++ b/ldns/rr.h
@@ -438,7 +438,7 @@ void ldns_rr_list_deep_free(ldns_rr_list *rr_list);
  * \param[in] right the rightside
  * \return a left with right concatenated to it
  */
-ldns_status ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right);
+bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right);
 
 /**
  * concatenates two ldns_rr_lists together, but makes clones of the rr's 
index 82f62e1dd5e11c707d0651405e61cd8fb2d60aac..18887089a77c2db3a99b34ec4a95004c67c005c4 100644 (file)
@@ -38,7 +38,6 @@ struct ldns_struct_zone
 typedef struct ldns_struct_zone ldns_zone;     
        
 
-
 /**
  * \param[in] z the zone to read from
  * \return the soa record in the zone
@@ -63,5 +62,23 @@ ldns_rr_list * ldns_zone_rrs(ldns_zone *z);
  */
 void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist);
 
+/**
+ * push an rrlist to a zone structure. This function use pointer
+ * copying, so the rr_list structure inside z is modified!
+ * \param[in] z the zone to add to
+ * \param[in] list the list to add
+ * \return a true on succes otherwise falsed
+ */
+bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list);
+
+/**
+ * push an singkle rr to a zone structure. This function use pointer
+ * copying, so the rr_list structure inside z is modified!
+ * \param[in] z the zone to add to
+ * \param[in] rr the rr to add
+ * \return a true on succes otherwise falsed
+ */
+bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr);
+
 
 #endif /* LDNS_ZONE_H */
diff --git a/rr.c b/rr.c
index 59267931ef0085190d53b9433676cc225c451dbd..34fbabc608d78c1261ffa1b08a14fcb70feb778d 100644 (file)
--- a/rr.c
+++ b/rr.c
@@ -480,7 +480,7 @@ ldns_rr_list_deep_free(ldns_rr_list *rr_list)
 
 
 /* add right to left. So we modify *left! */
-ldns_status
+bool
 ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
 {
        uint16_t r_rr_count;
@@ -490,7 +490,7 @@ ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
        if (left) {
                l_rr_count = ldns_rr_list_rr_count(left);
        } else {
-               return LDNS_STATUS_NULL;
+               return false;
        }
 
        if (right) {
@@ -501,14 +501,14 @@ ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
        
        if (l_rr_count + r_rr_count > LDNS_MAX_RR ) {
                /* overflow error */
-               return LDNS_STATUS_ERR;
+               return false;
        }
 
        /* push right to left */
        for(i = 0; i < r_rr_count; i++) {
                ldns_rr_list_push_rr(left, ldns_rr_list_rr(right, i));
        }
-       return LDNS_STATUS_OK;
+       return true;
 }
 
 ldns_rr_list *
diff --git a/zone.c b/zone.c
index 896cde93fcf393f1638aa0fe21738b2c2982902f..888cd0109b07a546a7f0bf3a1873fb59d6465e30 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -37,6 +37,19 @@ ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist)
        z->_rrs = rrlist;
 }
 
+bool
+ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list)
+{
+       return ldns_rr_list_cat(ldns_zone_rrs(z), list);
+
+}
+
+bool
+ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr)
+{
+       return ldns_rr_list_push_rr(
+                       ldns_zone_rrs(z), rr);
+}
 
 
 #if 0