|
@@ -12,6 +12,8 @@
|
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
+#include <vector>
|
|
|
+
|
|
|
#include <datasrc/database.h>
|
|
|
|
|
|
#include <exceptions/exceptions.h>
|
|
@@ -101,7 +103,8 @@ namespace {
|
|
|
}
|
|
|
if (rdata_str != "") {
|
|
|
try {
|
|
|
- rrset->addRdata(isc::dns::rdata::createRdata(type, cls, rdata_str));
|
|
|
+ rrset->addRdata(isc::dns::rdata::createRdata(type, cls,
|
|
|
+ rdata_str));
|
|
|
} catch (const isc::dns::rdata::InvalidRdataText& ivrt) {
|
|
|
// at this point, rrset may have been initialised for no reason,
|
|
|
// and won't be used. But the caller would drop the shared_ptr
|
|
@@ -137,13 +140,13 @@ namespace {
|
|
|
|
|
|
// Returns true if this store contains signatures covering the
|
|
|
// given type
|
|
|
- bool haveSigsFor(isc::dns::RRType type) {
|
|
|
+ bool haveSigsFor(isc::dns::RRType type) const {
|
|
|
return (sigs.count(type) > 0);
|
|
|
}
|
|
|
|
|
|
// If the store contains signatures for the type of the given
|
|
|
// rrset, they are appended to it.
|
|
|
- void appendSignatures(isc::dns::RRsetPtr& rrset) {
|
|
|
+ void appendSignatures(isc::dns::RRsetPtr& rrset) const {
|
|
|
if (haveSigsFor(rrset->getType())) {
|
|
|
BOOST_FOREACH(isc::dns::rdata::RdataPtr sig,
|
|
|
sigs.find(rrset->getType())->second) {
|
|
@@ -180,8 +183,8 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
|
|
|
}
|
|
|
|
|
|
if (columns.size() != 4) {
|
|
|
- isc_throw(DataSourceError,
|
|
|
- "Datasource backend did not return 4 columns in getNextRecord()");
|
|
|
+ isc_throw(DataSourceError, "Datasource backend did not return 4 "
|
|
|
+ "columns in getNextRecord()");
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -190,33 +193,35 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
|
|
|
//cur_sigtype(columns[2]);
|
|
|
|
|
|
if (cur_type == type) {
|
|
|
- addOrCreate(result_rrset, name, getClass(), cur_type, cur_ttl, columns[3]);
|
|
|
+ addOrCreate(result_rrset, name, getClass(), cur_type, cur_ttl,
|
|
|
+ columns[3]);
|
|
|
} else if (cur_type == isc::dns::RRType::CNAME()) {
|
|
|
// There should be no other data, so cur_rrset should be empty,
|
|
|
if (result_rrset) {
|
|
|
- isc_throw(DataSourceError,
|
|
|
- "CNAME found but it is not the only record for " +
|
|
|
- name.toText());
|
|
|
+ isc_throw(DataSourceError, "CNAME found but it is not "
|
|
|
+ "the only record for " + name.toText());
|
|
|
}
|
|
|
- addOrCreate(result_rrset, name, getClass(), cur_type, cur_ttl, columns[3]);
|
|
|
+ addOrCreate(result_rrset, name, getClass(), cur_type, cur_ttl,
|
|
|
+ columns[3]);
|
|
|
result_status = CNAME;
|
|
|
} else if (cur_type == isc::dns::RRType::RRSIG()) {
|
|
|
- // If we get signatures before we get the actual data, we can't know
|
|
|
- // which ones to keep and which to drop...
|
|
|
- // So we keep a separate store of any signature that may be relevant
|
|
|
- // and add them to the final RRset when we are done.
|
|
|
- // A possible optimization here is to not store them for types we
|
|
|
- // are certain we don't need
|
|
|
+ // If we get signatures before we get the actual data, we
|
|
|
+ // can't know which ones to keep and which to drop...
|
|
|
+ // So we keep a separate store of any signature that may be
|
|
|
+ // relevant and add them to the final RRset when we are done.
|
|
|
+ // A possible optimization here is to not store them for types
|
|
|
+ // we are certain we don't need
|
|
|
isc::dns::rdata::RdataPtr cur_rrsig(
|
|
|
- isc::dns::rdata::createRdata(cur_type, getClass(), columns[3]));
|
|
|
+ isc::dns::rdata::createRdata(cur_type, getClass(),
|
|
|
+ columns[3]));
|
|
|
sig_store.addSig(cur_rrsig);
|
|
|
}
|
|
|
} catch (const isc::dns::InvalidRRType& irt) {
|
|
|
- isc_throw(DataSourceError,
|
|
|
- "Invalid RRType in database for " << name << ": " << columns[0]);
|
|
|
+ isc_throw(DataSourceError, "Invalid RRType in database for " <<
|
|
|
+ name << ": " << columns[0]);
|
|
|
} catch (const isc::dns::InvalidRRTTL& irttl) {
|
|
|
- isc_throw(DataSourceError,
|
|
|
- "Invalid TTL in database for " << name << ": " << columns[1]);
|
|
|
+ isc_throw(DataSourceError, "Invalid TTL in database for " <<
|
|
|
+ name << ": " << columns[1]);
|
|
|
}
|
|
|
}
|
|
|
|