[svn] commit: r1104 - in /trunk/src/lib/auth/cpp: query.cc query.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Mar 4 00:39:03 UTC 2010
Author: jinmei
Date: Thu Mar 4 00:39:03 2010
New Revision: 1104
Log:
cleanup:
- minimize including header files by forward declaring pinter/reference
members
- move definitions to .cc
Modified:
trunk/src/lib/auth/cpp/query.cc
trunk/src/lib/auth/cpp/query.h
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 00:39:03 2010
@@ -23,8 +23,75 @@
#include "query.h"
+using namespace isc::dns;
+
namespace isc {
namespace auth {
+
+// Destructors defined here to avoid confusing the linker
+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) :
+ qname(n), qclass(c), qtype(t), zone(NULL),
+ section(sect), op(AUTH_QUERY), state(GETANSWER), flags(0)
+{}
+
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const Op o) :
+ qname(n), qclass(c), qtype(t), zone(NULL),
+ section(sect), op(o), state(GETANSWER), flags(0)
+{}
+
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const State st) :
+ qname(n), qclass(c), qtype(t), zone(NULL),
+ section(sect), op(AUTH_QUERY), state(st), flags(0)
+{}
+
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const Op o, const State st) :
+ qname(n), qclass(c), qtype(t), zone(NULL),
+ section(sect), op(o), state(st), flags(0)
+{}
+
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const Op o) :
+ qname(n), qclass(c), qtype(t), zone(NULL),
+ section(Section::ANSWER()),
+ op(o), state(GETANSWER), flags(0)
+{
+ if (op != SIMPLE_QUERY) {
+ throw "invalid constructor for this task operation";
+ }
+}
+
+// A referral query doesn't need to specify section, state, or type.
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const Op o) :
+ qname(n), qclass(c), qtype(RRType::ANY()), zone(NULL),
+ section(Section::ANSWER()), op(o), state(GETANSWER),
+ flags(0)
+{
+ if (op != REF_QUERY) {
+ throw "invalid constructor for this task operation";
+ }
+}
+
+QueryTask::QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::Section& sect, const Op o,
+ const State st) :
+ qname(n), qclass(c), qtype(RRType::ANY()), zone(NULL),
+ section(sect), op(o), state(st), flags(0)
+{
+ if (op != GLUE_QUERY && op != NOGLUE_QUERY) {
+ throw "invalid constructor for this task operation";
+ }
+}
Query::Query(Message& m, bool dnssec) :
status_(PENDING), qname_(NULL), qclass_(NULL), qtype_(NULL),
@@ -45,9 +112,5 @@
Section::ANSWER())));
}
-// Destructors defined here to avoid confusing the linker
-QueryTask::~QueryTask() {}
-Query::~Query() {}
-
}
}
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 00:39:03 2010
@@ -19,16 +19,16 @@
#include <queue>
-#include <exceptions/exceptions.h>
-#include <dns/name.h>
-#include <dns/message.h>
-#include <dns/rrset.h>
-#include <dns/rrclass.h>
-#include <dns/rrtype.h>
-
-using namespace isc::dns;
-
namespace isc {
+
+namespace dns {
+class Name;
+class Message;
+class Section;
+class RRClass;
+class RRType;
+}
+
namespace auth {
// An individual task to be carried out by the query logic
@@ -39,20 +39,20 @@
// The standard query tuple: qname/qclass/qtype.
// Note that qtype is ignored in the GLUE_QUERY/NOGLUE_QUERY case.
- const Name& qname;
- const RRClass& qclass;
- const RRType& qtype;
+ const isc::dns::Name& qname;
+ const isc::dns::RRClass& qclass;
+ const isc::dns::RRType& qtype;
// Optional: name for the containing zone, if known.
// This is particularly needed when looking up data in a
// zone other than the closest enclosure (such as getting
// DS queries from a parent zone on a server which serves
// both parent and child).
- Name* zone;
+ isc::dns::Name* zone;
// The section of the reply into which the data should be
// written after it has been fetched from the data source.
- const Section& section;
+ const isc::dns::Section& section;
// The op field indicates the operation to be carried out by
// this query task:
@@ -121,52 +121,29 @@
uint32_t flags;
// Constructors
- QueryTask(const Name& n, const RRClass& c,
- const RRType& t, const Section& sect) :
- qname(n), qclass(c), qtype(t), zone(NULL),
- section(sect), op(AUTH_QUERY), state(GETANSWER), flags(0) {}
- QueryTask(const Name& n, const RRClass& c,
- const RRType& t, const Section& sect, const Op o) :
- qname(n), qclass(c), qtype(t), zone(NULL),
- section(sect), op(o), state(GETANSWER), flags(0) {}
- QueryTask(const Name& n, const RRClass& c,
- const RRType& t, const Section& sect, const State st) :
- qname(n), qclass(c), qtype(t), zone(NULL),
- section(sect), op(AUTH_QUERY), state(st), flags(0) {}
- QueryTask(const Name& n, const RRClass& c,
- const RRType& t, const Section& sect,
- const Op o, const State st) :
- qname(n), qclass(c), qtype(t), zone(NULL),
- section(sect), op(o), state(st), flags(0) {}
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect);
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const Op o);
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const State st);
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const isc::dns::Section& sect,
+ const Op o, const State st);
// These are special constructors for particular query task types,
// to simplify the code.
//
// A simple query doesn't need to specify section or state.
- QueryTask(const Name& n, const RRClass& c, const RRType& t, const Op o) :
- qname(n), qclass(c), qtype(t), zone(NULL),
- section(Section::ANSWER()), op(o), state(GETANSWER), flags(0) {
- if (op != SIMPLE_QUERY) {
- throw "invalid constructor for this task operation";
- }
- }
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::RRType& t, const Op o);
// A referral query doesn't need to specify section, state, or type.
- QueryTask(const Name& n, const RRClass& c, const Op o) :
- qname(n), qclass(c), qtype(RRType::ANY()), zone(NULL),
- section(Section::ANSWER()), op(o), state(GETANSWER), flags(0) {
- if (op != REF_QUERY) {
- throw "invalid constructor for this task operation";
- }
- }
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c, const Op o);
// A glue (or noglue) query doesn't need to specify type.
- QueryTask(const Name& n, const RRClass& c,
- const Section& sect, const Op o, const State st) :
- qname(n), qclass(c), qtype(RRType::ANY()), zone(NULL),
- section(sect), op(o), state(st), flags(0) {
- if (op != GLUE_QUERY && op != NOGLUE_QUERY) {
- throw "invalid constructor for this task operation";
- }
- }
+ QueryTask(const isc::dns::Name& n, const isc::dns::RRClass& c,
+ const isc::dns::Section& sect, const Op o, const State st);
virtual ~QueryTask();
};
@@ -187,7 +164,7 @@
};
// Query constructor
- Query(Message& m, bool dnssec);
+ Query(isc::dns::Message& m, bool dnssec);
virtual ~Query();
@@ -202,11 +179,11 @@
bool wantDnssec() const { return want_dnssec_; }
void setWantDnssec(bool d) { want_dnssec_ = d; }
- const Name& qname() const { return *qname_; }
- const RRClass& qclass() const { return *qclass_; }
- const RRType& qtype() const { return *qtype_; }
-
- Message& message() const { return *message_; }
+ const isc::dns::Name& qname() const { return *qname_; }
+ const isc::dns::RRClass& qclass() const { return *qclass_; }
+ const isc::dns::RRType& qtype() const { return *qtype_; }
+
+ isc::dns::Message& message() const { return *message_; }
QueryTaskQueue& tasks() { return querytasks_; }
Status status() const { return status_; }
@@ -215,11 +192,11 @@
private:
Status status_;
- const Name* qname_;
- const RRClass* qclass_;
- const RRType* qtype_;
-
- Message* message_;
+ const isc::dns::Name* qname_;
+ const isc::dns::RRClass* qclass_;
+ const isc::dns::RRType* qtype_;
+
+ isc::dns::Message* message_;
QueryTaskQueue querytasks_;
bool want_additional_;
More information about the bind10-changes
mailing list