[svn] commit: r1110 - in /trunk/src: bin/auth/ lib/auth/cpp/

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 4 17:57:40 UTC 2010


Author: jinmei
Date: Thu Mar  4 17:57:39 2010
New Revision: 1110

Log:
overall cleanup for the data source code, phase 1.
- use forward declarations instead of including headers when possible
- partly as a result of that, moved method definitions from .h to .cc unless
  it does very trivial thing and is deemed to be performance sensitive.
- avoid 'using namespace' in header files
- made data-source related objects non-copyable as much as possible
- fixed a bug of an uninitialized variable
- made coding style more consistent

Modified:
    trunk/src/bin/auth/auth_srv.cc
    trunk/src/bin/auth/auth_srv.h
    trunk/src/lib/auth/cpp/data_source.cc
    trunk/src/lib/auth/cpp/data_source.h
    trunk/src/lib/auth/cpp/data_source_sqlite3.cc
    trunk/src/lib/auth/cpp/data_source_sqlite3.h
    trunk/src/lib/auth/cpp/data_source_static.cc
    trunk/src/lib/auth/cpp/data_source_static.h
    trunk/src/lib/auth/cpp/datasrc_unittest.cc
    trunk/src/lib/auth/cpp/query.cc
    trunk/src/lib/auth/cpp/query.h
    trunk/src/lib/auth/cpp/unittest_ds.cc
    trunk/src/lib/auth/cpp/unittest_ds.h
    trunk/src/lib/auth/cpp/unittest_util.h

Modified: trunk/src/bin/auth/auth_srv.cc
==============================================================================
--- trunk/src/bin/auth/auth_srv.cc (original)
+++ trunk/src/bin/auth/auth_srv.cc Thu Mar  4 17:57:39 2010
@@ -32,6 +32,8 @@
 #include <dns/message.h>
 #include <config/ccsession.h>
 
+#include <auth/query.h>
+
 #include <cc/data.h>
 
 #include "common.h"
@@ -47,7 +49,8 @@
 using namespace isc::data;
 using namespace isc::config;
 
-AuthSrv::AuthSrv(int port)
+AuthSrv::AuthSrv(int port) :
+    data_src(NULL), sock(-1)
 {
     int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     if (s < 0) {
@@ -65,18 +68,33 @@
 #endif
 
     if (bind(s, (struct sockaddr *)&sin, sa_len) < 0) {
+        close(s);
         throw FatalError("could not bind socket");
     }
 
     sock = s;
 
+    // XXX: the following code is not exception-safe.  Will address in the
+    // next phase.
+
+    data_src = new(MetaDataSrc);
+
     // add static data source
-    data_src.addDataSrc(new StaticDataSrc);
+    data_src->addDataSrc(new StaticDataSrc);
 
     // add SQL data source
     Sqlite3DataSrc* sd = new Sqlite3DataSrc;
     sd->init();
-    data_src.addDataSrc(sd);
+    data_src->addDataSrc(sd);
+}
+
+AuthSrv::~AuthSrv()
+{
+    if (sock >= 0) {
+        close(sock);
+    }
+
+    delete data_src;
 }
 
 void
@@ -115,8 +133,8 @@
         msg.setDNSSECSupported(dnssec_ok);
         msg.setUDPSize(sizeof(recvbuf));
 
-        // do the DataSource call here
-        data_src.doQuery(Query(msg, dnssec_ok));
+        Query query(msg, dnssec_ok);
+        data_src->doQuery(query);
 
         OutputBuffer obuffer(remote_bufsize);
         MessageRenderer renderer(obuffer);

Modified: trunk/src/bin/auth/auth_srv.h
==============================================================================
--- trunk/src/bin/auth/auth_srv.h (original)
+++ trunk/src/bin/auth/auth_srv.h Thu Mar  4 17:57:39 2010
@@ -26,6 +26,7 @@
 class AuthSrv {
 public:
     explicit AuthSrv(int port);
+    ~AuthSrv();
     int getSocket() { return (sock); }
     void processMessage();
     void serve(std::string zone_name);
@@ -34,7 +35,7 @@
 private:
     std::string _db_file;
 
-    isc::auth::MetaDataSrc data_src;
+    isc::auth::MetaDataSrc* data_src;
     int sock;
 };
 

Modified: trunk/src/lib/auth/cpp/data_source.cc
==============================================================================
--- trunk/src/lib/auth/cpp/data_source.cc (original)
+++ trunk/src/lib/auth/cpp/data_source.cc Thu Mar  4 17:57:39 2010
@@ -17,6 +17,8 @@
 #include <iostream>
 #include <vector>
 
+#include <boost/foreach.hpp>
+
 #include <dns/buffer.h>
 #include <dns/message.h>
 #include <dns/name.h>
@@ -27,6 +29,7 @@
 #include <cc/data.h>
 
 #include "data_source.h"
+#include "query.h"
 
 using namespace std;
 using namespace isc::dns;
@@ -71,9 +74,9 @@
 // Synthesize a CNAME answer, for the benefit of clients that don't
 // understand DNAME
 static void
-synthesizeCname(Query& q, QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
-    RdataIteratorPtr it;
-    it = rrset->getRdataIterator();
+synthesizeCname(Query& q, QueryTaskPtr task, RRsetPtr rrset, RRsetList& target)
+{
+    RdataIteratorPtr it = rrset->getRdataIterator();
 
     // More than one DNAME RR in the RRset is illegal, so we only have
     // to process the first one.
@@ -102,9 +105,9 @@
 // Add a task to the query task queue to look up the data pointed
 // to by a CNAME record
 static void
-chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
-    RdataIteratorPtr it;
-    it = rrset->getRdataIterator();
+chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset)
+{
+    RdataIteratorPtr it = rrset->getRdataIterator();
 
     // More than one CNAME RR in the RRset is illegal, so we only have
     // to process the first one.
@@ -113,20 +116,19 @@
         return;
     }
 
-    const Rdata& rd(it->getCurrent());
-    const generic::CNAME& cname = dynamic_cast<const generic::CNAME&>(rd);
-    const Name& target(cname.getCname());
-
-    QueryTaskPtr newtask = QueryTaskPtr(new QueryTask(target, task->qclass,
-                                                      task->qtype,
-                                                      Section::ANSWER(),
-                                                      QueryTask::FOLLOWCNAME)); 
-    q.tasks().push(newtask);
+    q.tasks().push(QueryTaskPtr(
+                       new QueryTask(dynamic_cast<const generic::CNAME&>
+                                     (it->getCurrent()).getCname(),
+                                     task->qclass,
+                                     task->qtype,
+                                     Section::ANSWER(),
+                                     QueryTask::FOLLOWCNAME)));
 }
 
 // Perform the query specified in a QueryTask object
 DataSrc::Result
-doQueryTask(const DataSrc* ds, Query& q, QueryTask& task, RRsetList& target) {
+doQueryTask(const DataSrc* ds, Query& q, QueryTask& task, RRsetList& target)
+{
     switch (task.op) {
     case QueryTask::AUTH_QUERY:
         return (ds->findRRset(q, task.qname, task.qclass, task.qtype,
@@ -152,13 +154,13 @@
 
 // Copy referral information into the authority section of a message
 static inline void
-copyAuth(Query& q, RRsetList& auth) {
-    Message& m = q.message();
+copyAuth(Query& q, RRsetList& auth)
+{
     BOOST_FOREACH(RRsetPtr rrset, auth) {
         if (rrset->getType() == RRType::DNAME()) {
             continue;
         }
-        m.addRRset(Section::AUTHORITY(), rrset, q.wantDnssec());
+        q.message().addRRset(Section::AUTHORITY(), rrset, q.wantDnssec());
         getAdditional(q, rrset);
     }
 }
@@ -166,7 +168,8 @@
 // Query for referrals (i.e., NS/DS or DNAME) at a given name
 static inline bool
 refQuery(const Name& name, Query& q, QueryTaskPtr task,
-         const DataSrc* ds, RRsetList& target) {
+         const DataSrc* ds, RRsetList& target)
+{
     QueryTask newtask(name, q.qclass(), QueryTask::REF_QUERY);
     newtask.zone = task->zone;
 
@@ -188,14 +191,14 @@
 // Match downward, from the zone apex to the query name, looking for
 // referrals.
 static inline bool
-hasDelegation(const DataSrc* ds, Query& q, QueryTaskPtr task) {
-    Message& m = q.message();
+hasDelegation(const DataSrc* ds, Query& q, QueryTaskPtr task)
+{
     int nlen = task->qname.getLabelCount();
     int diff = nlen - task->zone->getLabelCount();
     if (diff > 1) {
         bool found = false;
         RRsetList ref;
-        for(int i = diff; i > 1; i--) {
+        for(int i = diff; i > 1; --i) {
             Name sub(task->qname.split(i - 1, nlen - i));
             if (refQuery(sub, q, task, ds, ref)) {
                 found = true;
@@ -214,13 +217,13 @@
         if (found) {
             if (RRsetPtr r = ref[RRType::DNAME()]) {
                 RRsetList syn;
-                m.addRRset(Section::ANSWER(), r, q.wantDnssec());
-                m.setHeaderFlag(MessageFlag::AA());
+                q.message().addRRset(Section::ANSWER(), r, q.wantDnssec());
+                q.message().setHeaderFlag(MessageFlag::AA());
                 synthesizeCname(q, task, r, syn);
                 if (syn.size() == 1) {
-                    m.addRRset(Section::ANSWER(),
-                               syn[RRType::CNAME()],
-                               q.wantDnssec());
+                    q.message().addRRset(Section::ANSWER(),
+                                         syn[RRType::CNAME()],
+                                         q.wantDnssec());
                     chaseCname(q, task, syn[RRType::CNAME()]);
                     return (true);
                 }
@@ -236,7 +239,7 @@
     // at the actual qname node.)
     if (task->op == QueryTask::AUTH_QUERY &&
         task->state == QueryTask::GETANSWER) {
-        m.setHeaderFlag(MessageFlag::AA());
+        q.message().setHeaderFlag(MessageFlag::AA());
     }
 
     return (false);
@@ -244,7 +247,8 @@
 
 // Attempt a wildcard lookup
 static inline DataSrc::Result
-tryWildcard(Query& q, QueryTaskPtr task, const DataSrc* ds, bool& found) {
+tryWildcard(Query& q, QueryTaskPtr task, const DataSrc* ds, bool& found)
+{
     Message& m = q.message();
     DataSrc::Result result;
     found = false;
@@ -265,7 +269,7 @@
     Name star("*");
     uint32_t rflags = 0;
 
-    for(int i = 1; i <= diff; i++) {
+    for (int i = 1; i <= diff; ++i) {
         const Name& wname(star.concatenate(task->qname.split(i, nlen - i)));
         QueryTask newtask(wname, task->qclass, task->qtype,
                           QueryTask::SIMPLE_QUERY); 
@@ -307,8 +311,8 @@
     } else if (q.wantDnssec()) {
         // No wildcard found; add an NSEC to prove it
         RRsetList nsec;
-        QueryTask newtask = QueryTask(*task->zone, task->qclass, RRType::NSEC(),
-                                QueryTask::SIMPLE_QUERY); 
+        QueryTask newtask(*task->zone, task->qclass, RRType::NSEC(),
+                          QueryTask::SIMPLE_QUERY); 
         newtask.zone = task->zone;
         result = doQueryTask(ds, q, newtask, nsec);
         if (result != DataSrc::SUCCESS) {
@@ -327,15 +331,13 @@
 // doQuery: Processes a query.
 // 
 void
-DataSrc::doQuery(Query q) {
-    Result result;
+DataSrc::doQuery(Query& q)
+{
     Message& m = q.message();
     vector<RRsetPtr> additional;
 
     m.clearHeaderFlag(MessageFlag::AA());
     while (!q.tasks().empty()) {
-        RRsetList data;
-
         QueryTaskPtr task = q.tasks().front();
         q.tasks().pop();
 
@@ -349,19 +351,17 @@
         // Find the closest enclosing zone for which we are authoritative,
         // and the concrete data source which is authoritative for it.
         // (Note that RRtype DS queries need to go to the parent.)
-        Name search(".");
-        if (task->qtype == RRType::DS()) {
-            search = task->qname.split(1, task->qname.getLabelCount() - 1);
-        } else {
-            search = task->qname;
-        }
-
-        NameMatch match(search);
+        NameMatch match(task->qtype == RRType::DS() ?
+                        task->qname.split(1, task->qname.getLabelCount() - 1) :
+                        task->qname);
         findClosestEnclosure(match);
-        const DataSrc* ds = match.bestDataSrc();
+        const DataSrc* datasource = match.bestDataSrc();
         const Name* zone = match.closestName();
 
-        if (ds) {
+        RRsetList data;
+        Result result = SUCCESS;
+
+        if (datasource) {
             task->zone = new Name(*zone);
 
             // For these query task types, if there is more than
@@ -369,11 +369,11 @@
             // check the intermediate nodes for referrals.
             if ((task->op == QueryTask::AUTH_QUERY ||
                  task->op == QueryTask::NOGLUE_QUERY) &&
-                  hasDelegation(ds, q, task)) {
+                  hasDelegation(datasource, q, task)) {
                 continue;
             }
 
-            result = doQueryTask(ds, q, *task, data);
+            result = doQueryTask(datasource, q, *task, data);
             if (result != SUCCESS) {
                 m.setRcode(Rcode::SERVFAIL());
                 return;
@@ -382,7 +382,7 @@
             // Query found a referral; let's find out if that was expected--
             // i.e., if an NS was at the zone apex, or if we were querying
             // specifically for the NS, DS or DNAME record.
-            if ((task->flags & REFERRAL) &&
+            if ((task->flags & REFERRAL) != 0 &&
                 (zone->getLabelCount() == task->qname.getLabelCount() ||
                  task->qtype == RRType::NS() ||
                  task->qtype == RRType::DS() ||
@@ -414,7 +414,7 @@
                     // Add the NS records for the enclosing zone to
                     // the authority section.
                     RRsetList auth;
-                    if (! refQuery(Name(*zone), q, task, ds, auth)) {
+                    if (! refQuery(Name(*zone), q, task, datasource, auth)) {
                         m.setRcode(Rcode::SERVFAIL());
                         return;
                     }
@@ -443,7 +443,7 @@
         } else if (result == ERROR || result == NOT_IMPLEMENTED) {
             m.setRcode(Rcode::SERVFAIL());
             return;
-        } else if (task->flags & CNAME_FOUND) {
+        } else if ((task->flags & CNAME_FOUND) != 0) {
             // The qname node contains a CNAME.  Add a new task to the
             // queue to look up its target.
             if (RRsetPtr rrset = data[RRType::CNAME()]) {
@@ -451,12 +451,12 @@
                 chaseCname(q, task, rrset);
             }
             continue;
-        } else if (task->flags & REFERRAL) {
+        } else if ((task->flags & REFERRAL) != 0) {
             // The qname node contains an out-of-zone referral.
             if (task->state == QueryTask::GETANSWER) {
                 RRsetList auth;
                 m.clearHeaderFlag(MessageFlag::AA());
-                if (! refQuery(task->qname, q, task, ds, auth)) {
+                if (! refQuery(task->qname, q, task, datasource, auth)) {
                     m.setRcode(Rcode::SERVFAIL());
                     return;
                 }
@@ -474,7 +474,7 @@
                 }
             } 
             continue;
-        } else if (task->flags & NO_SUCH_ZONE) {
+        } else if ((task->flags & NO_SUCH_ZONE) != 0) {
             // No such zone.  If we're chasing cnames or adding additional
             // data, that's okay, but if doing an original query, return
             // REFUSED.
@@ -483,13 +483,13 @@
                 return;
             }
             continue;
-        } else if (task->flags & (NAME_NOT_FOUND|TYPE_NOT_FOUND)) {
+        } else if ((task->flags & (NAME_NOT_FOUND|TYPE_NOT_FOUND)) != 0) {
             // No data found at this qname/qtype.
             // If we were looking for answer data, not additional,
             // and the name was not found, we need to find out whether
             // there are any relevant wildcards.
             bool wildcard_found = false;
-            result = tryWildcard(q, task, ds, wildcard_found);
+            result = tryWildcard(q, task, datasource, wildcard_found);
             if (result != SUCCESS) {
                 m.setRcode(Rcode::SERVFAIL());
                 return;
@@ -507,8 +507,9 @@
             // section.  For TYPE_NOT_FOUND, do not set an error rcode,
             // and send the current NSEC in the authority section.
             Name nsecname(task->qname);
-            if (task->flags & NAME_NOT_FOUND) {
-                ds->findPreviousName(q, task->qname, nsecname, task->zone);
+            if ((task->flags & NAME_NOT_FOUND) != 0) {
+                datasource->findPreviousName(q, task->qname, nsecname,
+                                             task->zone);
             }
 
             if (task->state == QueryTask::GETANSWER) {
@@ -520,7 +521,7 @@
                 QueryTask newtask(Name(*zone), task->qclass, RRType::SOA(), 
                                   QueryTask::SIMPLE_QUERY); 
                 newtask.zone = task->zone;
-                result = doQueryTask(ds, q, newtask, soa);
+                result = doQueryTask(datasource, q, newtask, soa);
                 if (result != SUCCESS || newtask.flags != 0) {
                     m.setRcode(Rcode::SERVFAIL());
                     return;
@@ -532,11 +533,10 @@
 
             if (q.wantDnssec()) {
                 RRsetList nsec;
-                QueryTask newtask = QueryTask(nsecname, task->qclass,
-                                              RRType::NSEC(), 
-                                              QueryTask::SIMPLE_QUERY); 
+                QueryTask newtask(nsecname, task->qclass,
+                                  RRType::NSEC(), QueryTask::SIMPLE_QUERY);  
                 newtask.zone = task->zone;
-                result = doQueryTask(ds, q, newtask, nsec);
+                result = doQueryTask(datasource, q, newtask, nsec);
                 if (result != SUCCESS) {
                     m.setRcode(Rcode::SERVFAIL());
                     return;
@@ -573,5 +573,118 @@
     }
 }
 
-}
-}
+DataSrc::Result
+DataSrc::findAddrs(const Query& q, const Name& qname, const RRClass& qclass,
+                   RRsetList& target, uint32_t& flags, Name* zone) const
+{
+    Result r;
+    bool a = false, aaaa = false;
+
+    flags = 0;
+    r = findExactRRset(q, qname, qclass, RRType::A(), target, flags, zone);
+    if (r == SUCCESS && flags == 0) {
+        a = true;
+    }
+
+    flags = 0;
+    r = findExactRRset(q, qname, qclass, RRType::AAAA(), target, flags, zone);
+    if (r == SUCCESS && flags == 0) {
+        aaaa = true;
+    }
+
+    if (!a && !aaaa) {
+        flags = TYPE_NOT_FOUND;
+    } else {
+        flags = 0;
+    }
+
+    return (SUCCESS);
+}
+
+DataSrc::Result
+DataSrc::findReferral(const Query& q, const Name& qname, const RRClass& qclass,
+                      RRsetList& target, uint32_t& flags, Name* zone) const
+{
+    Result r;
+    bool ns = false, ds = false, dname = false;
+
+    flags = 0;
+    r = findExactRRset(q, qname, qclass, RRType::NS(), target, flags, zone);
+    if (r == SUCCESS && flags == 0) {
+        ns = true;
+    } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
+        return (SUCCESS);
+    }
+
+    flags = 0;
+    r = findExactRRset(q, qname, qclass, RRType::DS(), target, flags, zone);
+    if (r == SUCCESS && flags == 0) {
+        ds = true;
+    } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
+        return (SUCCESS);
+    }
+
+    flags = 0;
+    r = findExactRRset(q, qname, qclass, RRType::DNAME(), target, flags, zone);
+    if (r == SUCCESS && flags == 0) {
+        dname = true;
+    } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
+        return (SUCCESS);
+    }
+
+    if (!ns && !dname && !ds) {
+        flags = TYPE_NOT_FOUND;
+    } else {
+        flags = 0;
+    }
+
+    return (SUCCESS);
+}
+
+void
+MetaDataSrc::addDataSrc(DataSrc* ds)
+{
+    if (getClass() != RRClass::ANY() && ds->getClass() != getClass()) {
+        dns_throw(Unexpected, "class mismatch");
+    }
+
+    data_sources.push_back(ds);
+}
+
+void
+MetaDataSrc::findClosestEnclosure(NameMatch& match) const
+{
+    BOOST_FOREACH (DataSrc* ds, data_sources) {
+        if (getClass() != RRClass::ANY() && ds->getClass() != getClass()) {
+            continue;
+        }
+
+        ds->findClosestEnclosure(match);
+    }
+}
+
+NameMatch::~NameMatch()
+{
+    delete closest_name_;
+}
+
+void
+NameMatch::update(const DataSrc& new_source, const Name& container)
+{
+    if (closest_name_ == NULL) {
+        closest_name_ = new Name(container);
+        best_source_ = &new_source;
+        return;
+    }
+
+    if (container.compare(*closest_name_).getRelation() ==
+        NameComparisonResult::SUBDOMAIN) {
+        Name* newname = new Name(container);
+        delete closest_name_;
+        closest_name_ = newname;
+        best_source_ = &new_source;
+    }
+}
+
+}
+}

Modified: trunk/src/lib/auth/cpp/data_source.h
==============================================================================
--- trunk/src/lib/auth/cpp/data_source.h (original)
+++ trunk/src/lib/auth/cpp/data_source.h Thu Mar  4 17:57:39 2010
@@ -17,23 +17,45 @@
 #ifndef __DATA_SOURCE_H
 #define __DATA_SOURCE_H
 
-#include <boost/foreach.hpp>
+#include <vector>
+
 #include <dns/name.h>
-#include <dns/rrset.h>
-#include <dns/rrsetlist.h>
-#include <auth/query.h>
-#include <iostream>
-
-using namespace isc::dns;
+#include <dns/rrclass.h>
 
 namespace isc {
+
+namespace dns {
+class Name;
+class RRType;
+class RRset;
+class RRsetList;
+}
+
 namespace auth {
 
-class DataSrc;
 class NameMatch;
+class Query;
 
 class AbstractDataSrc {
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private to make it explicit that this is a pure base class.
+private:
+    AbstractDataSrc(const AbstractDataSrc& source);
+    AbstractDataSrc& operator=(const AbstractDataSrc& source);
+protected:
+    /// \brief The default constructor.
+    ///
+    /// This is intentionally defined as \c protected as this base class should
+    /// never be instantiated (except as part of a derived class).
+    AbstractDataSrc() {}
 public:
+    /// \brief The destructor.
+    virtual ~AbstractDataSrc() {};
+    //@}
+
     enum Result {
         SUCCESS,
         ERROR,
@@ -55,11 +77,9 @@
         NO_SUCH_ZONE = 0x10
     };
 
-    virtual ~AbstractDataSrc() {};
-
     // 'High-level' methods.  These will be implemented by the
     // general DataSrc class, and SHOULD NOT be overwritten by subclasses.
-    virtual void doQuery(Query query) = 0;
+    virtual void doQuery(Query& query) = 0;
 
     // XXX: High-level methods to be implemented later:
     // virtual void doUpdate(Update update) = 0;
@@ -77,185 +97,131 @@
     // Mandatory 'low-level' methods: These will NOT be implemented by
     // the general DataSrc class; subclasses MUST implement them.
     virtual Result findRRset(const Query& q,
-                             const Name& qname,
-                             const RRClass& qclass,
-                             const RRType& qtype,
-                             RRsetList& target,
+                             const isc::dns::Name& qname,
+                             const isc::dns::RRClass& qclass,
+                             const isc::dns::RRType& qtype,
+                             isc::dns::RRsetList& target,
                              uint32_t& flags,
-                             Name* zone = NULL) const = 0;
+                             isc::dns::Name* zone = NULL) const = 0;
 
     virtual Result findExactRRset(const Query& q,
-                                  const Name& qname,
-                                  const RRClass& qclass,
-                                  const RRType& qtype,
-                                  RRsetList& target,
+                                  const isc::dns::Name& qname,
+                                  const isc::dns::RRClass& qclass,
+                                  const isc::dns::RRType& qtype,
+                                  isc::dns::RRsetList& target,
                                   uint32_t& flags,
-                                  Name* zone = NULL) const = 0;
+                                  isc::dns::Name* zone = NULL) const = 0;
 
     // These will have dumb implementations in the general DataSrc
     // class, and SHOULD be overwritten by subclasses.
     virtual Result findAddrs(const Query& q,
-                             const Name& qname,
-                             const RRClass& qclass,
-                             RRsetList& target,
+                             const isc::dns::Name& qname,
+                             const isc::dns::RRClass& qclass,
+                             isc::dns::RRsetList& target,
                              uint32_t& flags,
-                             Name* zone = NULL) const = 0;
+                             isc::dns::Name* zone = NULL) const = 0;
 
      virtual Result findReferral(const Query& q,
-                                const Name& qname,
-                                const RRClass& qclass,
-                                RRsetList& target,
+                                const isc::dns::Name& qname,
+                                const isc::dns::RRClass& qclass,
+                                isc::dns::RRsetList& target,
                                 uint32_t& flags,
-                                Name* zone = NULL) const = 0;
+                                isc::dns::Name* zone = NULL) const = 0;
 
     // This MUST be implemented by concrete data sources which support
     // DNSSEC, but is optional for others (e.g., the static data source).
     virtual Result findPreviousName(const Query& q,
-                                    const Name& qname,
-                                    Name& target,
-                                    Name* zone) const = 0;
+                                    const isc::dns::Name& qname,
+                                    isc::dns::Name& target,
+                                    isc::dns::Name* zone) const = 0;
 
 };
 
 // Base class for a DNS Data Source
 class DataSrc : public AbstractDataSrc {
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+private:
+    DataSrc(const DataSrc& source);
+    DataSrc& operator=(const DataSrc& source);
 public:
-    DataSrc() : rrclass(RRClass::IN()) {}
-    DataSrc(const RRClass& c) : rrclass(c) {}
+    DataSrc() : rrclass(isc::dns::RRClass::IN()) {}
+    DataSrc(const isc::dns::RRClass& c) : rrclass(c) {}
+    /// \brief The destructor.
     virtual ~DataSrc() {};
-
-    void doQuery(Query q);
+    //@}
+
+    virtual void doQuery(Query& q);
 
     virtual void findClosestEnclosure(NameMatch& match) const = 0;
 
-    const RRClass& getClass() const { return rrclass; }
-    void setClass(RRClass& c) { rrclass = c; }
-    void setClass(const RRClass& c) { rrclass = c; }
+    const isc::dns::RRClass& getClass() const { return rrclass; }
+    void setClass(isc::dns::RRClass& c) { rrclass = c; }
+    void setClass(const isc::dns::RRClass& c) { rrclass = c; }
 
     Result init() { return NOT_IMPLEMENTED; }
     Result close() { return NOT_IMPLEMENTED; }
 
     virtual Result findRRset(const Query& q,
-                             const Name& qname,
-                             const RRClass& qclass,
-                             const RRType& qtype,
-                             RRsetList& target,
+                             const isc::dns::Name& qname,
+                             const isc::dns::RRClass& qclass,
+                             const isc::dns::RRType& qtype,
+                             isc::dns::RRsetList& target,
                              uint32_t& flags,
-                             Name* zone = NULL) const = 0;
+                             isc::dns::Name* zone = NULL) const = 0;
 
     virtual Result findExactRRset(const Query& q,
-                                  const Name& qname,
-                                  const RRClass& qclass,
-                                  const RRType& qtype,
-                                  RRsetList& target,
+                                  const isc::dns::Name& qname,
+                                  const isc::dns::RRClass& qclass,
+                                  const isc::dns::RRType& qtype,
+                                  isc::dns::RRsetList& target,
                                   uint32_t& flags,
-                                  Name* zone = NULL) const = 0;
+                                  isc::dns::Name* zone = NULL) const = 0;
 
     virtual Result findAddrs(const Query& q,
-                               const Name& qname,
-                               const RRClass& qclass,
-                               RRsetList& target,
+                               const isc::dns::Name& qname,
+                               const isc::dns::RRClass& qclass,
+                               isc::dns::RRsetList& target,
                                uint32_t& flags,
-                               Name* zone = NULL) const {
-        Result r;
-        bool a = false, aaaa = false;
-
-        flags = 0;
-        r = findExactRRset(q, qname, qclass, RRType::A(), target, flags, zone);
-        if (r == SUCCESS && flags == 0) {
-            a = true;
-        }
-
-        flags = 0;
-        r = findExactRRset(q, qname, qclass, RRType::AAAA(), target,
-                           flags, zone);
-        if (r == SUCCESS && flags == 0) {
-            aaaa = true;
-        }
-
-        if (!a && !aaaa) {
-            flags = TYPE_NOT_FOUND;
-        } else {
-            flags = 0;
-        }
-
-        return (SUCCESS);
-    }
+                             isc::dns::Name* zone = NULL) const;
 
     virtual Result findReferral(const Query& q,
-                                const Name& qname,
-                                const RRClass& qclass,
-                                RRsetList& target,
+                                const isc::dns::Name& qname,
+                                const isc::dns::RRClass& qclass,
+                                isc::dns::RRsetList& target,
                                 uint32_t& flags,
-                                Name* zone = NULL) const {
-        Result r;
-        bool ns = false, ds = false, dname = false;
-
-        flags = 0;
-        r = findExactRRset(q, qname, qclass, RRType::NS(), target, flags, zone);
-        if (r == SUCCESS && flags == 0) {
-            ns = true;
-        } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
-            return (SUCCESS);
-        }
-
-        flags = 0;
-        r = findExactRRset(q, qname, qclass, RRType::DS(), target, flags, zone);
-        if (r == SUCCESS && flags == 0) {
-            ds = true;
-        } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
-            return (SUCCESS);
-        }
-
-        flags = 0;
-        r = findExactRRset(q, qname, qclass, RRType::DNAME(), target,
-                           flags, zone);
-        if (r == SUCCESS && flags == 0) {
-            dname = true;
-        } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
-            return (SUCCESS);
-        }
-
-        if (!ns && !dname && !ds) {
-            flags = TYPE_NOT_FOUND;
-        } else {
-            flags = 0;
-        }
-
-        return (SUCCESS);
-    }
+                                isc::dns::Name* zone = NULL) const;
 
     virtual Result findPreviousName(const Query& q,
-                                    const Name& qname,
-                                    Name& target,
-                                    Name* zone) const = 0;
-private:
-    RRClass rrclass;
+                                    const isc::dns::Name& qname,
+                                    isc::dns::Name& target,
+                                    isc::dns::Name* zone) const = 0;
+private:
+    isc::dns::RRClass rrclass;
 };
 
 class MetaDataSrc : public DataSrc {
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    //@{
+private:
+    MetaDataSrc(const MetaDataSrc& source);
+    MetaDataSrc& operator=(const MetaDataSrc& source);
 public:
-    MetaDataSrc() : DataSrc(RRClass::ANY()) {}
-    MetaDataSrc(const RRClass& c) : DataSrc(c) {}
+    MetaDataSrc() : DataSrc(isc::dns::RRClass::ANY()) {}
+    MetaDataSrc(const isc::dns::RRClass& c) : DataSrc(c) {}
+    /// \brief The destructor.
     virtual ~MetaDataSrc() {}
-
-    void addDataSrc(DataSrc* ds) {
-        if (getClass() != RRClass::ANY() && ds->getClass() != getClass()) {
-            dns_throw(Unexpected, "class mismatch");
-        }
-
-        data_sources.push_back(ds);
-    }
-
-    void findClosestEnclosure(NameMatch& match) const {
-        BOOST_FOREACH (DataSrc* ds, data_sources) {
-            if (getClass() != RRClass::ANY() && ds->getClass() != getClass()) {
-                continue;
-            }
-
-            ds->findClosestEnclosure(match);
-        }
-    }
+    //@}
+
+    void addDataSrc(DataSrc* ds);
+    void findClosestEnclosure(NameMatch& match) const;
 
     // Actual queries for data should not be sent to a MetaDataSrc object,
     // so we return NOT_IMPLEMENTED if we receive any.
@@ -264,38 +230,45 @@
     // to get a pointer to the best concrete data source for the specified
     // zone, then send all queries directly to that data source.
 
-    Result findRRset(const Query& q, const Name& qname,
-                     const RRClass& qclass, const RRType& qtype,
-                     RRsetList& target, uint32_t& flags,
-                     Name* zone = NULL) const {
-        return (NOT_IMPLEMENTED);
-    }
-
-    Result findExactRRset(const Query& q, const Name& qname,
-                          const RRClass& qclass, const RRType& qtype,
-                          RRsetList& target, uint32_t& flags,
-                          Name* zone = NULL) const {
-        return (NOT_IMPLEMENTED);
-    }
-
-    Result findAddrs(const Query& q,
-                     const Name& qname, const RRClass& qclass,
-                     RRsetList& target, uint32_t& flags,
-                     Name* zone = NULL) const {
-        return (NOT_IMPLEMENTED);
-    }
-
-    Result findReferral(const Query& q,
-                        const Name& qname, const RRClass& qclass,
-                        RRsetList& target, uint32_t& flags,
-                        Name* zone = NULL) const {
+    Result findRRset(const Query& q, const isc::dns::Name& qname,
+                     const isc::dns::RRClass& qclass,
+                     const isc::dns::RRType& qtype,
+                     isc::dns::RRsetList& target, uint32_t& flags,
+                     isc::dns::Name* zone = NULL) const
+    {
+        return (NOT_IMPLEMENTED);
+    }
+
+    Result findExactRRset(const Query& q, const isc::dns::Name& qname,
+                          const isc::dns::RRClass& qclass,
+                          const isc::dns::RRType& qtype,
+                          isc::dns::RRsetList& target, uint32_t& flags,
+                          isc::dns::Name* zone = NULL) const
+    {
+        return (NOT_IMPLEMENTED);
+    }
+
+    Result findAddrs(const Query& q, const isc::dns::Name& qname,
+                     const isc::dns::RRClass& qclass,
+                     isc::dns::RRsetList& target, uint32_t& flags,
+                     isc::dns::Name* zone = NULL) const
+    {
+        return (NOT_IMPLEMENTED);
+    }
+
+    Result findReferral(const Query& q, const isc::dns::Name& qname,
+                        const isc::dns::RRClass& qclass,
+                        isc::dns::RRsetList& target, uint32_t& flags,
+                        isc::dns::Name* zone = NULL) const
+    {
         return (NOT_IMPLEMENTED);
     }
 
     virtual Result findPreviousName(const Query& q,
-                                    const Name& qname,
-                                    Name& target,
-                                    Name* zone) const {
+                                    const isc::dns::Name& qname,
+                                    isc::dns::Name& target,
+                                    isc::dns::Name* zone) const
+    {
         return (NOT_IMPLEMENTED);
     }
 
@@ -305,39 +278,20 @@
 
 class NameMatch {
 public:
-    NameMatch(const Name& qname) :
+    NameMatch(const isc::dns::Name& qname) :
         closest_name_(NULL), best_source_(NULL), qname_(qname) {}
-
-    ~NameMatch() {
-        delete closest_name_;
-    }
-
-    void update(const DataSrc& new_source, const Name& container) {
-        if (closest_name_ == NULL) {
-            closest_name_ = new Name(container);
-            best_source_ = &new_source;
-            return;
-        }
-
-        NameComparisonResult::NameRelation cmp = 
-            container.compare(*closest_name_).getRelation();
-
-        if (cmp == NameComparisonResult::SUBDOMAIN) {
-            Name* newname = new Name(container);
-            delete closest_name_;
-            closest_name_ = newname;
-            best_source_ = &new_source;
-        }
-    }
-
-    const Name& qname() { return (qname_); }
-    const Name* closestName() { return (closest_name_); }
+    ~NameMatch();
+
+    void update(const DataSrc& new_source, const isc::dns::Name& container);
+
+    const isc::dns::Name& qname() { return (qname_); }
+    const isc::dns::Name* closestName() { return (closest_name_); }
     const DataSrc* bestDataSrc() { return (best_source_); }
 
 private:
-    const Name* closest_name_;
+    const isc::dns::Name* closest_name_;
     const DataSrc* best_source_;
-    const Name& qname_;
+    const isc::dns::Name qname_;
 };
 
 }

Modified: trunk/src/lib/auth/cpp/data_source_sqlite3.cc
==============================================================================
--- trunk/src/lib/auth/cpp/data_source_sqlite3.cc (original)
+++ trunk/src/lib/auth/cpp/data_source_sqlite3.cc Thu Mar  4 17:57:39 2010
@@ -34,7 +34,8 @@
 //  Prepare a statement.  Can call release() or sqlite3_finalize()
 //  directly.
 //
-sqlite3_stmt* Sqlite3DataSrc::prepare(const char *statement) {
+sqlite3_stmt* Sqlite3DataSrc::prepare(const char *statement)
+{
     int rc;
     sqlite3_stmt *prepared = NULL;
 
@@ -55,7 +56,8 @@
 //
 //  Get the database schema version.
 //
-int Sqlite3DataSrc::getVersion(void) {
+int Sqlite3DataSrc::getVersion(void)
+{
     if (database_version == -1) {
         loadVersion();
     }
@@ -66,7 +68,8 @@
 //  Find the exact zone match.  Return -1 if not found, or the zone's
 //  ID if found.  This will always be >= 0 if found.
 //
-int Sqlite3DataSrc::hasExactZone(const char *name) const {
+int Sqlite3DataSrc::hasExactZone(const char* name) const
+{
     int rc, i;
     sqlite3_reset(q_zone);
     rc = sqlite3_bind_text(q_zone, 1, name, -1, SQLITE_STATIC);
@@ -263,7 +266,8 @@
 //  >= 0 if found.  If position is not NULL, it will be filled in with the
 //  longest match found.
 //
-int Sqlite3DataSrc::findClosest(const char *name, const char **position) const {
+int Sqlite3DataSrc::findClosest(const char *name, const char **position) const
+{
     int rc;
     const char *current = name;
     
@@ -286,7 +290,9 @@
     return (-1);
 }
 
-void Sqlite3DataSrc::loadVersion(void) {
+void
+Sqlite3DataSrc::loadVersion(void)
+{
     int rc;
 
     const char *q = "SELECT version FROM schema_version";
@@ -299,49 +305,51 @@
     release(prepared);
 }
 
-void Sqlite3DataSrc::setupPreparedStatements(void) {
-
-    const char *q_zone_str = "SELECT id FROM zones WHERE name=?1";
+void
+Sqlite3DataSrc::setupPreparedStatements(void)
+{
+
+    const char* q_zone_str = "SELECT id FROM zones WHERE name=?1";
     try {
         q_zone = prepare(q_zone_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_zone_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
     }
 
-    const char *q_record_str = "SELECT rdtype, ttl, sigtype, rdata "
+    const char* q_record_str = "SELECT rdtype, ttl, sigtype, rdata "
                                "FROM records WHERE zone_id=?1 AND name=?2 AND "
                                "((rdtype=?3 OR sigtype=?3) OR "
                                "(rdtype='CNAME' OR sigtype='CNAME') OR "
                                "(rdtype='NS' OR sigtype='NS'))";
     try {
         q_record = prepare(q_record_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_record_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
     }
 
-    const char *q_addrs_str = "SELECT rdtype, ttl, sigtype, rdata "
+    const char* q_addrs_str = "SELECT rdtype, ttl, sigtype, rdata "
                                "FROM records WHERE zone_id=?1 AND name=?2 AND "
                                "(rdtype='A' OR sigtype='A' OR "
                                "rdtype='AAAA' OR sigtype='AAAA')";
     try {
         q_addrs = prepare(q_addrs_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_addrs_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
     }
-    const char *q_referral_str = "SELECT rdtype, ttl, sigtype, rdata FROM "
+    const char* q_referral_str = "SELECT rdtype, ttl, sigtype, rdata FROM "
                                  "records WHERE zone_id=?1 AND name=?2 AND"
                                  "(rdtype='NS' OR sigtype='NS' OR "
                                  "rdtype='DS' OR sigtype='DS' OR "
                                  "rdtype='DNAME' OR sigtype='DNAME')";
     try {
         q_referral = prepare(q_referral_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_referral_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
@@ -350,29 +358,29 @@
                              "FROM records WHERE zone_id=?1 AND name=?2";
     try {
         q_any = prepare(q_any_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_any_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
     }
 
-    const char *q_count_str = "SELECT COUNT(*) FROM records "
+    const char* q_count_str = "SELECT COUNT(*) FROM records "
                               "WHERE zone_id=?1 AND (name=?2 OR "
                               "name LIKE '%.' || ?2);";
     try {
         q_count = prepare(q_count_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_count_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
     }
 
-    const char *q_previous_str = "SELECT name FROM records "
+    const char* q_previous_str = "SELECT name FROM records "
                                  "WHERE zone_id=?1 AND rdtype = 'NSEC' AND "
                                  "rname < $2 ORDER BY rname DESC LIMIT 1";
     try {
         q_previous = prepare(q_previous_str);
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl << q_previous_str << endl;
         cout << sqlite3_errmsg(db) << endl;
         throw(e);
@@ -380,7 +388,9 @@
 
 }
 
-void Sqlite3DataSrc::execSetupQuery(const char *query) {
+void
+Sqlite3DataSrc::execSetupQuery(const char *query)
+{
     int rc;
 
     rc = sqlite3_exec(db, query, NULL, NULL, NULL);
@@ -389,7 +399,9 @@
     }
 }
 
-void Sqlite3DataSrc::checkAndSetupSchema(void) {
+void
+Sqlite3DataSrc::checkAndSetupSchema(void)
+{
     try {
         loadVersion();
         setupPreparedStatements();
@@ -446,7 +458,7 @@
         open("/tmp/zone.sqlite3");
     
         cout << "Schema version: " << getVersion() << endl;
-    } catch (const char *e) {
+    } catch (const char* e) {
         cout << e << endl;
     }
 
@@ -454,7 +466,8 @@
 }
 
 void
-Sqlite3DataSrc::findClosestEnclosure(NameMatch& match) const {
+Sqlite3DataSrc::findClosestEnclosure(NameMatch& match) const
+{
     const Name& qname = match.qname();
     const string target_string = qname.toText();
     const char *position = NULL;
@@ -473,14 +486,14 @@
                                  Name& target,
                                  Name* zone) const
 {
-    const char *c_rname = qname.reverse().toText().c_str();
+    const char* c_rname = qname.reverse().toText().c_str();
 
     int zone_id;
     if (zone == NULL) {
-        const char *c_name = qname.toText().c_str();
+        const char* c_name = qname.toText().c_str();
         zone_id = findClosest(c_name, NULL);
     } else {
-        const char *c_zone = zone->toText().c_str();
+        const char* c_zone = zone->toText().c_str();
         zone_id = findClosest(c_zone, NULL);
     }
 
@@ -554,18 +567,20 @@
                           const RRClass& qclass,
                           RRsetList& target,
                           uint32_t& flags,
-                          Name* zone) const {
+                          Name* zone) const
+{
     findRecords(qname, RRType::ANY(), target, zone, ADDRESS, flags);
     return (SUCCESS);
 }
 
 DataSrc::Result
 Sqlite3DataSrc::findReferral(const Query& q,
-                            const Name& qname,
-                            const RRClass& qclass,
-                            RRsetList& target,
-                            uint32_t& flags,
-                            Name* zone) const {
+                             const Name& qname,
+                             const RRClass& qclass,
+                             RRsetList& target,
+                             uint32_t& flags,
+                             Name* zone) const
+{
     findRecords(qname, RRType::ANY(), target, zone, DELEGATION, flags);
     return (SUCCESS);
 }

Modified: trunk/src/lib/auth/cpp/data_source_sqlite3.h
==============================================================================
--- trunk/src/lib/auth/cpp/data_source_sqlite3.h (original)
+++ trunk/src/lib/auth/cpp/data_source_sqlite3.h Thu Mar  4 17:57:39 2010
@@ -14,59 +14,79 @@
 
 // $Id$
 
-#ifndef __SQLITE3_DATA_SOURCE_H
-#define __SQLITE3_DATA_SOURCE_H
+#ifndef __DATA_SOURCE_SQLITE3_H
+#define __DATA_SOURCE_SQLITE3_H
+
+#include <string>
 
 #include <sqlite3.h>
 
 #include "data_source.h"
 
-using namespace isc::dns;
+namespace isc {
 
-namespace isc {
+namespace dns {
+class Name;
+class RRClass;
+class RRType;
+class RRsetList;
+}
+
 namespace auth {
 
+class Query;
+
 class Sqlite3DataSrc : public DataSrc {
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    //@{
+private:
+    Sqlite3DataSrc(const Sqlite3DataSrc& source);
+    Sqlite3DataSrc& operator=(const Sqlite3DataSrc& source);
 public:
     Sqlite3DataSrc();
     virtual ~Sqlite3DataSrc();
+    //@}
 
     virtual void findClosestEnclosure(NameMatch& match) const;
 
     virtual Result findRRset(const Query& q,
-                             const Name& qname,
-                             const RRClass& qclass,
-                             const RRType& qtype,
-                             RRsetList& target,
+                             const isc::dns::Name& qname,
+                             const isc::dns::RRClass& qclass,
+                             const isc::dns::RRType& qtype,
+                             isc::dns::RRsetList& target,
                              uint32_t& flags,
-                             Name* zone = NULL) const;
+                             isc::dns::Name* zone = NULL) const;
 
     virtual Result findExactRRset(const Query& q,
-                                  const Name& qname,
-                                  const RRClass& qclass,
-                                  const RRType& qtype,
-                                  RRsetList& target,
+                                  const isc::dns::Name& qname,
+                                  const isc::dns::RRClass& qclass,
+                                  const isc::dns::RRType& qtype,
+                                  isc::dns::RRsetList& target,
                                   uint32_t& flags,
-                                  Name* zone = NULL) const;
+                                  isc::dns::Name* zone = NULL) const;
 
     virtual Result findAddrs(const Query& q,
-                               const Name& qname,
-                               const RRClass& qclass,
-                               RRsetList& target,
+                               const isc::dns::Name& qname,
+                               const isc::dns::RRClass& qclass,
+                               isc::dns::RRsetList& target,
                                uint32_t& flags,
-                               Name* zone = NULL) const;
+                               isc::dns::Name* zone = NULL) const;
 
     virtual Result findReferral(const Query& q,
-                                const Name& qname,
-                                const RRClass& qclass,
-                                RRsetList& target,
+                                const isc::dns::Name& qname,
+                                const isc::dns::RRClass& qclass,
+                                isc::dns::RRsetList& target,
                                 uint32_t& flags,
-                                Name* zone = NULL) const;
+                                isc::dns::Name* zone = NULL) const;
 
     virtual DataSrc::Result findPreviousName(const Query& q,
-                                             const Name& qname,
-                                             Name& target,
-                                             Name* zone) const;
+                                             const isc::dns::Name& qname,
+                                             isc::dns::Name& target,
+                                             isc::dns::Name* zone) const;
 
     virtual Result init();
     virtual Result close();
@@ -83,8 +103,8 @@
     void release(sqlite3_stmt* prepared);
     int getVersion(void);
     int hasExactZone(const char *name) const;
-    int findRecords(const Name& name, const RRType& rdtype,
-                    RRsetList& target, Name* zone,
+    int findRecords(const isc::dns::Name& name, const isc::dns::RRType& rdtype,
+                    isc::dns::RRsetList& target, isc::dns::Name* zone,
                     const Mode mode, uint32_t& flags) const;
     int findClosest(const char *name, const char **position) const;
     void loadVersion(void);
@@ -111,7 +131,7 @@
 }
 }
 
-#endif // __SQLITE3_DATA_SOURCE_H
+#endif // __DATA_SOURCE_SQLITE3_H
 
 // Local Variables: 
 // mode: c++

Modified: trunk/src/lib/auth/cpp/data_source_static.cc
==============================================================================
--- trunk/src/lib/auth/cpp/data_source_static.cc (original)
+++ trunk/src/lib/auth/cpp/data_source_static.cc Thu Mar  4 17:57:39 2010
@@ -18,9 +18,11 @@
 #include <dns/rdataclass.h>
 #include <dns/rrclass.h>
 #include <dns/rrset.h>
+#include <dns/rrsetlist.h>
 #include <dns/rrtype.h>
 #include <dns/rrttl.h>
 
+#include "data_source.h"
 #include "data_source_static.h"
 
 using namespace std;
@@ -30,36 +32,62 @@
 namespace isc {
 namespace auth {
 
-StaticDataSrc::StaticDataSrc() : authors_name("authors.bind"),
-                                 version_name("version.bind")
+// There's no mutable internal state in StaticDataSrcImpl, so define it
+// as a struct.
+
+namespace {
+
+// All data in this class is literally static and can be generated at
+// initialization time (and won't be changed).  Names can be statically
+// initialized.  For RRsets, a helper class (StaticDataInitializer) and its
+// only instance will be used for initialization.
+const Name authors_name("authors.bind");
+const Name version_name("version.bind");
+// XXX: unfortunately these can't be RRsetPtr because they'll be passed to
+// RRsetList::addRRset(), which expect non const RRsetPtr.  We should revisit
+// this design later.
+RRsetPtr authors;
+RRsetPtr authors_ns;
+RRsetPtr version;
+RRsetPtr version_ns;
+
+class StaticDataInitializer {
+public:
+    StaticDataInitializer()
+    {
+        authors = RRsetPtr(new RRset(authors_name, RRClass::CH(),
+                                     RRType::TXT(), RRTTL(0)));
+        authors->addRdata(generic::TXT("Evan Hunt"));
+        authors->addRdata(generic::TXT("Han Feng"));
+        authors->addRdata(generic::TXT("Jelte Jansen"));
+        authors->addRdata(generic::TXT("Jeremy C. Reed")); 
+        authors->addRdata(generic::TXT("Jin Jian"));
+        authors->addRdata(generic::TXT("JINMEI Tatuya"));
+        authors->addRdata(generic::TXT("Kazunori Fujiwara"));
+        authors->addRdata(generic::TXT("Michael Graff"));
+        authors->addRdata(generic::TXT("Naoki Kambe"));
+        authors->addRdata(generic::TXT("Shane Kerr"));
+        authors->addRdata(generic::TXT("Zhang Likun"));
+
+        authors_ns = RRsetPtr(new RRset(authors_name, RRClass::CH(),
+                                        RRType::NS(), RRTTL(0)));
+        authors_ns->addRdata(generic::NS(authors_name));
+
+        version = RRsetPtr(new RRset(version_name, RRClass::CH(),
+                                     RRType::TXT(), RRTTL(0)));
+        version->addRdata(generic::TXT("BIND10 0.0.0 (pre-alpha)"));
+
+        version_ns = RRsetPtr(new RRset(version_name, RRClass::CH(),
+                                        RRType::NS(), RRTTL(0)));
+        version_ns->addRdata(generic::NS(version_name));
+    }
+};
+const StaticDataInitializer initialier_object;
+}
+
+StaticDataSrc::StaticDataSrc()
 {
     setClass(RRClass::CH());
-
-    authors = RRsetPtr(new RRset(authors_name, RRClass::CH(),
-                                          RRType::TXT(), RRTTL(0)));
-    authors->addRdata(generic::TXT("Evan Hunt"));
-    authors->addRdata(generic::TXT("Han Feng"));
-    authors->addRdata(generic::TXT("Jelte Jansen"));
-    authors->addRdata(generic::TXT("Jeremy C. Reed")); 
-    authors->addRdata(generic::TXT("Jin Jian"));
-    authors->addRdata(generic::TXT("JINMEI Tatuya"));
-    authors->addRdata(generic::TXT("Kazunori Fujiwara"));
-    authors->addRdata(generic::TXT("Michael Graff"));
-    authors->addRdata(generic::TXT("Naoki Kambe"));
-    authors->addRdata(generic::TXT("Shane Kerr"));
-    authors->addRdata(generic::TXT("Zhang Likun"));
-
-    authors_ns = RRsetPtr(new RRset(authors_name, RRClass::CH(),
-                                    RRType::NS(), RRTTL(0)));
-    authors_ns->addRdata(generic::NS(authors_name));
-
-    version = RRsetPtr(new RRset(version_name, RRClass::CH(),
-                                          RRType::TXT(), RRTTL(0)));
-    version->addRdata(generic::TXT("BIND10 0.0.0 (pre-alpha)"));
-
-    version_ns = RRsetPtr(new RRset(version_name, RRClass::CH(),
-                                    RRType::NS(), RRTTL(0)));
-    version_ns->addRdata(generic::NS(version_name));
 }
 
 void
@@ -83,13 +111,9 @@
 }
 
 DataSrc::Result
-StaticDataSrc::findRRset(const Query& q,
-                         const Name& qname,
-                         const RRClass& qclass,
-                         const RRType& qtype,
-                         RRsetList& target,
-                         uint32_t& flags,
-                         Name* zone) const
+StaticDataSrc::findRRset(const Query& q, const Name& qname,
+                         const RRClass& qclass, const RRType& qtype,
+                         RRsetList& target, uint32_t& flags, Name* zone) const
 {
     flags = 0;
     if (qclass != getClass()) {
@@ -123,5 +147,33 @@
     return (SUCCESS);
 }
 
+DataSrc::Result
+StaticDataSrc::findExactRRset(const Query& q, const Name& qname,
+                              const RRClass& qclass, const RRType& qtype,
+                              RRsetList& target, uint32_t& flags,
+                              Name* zone) const
+{
+    return (findRRset(q, qname, qclass, qtype, target, flags, zone));
+}
+
+DataSrc::Result
+StaticDataSrc::findPreviousName(const Query& q, const Name& qname,
+                                Name& target, Name* zone) const
+{
+    return (NOT_IMPLEMENTED);
+}
+
+DataSrc::Result
+StaticDataSrc::init()
+{
+    return (SUCCESS);
+}
+
+DataSrc::Result
+StaticDataSrc::close()
+{
+    return (SUCCESS);
+}
+
 }
 }

Modified: trunk/src/lib/auth/cpp/data_source_static.h
==============================================================================
--- trunk/src/lib/auth/cpp/data_source_static.h (original)
+++ trunk/src/lib/auth/cpp/data_source_static.h Thu Mar  4 17:57:39 2010
@@ -27,54 +27,61 @@
 
 #include "data_source.h"
 
-using namespace isc::dns;
+namespace isc {
 
-namespace isc {
+namespace dns {
+class Name;
+class RRClass;
+class RRType;
+class RRType;
+class RRsetList;
+}
+
 namespace auth {
 
+class Query;
+class NameMatch;
+
 class StaticDataSrc : public DataSrc {
+private:
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    //@{
+    StaticDataSrc(const StaticDataSrc& source);
+    StaticDataSrc& operator=(const StaticDataSrc& source);
 public:
     StaticDataSrc();
     ~StaticDataSrc() {}
+    //@}
 
     void findClosestEnclosure(NameMatch& match) const;
 
     Result findRRset(const Query& q,
-                     const Name& qname,
-                     const RRClass& qclass,
-                     const RRType& qtype,
-                     RRsetList& target,
+                     const isc::dns::Name& qname,
+                     const isc::dns::RRClass& qclass,
+                     const isc::dns::RRType& qtype,
+                     isc::dns::RRsetList& target,
                      uint32_t& flags,
-                     Name* zone = NULL) const;
+                     isc::dns::Name* zone = NULL) const;
 
     Result findExactRRset(const Query& q,
-                         const Name& qname,
-                         const RRClass& qclass,
-                         const RRType& qtype,
-                         RRsetList& target,
-                         uint32_t& flags,
-                         Name* zone = NULL) const
-    {
-        return (findRRset(q, qname, qclass, qtype, target, flags, zone));
-    }
+                          const isc::dns::Name& qname,
+                          const isc::dns::RRClass& qclass,
+                          const isc::dns::RRType& qtype,
+                          isc::dns::RRsetList& target,
+                          uint32_t& flags,
+                          isc::dns::Name* zone = NULL) const;
 
     Result findPreviousName(const Query& q,
-                            const Name& qname,
-                            Name& target,
-                            Name* zone) const {
-        return (NOT_IMPLEMENTED);
-    }
+                            const isc::dns::Name& qname,
+                            isc::dns::Name& target,
+                            isc::dns::Name* zone) const;
 
-    Result init() { return (SUCCESS); }
-    Result close() { return (SUCCESS); }
-
-private:
-    const Name authors_name;
-    const Name version_name;
-    RRsetPtr authors;
-    RRsetPtr authors_ns;
-    RRsetPtr version;
-    RRsetPtr version_ns;
+    Result init();
+    Result close();
 };
 
 }

Modified: trunk/src/lib/auth/cpp/datasrc_unittest.cc
==============================================================================
--- trunk/src/lib/auth/cpp/datasrc_unittest.cc (original)
+++ trunk/src/lib/auth/cpp/datasrc_unittest.cc Thu Mar  4 17:57:39 2010
@@ -31,6 +31,7 @@
 #include <dns/rrttl.h>
 #include <dns/rrtype.h>
 
+#include "query.h"
 #include "unittest_util.h"
 #include "unittest_ds.h"
 
@@ -66,7 +67,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -127,7 +128,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -162,7 +163,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -186,7 +187,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -212,7 +213,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -228,7 +229,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -287,7 +288,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -346,7 +347,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -407,7 +408,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -438,7 +439,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -477,7 +478,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -514,7 +515,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 
@@ -557,7 +558,7 @@
     msg.makeResponse();
     msg.setHeaderFlag(MessageFlag::AA());
     msg.setRcode(Rcode::NOERROR());
-    Query q = Query(msg, true);
+    Query q(msg, true);
     ds.doQuery(q);
     Message* m = &(q.message());
 

Modified: trunk/src/lib/auth/cpp/query.cc
==============================================================================
--- trunk/src/lib/auth/cpp/query.cc (original)
+++ trunk/src/lib/auth/cpp/query.cc Thu Mar  4 17:57:39 2010
@@ -29,8 +29,8 @@
 namespace auth {
 
 // Destructors defined here to avoid confusing the linker
+Query::~Query() {}
 QueryTask::~QueryTask() {}
-Query::~Query() {}
 
 QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
                      const isc::dns::RRType& t, const isc::dns::Section& sect) :
@@ -66,7 +66,7 @@
     op(o), state(GETANSWER), flags(0)
 {
     if (op != SIMPLE_QUERY) {
-        throw "invalid constructor for this task operation";
+        dns_throw(Unexpected, "invalid constructor for this task operation");
     }
 }
 
@@ -78,7 +78,7 @@
     flags(0)
 {
     if (op != REF_QUERY) {
-        throw "invalid constructor for this task operation";
+        dns_throw(Unexpected, "invalid constructor for this task operation");
     }
 }
 
@@ -89,7 +89,7 @@
         section(sect), op(o), state(st), flags(0)
 {
     if (op != GLUE_QUERY && op != NOGLUE_QUERY) {
-        throw "invalid constructor for this task operation";
+        dns_throw(Unexpected, "invalid constructor for this task operation");
     }
 }
 

Modified: trunk/src/lib/auth/cpp/query.h
==============================================================================
--- trunk/src/lib/auth/cpp/query.h (original)
+++ trunk/src/lib/auth/cpp/query.h Thu Mar  4 17:57:39 2010
@@ -33,6 +33,11 @@
 
 // An individual task to be carried out by the query logic
 class QueryTask {
+private:
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    QueryTask(const QueryTask& source);
+    QueryTask& operator=(const QueryTask& source);
 public:
     // XXX: Members are currently public, but should probably be
     // moved to private and wrapped in get() functions later.
@@ -145,7 +150,7 @@
     QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
               const isc::dns::Section& sect, Op o, State st);
 
-    virtual ~QueryTask();
+    ~QueryTask();
 };
 
 typedef boost::shared_ptr<QueryTask> QueryTaskPtr;
@@ -163,10 +168,21 @@
         ANSWERED
     };
 
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    //@{
+private:
+    Query(const Query& source);
+    Query& operator=(const Query& source);
+public:
     // Query constructor
     Query(isc::dns::Message& m, bool dnssec);
-
+    /// \brief The destructor.
     virtual ~Query();
+    //@}
 
     // wantAdditional() == true indicates that additional-section data
     // should be looked up while processing this query.  false indicates

Modified: trunk/src/lib/auth/cpp/unittest_ds.cc
==============================================================================
--- trunk/src/lib/auth/cpp/unittest_ds.cc (original)
+++ trunk/src/lib/auth/cpp/unittest_ds.cc Thu Mar  4 17:57:39 2010
@@ -25,6 +25,7 @@
 #include <dns/rdataclass.h>
 #include <dns/rrclass.h>
 #include <dns/rrset.h>
+#include <dns/rrsetlist.h>
 #include <dns/rrtype.h>
 #include <dns/rrttl.h>
 

Modified: trunk/src/lib/auth/cpp/unittest_ds.h
==============================================================================
--- trunk/src/lib/auth/cpp/unittest_ds.h (original)
+++ trunk/src/lib/auth/cpp/unittest_ds.h Thu Mar  4 17:57:39 2010
@@ -17,57 +17,75 @@
 #ifndef __TEST_DATA_SOURCE_H
 #define __TEST_DATA_SOURCE_H
 
+#include <dns/name.h>
+#include <dns/rrset.h>
+
 #include <gtest/gtest.h>
-#include "unittest_util.h"
-
-using isc::UnitTestUtil;
-using namespace isc::dns;
 
 #include "data_source.h"
 
 namespace isc {
+
+namespace dns {
+class RRClass;
+class RRType;
+class RRsetList;
+}
+
 namespace auth {
+class Query;
+
 class TestDataSrc : public DataSrc {
+    ///
+    /// \name Constructors, Assignment Operator and Destructor.
+    ///
+    /// Note: The copy constructor and the assignment operator are intentionally
+    /// defined as private.
+    //@{
+private:
+    TestDataSrc(const TestDataSrc& source);
+    TestDataSrc operator=(const TestDataSrc& source); 
 public:
     TestDataSrc();
     ~TestDataSrc() {}
+    //@}
 
     void findClosestEnclosure(NameMatch& match) const;
 
     Result findRRset(const Query& q,
-                     const Name& qname,
-                     const RRClass& qclass,
-                     const RRType& qtype,
-                     RRsetList& target,
+                     const isc::dns::Name& qname,
+                     const isc::dns::RRClass& qclass,
+                     const isc::dns::RRType& qtype,
+                     isc::dns::RRsetList& target,
                      uint32_t& flags,
-                     Name* zone = NULL) const;
+                     isc::dns::Name* zone = NULL) const;
 
     Result findExactRRset(const Query& q,
-                          const Name& qname,
-                          const RRClass& qclass,
-                          const RRType& qtype,
-                          RRsetList& target,
+                          const isc::dns::Name& qname,
+                          const isc::dns::RRClass& qclass,
+                          const isc::dns::RRType& qtype,
+                          isc::dns::RRsetList& target,
                           uint32_t& flags,
-                          Name* zone = NULL) const;
+                          isc::dns::Name* zone = NULL) const;
 
     Result findAddrs(const Query& q,
-                     const Name& qname,
-                     const RRClass& qclass,
-                     RRsetList& target,
+                     const isc::dns::Name& qname,
+                     const isc::dns::RRClass& qclass,
+                     isc::dns::RRsetList& target,
                      uint32_t& flags,
-                     Name* zone = NULL) const;
+                     isc::dns::Name* zone = NULL) const;
 
     Result findReferral(const Query& q,
-                        const Name& qname,
-                        const RRClass& qclass,
-                        RRsetList& target,
+                        const isc::dns::Name& qname,
+                        const isc::dns::RRClass& qclass,
+                        isc::dns::RRsetList& target,
                         uint32_t& flags,
-                        Name* zone = NULL) const;
+                        isc::dns::Name* zone = NULL) const;
 
     Result findPreviousName(const Query& q,
-                            const Name& qname,
-                            Name& target,
-                            Name* zone) const;
+                            const isc::dns::Name& qname,
+                            isc::dns::Name& target,
+                            isc::dns::Name* zone) const;
 
     Result init() { return (SUCCESS); }
     Result close() { return (SUCCESS); }
@@ -79,56 +97,56 @@
         DELEGATION
     };
 
-    void findRecords(const Name& name, const RRType& rdtype,
-                     RRsetList& target, Name* zone, const Mode mode,
-                     uint32_t& flags) const;
+    void findRecords(const isc::dns::Name& name, const isc::dns::RRType& rdtype,
+                     isc::dns::RRsetList& target, isc::dns::Name* zone,
+                     const Mode mode, uint32_t& flags) const;
 
-    const Name example;
-    const Name sql1;
-    const Name www_sql1;
-    const Name www;
-    const Name foo;
-    const Name dns01;
-    const Name dns02;
-    const Name dns03;
-    const Name cnameint;
-    const Name cnameext;
-    const Name dname;
-    const Name wild;
-    const Name subzone;
-    RRsetPtr example_ns;
-    RRsetPtr example_soa;
-    RRsetPtr example_nsec;
-    RRsetPtr www_a;
-    RRsetPtr www_nsec;
-    RRsetPtr foo_cname;
-    RRsetPtr foo_nsec;
-    RRsetPtr cnameint_cname;
-    RRsetPtr cnameint_nsec;
-    RRsetPtr cnameext_cname;
-    RRsetPtr cnameext_nsec;
-    RRsetPtr dns01_a;
-    RRsetPtr dns01_nsec;
-    RRsetPtr dns02_a;
-    RRsetPtr dns02_nsec;
-    RRsetPtr dns03_a;
-    RRsetPtr dns03_nsec;
-    RRsetPtr wild_a;
-    RRsetPtr wild_nsec;
-    RRsetPtr dname_dname;
-    RRsetPtr dname_nsec;
-    RRsetPtr sql1_ns;
-    RRsetPtr sql1_soa;
-    RRsetPtr sql1_nsec;
-    RRsetPtr sql1_ds;
-    RRsetPtr sql1_ds_nsec;
-    RRsetPtr www_sql1_a;
-    RRsetPtr www_sql1_nsec;
-    RRsetPtr subzone_ns;
-    RRsetPtr subzone_nsec;
-    RRsetPtr subzone_glue1;
-    RRsetPtr subzone_glue2;
-    RRsetPtr subzone_ds;
+    const isc::dns::Name example;
+    const isc::dns::Name sql1;
+    const isc::dns::Name www_sql1;
+    const isc::dns::Name www;
+    const isc::dns::Name foo;
+    const isc::dns::Name dns01;
+    const isc::dns::Name dns02;
+    const isc::dns::Name dns03;
+    const isc::dns::Name cnameint;
+    const isc::dns::Name cnameext;
+    const isc::dns::Name dname;
+    const isc::dns::Name wild;
+    const isc::dns::Name subzone;
+    isc::dns::RRsetPtr example_ns;
+    isc::dns::RRsetPtr example_soa;
+    isc::dns::RRsetPtr example_nsec;
+    isc::dns::RRsetPtr www_a;
+    isc::dns::RRsetPtr www_nsec;
+    isc::dns::RRsetPtr foo_cname;
+    isc::dns::RRsetPtr foo_nsec;
+    isc::dns::RRsetPtr cnameint_cname;
+    isc::dns::RRsetPtr cnameint_nsec;
+    isc::dns::RRsetPtr cnameext_cname;
+    isc::dns::RRsetPtr cnameext_nsec;
+    isc::dns::RRsetPtr dns01_a;
+    isc::dns::RRsetPtr dns01_nsec;
+    isc::dns::RRsetPtr dns02_a;
+    isc::dns::RRsetPtr dns02_nsec;
+    isc::dns::RRsetPtr dns03_a;
+    isc::dns::RRsetPtr dns03_nsec;
+    isc::dns::RRsetPtr wild_a;
+    isc::dns::RRsetPtr wild_nsec;
+    isc::dns::RRsetPtr dname_dname;
+    isc::dns::RRsetPtr dname_nsec;
+    isc::dns::RRsetPtr sql1_ns;
+    isc::dns::RRsetPtr sql1_soa;
+    isc::dns::RRsetPtr sql1_nsec;
+    isc::dns::RRsetPtr sql1_ds;
+    isc::dns::RRsetPtr sql1_ds_nsec;
+    isc::dns::RRsetPtr www_sql1_a;
+    isc::dns::RRsetPtr www_sql1_nsec;
+    isc::dns::RRsetPtr subzone_ns;
+    isc::dns::RRsetPtr subzone_nsec;
+    isc::dns::RRsetPtr subzone_glue1;
+    isc::dns::RRsetPtr subzone_glue2;
+    isc::dns::RRsetPtr subzone_ds;
 };
 
 }

Modified: trunk/src/lib/auth/cpp/unittest_util.h
==============================================================================
--- trunk/src/lib/auth/cpp/unittest_util.h (original)
+++ trunk/src/lib/auth/cpp/unittest_util.h Thu Mar  4 17:57:39 2010
@@ -23,9 +23,6 @@
 #include <dns/name.h>
 
 #include <gtest/gtest.h>
-
-using namespace std;
-using namespace isc::dns;
 
 namespace isc {
 
@@ -77,7 +74,7 @@
     ///
     static ::testing::AssertionResult
     matchName(const char* nameexp1, const char* nameexp2,
-              const Name& name1, const Name& name2);
+              const isc::dns::Name& name1, const isc::dns::Name& name2);
 };
 }
 #endif // __UNITTEST_UTIL_H




More information about the bind10-changes mailing list