Browse Source

[1307] final (unrelated) cleanups:
- renamed private methods to addXXX for consistency
- made them non const member functions (for the same reason why
addNXDOMAINProof can't be so)
- renamed variable 'zone' to 'finder' to adapt to class name change

JINMEI Tatuya 13 years ago
parent
commit
1814e37c1b
2 changed files with 32 additions and 32 deletions
  1. 20 20
      src/bin/auth/query.cc
  2. 12 12
      src/bin/auth/query.h

+ 20 - 20
src/bin/auth/query.cc

@@ -32,24 +32,24 @@ namespace isc {
 namespace auth {
 namespace auth {
 
 
 void
 void
-Query::getAdditional(ZoneFinder& zone, const RRset& rrset) const {
+Query::addAdditional(ZoneFinder& zone, const RRset& rrset) {
     RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
     RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
     for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
     for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
         const Rdata& rdata(rdata_iterator->getCurrent());
         const Rdata& rdata(rdata_iterator->getCurrent());
         if (rrset.getType() == RRType::NS()) {
         if (rrset.getType() == RRType::NS()) {
             // Need to perform the search in the "GLUE OK" mode.
             // Need to perform the search in the "GLUE OK" mode.
             const generic::NS& ns = dynamic_cast<const generic::NS&>(rdata);
             const generic::NS& ns = dynamic_cast<const generic::NS&>(rdata);
-            findAddrs(zone, ns.getNSName(), ZoneFinder::FIND_GLUE_OK);
+            addAdditionalAddrs(zone, ns.getNSName(), ZoneFinder::FIND_GLUE_OK);
         } else if (rrset.getType() == RRType::MX()) {
         } else if (rrset.getType() == RRType::MX()) {
             const generic::MX& mx(dynamic_cast<const generic::MX&>(rdata));
             const generic::MX& mx(dynamic_cast<const generic::MX&>(rdata));
-            findAddrs(zone, mx.getMXName());
+            addAdditionalAddrs(zone, mx.getMXName());
         }
         }
     }
     }
 }
 }
 
 
 void
 void
-Query::findAddrs(ZoneFinder& zone, const Name& qname,
-                 const ZoneFinder::FindOptions options) const
+Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
+                          const ZoneFinder::FindOptions options)
 {
 {
     // Out of zone name
     // Out of zone name
     NameComparisonResult result = zone.getOrigin().compare(qname);
     NameComparisonResult result = zone.getOrigin().compare(qname);
@@ -88,12 +88,12 @@ Query::findAddrs(ZoneFinder& zone, const Name& qname,
 }
 }
 
 
 void
 void
-Query::putSOA(ZoneFinder& zone) {
-    ZoneFinder::FindResult soa_result(zone.find(zone.getOrigin(),
+Query::addSOA(ZoneFinder& finder) {
+    ZoneFinder::FindResult soa_result(finder.find(finder.getOrigin(),
         RRType::SOA(), NULL, dnssec_opt_));
         RRType::SOA(), NULL, dnssec_opt_));
     if (soa_result.code != ZoneFinder::SUCCESS) {
     if (soa_result.code != ZoneFinder::SUCCESS) {
         isc_throw(NoSOA, "There's no SOA record in zone " <<
         isc_throw(NoSOA, "There's no SOA record in zone " <<
-            zone.getOrigin().toText());
+            finder.getOrigin().toText());
     } else {
     } else {
         /*
         /*
          * FIXME:
          * FIXME:
@@ -168,20 +168,20 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
 }
 }
 
 
 void
 void
-Query::getAuthAdditional(ZoneFinder& zone) const {
+Query::addAuthAdditional(ZoneFinder& finder) {
     // Fill in authority and addtional sections.
     // Fill in authority and addtional sections.
-    ZoneFinder::FindResult ns_result = zone.find(zone.getOrigin(),
-                                                 RRType::NS(), NULL,
-                                                 dnssec_opt_);
+    ZoneFinder::FindResult ns_result = finder.find(finder.getOrigin(),
+                                                   RRType::NS(), NULL,
+                                                   dnssec_opt_);
     // zone origin name should have NS records
     // zone origin name should have NS records
     if (ns_result.code != ZoneFinder::SUCCESS) {
     if (ns_result.code != ZoneFinder::SUCCESS) {
         isc_throw(NoApexNS, "There's no apex NS records in zone " <<
         isc_throw(NoApexNS, "There's no apex NS records in zone " <<
-                zone.getOrigin().toText());
+                finder.getOrigin().toText());
     } else {
     } else {
         response_.addRRset(Message::SECTION_AUTHORITY,
         response_.addRRset(Message::SECTION_AUTHORITY,
             boost::const_pointer_cast<RRset>(ns_result.rrset), dnssec_);
             boost::const_pointer_cast<RRset>(ns_result.rrset), dnssec_);
         // Handle additional for authority section
         // Handle additional for authority section
-        getAdditional(zone, *ns_result.rrset);
+        addAdditional(finder, *ns_result.rrset);
     }
     }
 }
 }
 
 
@@ -280,14 +280,14 @@ Query::process() {
                         response_.addRRset(Message::SECTION_ANSWER, rrset,
                         response_.addRRset(Message::SECTION_ANSWER, rrset,
                                            dnssec_);
                                            dnssec_);
                         // Handle additional for answer section
                         // Handle additional for answer section
-                        getAdditional(*result.zone_finder, *rrset.get());
+                        addAdditional(*result.zone_finder, *rrset.get());
                     }
                     }
                 } else {
                 } else {
                     response_.addRRset(Message::SECTION_ANSWER,
                     response_.addRRset(Message::SECTION_ANSWER,
                         boost::const_pointer_cast<RRset>(db_result.rrset),
                         boost::const_pointer_cast<RRset>(db_result.rrset),
                         dnssec_);
                         dnssec_);
                     // Handle additional for answer section
                     // Handle additional for answer section
-                    getAdditional(*result.zone_finder, *db_result.rrset);
+                    addAdditional(*result.zone_finder, *db_result.rrset);
                 }
                 }
                 // If apex NS records haven't been provided in the answer
                 // If apex NS records haven't been provided in the answer
                 // section, insert apex NS records into the authority section
                 // section, insert apex NS records into the authority section
@@ -297,7 +297,7 @@ Query::process() {
                     db_result.code != ZoneFinder::SUCCESS ||
                     db_result.code != ZoneFinder::SUCCESS ||
                     (qtype_ != RRType::NS() && !qtype_is_any))
                     (qtype_ != RRType::NS() && !qtype_is_any))
                 {
                 {
-                    getAuthAdditional(*result.zone_finder);
+                    addAuthAdditional(*result.zone_finder);
                 }
                 }
                 break;
                 break;
             case ZoneFinder::DELEGATION:
             case ZoneFinder::DELEGATION:
@@ -305,11 +305,11 @@ Query::process() {
                 response_.addRRset(Message::SECTION_AUTHORITY,
                 response_.addRRset(Message::SECTION_AUTHORITY,
                     boost::const_pointer_cast<RRset>(db_result.rrset),
                     boost::const_pointer_cast<RRset>(db_result.rrset),
                     dnssec_);
                     dnssec_);
-                getAdditional(*result.zone_finder, *db_result.rrset);
+                addAdditional(*result.zone_finder, *db_result.rrset);
                 break;
                 break;
             case ZoneFinder::NXDOMAIN:
             case ZoneFinder::NXDOMAIN:
                 response_.setRcode(Rcode::NXDOMAIN());
                 response_.setRcode(Rcode::NXDOMAIN());
-                putSOA(*result.zone_finder);
+                addSOA(*result.zone_finder);
 
 
                 // If DNSSEC proof is requested and we've got it, add it.
                 // If DNSSEC proof is requested and we've got it, add it.
                 if (dnssec_ && db_result.rrset) {
                 if (dnssec_ && db_result.rrset) {
@@ -318,7 +318,7 @@ Query::process() {
                 break;
                 break;
             case ZoneFinder::NXRRSET:
             case ZoneFinder::NXRRSET:
                 // Just empty answer with SOA in authority section
                 // Just empty answer with SOA in authority section
-                putSOA(*result.zone_finder);
+                addSOA(*result.zone_finder);
                 break;
                 break;
             default:
             default:
                 // These are new result codes (WILDCARD and WILDCARD_NXRRSET)
                 // These are new result codes (WILDCARD and WILDCARD_NXRRSET)

+ 12 - 12
src/bin/auth/query.h

@@ -69,7 +69,7 @@ private:
     /// Adds a SOA of the zone into the authority zone of response_.
     /// Adds a SOA of the zone into the authority zone of response_.
     /// Can throw NoSOA.
     /// Can throw NoSOA.
     ///
     ///
-    void putSOA(isc::datasrc::ZoneFinder& zone);
+    void addSOA(isc::datasrc::ZoneFinder& finder);
 
 
     /// Add NSEC RRs that prove an NXDOMAIN result.
     /// Add NSEC RRs that prove an NXDOMAIN result.
     ///
     ///
@@ -78,7 +78,7 @@ private:
                           isc::dns::ConstRRsetPtr nsec);
                           isc::dns::ConstRRsetPtr nsec);
 
 
     /// \brief Look up additional data (i.e., address records for the names
     /// \brief Look up additional data (i.e., address records for the names
-    /// included in NS or MX records).
+    /// included in NS or MX records) and add them to the additional section.
     ///
     ///
     /// Note: Any additional data which has already been provided in the
     /// Note: Any additional data which has already been provided in the
     /// answer section (i.e., if the original query happend to be for the
     /// answer section (i.e., if the original query happend to be for the
@@ -91,8 +91,8 @@ private:
     /// query is to be found.
     /// query is to be found.
     /// \param rrset The RRset (i.e., NS or MX rrset) which require additional
     /// \param rrset The RRset (i.e., NS or MX rrset) which require additional
     /// processing.
     /// processing.
-    void getAdditional(isc::datasrc::ZoneFinder& zone,
-                       const isc::dns::RRset& rrset) const;
+    void addAdditional(isc::datasrc::ZoneFinder& zone,
+                       const isc::dns::RRset& rrset);
 
 
     /// \brief Find address records for a specified name.
     /// \brief Find address records for a specified name.
     ///
     ///
@@ -110,13 +110,13 @@ private:
     /// be found.
     /// be found.
     /// \param qname The name in rrset RDATA.
     /// \param qname The name in rrset RDATA.
     /// \param options The search options.
     /// \param options The search options.
-    void findAddrs(isc::datasrc::ZoneFinder& zone,
-                   const isc::dns::Name& qname,
-                   const isc::datasrc::ZoneFinder::FindOptions options
-                   = isc::datasrc::ZoneFinder::FIND_DEFAULT) const;
+    void addAdditionalAddrs(isc::datasrc::ZoneFinder& zone,
+                            const isc::dns::Name& qname,
+                            const isc::datasrc::ZoneFinder::FindOptions options
+                            = isc::datasrc::ZoneFinder::FIND_DEFAULT);
 
 
     /// \brief Look up a zone's NS RRset and their address records for an
     /// \brief Look up a zone's NS RRset and their address records for an
-    /// authoritative answer.
+    /// authoritative answer, and add them to the additional section.
     ///
     ///
     /// On returning an authoritative answer, insert a zone's NS into the
     /// On returning an authoritative answer, insert a zone's NS into the
     /// authority section and AAAA/A RRs of each of the NS RDATA into the
     /// authority section and AAAA/A RRs of each of the NS RDATA into the
@@ -131,9 +131,9 @@ private:
     /// include AAAA/A RRs under a zone cut in additional section. (BIND 9
     /// include AAAA/A RRs under a zone cut in additional section. (BIND 9
     /// excludes under-cut RRs; NSD include them.)
     /// excludes under-cut RRs; NSD include them.)
     ///
     ///
-    /// \param zone The \c ZoneFinder through which the NS and additional data
-    /// for the query are to be found.
-    void getAuthAdditional(isc::datasrc::ZoneFinder& zone) const;
+    /// \param finder The \c ZoneFinder through which the NS and additional
+    /// data for the query are to be found.
+    void addAuthAdditional(isc::datasrc::ZoneFinder& finder);
 
 
 public:
 public:
     /// Constructor from query parameters.
     /// Constructor from query parameters.