[svn] commit: r855 - in /branches/each-ds/src/lib/dns/cpp: rdata/generic/rrsig_46.cc rrset.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Feb 17 19:56:09 UTC 2010
Author: each
Date: Wed Feb 17 19:56:08 2010
New Revision: 855
Log:
checkpoint:
- fixed RRset constructor to use the right RRType for rrsig
- RRSIG can now parse date in YYYYMMDDHHmmSS format (this, or something
better, should become a general library call)
Modified:
branches/each-ds/src/lib/dns/cpp/rdata/generic/rrsig_46.cc
branches/each-ds/src/lib/dns/cpp/rrset.h
Modified: branches/each-ds/src/lib/dns/cpp/rdata/generic/rrsig_46.cc
==============================================================================
--- branches/each-ds/src/lib/dns/cpp/rdata/generic/rrsig_46.cc (original)
+++ branches/each-ds/src/lib/dns/cpp/rdata/generic/rrsig_46.cc Wed Feb 17 19:56:08 2010
@@ -14,6 +14,7 @@
// $Id$
+#include <iostream>
#include <string>
#include <sstream>
#include <vector>
@@ -28,6 +29,9 @@
#include "rdataclass.h"
#include <boost/lexical_cast.hpp>
+#include <stdio.h>
+#include <time.h>
+
using namespace std;
// BEGIN_ISC_NAMESPACE
@@ -45,12 +49,25 @@
// right now, we don't support the YYYYMMDDHHmmSS format for
// expire/inception
if (iss.bad() || iss.fail() || !iss.eof()) {
- dns_throw(InvalidRdataText, "Invalid RRSIG Time format");
+ int year, month, day, hour, minute, second;
+ if (sscanf(time_txt.c_str(), "%4d%2d%2d%2d%2d%2d",
+ &year, &month, &day, &hour, &minute, &second) != 6) {
+ dns_throw(InvalidRdataText, "Invalid RRSIG Time format");
+ }
+
+ // reformat the date so that strptime() can parse it
+ ostringstream s;
+ s << year << " " << month << " " << day << " "
+ << hour << " " << minute << " " << second;
+
+ struct tm time;
+ strptime(s.str().c_str(), "%Y %m %d %H %M %S", &time);
+ timeval = mktime(&time);
}
return (timeval);
}
-}
+} // end namespace
struct RRSIGImpl {
// straightforward representation of RRSIG RDATA fields
Modified: branches/each-ds/src/lib/dns/cpp/rrset.h
==============================================================================
--- branches/each-ds/src/lib/dns/cpp/rrset.h (original)
+++ branches/each-ds/src/lib/dns/cpp/rrset.h Wed Feb 17 19:56:08 2010
@@ -24,6 +24,7 @@
#include <boost/shared_ptr.hpp>
#include "rdata.h"
+#include "rrtype.h"
namespace isc {
namespace dns {
@@ -36,8 +37,11 @@
class MessageRenderer;
class AbstractRRset;
-typedef boost::shared_ptr<AbstractRRset> RRsetPtr;
class BasicRRset;
+class RRset;
+class BasicRRset;
+typedef boost::shared_ptr<RRset> RRsetPtr;
+typedef boost::shared_ptr<BasicRRset> BasicRRsetPtr;
class BasicRRsetImpl;
class RdataIterator;
@@ -186,7 +190,7 @@
RdataIteratorPtr it = sigs.getRdataIterator();
rrsig_ = BasicRRsetPtr(new BasicRRset(this->getName(), this->getClass(),
- this->getType(), this->getTTL()));
+ RRType::RRSIG(), this->getTTL()));
for (it->first(); !it->isLast(); it->next()) {
rrsig_->addRdata(it->getCurrent());
}
@@ -200,7 +204,7 @@
rrsig_ = BasicRRsetPtr();
}
- virtual RRsetPtr getRRsig() {
+ virtual BasicRRsetPtr getRRsig() {
return (rrsig_);
}
private:
More information about the bind10-changes
mailing list