[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r5476 - in branches/OpenDNSSEC-adapters/signer/src: adapter signer

Matthijs Mekking matthijs at nlnetlabs.nl
Thu Aug 25 11:57:06 CEST 2011


Author: matthijs
Date: 2011-08-25 11:57:05 +0200 (Thu, 25 Aug 2011)
New Revision: 5476

Modified:
   branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c
   branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.h
   branches/OpenDNSSEC-adapters/signer/src/adapter/adfile.c
   branches/OpenDNSSEC-adapters/signer/src/signer/domain.c
   branches/OpenDNSSEC-adapters/signer/src/signer/domain.h
   branches/OpenDNSSEC-adapters/signer/src/signer/namedb.c
   branches/OpenDNSSEC-adapters/signer/src/signer/namedb.h
   branches/OpenDNSSEC-adapters/signer/src/signer/rrset.c
   branches/OpenDNSSEC-adapters/signer/src/signer/rrset.h
Log:
less verbose adapter api



Modified: branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c	2011-08-25 09:57:05 UTC (rev 5476)
@@ -52,8 +52,6 @@
 adapi_get_serial(zone_type* zone)
 {
     if (!zone || !zone->db) {
-        ods_log_error("[%s] unable to get serial: "
-            "no zone data", adapi_str);
         return 0;
     }
     return zone->db->inbserial;
@@ -68,8 +66,6 @@
 adapi_set_serial(zone_type* zone, uint32_t serial)
 {
     if (!zone || !zone->db) {
-        ods_log_error("[%s] unable to set serial: "
-            "no zone data", adapi_str);
         return;
     }
     zone->db->inbserial = serial;
@@ -85,8 +81,6 @@
 adapi_get_origin(zone_type* zone)
 {
     if (!zone) {
-        ods_log_error("[%s] unable to get origin: "
-            "no zone", adapi_str);
         return NULL;
     }
     return zone->apex;
@@ -101,9 +95,7 @@
 adapi_get_class(zone_type* zone)
 {
     if (!zone) {
-        ods_log_error("[%s] unable to get class: "
-            "no zone", adapi_str);
-        return LDNS_RR_CLASS_FIRST;
+        return LDNS_RR_CLASS_IN;
     }
     return zone->klass;
 }
@@ -117,8 +109,6 @@
 adapi_get_ttl(zone_type* zone)
 {
     if (!zone) {
-        ods_log_error("[%s] unable to get ttl: "
-            "no zone data", adapi_str);
         return 0;
     }
     return zone->default_ttl;
@@ -129,22 +119,13 @@
  * Do full zone transaction.
  *
  */
-ods_status
+void
 adapi_trans_full(zone_type* zone)
 {
-    if (!zone || !zone->db) {
-        ods_log_error("[%s] unable to start full zone transaction: "
-            "no zone data", adapi_str);
-        return ODS_STATUS_ASSERT_ERR;
+    if (!zone || !zone->db || !zone->signconf) {
     }
-    if (!zone->signconf) {
-        ods_log_error("[%s] unable to start full zone transaction: "
-            "no signer configuration", adapi_str);
-        return ODS_STATUS_ASSERT_ERR;
-    }
-    ods_log_assert(zone->signconf);
-
-    return namedb_diff(zone->db, zone->signconf->keys);
+    namedb_diff(zone->db, zone->signconf->keys);
+    return;
 }
 
 
@@ -152,15 +133,14 @@
  * Do incremental zone transaction.
  *
  */
-ods_status
+void
 adapi_trans_diff(zone_type* zone)
 {
     if (!zone || !zone->db) {
-        ods_log_error("[%s] unable to start incremental zone transaction: "
-            "no zone data", adapi_str);
-        return ODS_STATUS_ASSERT_ERR;
+        return;
     }
-    return ODS_STATUS_OK;
+    /* todo */
+    return;
 }
 
 

Modified: branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.h	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.h	2011-08-25 09:57:05 UTC (rev 5476)
@@ -83,18 +83,16 @@
 /*
  * Do full zone transaction.
  * \param[in] zone zone
- * \return ods_status status
  *
  */
-ods_status adapi_trans_full(zone_type* zone);
+void adapi_trans_full(zone_type* zone);
 
 /*
  * Do incremental zone transaction.
  * \param[in] zone zone
- * \return ods_status status
  *
  */
-ods_status adapi_trans_diff(zone_type* zone);
+void adapi_trans_diff(zone_type* zone);
 
 /**
  * Add RR.

Modified: branches/OpenDNSSEC-adapters/signer/src/adapter/adfile.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/adapter/adfile.c	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/adapter/adfile.c	2011-08-25 09:57:05 UTC (rev 5476)
@@ -337,16 +337,8 @@
         return status;
     }
     /* [end] read zone */
-
-    /* [start] full transaction */
-    status = adapi_trans_full(adzone);
-    if (status != ODS_STATUS_OK) {
-        ods_log_error("[%s] unable to read file: start transaction failed",
-            adapter_str);
-        return status;
-    }
-    /* [end] full transaction */
-
+    adapi_trans_full(adzone);
+    
     /* [start] validate updates */
     status = zone_examine(adzone);
     if (status != ODS_STATUS_OK) {
@@ -398,15 +390,7 @@
         return status;
     }
     /* [end] read zone */
-
-    /* [start] full transaction */
-    status = adapi_trans_full(adzone);
-    if (status != ODS_STATUS_OK) {
-        ods_log_error("[%s] unable to recover file: start transaction failed",
-            adapter_str);
-        return status;
-    }
-    /* [end] full transaction */
+    adapi_trans_full(adzone);
     return ODS_STATUS_OK;
 }
 

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/domain.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/domain.c	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/domain.c	2011-08-25 09:57:05 UTC (rev 5476)
@@ -457,18 +457,17 @@
 
 
 /**
- * Calculate differences at this domain between current and new RRsets.
+ * Apply differences at domain.
  *
  */
-ods_status
+void
 domain_diff(domain_type* domain, keylist_type* kl)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     rrset_type* rrset = NULL;
-    ods_status status = ODS_STATUS_OK;
 
     if (!domain || !domain->rrsets) {
-        return status;
+        return;
     }
     if (domain->rrsets->root != LDNS_RBTREE_NULL) {
         node = ldns_rbtree_first(domain->rrsets);
@@ -481,13 +480,10 @@
             continue;
         }
         /* normal cases */
-        status = rrset_diff(rrset, kl);
-        if (status != ODS_STATUS_OK) {
-            return status;
-        }
+        rrset_diff(rrset, kl);
         node = ldns_rbtree_next(node);
     }
-    return status;
+    return;
 }
 
 

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/domain.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/domain.h	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/domain.h	2011-08-25 09:57:05 UTC (rev 5476)
@@ -168,13 +168,12 @@
 rrset_type* domain_del_rrset(domain_type* domain, rrset_type* rrset);
 
 /**
- * Calculate differences at this domain between current and new RRsets.
- * \param[in] domain the domain
+ * Apply differences at domain.
+ * \param[in] domain domain
  * \param[in] kl current key list
- * \return ods_status status
  *
  */
-ods_status domain_diff(domain_type* domain, keylist_type* kl);
+void domain_diff(domain_type* domain, keylist_type* kl);
 
 /**
  * Examine domain and verify if data exists.

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/namedb.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/namedb.c	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/namedb.c	2011-08-25 09:57:05 UTC (rev 5476)
@@ -713,28 +713,24 @@
  * Calculate differences at the namedb between current and new RRsets.
  *
  */
-ods_status
+void
 namedb_diff(namedb_type* db, keylist_type* kl)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     domain_type* domain = NULL;
-    ods_status status = ODS_STATUS_OK;
 
     if (!db || !db->domains) {
-        return status;
+        return;
     }
     if (db->domains->root != LDNS_RBTREE_NULL) {
         node = ldns_rbtree_first(db->domains);
     }
     while (node && node != LDNS_RBTREE_NULL) {
         domain = (domain_type*) node->data;
-        status = domain_diff(domain, kl);
-        if (status != ODS_STATUS_OK) {
-            return status;
-        }
+        domain_diff(domain, kl);
         node = ldns_rbtree_next(node);
     }
-    return status;
+    return;
 }
 
 

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/namedb.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/namedb.h	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/namedb.h	2011-08-25 09:57:05 UTC (rev 5476)
@@ -172,10 +172,9 @@
  * Apply differences in db.
  * \param[in] db namedb
  * \param[in] kl current key list
- * \return ods_status status
  *
  */
-ods_status namedb_diff(namedb_type* zd, keylist_type* kl);
+void namedb_diff(namedb_type* db, keylist_type* kl);
 
 /**
  * Commit updates to zone data.

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/rrset.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/rrset.c	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/rrset.c	2011-08-25 09:57:05 UTC (rev 5476)
@@ -486,13 +486,12 @@
 
 
 /**
- * Calculate differences between the current RRset and the pending new one.
+ * Apply differences at RRset.
  *
  */
-ods_status
+void
 rrset_diff(rrset_type* rrset, keylist_type* kl)
 {
-    ods_status status = ODS_STATUS_OK;
     ldns_status lstatus = LDNS_STATUS_OK;
     ldns_dnssec_rrs* current = NULL;
     ldns_dnssec_rrs* pending = NULL;
@@ -501,7 +500,7 @@
     int cmp = 0;
 
     if (!rrset) {
-        return status;
+        return;
     }
 
     current = rrset->rrs;
@@ -519,7 +518,7 @@
         if (lstatus != LDNS_STATUS_OK) {
                 ods_log_error("[%s] diff failed: compare failed (%s)",
                     rrset_str, ldns_get_errorstr_by_id(lstatus));
-                return ODS_STATUS_ERR;
+                return;
         }
 
         if (cmp > 0) {
@@ -536,7 +535,7 @@
                 if (!rr) {
                     ods_log_error("[%s] diff failed: failed to delete RR",
                         rrset_str);
-                    return ODS_STATUS_ERR;
+                    return;
                 }
             }
 
@@ -581,13 +580,13 @@
                 if (!rr) {
                     ods_log_error("[%s] diff failed: failed to delete RR",
                         rrset_str);
-                    return ODS_STATUS_ERR;
+                    return;
                 }
             }
             current = current->next;
         }
     }
-    return ODS_STATUS_OK;
+    return;
 }
 
 

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/rrset.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/rrset.h	2011-08-25 09:47:26 UTC (rev 5475)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/rrset.h	2011-08-25 09:57:05 UTC (rev 5476)
@@ -189,13 +189,12 @@
 ods_status rrset_wipe_out(rrset_type* rrset);
 
 /**
- * Calculate differences between the current RRset and the pending new one.
+ * Apply differences at RRset.
  * \param[in] rrset RRset
  * \param[in] kl current key list
- * \return ods_status status
  *
  */
-ods_status rrset_diff(rrset_type* rrset, keylist_type* kl);
+void rrset_diff(rrset_type* rrset, keylist_type* kl);
 
 /**
  * Commit updates from RRset.




More information about the Opendnssec-commits mailing list