Commit 2aa24772 authored by JINMEI Tatuya's avatar JINMEI Tatuya

[2429] define MAX_TTL in rrttl.h, as its bare value, not in form of RRTTL

parent ed49f68c
......@@ -52,7 +52,6 @@ public:
const MasterLoaderCallbacks& callbacks,
const AddRRCallback& add_callback,
MasterLoader::Options options) :
MAX_TTL(0x7fffffff),
lexer_(),
zone_origin_(zone_origin),
zone_class_(zone_class),
......@@ -158,7 +157,7 @@ private:
// RR and the lexer is positioned at the next line. It's just for
// calculating the accurate source line when callback is necessary.
void limitTTL(RRTTL& ttl, bool post_parsing) {
if (ttl > MAX_TTL) {
if (ttl.getValue() > RRTTL::MAX_TTL) {
const size_t src_line = lexer_.getSourceLine() -
(post_parsing ? 1 : 0);
callbacks_.warning(lexer_.getSourceName(), src_line,
......@@ -306,11 +305,6 @@ private:
}
private:
// RFC2181 Section 8 specifies TTLs are unsigned 32-bit integer,
// effectively limiting the maximum value to 2^32-1. This constant
// represent a TTL of the max value.
const RRTTL MAX_TTL;
MasterLexer lexer_;
const Name zone_origin_;
const RRClass zone_class_;
......
......@@ -57,6 +57,10 @@ Unit units[] = {
namespace isc {
namespace dns {
// The actual definition of a static const member, in case it's address is
// needed.
const uint32_t RRTTL::MAX_TTL;
namespace {
bool
parseTTLStr(const string& ttlstr, uint32_t& ttlval, string* error_txt) {
......
......@@ -267,6 +267,17 @@ public:
{ return (ttlval_ > other.ttlval_); }
//@}
///
/// \name Protocol constants
///
//@{
/// \brief Max allowable value for TTLs, as defined in RFC2181, Sec. 8.
///
/// \note At the moment an RRTTL object can have a value larger than
/// this limit. We may revisit it in a future version.
static const uint32_t MAX_TTL = 0x7fffffff;
//@}
private:
uint32_t ttlval_;
};
......
Markdown is supported
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