[svn] commit: r552 - in /experiments/each-query: ./ src/lib/dns/data_source.h src/lib/dns/query.h src/lib/dns/rrset.h

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 27 00:57:00 UTC 2010


Author: each
Date: Wed Jan 27 00:57:00 2010
New Revision: 552

Log:
First shot at a Query API

Added:
    experiments/each-query/
      - copied from r515, branches/parkinglot/
    experiments/each-query/src/lib/dns/query.h
Modified:
    experiments/each-query/src/lib/dns/data_source.h
    experiments/each-query/src/lib/dns/rrset.h

Modified: experiments/each-query/src/lib/dns/data_source.h
==============================================================================
--- experiments/each-query/src/lib/dns/data_source.h (original)
+++ experiments/each-query/src/lib/dns/data_source.h Wed Jan 27 00:57:00 2010
@@ -22,31 +22,6 @@
 
 namespace isc {
 namespace dns {
-
-// do we need to make a template for this?
-// i.e. do we want this to be able to hold more types than RRset?
-class SearchResult {
-public:
-    enum status_type { success, error, not_implemented,
-                       zone_not_found, name_not_found };
-
-    void addRRset(RRsetPtr rrset) { rrsets.push_back(rrset); }
-
-    status_type getStatus() { return status; }
-    void setStatus(status_type s) { status = s; }
-    
-    /* forward iterator interface */
-    typedef std::vector<RRsetPtr>::iterator iterator;
-    typedef std::vector<RRsetPtr>::const_iterator const_iterator;
-    std::vector<RRsetPtr>::iterator begin() { return rrsets.begin(); }
-    std::vector<RRsetPtr>::iterator end() { return rrsets.end(); }
-    std::vector<RRsetPtr>::const_iterator begin() const { return rrsets.begin(); }
-    std::vector<RRsetPtr>::const_iterator end() const { return rrsets.end(); }
-    
-private:
-    status_type status;
-    std::vector<RRsetPtr> rrsets;
-};
 
 // Base class for a DNS Data Source
 class DataSource {
@@ -88,10 +63,10 @@
     // for the zone_name, see getZoneFor, perhaps this needs to be a more
     // general handle
     // And perhaps we need a function that does not have that argument too
-    virtual SearchResult findRRsets(const Name& zone_name,
-                                    const Name& name,
-                                    const RRClass& clas,
-                                    const RRType& type) = 0;
+    virtual RRsetList findRRsets(const Name& zone_name,
+                                 const Name& name,
+                                 const RRClass& clas,
+                                 const RRType& type) = 0;
 
     //
     // optional 'low-level' methods, an implementation may overwrite these,

Modified: experiments/each-query/src/lib/dns/rrset.h
==============================================================================
--- experiments/each-query/src/lib/dns/rrset.h (original)
+++ experiments/each-query/src/lib/dns/rrset.h Wed Jan 27 00:57:00 2010
@@ -364,6 +364,35 @@
 };
 
 //
+// A list of RRsets, as provided in response to a data source query
+//
+class RRsetList {
+public:
+    enum status_type { success, error, not_implemented,
+                       zone_not_found, name_not_found };
+
+    void addRRset(RRsetPtr rrset) { rrsets.push_back(rrset); }
+
+    status_type getStatus() { return status; }
+    void setStatus(status_type s) { status = s; }
+    
+    // forward iterator interface
+    typedef std::vector<RRsetPtr>::iterator iterator;
+    typedef std::vector<RRsetPtr>::const_iterator const_iterator;
+
+    iterator begin() { return rrsets.begin(); }
+    iterator end() { return rrsets.end(); }
+
+    const_iterator begin() const { return rrsets.begin(); }
+    const_iterator end() const { return rrsets.end(); }
+    
+private:
+    status_type status;
+    std::vector<RRsetPtr> rrsets;
+};
+
+
+//
 // Generic Question section entry
 // XXX: it seems to be not a good idea to inherit from RRset.  We should
 // probably re-define it as a separate class.




More information about the bind10-changes mailing list