MasterLoader::Options options) :
lexer_(),
zone_origin_(zone_origin),
+ active_origin_(zone_origin),
zone_class_(zone_class),
callbacks_(callbacks),
add_callback_(add_callback),
pushSource(filename);
}
+ void doOrigin() {
+ // Parse and create the new origin. It is relative to the previous
+ // one.
+ const MasterToken::StringRegion&
+ name_string(lexer_.getNextToken(MasterToken::QSTRING).
+ getStringRegion());
+ active_origin_ = Name(name_string.beg, name_string.len,
+ &active_origin_);
+ // Make sure there's the EOLN
+ eatUntilEOL(true);
+ }
+
void handleDirective(const char* directive, size_t length) {
if (iequals(directive, "INCLUDE")) {
doInclude();
} else if (iequals(directive, "ORIGIN")) {
- // TODO: Implement
- isc_throw(isc::NotImplemented,
- "Origin directive not implemented yet");
+ doOrigin();
} else if (iequals(directive, "TTL")) {
// TODO: Implement
isc_throw(isc::NotImplemented,
private:
MasterLexer lexer_;
const Name zone_origin_;
+ Name active_origin_; // The origin used during parsing
+ // (modifiable by $ORIGIN)
const RRClass zone_class_;
MasterLoaderCallbacks callbacks_;
AddRRCallback add_callback_;
}
const Name name(name_string.beg, name_string.len,
- &zone_origin_);
+ &active_origin_);
// TODO: Some more flexibility. We don't allow omitting
// anything yet
const rdata::RdataPtr data(rdata::createRdata(rrtype, rrclass,
lexer_,
- &zone_origin_,
+ &active_origin_,
options_,
callbacks_));
// In case we get NULL, it means there was error creating