pushSource(filename);
}
+ // A helper method for loadIncremental(). It parses part of an RR
+ // until it finds the RR type field. If TTL or RR class is
+ // specified before the RR type, it also recognizes and validates
+ // them. explicit_ttl will be set to true if this method finds a
+ // valid TTL field.
+ RRType parseRRParams(bool& explicit_ttl) {
+ // Find TTL, class and type. Both TTL and class are
+ // optional and may occur in any order if they exist. TTL
+ // and class come before type which must exist.
+ //
+ // [<TTL>] [<class>] <type> <RDATA>
+ // [<class>] [<TTL>] <type> <RDATA>
+ MasterToken rrparam_token = lexer_.getNextToken(MasterToken::STRING);
+
+ // named-signzone outputs TTL first, so try parsing it in order
+ // first.
+ if (setCurrentTTL(rrparam_token.getString())) {
+ explicit_ttl = true;
+ rrparam_token = lexer_.getNextToken(MasterToken::STRING);
+ } else {
+ // If it's not a TTL here, continue and try again
+ // after the RR class below.
+ }
+
+ boost::scoped_ptr<RRClass> rrclass;
+ try {
+ rrclass.reset(new RRClass(rrparam_token.getString()));
+ rrparam_token = lexer_.getNextToken(MasterToken::STRING);
+ } catch (const InvalidRRClass&) {
+ // If it's not an rrclass here, use the zone's class.
+ rrclass.reset(new RRClass(zone_class_));
+ }
+
+ // If we couldn't parse TTL earlier in the stream (above), try
+ // again at current location.
+ if (!explicit_ttl &&
+ setCurrentTTL(rrparam_token.getString())) {
+ explicit_ttl = true;
+ rrparam_token = lexer_.getNextToken(MasterToken::STRING);
+ }
+
+ if (*rrclass != zone_class_) {
+ isc_throw(InternalException, "Class mismatch: " << *rrclass <<
+ "vs. " << zone_class_);
+ }
+
+ // Return the current string token's value as the RRType.
+ return (RRType(rrparam_token.getString()));
+ }
+
// Upper limit check when recognizing a specific TTL value from the
// zone file ($TTL, the RR's TTL field, or the SOA minimum). RFC2181
- // Section 8 limits the range of TTL values to unsigned 32-bit integers,
+ // Section 8 limits the range of TTL values to 2^31-1 (0x7fffffff),
// and prohibits transmitting a TTL field exceeding this range. We
// guarantee that by limiting the value at the time of zone
// parsing/loading, following what BIND 9 does. Resetting it to 0