Commit 140be7df authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

cleanup:

- minimize including header files by forward declaring pinter/reference
  members
- move definitions to .cc


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1104 e5f2f494-b856-4b98-b285-d166d9295462
parent 840c1d8b
......@@ -23,9 +23,76 @@
#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),
message_(&m), want_additional_(true), want_dnssec_(dnssec)
......@@ -45,9 +112,5 @@ Query::Query(Message& m, bool dnssec) :
Section::ANSWER())));
}
// Destructors defined here to avoid confusing the linker
QueryTask::~QueryTask() {}
Query::~Query() {}
}
}
......@@ -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>
namespace isc {
using namespace isc::dns;
namespace dns {
class Name;
class Message;
class Section;
class RRClass;
class RRType;
}
namespace isc {
namespace auth {
// An individual task to be carried out by the query logic
......@@ -39,20 +39,20 @@ public:
// 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 @@ public:
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 @@ public:
};
// Query constructor
Query(Message& m, bool dnssec);
Query(isc::dns::Message& m, bool dnssec);
virtual ~Query();
......@@ -202,11 +179,11 @@ public:
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_; }
const isc::dns::Name& qname() const { return *qname_; }
const isc::dns::RRClass& qclass() const { return *qclass_; }
const isc::dns::RRType& qtype() const { return *qtype_; }
Message& message() const { return *message_; }
isc::dns::Message& message() const { return *message_; }
QueryTaskQueue& tasks() { return querytasks_; }
Status status() const { return status_; }
......@@ -215,11 +192,11 @@ public:
private:
Status status_;
const Name* qname_;
const RRClass* qclass_;
const RRType* qtype_;
const isc::dns::Name* qname_;
const isc::dns::RRClass* qclass_;
const isc::dns::RRType* qtype_;
Message* message_;
isc::dns::Message* message_;
QueryTaskQueue querytasks_;
bool want_additional_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment