return iter->second;
}
-#ifndef HAVE_LUA
-void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
-{
- if(!fname.empty())
- throw PDNSException("Asked to load a Lua configuration file '"+fname+"' in binary without Lua support");
-}
-#else
+ static void parseRPZParameters(const std::unordered_map<string,boost::variant<uint32_t, string> >& have, std::string& polName, boost::optional<DNSFilterEngine::Policy>& defpol, uint32_t& maxTTL, size_t& zoneSizeHint)
+ {
+ if(have.count("policyName")) {
+ polName = boost::get<std::string>(constGet(have, "policyName"));
+ }
+ if(have.count("defpol")) {
+ defpol=DNSFilterEngine::Policy();
+ defpol->d_kind = (DNSFilterEngine::PolicyKind)boost::get<uint32_t>(constGet(have, "defpol"));
+ defpol->d_name = std::make_shared<std::string>(polName);
+ if(defpol->d_kind == DNSFilterEngine::PolicyKind::Custom) {
+ defpol->d_custom=
+ shared_ptr<DNSRecordContent>(
+ DNSRecordContent::mastermake(QType::CNAME, 1,
+ boost::get<string>(constGet(have,"defcontent"))
+ )
+ );
+
+ if(have.count("defttl"))
+ defpol->d_ttl = static_cast<int32_t>(boost::get<uint32_t>(constGet(have, "defttl")));
+ else
+ defpol->d_ttl = -1; // get it from the zone
+ }
+ }
+ if(have.count("maxTTL")) {
+ maxTTL = boost::get<uint32_t>(constGet(have, "maxTTL"));
+ }
+ if(have.count("zoneSizeHint")) {
+ zoneSizeHint = static_cast<size_t>(boost::get<uint32_t>(constGet(have, "zoneSizeHint")));
+ }
+ }
+
void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
{
LuaConfigItems lci;