BIND 10 trac1198, updated. afee8bc035223c87c385a6855ab210b4e55cc161 [1198] Miscellaneous additional debug messages and documentation
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 28 13:10:34 UTC 2011
The branch, trac1198 has been updated
via afee8bc035223c87c385a6855ab210b4e55cc161 (commit)
via 717946a088b5c3fa287258e1ebc3fa6dd9093702 (commit)
from b8e895092634bc661baf7fa043fffdba511f8256 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit afee8bc035223c87c385a6855ab210b4e55cc161
Author: Stephen Morris <stephen at isc.org>
Date: Mon Nov 28 13:10:07 2011 +0000
[1198] Miscellaneous additional debug messages and documentation
commit 717946a088b5c3fa287258e1ebc3fa6dd9093702
Author: Stephen Morris <stephen at isc.org>
Date: Mon Nov 28 10:43:05 2011 +0000
[1198] Convert header documentation to Doxygen triple-slash format
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/database.cc | 245 +++++++---
src/lib/datasrc/database.h | 888 ++++++++++++++++------------------
src/lib/datasrc/datasrc_messages.mes | 48 ++-
3 files changed, 612 insertions(+), 569 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index d5baebf..4092d5d 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -14,7 +14,6 @@
#include <string>
#include <vector>
-#include <iostream>
#include <datasrc/database.h>
#include <datasrc/data_source.h>
@@ -392,21 +391,35 @@ DatabaseClient::Finder::findNSECCover(const Name& name) {
DatabaseClient::Finder::DelegationSearchResult
DatabaseClient::Finder::findDelegationPoint(const isc::dns::Name& name,
- const FindOptions options) {
+ const FindOptions options)
+{
// Result of search
isc::dns::ConstRRsetPtr result_rrset;
ZoneFinder::Result result_status = SUCCESS;
- // In case we are in GLUE_OK mode and start matching wildcards,
- // we can't do it under NS, so we store it here to check
- isc::dns::ConstRRsetPtr first_ns;
-
// Are we searching for glue?
- const bool glue_ok((options & FIND_GLUE_OK) != 0);
+ const bool glue_ok = ((options & FIND_GLUE_OK) != 0);
+
+ // This next declaration is an optimisation. When we search the database
+ // for glue records, we generally ignore delegations. (This allows for
+ // the case where e.g. the delegation to zone example.com refers to
+ // nameservers within the zone, e.g. ns1.example.com. When conducting the
+ // search for ns1.example.com, we have to search past the NS records at
+ // example.com.)
+ //
+ // The one case where this is forbidden is when we search past the zone
+ // cut but the match we find for the glue is a wildcard match. In that
+ // case, we return the delegation instead. To save a new search, we record
+ // the location of the delegation cut when we encounter it here.
+ // TODO: where does it say we can't return wildcard glue?
+ isc::dns::ConstRRsetPtr first_ns;
// We want to search from the apex down. We are given the full domain
// name so we have to do some manipulation to ensure that when we start
- // checking superdomains, we start from the right label:
+ // checking superdomains, we start from the the domain name of the zone
+ // (e.g. if the name is b.a.example.com. and we are in the example.com.
+ // zone, we check example.com., a.example.com. and b.a.example.com. We
+ // don't need to check com. or .).
//
// Set the number of labels in the origin (i.e. apex of the zone) and in
// the last known non-empty domain (which, at this point, is the origin).
@@ -418,7 +431,7 @@ DatabaseClient::Finder::findDelegationPoint(const isc::dns::Name& name,
const size_t remove_labels = name.getLabelCount() - origin_label_count;
// Go through all superdomains from the origin down searching for nodes
- // that indicate a delegation (NS or DNAME).
+ // that indicate a delegation (.e. NS or DNAME).
for (int i = remove_labels; i > 0; --i) {
const Name superdomain(name.split(i));
@@ -433,31 +446,39 @@ DatabaseClient::Finder::findDelegationPoint(const isc::dns::Name& name,
DELEGATION_TYPES(), not_origin);
if (found.first) {
// This node contains either NS or DNAME RRs so it does exist.
- last_known = superdomain.getLabelCount();
const FoundIterator nsi(found.second.find(RRType::NS()));
const FoundIterator dni(found.second.find(RRType::DNAME()));
- // In case we are in GLUE_OK mode, we want to store the
- // highest encountered NS (but not apex)
- // TODO: WHY?
+ // An optimisation. We know that there is an exact match for
+ // something at this point in the tree so remember it. If we have
+ // to do a wildcard search, as we search upwards through the tree
+ // we don't need to pass this point, which is an exact match for
+ // the domain name.
+ last_known = superdomain.getLabelCount();
+
if (glue_ok && !first_ns && not_origin &&
nsi != found.second.end()) {
+ // If we are searching for glue ("glue OK" mode), store the
+ // highest NS record that we find that is not the apex. This
+ // is another optimisation for later, where we need the
+ // information if the domain we are looking for matches through
+ // a wildcard.
first_ns = nsi->second;
} else if (!glue_ok && not_origin && nsi != found.second.end()) {
- // Not in glue OK mode and we have found an NS RRset that is
- // not at the apex. We have a delegation so return that fact.
+ // Not searching for glue and we have found an NS RRset that is
+ // not at the apex. We have found a delegation - return that
+ // fact, there is no need to search further down the tree.
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_FOUND_DELEGATION).
arg(accessor_->getDBName()).arg(superdomain);
result_rrset = nsi->second;
result_status = DELEGATION;
-
- // No need to go further down the tree.
break;
} else if (dni != found.second.end()) {
- // We have found a DNAME so again return the fact.
+ // We have found a DNAME so again stop searching down the tree
+ // and return the information.
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_FOUND_DNAME).
arg(accessor_->getDBName()).arg(superdomain);
@@ -468,8 +489,6 @@ DatabaseClient::Finder::findDelegationPoint(const isc::dns::Name& name,
" has " << result_rrset->getRdataCount() <<
" rdata, 1 expected");
}
-
- // No need to go further down the tree.
break;
}
}
@@ -483,13 +502,12 @@ DatabaseClient::Finder::findWildcardMatch(
const isc::dns::Name& name, const isc::dns::RRType& type,
const FindOptions options, const DelegationSearchResult& dresult)
{
- // Result of search (status initialized to assume we don't find any
- // matching RRsets).
+ // Initialize search result to indicate nothing found
isc::dns::ConstRRsetPtr result_rrset;
ZoneFinder::Result result_status = NXDOMAIN;
- // Search options
- const bool dnssec_data((options & FIND_DNSSEC) != 0);
+ // Should DNSSEC data be returned?
+ const bool dnssec_data = ((options & FIND_DNSSEC) != 0);
// Note that during the search we are going to search not only for the
// requested type, but also for types that indicate a delegation -
@@ -497,73 +515,128 @@ DatabaseClient::Finder::findWildcardMatch(
WantedTypes final_types(FINAL_TYPES());
final_types.insert(type);
- // We know that the name is a non-empty terminal, so check for wildcards.
- // We can start at the last known non-empty domain and work up. We remove
- // labels one by one and look for the wildcard there, up to the
- // first non-empty domain.
- for (size_t i = 1; i <= name.getLabelCount() - dresult.last_known; ++i) {
+ // This method is called when we have not found an exact match and when we
+ // know that the name is not an empty non-terminal. So the only way that
+ // the name can match something in the zone is through a wildcard match.
+ //
+ // During an earlier stage in the search for this name, we made a record of
+ // the lowest superdomain for which we know an RR exists. (Note the "we
+ // know" qualification - there may be lower superdomains (ones with more
+ // labels) that hold an RR, but as we weren't searching for them, we don't
+ // know about them.)
+ //
+ // In the search for a wildcard match (which starts at the given domain
+ // name and goes up the tree to successive superdomains), this is the level
+ // at which we can stop - there can't be a wildcard at or beyond that
+ // point.
+ for (size_t i = 1; i <= (name.getLabelCount() - dresult.last_known); ++i) {
- // Construct the name with *
+ // Strip off the left-more label(s) in the name and replace with a "*".
const Name superdomain(name.split(i));
const string wildcard("*." + superdomain.toText());
const string construct_name(name.toText());
// TODO What do we do about DNAME here?
- // The types are the same as with original query
+ // Search for a match. The types are the same as with original query.
FoundRRsets found = getRRsets(wildcard, final_types, true,
&construct_name);
if (found.first) {
+ // Found something - but what?
+
if (dresult.first_ns) {
- // In case we are under NS, we don't wildcard-match, but return
- // delegation
- result_rrset = dresult.first_ns;
- result_status = DELEGATION;
+ // About to use first_ns. The only way this can be set is if
+ // we are searching for glue, so do a sanity check.
+ if ((options & FIND_GLUE_OK) == 0) {
+ isc_throw(Unexpected, "Inconsistent conditions during "
+ "cancel of wilcard search for " <<
+ name.toText() << ": find_ns non-null when not "
+ "processing glue request");
+ }
+ // We found a wildcard match for a glue record below a
+ // delegation point. In this case we don't return the match,
+ // instead we return the delegation. (Note that if we didn't
+ // a wildcard match at all, we would return NXDOMAIN, not the
+ // the delegation.)
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_WILDCARD_CANCEL_NS).
arg(accessor_->getDBName()).arg(wildcard).
arg(dresult.first_ns->getName());
+ result_status = DELEGATION;
+ result_rrset = dresult.first_ns;
- } else if (!hasSubdomains(name.split(i - 1).toText())) {
-
- // Nothing we added as part of the * can exist directly, as we
- // go up only to first existing domain, but it could be an empty
- // non-terminal. In that case, we need to cancel the match.
+ } else if (!hasSubdomains(name.split(i - 1).toText())) {
+ // We found a wildcard match and we are sure that the match
+ // is not an empty non-terminal (E.g. searching for a match
+ // for c.b.a.example.com, we found that b.a.example.com did
+ // not exist but that *.a.example.com. did. Checking
+ // b.a.example.com revealed no subdomains, so we can use the
+ // wilcard match we found.)
const FoundIterator cni(found.second.find(RRType::CNAME()));
const FoundIterator nsi(found.second.find(RRType::NS()));
const FoundIterator nci(found.second.find(RRType::NSEC()));
const FoundIterator wti(found.second.find(type));
+
if (cni != found.second.end() && type != RRType::CNAME()) {
- result_rrset = cni->second;
+ // Found a wildcard match for a CNAME but were not
+ // searching for one.
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED,
+ DATASRC_DATABASE_WILDCARD_CNAME).
+ arg(accessor_->getDBName()).
+ arg(wildcard).arg(name);
result_status = WILDCARD_CNAME;
+ result_rrset = cni->second;
} else if (nsi != found.second.end()) {
- result_rrset = nsi->second;
+ // Found a wildcard match to an NS.
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED,
+ DATASRC_DATABASE_WILDCARD_NS).
+ arg(accessor_->getDBName()).
+ arg(wildcard).arg(name);
result_status = DELEGATION;
+ result_rrset = nsi->second;
} else if (wti != found.second.end()) {
- result_rrset = wti->second;
+ // Found a wildcard match to the name and type we were
+ // search for.
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED,
+ DATASRC_DATABASE_WILDCARD_MATCH).
+ arg(accessor_->getDBName()).
+ arg(wildcard).arg(name);
result_status = WILDCARD;
+ result_rrset = wti->second;
} else {
- // NXRRSET case in the wildcard
+ // Found a wildcard match to the name but not to the type
+ // (i.e. NXRRSET).
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED,
+ DATASRC_DATABASE_WILDCARD_NXRRSET).
+ arg(accessor_->getDBName()).
+ arg(wildcard).arg(name);
result_status = WILDCARD_NXRRSET;
+
if (dnssec_data && nci != found.second.end()) {
- // User wants a proof the wildcard doesn't contain it
- //
- // However, we need to get the RRset in the name of the
- // wildcard, not the constructed one, so we walk it
- // again
+ // User wants a proof the wildcard doesn't contain
+ // the requested type. However, we need to get the
+ // RRset in the name of the wildcard, not the
+ // constructed one, so we search the tree again.
found = getRRsets(wildcard, NSEC_TYPES(), true);
result_rrset =
found.second.find(RRType::NSEC())->second;
}
}
- LOG_DEBUG(logger, DBG_TRACE_DETAILED,DATASRC_DATABASE_WILDCARD).
- arg(accessor_->getDBName()).arg(wildcard).arg(name);
} else {
+ // A more specified match was found so the wildcard search
+ // is canceled. (E.g. searching for a match
+ // for c.b.a.example.com, we found that b.a.example.com did
+ // not exist but that *.a.example.com. did. Checking
+ // b.a.example.com found subdomains. So b.example.com is
+ // an empty non-terminal and so should not be returned in
+ // the wildcard matching process. In other words,
+ // b.example.com does exist in the DNS space, it just doesn't
+ // have any RRs associated with it.)
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_WILDCARD_CANCEL_SUB).
arg(accessor_->getDBName()).arg(wildcard).
@@ -571,12 +644,19 @@ DatabaseClient::Finder::findWildcardMatch(
result_status = NXDOMAIN;
}
break;
+
} else if (hasSubdomains(wildcard)) {
- // Empty non-terminal asterisk
+ // Found a match, but it is an empty non-terminal asterisk. (E.g.#
+ // subdomain.*.example.com. is present, but there is nothing at
+ // *.example.com.) In this case, return an NXRRSET indication;
+ // the wildcard exists in the DNS space, there's just nothing
+ // associated with it. If DNSSEC data is required, return the
+ // covering NSEC record.
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_WILDCARD_EMPTY).
arg(accessor_->getDBName()).arg(wildcard).arg(name);
result_status = NXRRSET;
+
if (dnssec_data) {
result_rrset = findNSECCover(Name(wildcard));
if (result_rrset) {
@@ -626,6 +706,8 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
// All avenues to find a match are now exhausted, return NXDOMAIN (plus
// NSEC records if requested).
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_DATABASE_NO_MATCH).
+ arg(accessor_->getDBName()).arg(name).arg(type).arg(getClass());
return (FindResult(NXDOMAIN, dnssec_data ? findNSECCover(name) :
ConstRRsetPtr()));
}
@@ -652,24 +734,29 @@ ZoneFinder::FindResult
DatabaseClient::Finder::find(const isc::dns::Name& name,
const isc::dns::RRType& type,
isc::dns::RRsetList*,
- const FindOptions options) {
+ const FindOptions options)
+{
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_DATABASE_FIND_RECORDS)
- .arg(accessor_->getDBName()).arg(name).arg(type);
+ .arg(accessor_->getDBName()).arg(name).arg(type).arg(getClass());
// First, go through all superdomains from the origin down, searching for
// nodes that indicate a delegation (i.e. NS or DNAME, ignoring NS records
// at the apex). If one is found, the search stops there.
//
// (In fact there could be RRs in the database corresponding to subdomains
- // of the delegation. However as no search will find them, they are said
- // to be occluded by the presence of the delegation.)
+ // of the delegation. The reason we do the search for the delegations
+ // first is because the delegation means that another zone is authoritative
+ // for the data and so should be consulted to retrieve it. RRs below
+ // this delegation point can be found in a search for glue but not
+ // otherwise; in the latter case they are said to be occluded by the
+ // presence of the delegation.)
const DelegationSearchResult dresult = findDelegationPoint(name, options);
if (dresult.rrset) {
return (FindResult(dresult.code, dresult.rrset));
}
- // If there is no delegation in the page, look for the exact match to the
- // request name/type/class. However, there are special cases:
+ // If there is no delegation, look for the exact match to the request
+ // name/type/class. However, there are special cases:
// - Requested name has a singleton CNAME record associated with it
// - Requested name is a delegation point (NS only but not at the zone
// apex - DNAME is ignored here).
@@ -687,10 +774,10 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
if (!is_origin && ((options & FIND_GLUE_OK) == 0) &&
nsi != found.second.end()) {
- // A NS RRset was found at the domain we were searching for. As
- // it is not at the origin of the zone, it is a delegation and
- // indicates that this this zone is not authoritative for the data.
- // Just return the delegation information.
+ // A NS RRset was found at the domain we were searching for. As it is
+ // not at the origin of the zone, it is a delegation and indicates that
+ // this this zone is not authoritative for the data. Just return the
+ // delegation information.
return (logAndCreateResult(name, type, DELEGATION, nsi->second,
DATASRC_DATABASE_FOUND_DELEGATION_EXACT));
@@ -719,8 +806,8 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
} else if (wti != found.second.end()) {
// Found an RR matching the query, so return it. (Note that this
- // includes the case where we were querying for a CNAME and found
- // it. It also includes the case where we were querying for an NS
+ // includes the case where we were explicitly querying for a CNAME and
+ // found it. It also includes the case where we were querying for an NS
// RRset and found it at the apex of the zone.)
return (logAndCreateResult(name, type, SUCCESS, wti->second,
DATASRC_DATABASE_FOUND_RRSET));
@@ -733,8 +820,9 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
}
// If we get here, we have found something at the requested name but not
- // one of the RR types we were interested in. This is the NXRRSET case so,
- // if DNSSEC information was requested, provide the NSEC records.
+ // one of the RR types we were interested in. This is the NXRRSET case so
+ // return the appropriate status. If DNSSEC information was requested,
+ // provide the NSEC records.
if ((options & FIND_DNSSEC) != 0) {
const FoundIterator nci = found.second.find(RRType::NSEC());
if (nci != found.second.end()) {
@@ -753,10 +841,9 @@ DatabaseClient::Finder::findPreviousName(const Name& name) const {
try {
return (Name(str));
}
- /*
- * To avoid having the same code many times, we just catch all the
- * exceptions and handle them in a common code below
- */
+
+ // To avoid having the same code many times, we just catch all the
+ // exceptions and handle them in a common code below
catch (const isc::dns::EmptyLabel&) {}
catch (const isc::dns::TooLongLabel&) {}
catch (const isc::dns::BadLabelType&) {}
@@ -779,14 +866,12 @@ DatabaseClient::Finder::getClass() const {
namespace {
-/*
- * This needs, beside of converting all data from textual representation, group
- * together rdata of the same RRsets. To do this, we hold one row of data ahead
- * of iteration. When we get a request to provide data, we create it from this
- * data and load a new one. If it is to be put to the same rrset, we add it.
- * Otherwise we just return what we have and keep the row as the one ahead
- * for next time.
- */
+/// This needs, beside of converting all data from textual representation, group
+/// together rdata of the same RRsets. To do this, we hold one row of data ahead
+/// of iteration. When we get a request to provide data, we create it from this
+/// data and load a new one. If it is to be put to the same rrset, we add it.
+/// Otherwise we just return what we have and keep the row as the one ahead
+/// for next time.
class DatabaseIterator : public ZoneIterator {
public:
DatabaseIterator(shared_ptr<DatabaseAccessor> accessor,
@@ -1154,5 +1239,5 @@ DatabaseClient::getUpdater(const isc::dns::Name& name, bool replace,
return (ZoneUpdaterPtr(new DatabaseUpdater(update_accessor, zone.second,
name, rrclass_, journaling)));
}
-}
-}
+} // namespace datasrc
+} // namespace isc
diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h
index bd07481..bc3f14e 100644
--- a/src/lib/datasrc/database.h
+++ b/src/lib/datasrc/database.h
@@ -36,46 +36,41 @@
namespace isc {
namespace datasrc {
-/**
- * \brief Abstraction of lowlevel database with DNS data
- *
- * This class is defines interface to databases. Each supported database
- * will provide methods for accessing the data stored there in a generic
- * manner. The methods are meant to be low-level, without much or any knowledge
- * about DNS and should be possible to translate directly to queries.
- *
- * On the other hand, how the communication with database is done and in what
- * schema (in case of relational/SQL database) is up to the concrete classes.
- *
- * This class is non-copyable, as copying connections to database makes little
- * sense and will not be needed.
- *
- * \todo Is it true this does not need to be copied? For example the zone
- * iterator might need it's own copy. But a virtual clone() method might
- * be better for that than copy constructor.
- *
- * \note The same application may create multiple connections to the same
- * database, having multiple instances of this class. If the database
- * allows having multiple open queries at one connection, the connection
- * class may share it.
- */
+/// \brief Abstraction of lowlevel database with DNS data
+///
+/// This class is defines interface to databases. Each supported database
+/// will provide methods for accessing the data stored there in a generic
+/// manner. The methods are meant to be low-level, without much or any knowledge
+/// about DNS and should be possible to translate directly to queries.
+///
+/// On the other hand, how the communication with database is done and in what
+/// schema (in case of relational/SQL database) is up to the concrete classes.
+///
+/// This class is non-copyable, as copying connections to database makes little
+/// sense and will not be needed.
+///
+/// \todo Is it true this does not need to be copied? For example the zone
+/// iterator might need it's own copy. But a virtual clone() method might
+/// be better for that than copy constructor.
+///
+/// \note The same application may create multiple connections to the same
+/// database, having multiple instances of this class. If the database
+/// allows having multiple open queries at one connection, the connection
+/// class may share it.
class DatabaseAccessor : boost::noncopyable {
public:
- /**
- * Definitions of the fields as they are required to be filled in
- * by IteratorContext::getNext()
- *
- * When implementing getNext(), the columns array should
- * be filled with the values as described in this enumeration,
- * in this order, i.e. TYPE_COLUMN should be the first element
- * (index 0) of the array, TTL_COLUMN should be the second element
- * (index 1), etc.
- */
+ /// \brief Data columns for by IteratorContext::getNext()
+ ///
+ /// When implementing getNext(), the columns array should be filled with
+ /// the values as described in this enumeration, in this order, i.e.
+ /// - TYPE_COLUMN should be the first element (index 0) of the array,
+ /// - TTL_COLUMN should be the second element (index 1),
+ /// - etc.
enum RecordColumns {
TYPE_COLUMN = 0, ///< The RRType of the record (A/NS/TXT etc.)
TTL_COLUMN = 1, ///< The TTL of the record (a
- SIGTYPE_COLUMN = 2, ///< For RRSIG records, this contains the RRTYPE
- ///< the RRSIG covers. In the current implementation,
+ SIGTYPE_COLUMN = 2, ///< For RRSIG records, this contains the RRTYPEs
+ ///< the RRSIG cover. In the current implementation,
///< this field is ignored.
RDATA_COLUMN = 3, ///< Full text representation of the record's RDATA
NAME_COLUMN = 4, ///< The domain name of this RR
@@ -83,31 +78,26 @@ public:
///< the largest other element in this enum plus 1.
};
- /**
- * Definitions of the fields to be passed to addRecordToZone().
- *
- * Each derived implementation of addRecordToZone() should expect
- * the "columns" array to be filled with the values as described in this
- * enumeration, in this order.
- */
+ /// \brief Definitions of the fields to be passed to addRecordToZone()
+ ///
+ /// Each derived implementation of addRecordToZone() should expect
+ /// the "columns" array to be filled with the values as described in this
+ /// enumeration, in this order.
enum AddRecordColumns {
- ADD_NAME = 0, ///< The owner name of the record (a domain name)
- ADD_REV_NAME = 1, ///< Reversed name of NAME (used for DNSSEC)
- ADD_TTL = 2, ///< The TTL of the record (in numeric form)
- ADD_TYPE = 3, ///< The RRType of the record (A/NS/TXT etc.)
- ADD_SIGTYPE = 4, ///< For RRSIG records, this contains the RRTYPE
- ///< the RRSIG covers.
- ADD_RDATA = 5, ///< Full text representation of the record's RDATA
+ ADD_NAME = 0, ///< The owner name of the record (a domain name)
+ ADD_REV_NAME = 1, ///< Reversed name of NAME (used for DNSSEC)
+ ADD_TTL = 2, ///< The TTL of the record (in numeric form)
+ ADD_TYPE = 3, ///< The RRType of the record (A/NS/TXT etc.)
+ ADD_SIGTYPE = 4, ///< RRSIGs only: RRTYPEs the RRSIG covers.
+ ADD_RDATA = 5, ///< Full text representation of the record's RDATA
ADD_COLUMN_COUNT = 6 ///< Number of columns
};
- /**
- * Definitions of the fields to be passed to deleteRecordInZone().
- *
- * Each derived implementation of deleteRecordInZone() should expect
- * the "params" array to be filled with the values as described in this
- * enumeration, in this order.
- */
+ /// \brief Definitions of the fields to be passed to deleteRecordInZone()
+ ///
+ /// Each derived implementation of deleteRecordInZone() should expect
+ /// the "params" array to be filled with the values as described in this
+ /// enumeration, in this order.
enum DeleteRecordParams {
DEL_NAME = 0, ///< The owner name of the record (a domain name)
DEL_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
@@ -115,218 +105,199 @@ public:
DEL_PARAM_COUNT = 3 ///< Number of parameters
};
- /**
- * Operation mode when adding a record diff.
- *
- * This is used as the "operation" parameter value of addRecordDiff().
- */
+ /// \brief Operation mode when adding a record diff.
+ ///
+ /// This is used as the "operation" parameter value of addRecordDiff().
enum DiffOperation {
DIFF_ADD = 0, ///< This diff is for adding an RR
DIFF_DELETE = 1 ///< This diff is for deleting an RR
};
- /**
- * Definitions of the fields to be passed to addRecordDiff().
- *
- * Each derived implementation of addRecordDiff() should expect
- * the "params" array to be filled with the values as described in this
- * enumeration, in this order.
- */
+ /// \brief Definitions of the fields to be passed to addRecordDiff().
+ ///
+ /// Each derived implementation of addRecordDiff() should expect
+ /// the "params" array to be filled with the values as described in this
+ /// enumeration, in this order.
enum DiffRecordParams {
- DIFF_NAME = 0, ///< The owner name of the record (a domain name)
- DIFF_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
- DIFF_TTL = 2, ///< The TTL of the record (in numeric form)
- DIFF_RDATA = 3, ///< Full text representation of the record's RDATA
+ DIFF_NAME = 0, ///< Owner name of the record (a domain name)
+ DIFF_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
+ DIFF_TTL = 2, ///< The TTL of the record (in numeric form)
+ DIFF_RDATA = 3, ///< Full text representation of record's RDATA
DIFF_PARAM_COUNT = 4 ///< Number of parameters
};
- /**
- * \brief Destructor
- *
- * It is empty, but needs a virtual one, since we will use the derived
- * classes in polymorphic way.
- */
+ /// \brief Destructor
+ ///
+ /// It is empty, but needs a virtual one, since we will use the derived
+ /// classes in polymorphic way.
virtual ~DatabaseAccessor() { }
- /**
- * \brief Retrieve a zone identifier
- *
- * This method looks up a zone for the given name in the database. It
- * should match only exact zone name (eg. name is equal to the zone's
- * apex), as the DatabaseClient will loop trough the labels itself and
- * find the most suitable zone.
- *
- * It is not specified if and what implementation of this method may throw,
- * so code should expect anything.
- *
- * \param name The (fully qualified) domain name of the zone's apex to be
- * looked up.
- * \return The first part of the result indicates if a matching zone
- * was found. In case it was, the second part is internal zone ID.
- * This one will be passed to methods finding data in the zone.
- * It is not required to keep them, in which case whatever might
- * be returned - the ID is only passed back to the database as
- * an opaque handle.
- */
+ /// \brief Retrieve a zone identifier
+ ///
+ /// This method looks up a zone for the given name in the database. It
+ /// should match only exact zone name (eg. name is equal to the zone's
+ /// apex), as the DatabaseClient will loop trough the labels itself and
+ /// find the most suitable zone.
+ ///
+ /// It is not specified if and what implementation of this method may throw,
+ /// so code should expect anything.
+ ///
+ /// \param name The (fully qualified) domain name of the zone's apex to be
+ /// looked up.
+ /// \return The first part of the result indicates if a matching zone
+ /// was found. In case it was, the second part is internal zone ID.
+ /// This one will be passed to methods finding data in the zone.
+ /// It is not required to keep them, in which case whatever might
+ /// be returned - the ID is only passed back to the database as
+ /// an opaque handle.
virtual std::pair<bool, int> getZone(const std::string& name) const = 0;
- /**
- * \brief This holds the internal context of ZoneIterator for databases
- *
- * While the ZoneIterator implementation from DatabaseClient does all the
- * translation from strings to DNS classes and validation, this class
- * holds the pointer to where the database is at reading the data.
- *
- * It can either hold shared pointer to the connection which created it
- * and have some kind of statement inside (in case single database
- * connection can handle multiple concurrent SQL statements) or it can
- * create a new connection (or, if it is more convenient, the connection
- * itself can inherit both from DatabaseConnection and IteratorContext
- * and just clone itself).
- */
+ /// \brief This holds the internal context of ZoneIterator for databases
+ ///
+ /// While the ZoneIterator implementation from DatabaseClient does all the
+ /// translation from strings to DNS classes and validation, this class
+ /// holds the pointer to where the database is at reading the data.
+ ///
+ /// It can either hold shared pointer to the connection which created it
+ /// and have some kind of statement inside (in case single database
+ /// connection can handle multiple concurrent SQL statements) or it can
+ /// create a new connection (or, if it is more convenient, the connection
+ /// itself can inherit both from DatabaseConnection and IteratorContext
+ /// and just clone itself).
class IteratorContext : public boost::noncopyable {
public:
- /**
- * \brief Destructor
- *
- * Virtual destructor, so any descendand class is destroyed correctly.
- */
+ /// \brief Destructor
+ ///
+ /// Virtual destructor, so any descendand class is destroyed correctly.
virtual ~IteratorContext() { }
- /**
- * \brief Function to provide next resource record
- *
- * This function should provide data about the next resource record
- * from the data that is searched. The data is not converted yet.
- *
- * Depending on how the iterator was constructed, there is a difference
- * in behaviour; for a 'full zone iterator', created with
- * getAllRecords(), all COLUMN_COUNT elements of the array are
- * overwritten.
- * For a 'name iterator', created with getRecords(), the column
- * NAME_COLUMN is untouched, since what would be added here is by
- * definition already known to the caller (it already passes it as
- * an argument to getRecords()).
- *
- * Once this function returns false, any subsequent call to it should
- * result in false. The implementation of a derived class must ensure
- * it doesn't cause any disruption due to that such as a crash or
- * exception.
- *
- * \note The order of RRs is not strictly set, but the RRs for single
- * RRset must not be interleaved with any other RRs (eg. RRsets must be
- * "together").
- *
- * \param columns The data will be returned through here. The order
- * is specified by the RecordColumns enum, and the size must be
- * COLUMN_COUNT
- * \todo Do we consider databases where it is stored in binary blob
- * format?
- * \throw DataSourceError if there's database-related error. If the
- * exception (or any other in case of derived class) is thrown,
- * the iterator can't be safely used any more.
- * \return true if a record was found, and the columns array was
- * updated. false if there was no more data, in which case
- * the columns array is untouched.
- */
+ /// \brief Function to provide next resource record
+ ///
+ /// This function should provide data about the next resource record
+ /// from the data that is searched. The data is not converted yet.
+ ///
+ /// Depending on how the iterator was constructed, there is a difference
+ /// in behaviour; for a 'full zone iterator', created with
+ /// getAllRecords(), all COLUMN_COUNT elements of the array are
+ /// overwritten.
+ /// For a 'name iterator', created with getRecords(), the column
+ /// NAME_COLUMN is untouched, since what would be added here is by
+ /// definition already known to the caller (it already passes it as
+ /// an argument to getRecords()).
+ ///
+ /// Once this function returns false, any subsequent call to it should
+ /// result in false. The implementation of a derived class must ensure
+ /// it doesn't cause any disruption due to that such as a crash or
+ /// exception.
+ ///
+ /// \note The order of RRs is not strictly set, but the RRs for single
+ /// RRset must not be interleaved with any other RRs (eg. RRsets must be
+ /// "together").
+ ///
+ /// \param columns The data will be returned through here. The order
+ /// is specified by the RecordColumns enum, and the size must be
+ /// COLUMN_COUNT
+ /// \todo Do we consider databases where it is stored in binary blob
+ /// format?
+ /// \throw DataSourceError if there's database-related error. If the
+ /// exception (or any other in case of derived class) is thrown,
+ /// the iterator can't be safely used any more.
+ /// \return true if a record was found, and the columns array was
+ /// updated. false if there was no more data, in which case
+ /// the columns array is untouched.
virtual bool getNext(std::string (&columns)[COLUMN_COUNT]) = 0;
};
typedef boost::shared_ptr<IteratorContext> IteratorContextPtr;
- /**
- * \brief Creates an iterator context for a specific name.
- *
- * Returns an IteratorContextPtr that contains all records of the
- * given name from the given zone.
- *
- * The implementation of the iterator that is returned may leave the
- * NAME_COLUMN column of the array passed to getNext() untouched, as that
- * data is already known (it is the same as the name argument here)
- *
- * \exception any Since any implementation can be used, the caller should
- * expect any exception to be thrown.
- *
- * \param name The name to search for. This should be a FQDN.
- * \param id The ID of the zone, returned from getZone().
- * \param subdomains If set to true, match subdomains of name instead
- * of name itself. It is used to find empty domains and match
- * wildcards.
- * \return Newly created iterator context. Must not be NULL.
- */
+ /// \brief Creates an iterator context for a specific name.
+ ///
+ /// Returns an IteratorContextPtr that contains all records of the
+ /// given name from the given zone.
+ ///
+ /// The implementation of the iterator that is returned may leave the
+ /// NAME_COLUMN column of the array passed to getNext() untouched, as that
+ /// data is already known (it is the same as the name argument here)
+ ///
+ /// \exception any Since any implementation can be used, the caller should
+ /// expect any exception to be thrown.
+ ///
+ /// \param name The name to search for. This should be a FQDN.
+ /// \param id The ID of the zone, returned from getZone().
+ /// \param subdomains If set to true, match subdomains of name instead
+ /// of name itself. It is used to find empty domains and match
+ /// wildcards.
+ /// \return Newly created iterator context. Must not be NULL.
virtual IteratorContextPtr getRecords(const std::string& name,
int id,
bool subdomains = false) const = 0;
- /**
- * \brief Creates an iterator context for the whole zone.
- *
- * Returns an IteratorContextPtr that contains all records of the
- * zone with the given zone id.
- *
- * Each call to getNext() on the returned iterator should copy all
- * column fields of the array that is passed, as defined in the
- * RecordColumns enum.
- *
- * \exception any Since any implementation can be used, the caller should
- * expect any exception to be thrown.
- *
- * \param id The ID of the zone, returned from getZone().
- * \return Newly created iterator context. Must not be NULL.
- */
+ /// \brief Creates an iterator context for the whole zone.
+ ///
+ /// Returns an IteratorContextPtr that contains all records of the
+ /// zone with the given zone id.
+ ///
+ /// Each call to getNext() on the returned iterator should copy all
+ /// column fields of the array that is passed, as defined in the
+ /// RecordColumns enum.
+ ///
+ /// \exception any Since any implementation can be used, the caller should
+ /// expect any exception to be thrown.
+ ///
+ /// \param id The ID of the zone, returned from getZone().
+ /// \return Newly created iterator context. Must not be NULL.
virtual IteratorContextPtr getAllRecords(int id) const = 0;
- /**
- * \brief Creates an iterator context for a set of differences.
- *
- * Returns an IteratorContextPtr that contains all difference records for
- * the given zone between two versions of a zone.
- *
- * The difference records are the set of records that would appear in an
- * IXFR serving a request for the difference between two versions of a zone.
- * The records are returned in the same order as they would be in the IXFR.
- * This means that if the the difference between versions of a zone with SOA
- * serial numbers of "start" and "end" is required, and the zone contains
- * the differences between serial number "start" to serial number
- * "intermediate" and from serial number "intermediate" to serial number
- * "end", the returned records will be (in order):
- *
- * \li SOA for serial "start"
- * \li Records removed from the zone between versions "start" and
- * "intermediate" of the zone. The order of these is not guaranteed.
- * \li SOA for serial "intermediate"
- * \li Records added to the zone between versions "start" and
- * "intermediate" of the zone. The order of these is not guaranteed.
- * \li SOA for serial "intermediate"
- * \li Records removed from the zone between versions "intermediate" and
- * "end" of the zone. The order of these is not guaranteed.
- * \li SOA for serial "end"
- * \li Records added to the zone between versions "intermediate" and "end"
- * of the zone. The order of these is not guaranteed.
- *
- * Note that there is no requirement that "start" be less than "end". Owing
- * to serial number arithmetic, it is entirely possible that a later version
- * of a zone will have a smaller SOA serial number than an earlier version.
- *
- * Each call to getNext() on the returned iterator should copy all
- * column fields of the array that is passed, as defined in the
- * RecordColumns enum.
- *
- * \exception any Since any implementation can be used, the caller should
- * expect any exception to be thrown.
- *
- * \param id The ID of the zone, returned from getZone().
- * \param start The SOA serial number of the version of the zone from
- * which the difference sequence should start.
- * \param end The SOA serial number of the version of the zone at which
- * the difference sequence should end.
- *
- * \return Newly created iterator context. Must not be NULL.
- */
+ /// \brief Creates an iterator context for a set of differences.
+ ///
+ /// Returns an IteratorContextPtr that contains all difference records for
+ /// the given zone between two versions of a zone.
+ ///
+ /// The difference records are the set of records that would appear in an
+ /// IXFR serving a request for the difference between two versions of a
+ /// zone. The records are returned in the same order as they would be in
+ /// the IXFR. This means that if the the difference between versions of a
+ /// zone with SOA serial numbers of "start" and "end" is required, and the
+ /// zone contains the differences between serial number "start" to serial
+ /// number "intermediate" and from serial number "intermediate" to serial
+ /// number "end", the returned records will be (in order):
+ ///
+ /// \li SOA for serial "start"
+ /// \li Records removed from the zone between versions "start" and
+ /// "intermediate" of the zone. The order of these is not guaranteed.
+ /// \li SOA for serial "intermediate"
+ /// \li Records added to the zone between versions "start" and
+ /// "intermediate" of the zone. The order of these is not guaranteed.
+ /// \li SOA for serial "intermediate"
+ /// \li Records removed from the zone between versions "intermediate" and
+ /// "end" of the zone. The order of these is not guaranteed.
+ /// \li SOA for serial "end"
+ /// \li Records added to the zone between versions "intermediate" and "end"
+ /// of the zone. The order of these is not guaranteed.
+ ///
+ /// Note that there is no requirement that "start" be less than "end".
+ /// Owing to serial number arithmetic, it is entirely possible that a later
+ /// version of a zone will have a smaller SOA serial number than an earlier
+ /// version.
+ ///
+ /// Each call to getNext() on the returned iterator should copy all column
+ /// fields of the array that is passed, as defined in the RecordColumns
+ /// enum.
+ ///
+ /// \exception any Since any implementation can be used, the caller should
+ /// expect any exception to be thrown.
+ ///
+ /// \param id The ID of the zone, returned from getZone().
+ /// \param start The SOA serial number of the version of the zone from
+ /// which the difference sequence should start.
+ /// \param end The SOA serial number of the version of the zone at which
+ /// the difference sequence should end.
+ ///
+ /// \return Newly created iterator context. Must not be NULL.
virtual IteratorContextPtr
getDiffs(int id, uint32_t start, uint32_t end) const = 0;
- /// Start a transaction for updating a zone.
+ /// \brief Start a transaction for updating a zone.
///
/// Each derived class version of this method starts a database
/// transaction to make updates to the given name of zone (whose class was
@@ -385,7 +356,7 @@ public:
virtual std::pair<bool, int> startUpdateZone(const std::string& zone_name,
bool replace) = 0;
- /// Add a single record to the zone to be updated.
+ /// \brief Add a single record to the zone to be updated.
///
/// This method provides a simple interface to insert a new record
/// (a database "row") to the zone in the update context started by
@@ -424,7 +395,7 @@ public:
virtual void addRecordToZone(
const std::string (&columns)[ADD_COLUMN_COUNT]) = 0;
- /// Delete a single record from the zone to be updated.
+ /// \brief Delete a single record from the zone to be updated.
///
/// This method provides a simple interface to delete a record
/// (a database "row") from the zone in the update context started by
@@ -461,7 +432,7 @@ public:
virtual void deleteRecordInZone(
const std::string (¶ms)[DEL_PARAM_COUNT]) = 0;
- /// Start a general transaction.
+ /// \brief Start a general transaction.
///
/// Each derived class version of this method starts a database
/// transaction in a way specific to the database details. Any subsequent
@@ -481,7 +452,7 @@ public:
/// internal database related error.
virtual void startTransaction() = 0;
- /// Commit a transaction.
+ /// \brief Commit a transaction.
///
/// This method completes a transaction started by \c startTransaction
/// or \c startUpdateZone.
@@ -504,7 +475,7 @@ public:
/// to the method or internal database error.
virtual void commit() = 0;
- /// Rollback any changes in a transaction made so far.
+ /// \brief Rollback any changes in a transaction made so far.
///
/// This method rollbacks a transaction started by \c startTransaction or
/// \c startUpdateZone. When it succeeds (it normally should, but see
@@ -530,7 +501,7 @@ public:
/// to the method or internal database error.
virtual void rollback() = 0;
- /// Install a single RR diff in difference sequences for zone update.
+ /// \brief Install a single RR diff in difference sequences for zone update.
///
/// This method inserts parameters of an update operation for a single RR
/// (either adding or deleting one) in the underlying database.
@@ -606,7 +577,7 @@ public:
int zone_id, uint32_t serial, DiffOperation operation,
const std::string (¶ms)[DIFF_PARAM_COUNT]) = 0;
- /// Clone the accessor with the same configuration.
+ /// \brief Clone the accessor with the same configuration.
///
/// Each derived class implementation of this method will create a new
/// accessor of the same derived class with the same configuration
@@ -635,184 +606,165 @@ public:
/// \return A shared pointer to the cloned accessor.
virtual boost::shared_ptr<DatabaseAccessor> clone() = 0;
- /**
- * \brief Returns a string identifying this dabase backend
- *
- * The returned string is mainly intended to be used for
- * debugging/logging purposes.
- *
- * Any implementation is free to choose the exact string content,
- * but it is advisable to make it a name that is distinguishable
- * from the others.
- *
- * \return the name of the database
- */
+ /// \brief Returns a string identifying this dabase backend
+ ///
+ /// The returned string is mainly intended to be used for
+ /// debugging/logging purposes.
+ ///
+ /// Any implementation is free to choose the exact string content,
+ /// but it is advisable to make it a name that is distinguishable
+ /// from the others.
+ ///
+ /// \return the name of the database
virtual const std::string& getDBName() const = 0;
- /**
- * \brief It returns the previous name in DNSSEC order.
- *
- * This is used in DatabaseClient::findPreviousName and does more
- * or less the real work, except for working on strings.
- *
- * \param rname The name to ask for previous of, in reversed form.
- * We use the reversed form (see isc::dns::Name::reverse),
- * because then the case insensitive order of string representation
- * and the DNSSEC order correspond (eg. org.example.a is followed
- * by org.example.a.b which is followed by org.example.b, etc).
- * \param zone_id The zone to look through.
- * \return The previous name.
- * \note This function must return previous name even in case
- * the queried rname does not exist in the zone.
- * \note This method must skip under-the-zone-cut data (glue data).
- * This might be implemented by looking for NSEC records (as glue
- * data don't have them) in the zone or in some other way.
- *
- * \throw DataSourceError if there's a problem with the database.
- * \throw NotImplemented if this database doesn't support DNSSEC
- * or there's no previous name for the queried one (the NSECs
- * might be missing or the queried name is less or equal the
- * apex of the zone).
- */
+ /// \brief It returns the previous name in DNSSEC order.
+ ///
+ /// This is used in DatabaseClient::findPreviousName and does more
+ /// or less the real work, except for working on strings.
+ ///
+ /// \param rname The name to ask for previous of, in reversed form.
+ /// We use the reversed form (see isc::dns::Name::reverse),
+ /// because then the case insensitive order of string representation
+ /// and the DNSSEC order correspond (eg. org.example.a is followed
+ /// by org.example.a.b which is followed by org.example.b, etc).
+ /// \param zone_id The zone to look through.
+ /// \return The previous name.
+ /// \note This function must return previous name even in case
+ /// the queried rname does not exist in the zone.
+ /// \note This method must skip under-the-zone-cut data (glue data).
+ /// This might be implemented by looking for NSEC records (as glue
+ /// data don't have them) in the zone or in some other way.
+ ///
+ /// \throw DataSourceError if there's a problem with the database.
+ /// \throw NotImplemented if this database doesn't support DNSSEC
+ /// or there's no previous name for the queried one (the NSECs
+ /// might be missing or the queried name is less or equal the
+ /// apex of the zone).
virtual std::string findPreviousName(int zone_id,
const std::string& rname) const = 0;
};
-/**
- * \brief Concrete data source client oriented at database backends.
- *
- * This class (together with corresponding versions of ZoneFinder,
- * ZoneIterator, etc.) translates high-level data source queries to
- * low-level calls on DatabaseAccessor. It calls multiple queries
- * if necessary and validates data from the database, allowing the
- * DatabaseAccessor to be just simple translation to SQL/other
- * queries to database.
- *
- * While it is possible to subclass it for specific database in case
- * of special needs, it is not expected to be needed. This should just
- * work as it is with whatever DatabaseAccessor.
- */
+/// \brief Concrete data source client oriented at database backends.
+///
+/// This class (together with corresponding versions of ZoneFinder,
+/// ZoneIterator, etc.) translates high-level data source queries to
+/// low-level calls on DatabaseAccessor. It calls multiple queries
+/// if necessary and validates data from the database, allowing the
+/// DatabaseAccessor to be just simple translation to SQL/other
+/// queries to database.
+///
+/// While it is possible to subclass it for specific database in case
+/// of special needs, it is not expected to be needed. This should just
+/// work as it is with whatever DatabaseAccessor.
class DatabaseClient : public DataSourceClient {
public:
- /**
- * \brief Constructor
- *
- * It initializes the client with a database via the given accessor.
- *
- * \exception isc::InvalidParameter if accessor is NULL. It might throw
- * standard allocation exception as well, but doesn't throw anything else.
- *
- * \param rrclass The RR class of the zones that this client will handle.
- * \param accessor The accessor to the database to use to get data.
- * As the parameter suggests, the client takes ownership of the accessor
- * and will delete it when itself deleted.
- */
+ /// \brief Constructor
+ ///
+ /// It initializes the client with a database via the given accessor.
+ ///
+ /// \exception isc::InvalidParameter if accessor is NULL. It might throw
+ /// standard allocation exception as well, but doesn't throw anything else.
+ ///
+ /// \param rrclass The RR class of the zones that this client will handle.
+ /// \param accessor The accessor to the database to use to get data.
+ /// As the parameter suggests, the client takes ownership of the accessor
+ /// and will delete it when itself deleted.
DatabaseClient(isc::dns::RRClass rrclass,
boost::shared_ptr<DatabaseAccessor> accessor);
- /**
- * \brief Corresponding ZoneFinder implementation
- *
- * The zone finder implementation for database data sources. Similarly
- * to the DatabaseClient, it translates the queries to methods of the
- * database.
- *
- * Application should not come directly in contact with this class
- * (it should handle it trough generic ZoneFinder pointer), therefore
- * it could be completely hidden in the .cc file. But it is provided
- * to allow testing and for rare cases when a database needs slightly
- * different handling, so it can be subclassed.
- *
- * Methods directly corresponds to the ones in ZoneFinder.
- */
+ /// \brief Corresponding ZoneFinder implementation
+ ///
+ /// The zone finder implementation for database data sources. Similarly
+ /// to the DatabaseClient, it translates the queries to methods of the
+ /// database.
+ ///
+ /// Application should not come directly in contact with this class
+ /// (it should handle it trough generic ZoneFinder pointer), therefore
+ /// it could be completely hidden in the .cc file. But it is provided
+ /// to allow testing and for rare cases when a database needs slightly
+ /// different handling, so it can be subclassed.
+ ///
+ /// Methods directly corresponds to the ones in ZoneFinder.
class Finder : public ZoneFinder {
public:
- /**
- * \brief Constructor
- *
- * \param database The database (shared with DatabaseClient) to
- * be used for queries (the one asked for ID before).
- * \param zone_id The zone ID which was returned from
- * DatabaseAccessor::getZone and which will be passed to further
- * calls to the database.
- * \param origin The name of the origin of this zone. It could query
- * it from database, but as the DatabaseClient just searched for
- * the zone using the name, it should have it.
- */
+ /// \brief Constructor
+ ///
+ /// \param database The database (shared with DatabaseClient) to
+ /// be used for queries (the one asked for ID before).
+ /// \param zone_id The zone ID which was returned from
+ /// DatabaseAccessor::getZone and which will be passed to further
+ /// calls to the database.
+ /// \param origin The name of the origin of this zone. It could query
+ /// it from database, but as the DatabaseClient just searched for
+ /// the zone using the name, it should have it.
Finder(boost::shared_ptr<DatabaseAccessor> database, int zone_id,
const isc::dns::Name& origin);
+
// The following three methods are just implementations of inherited
// ZoneFinder's pure virtual methods.
virtual isc::dns::Name getOrigin() const;
virtual isc::dns::RRClass getClass() const;
- /**
- * \brief Find an RRset in the datasource
- *
- * Searches the datasource for an RRset of the given name and
- * type. If there is a CNAME at the given name, the CNAME rrset
- * is returned.
- * (this implementation is not complete, and currently only
- * does full matches, CNAMES, and the signatures for matches and
- * CNAMEs)
- * \note target was used in the original design to handle ANY
- * queries. This is not implemented yet, and may use
- * target again for that, but it might also use something
- * different. It is left in for compatibility at the moment.
- * \note options are ignored at this moment
- *
- * \note Maybe counter intuitively, this method is not a const member
- * function. This is intentional; some of the underlying implementations
- * are expected to use a database backend, and would internally contain
- * some abstraction of "database connection". In the most strict sense
- * any (even read only) operation might change the internal state of
- * such a connection, and in that sense the operation cannot be considered
- * "const". In order to avoid giving a false sense of safety to the
- * caller, we indicate a call to this method may have a surprising
- * side effect. That said, this view may be too strict and it may
- * make sense to say the internal database connection doesn't affect
- * external behavior in terms of the interface of this method. As
- * we gain more experiences with various kinds of backends we may
- * revisit the constness.
- *
- * \exception DataSourceError when there is a problem reading
- * the data from the dabase backend.
- * This can be a connection, code, or
- * data (parse) error.
- *
- * \param name The name to find
- * \param type The RRType to find
- * \param target Unused at this moment
- * \param options Options about how to search.
- * See ZoneFinder::FindOptions.
- */
+ /// \brief Find an RRset in the datasource
+ ///
+ /// Searches the datasource for an RRset of the given name and
+ /// type. If there is a CNAME at the given name, the CNAME rrset
+ /// is returned.
+ /// (this implementation is not complete, and currently only
+ /// does full matches, CNAMES, and the signatures for matches and
+ /// CNAMEs)
+ /// \note target was used in the original design to handle ANY
+ /// queries. This is not implemented yet, and may use
+ /// target again for that, but it might also use something
+ /// different. It is left in for compatibility at the moment.
+ /// \note options are ignored at this moment
+ ///
+ /// \note Maybe counter intuitively, this method is not a const member
+ /// function. This is intentional; some of the underlying
+ /// implementations are expected to use a database backend, and would
+ /// internally contain some abstraction of "database connection". In
+ /// the most strict sense any (even read only) operation might change
+ /// the internal state of such a connection, and in that sense the
+ /// operation cannot be considered "const". In order to avoid giving a
+ /// false sense of safety to the caller, we indicate a call to this
+ /// method may have a surprising side effect. That said, this view may
+ /// be too strict and it may make sense to say the internal database
+ /// connection doesn't affect external behavior in terms of the
+ /// interface of this method. As we gain more experiences with various
+ /// kinds of backends we may revisit the constness.
+ ///
+ /// \exception DataSourceError when there is a problem reading
+ /// the data from the dabase backend.
+ /// This can be a connection, code, or
+ /// data (parse) error.
+ ///
+ /// \param name The name to find
+ /// \param type The RRType to find
+ /// \param target Unused at this moment
+ /// \param options Options about how to search.
+ /// See ZoneFinder::FindOptions.
virtual FindResult find(const isc::dns::Name& name,
const isc::dns::RRType& type,
isc::dns::RRsetList* target = NULL,
const FindOptions options = FIND_DEFAULT);
- /**
- * \brief Implementation of ZoneFinder::findPreviousName method.
- */
+ /// \brief Implementation of ZoneFinder::findPreviousName method.
virtual isc::dns::Name findPreviousName(const isc::dns::Name& query)
const;
- /**
- * \brief The zone ID
- *
- * This function provides the stored zone ID as passed to the
- * constructor. This is meant for testing purposes and normal
- * applications shouldn't need it.
- */
+ /// \brief The zone ID
+ ///
+ /// This function provides the stored zone ID as passed to the
+ /// constructor. This is meant for testing purposes and normal
+ /// applications shouldn't need it.
int zone_id() const { return (zone_id_); }
- /**
- * \brief The database accessor.
- *
- * This function provides the database accessor stored inside as
- * passed to the constructor. This is meant for testing purposes and
- * normal applications shouldn't need it.
- */
+ /// \brief The database accessor.
+ ///
+ /// This function provides the database accessor stored inside as
+ /// passed to the constructor. This is meant for testing purposes and
+ /// normal applications shouldn't need it.
const DatabaseAccessor& getAccessor() const {
return (*accessor_);
}
@@ -855,39 +807,37 @@ public:
first_ns(param_ns),
last_known(param_last_known)
{}
- const ZoneFinder::Result code; ///< Result code
- const isc::dns::ConstRRsetPtr rrset; ///< Pointer to RRset found
- const isc::dns::ConstRRsetPtr first_ns; ///< Pointer to first NS found
+ const ZoneFinder::Result code; ///< Result code
+ const isc::dns::ConstRRsetPtr rrset; ///< RRset found
+ const isc::dns::ConstRRsetPtr first_ns; ///< First NS found
const size_t last_known; ///< No. labels in last non-empty domain
};
- /**
- * \brief Searches database for RRsets of one domain.
- *
- * This method scans RRs of single domain specified by name and
- * extracts any RRsets found and requested by parameters.
- *
- * It is used internally by find(), because it is called multiple
- * times (usually with different domains).
- *
- * \param name Which domain name should be scanned.
- * \param types List of types the caller is interested in.
- * \param check_ns If this is set to true, it checks nothing lives
- * together with NS record (with few little exceptions, like RRSIG
- * or NSEC). This check is meant for non-apex NS records.
- * \param construct_name If this is NULL, the resulting RRsets have
- * their name set to name. If it is not NULL, it overrides the name
- * and uses this one (this can be used for wildcard synthesized
- * records).
- * \return A pair, where the first element indicates if the domain
- * contains any RRs at all (not only the requested, it may happen
- * this is set to true, but the second part is empty). The second
- * part is map from RRtypes to RRsets of the corresponding types.
- * If the RRset is not present in DB, the RRtype is not there at
- * all (so you'll not find NULL pointer in the result).
- * \throw DataSourceError If there's a low-level error with the
- * database or the database contains bad data.
- */
+ /// \brief Searches database for RRsets of one domain.
+ ///
+ /// This method scans RRs of single domain specified by name and
+ /// extracts any RRsets found and requested by parameters.
+ ///
+ /// It is used internally by find(), because it is called multiple
+ /// times (usually with different domains).
+ ///
+ /// \param name Which domain name should be scanned.
+ /// \param types List of types the caller is interested in.
+ /// \param check_ns If this is set to true, it checks nothing lives
+ /// together with NS record (with few little exceptions, like RRSIG
+ /// or NSEC). This check is meant for non-apex NS records.
+ /// \param construct_name If this is NULL, the resulting RRsets have
+ /// their name set to name. If it is not NULL, it overrides the name
+ /// and uses this one (this can be used for wildcard synthesized
+ /// records).
+ /// \return A pair, where the first element indicates if the domain
+ /// contains any RRs at all (not only the requested, it may happen
+ /// this is set to true, but the second part is empty). The second
+ /// part is map from RRtypes to RRsets of the corresponding types.
+ /// If the RRset is not present in DB, the RRtype is not there at
+ /// all (so you'll not find NULL pointer in the result).
+ /// \throw DataSourceError If there's a low-level error with the
+ /// database or the database contains bad data.
FoundRRsets getRRsets(const std::string& name,
const WantedTypes& types, bool check_ns,
const std::string* construct_name = NULL);
@@ -1039,63 +989,55 @@ public:
/// \return true if the name has subdomains, false if not.
bool hasSubdomains(const std::string& name);
- /**
- * \brief Get the NSEC covering a name.
- *
- * This one calls findPreviousName on the given name and extracts an NSEC
- * record on the result. It handles various error cases. The method exists
- * to share code present at more than one location.
- */
+ /// \brief Get the NSEC covering a name.
+ ///
+ /// This one calls findPreviousName on the given name and extracts an
+ /// NSEC record on the result. It handles various error cases. The
+ /// method exists to share code present at more than one location.
dns::RRsetPtr findNSECCover(const dns::Name& name);
- /**
- * \brief Convenience type shortcut.
- *
- * To find stuff in the result of getRRsets.
- */
+ /// \brief Convenience type shortcut.
+ ///
+ /// To find stuff in the result of getRRsets.
typedef std::map<dns::RRType, dns::RRsetPtr>::const_iterator
FoundIterator;
};
- /**
- * \brief Find a zone in the database
- *
- * This queries database's getZone to find the best matching zone.
- * It will propagate whatever exceptions are thrown from that method
- * (which is not restricted in any way).
- *
- * \param name Name of the zone or data contained there.
- * \return FindResult containing the code and an instance of Finder, if
- * anything is found. However, application should not rely on the
- * ZoneFinder being instance of Finder (possible subclass of this class
- * may return something else and it may change in future versions), it
- * should use it as a ZoneFinder only.
- */
+ /// \brief Find a zone in the database
+ ///
+ /// This queries database's getZone to find the best matching zone.
+ /// It will propagate whatever exceptions are thrown from that method
+ /// (which is not restricted in any way).
+ ///
+ /// \param name Name of the zone or data contained there.
+ /// \return FindResult containing the code and an instance of Finder, if
+ /// anything is found. However, application should not rely on the
+ /// ZoneFinder being instance of Finder (possible subclass of this class
+ /// may return something else and it may change in future versions), it
+ /// should use it as a ZoneFinder only.
virtual FindResult findZone(const isc::dns::Name& name) const;
- /**
- * \brief Get the zone iterator
- *
- * The iterator allows going through the whole zone content. If the
- * underlying DatabaseConnection is implemented correctly, it should
- * be possible to have multiple ZoneIterators at once and query data
- * at the same time.
- *
- * \exception DataSourceError if the zone doesn't exist.
- * \exception isc::NotImplemented if the underlying DatabaseConnection
- * doesn't implement iteration. But in case it is not implemented
- * and the zone doesn't exist, DataSourceError is thrown.
- * \exception Anything else the underlying DatabaseConnection might
- * want to throw.
- * \param name The origin of the zone to iterate.
- * \param separate_rrs If true, the iterator will return each RR as a
- * new RRset object. If false, the iterator will
- * combine consecutive RRs with the name and type
- * into 1 RRset. The capitalization of the RRset will
- * be that of the first RR read, and TTLs will be
- * adjusted to the lowest one found.
- * \return Shared pointer to the iterator (it will never be NULL)
- */
+ /// \brief Get the zone iterator
+ ///
+ /// The iterator allows going through the whole zone content. If the
+ /// underlying DatabaseConnection is implemented correctly, it should
+ /// be possible to have multiple ZoneIterators at once and query data
+ /// at the same time.
+ ///
+ /// \exception DataSourceError if the zone doesn't exist.
+ /// \exception isc::NotImplemented if the underlying DatabaseConnection
+ /// doesn't implement iteration. But in case it is not implemented
+ /// and the zone doesn't exist, DataSourceError is thrown.
+ /// \exception Anything else the underlying DatabaseConnection might
+ /// want to throw.
+ /// \param name The origin of the zone to iterate.
+ /// \param separate_rrs If true, the iterator will return each RR as a
+ /// new RRset object. If false, the iterator will
+ /// combine consecutive RRs with the name and type
+ /// into 1 RRset. The capitalization of the RRset will
+ /// be that of the first RR read, and TTLs will be
+ /// adjusted to the lowest one found.
+ /// \return Shared pointer to the iterator (it will never be NULL)
virtual ZoneIteratorPtr getIterator(const isc::dns::Name& name,
bool separate_rrs = false) const;
@@ -1119,7 +1061,3 @@ private:
}
#endif // __DATABASE_DATASRC_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index 100476e..54fe799 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -68,7 +68,7 @@ The datasource tried to provide an NSEC proof that the named domain does not
exist, but the database backend doesn't support DNSSEC. No proof is included
in the answer as a result.
-% DATASRC_DATABASE_FIND_RECORDS looking in datasource %1 for record %2/%3
+% DATASRC_DATABASE_FIND_RECORDS looking in datasource %1 for record %2/%3/%4
Debug information. The database data source is looking up records with the given
name and type in the database.
@@ -78,7 +78,7 @@ different TTL values. This isn't allowed on the wire and is considered
an error, so we set it to the lowest value we found (but we don't modify the
database). The data in database should be checked and fixed.
-% DATASRC_DATABASE_FOUND_CNAME search in datasource %1 for %2/%3/%4 resulted in CNAME %5
+% DATASRC_DATABASE_FOUND_CNAME search in datasource %1 for %2/%3/%4 found CNAME
When searching the domain for a name a CNAME was found at that name. Even
though it was not the RR type being sought, it is returned. If the query
of the database was issued by a result searching for the name, the return of
@@ -89,7 +89,7 @@ target of the CNAME.
When searching for a domain, the program met a delegation to a different zone
at the given domain name. It will return that one instead.
-% DATASRC_DATABASE_FOUND_DELEGATION_EXACT Found delegation at %2 (exact match) in %1
+% DATASRC_DATABASE_FOUND_DELEGATION_EXACT search in datasource %1 for %2/%3/%4 found delegation at %5
The program found the domain requested, but it is a delegation point to a
different zone, therefore it is not authoritative for this domain name.
It will return the NS record instead.
@@ -118,7 +118,7 @@ A search in the database for RRs for the specified name, type and class has
located RRs that match the name and class but not the type. DNSSEC information
has been requested, but there is no NSEC record corresponding to the node.
-% DATASRC_DATABASE_FOUND_RRSET search in datasource %1 resulted in RRset %2
+% DATASRC_DATABASE_FOUND_RRSET search in datasource %1 resulted in RRset %5
The data returned by the database backend contained data for the given domain
name, and it either matches the type or has a relevant type. The RRset that is
returned is printed.
@@ -140,6 +140,10 @@ were found to be different. This isn't allowed on the wire and is considered
an error, so we set it to the lowest value we found (but we don't modify the
database). The data in database should be checked and fixed.
+% DATASRC_DATABASE_NO_MATCH not match for %2/%3/%4 in %1
+No match (not even a wildcard) was found in the named data source for the given
+name/type/class in the data source.
+
% DATASRC_DATABASE_UPDATER_COMMIT updates committed for '%1/%2' on %3
Debug information. A set of updates to a zone has been successfully
committed to the corresponding database backend. The zone name,
@@ -175,11 +179,7 @@ whether the data is still valid. The zone name, its class, and the
underlying database name as well as the error message thrown from the
database module are shown in the log message.
-% DATASRC_DATABASE_WILDCARD constructing RRset %3 from wildcard %2 in %1
-The database doesn't contain directly matching domain, but it does contain a
-wildcard one which is being used to synthesize the answer.
-
-% DATASRC_DATABASE_WILDCARD_CANCEL_NS canceled wildcard match on %2 because %3 contains NS in %1
+% DATASRC_DATABASE_WILDCARD_CANCEL_NS canceled wildcard match on %3 because %2 contains NS (data source %1)
The database was queried to provide glue data and it didn't find direct match.
It could create it from given wildcard, but matching wildcards is forbidden
under a zone cut, which was found. Therefore the delegation will be returned
@@ -191,11 +191,31 @@ exists, therefore this name is something like empty non-terminal (actually,
from the protocol point of view, it is empty non-terminal, but the code
discovers it differently).
-% DATASRC_DATABASE_WILDCARD_EMPTY implicit wildcard %2 used to construct %3 in %1
-The given wildcard exists implicitly in the domainspace, as empty nonterminal
-(eg. there's something like subdomain.*.example.org, so *.example.org exists
-implicitly, but is empty). This will produce NXRRSET, because the constructed
-domain is empty as well as the wildcard.
+% DATASRC_DATABASE_WILDCARD_CNAME found CNAME at %2 which is a wildcard match for %3 in %1
+The database doesn't contain directly matching name. When searching
+for a wildcard match, a CNAME RR was found at a wildcard record
+matching the name. This is returned as the result of the search.
+
+% DATASRC_DATABASE_WILDCARD_EMPTY found subdomains of %2 which is a wildcard match for %3 in %1
+The given wildcard matches the name being sough but it as an empty
+nonterminal (e.g. there's nothing at *.example.com but something like
+subdomain.*.example.org, do exist: so *.example.org exists in the
+namespace but has no RRs assopciated with it). This will produce NXRRSET.
+
+% DATASRC_DATABASE_WILDCARD_MATCH found match at %2 which is a wildcard match for %3 in %1
+The database doesn't contain directly matching name. When searching
+for a wildcard match, a wildcard record matching the name and type of
+the query was found. The data at this point is returned.
+
+% DATASRC_DATABASE_WILDCARD_NS found NS at %2 which is a wildcard match for %3 in %1
+The database doesn't contain directly matching name. When searching
+for a wildcard match, an NS RR was found at a wildcard record matching
+the name. This is returned as the result of the search.
+
+% DATASRC_DATABASE_WILDCARD_NXRRSET found no data at %2 which is a wildcard match for %3 in %1
+The database doesn't contain directly matching name. When searching
+for a wildcard match, a matching wildcard entry was found but it did
+not contain RRs the requested type. AN NXRRSET indication is returned.
% DATASRC_DO_QUERY handling query for '%1/%2'
A debug message indicating that a query for the given name and RR type is being
More information about the bind10-changes
mailing list