From 27c44631f775defb217bb3409419371891ea03c1 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sun, 7 Jan 2018 18:45:58 +0200 Subject: [PATCH] lua-base4: Add newDRR for making DNSResourceRecords --- pdns/lua-base4.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pdns/lua-base4.cc b/pdns/lua-base4.cc index eb37dd92a..4ac452ab4 100644 --- a/pdns/lua-base4.cc +++ b/pdns/lua-base4.cc @@ -71,6 +71,18 @@ void BaseLua4::prepareContext() { d_lw->registerFunction("chopOff", [](DNSName&dn ) { return dn.chopOff(); }); // DNSResourceRecord + d_lw->writeFunction("newDRR", [](const DNSName& qname, const string& qtype, const unsigned int ttl, const string& content, boost::optional domain_id, boost::optional auth){ + auto drr = DNSResourceRecord(); + drr.qname = qname; + drr.qtype = qtype; + drr.ttl = ttl; + drr.setContent(content); + if (domain_id) + drr.domain_id = *domain_id; + if (auth) + drr.auth = *auth; + return drr; + }); d_lw->registerEqFunction(&DNSResourceRecord::operator==); d_lw->registerFunction("__lt", &DNSResourceRecord::operator<); d_lw->registerFunction("toString", [](const DNSResourceRecord& rec) { return rec.getZoneRepresentation();} ); -- 2.40.0