]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
hook up edns options to prototypes
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 26 Jan 2016 08:25:07 +0000 (09:25 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 26 Jan 2016 08:25:07 +0000 (09:25 +0100)
pdns/lua-recursor4.cc
pdns/lua-recursor4.hh

index 2e1102e8229825bd8b47a36d611c1ef6181cd8c2..a0c999b56de832b501f29c26cb7fb74abcc51d4c 100644 (file)
@@ -29,7 +29,7 @@ bool RecursorLua4::postresolve(const ComboAddress& remote,const ComboAddress& lo
 }
 
 
-bool RecursorLua4::preresolve(const ComboAddress& remote, const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& ret, int& res, bool* variable)
+bool RecursorLua4::preresolve(const ComboAddress& remote, const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& ret, const vector<pair<uint8_t,string> >* ednsOpts, int& res, bool* variable)
 {
   return false;
 }
@@ -255,6 +255,7 @@ RecursorLua4::RecursorLua4(const std::string& fname)
   d_lw->registerMember("name", &DNSRecord::d_name);
   d_lw->registerMember("type", &DNSRecord::d_type);
   d_lw->registerMember("ttl", &DNSRecord::d_ttl);
+  d_lw->registerMember("ednsOptions", &DNSQuestion::ednsOptions);
   
   d_lw->registerFunction<string(DNSRecord::*)()>("getContent", [](const DNSRecord& dr) { return dr.d_content->getZoneRepresentation(); });
 
@@ -334,29 +335,29 @@ RecursorLua4::RecursorLua4(const std::string& fname)
   d_gettag = d_lw->readVariable<boost::optional<gettag_t>>("gettag").get_value_or(0);
 }
 
-bool RecursorLua4::preresolve(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable)
+bool RecursorLua4::preresolve(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, const vector<pair<uint8_t,string> >* ednsOpts, int& ret, bool* variable)
 {
-  return genhook(d_preresolve, remote, local, query, qtype, res, ret, variable);
+  return genhook(d_preresolve, remote, local, query, qtype, res, 0, ret, variable);
 }
 
 bool RecursorLua4::nxdomain(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable)
 {
-  return genhook(d_nxdomain, remote, local, query, qtype, res, ret, variable);
+  return genhook(d_nxdomain, remote, local, query, qtype, res, 0, ret, variable);
 }
 
 bool RecursorLua4::nodata(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable)
 {
-  return genhook(d_nodata, remote, local, query, qtype, res, ret, variable);
+  return genhook(d_nodata, remote, local, query, qtype, res, 0, ret, variable);
 }
 
 bool RecursorLua4::postresolve(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable)
 {
-  return genhook(d_postresolve, remote, local, query, qtype, res, ret, variable);
+  return genhook(d_postresolve, remote, local, query, qtype, res, 0, ret, variable);
 }
 
 bool RecursorLua4::preoutquery(const ComboAddress& ns, const ComboAddress& requestor, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret)
 {
-  return genhook(d_preoutquery, ns, requestor, query, qtype, res, ret, 0);
+  return genhook(d_preoutquery, ns, requestor, query, qtype, res, 0, ret, 0);
 }
 
 bool RecursorLua4::ipfilter(const ComboAddress& remote, const ComboAddress& local, const struct dnsheader& dh)
@@ -373,7 +374,7 @@ int RecursorLua4::gettag(const ComboAddress& remote, const ComboAddress& local,
   return 0;
 }
 
-bool RecursorLua4::genhook(luacall_t& func, const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable)
+bool RecursorLua4::genhook(luacall_t& func, const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, const vector<pair<uint8_t,string> >* ednsOpts, int& ret, bool* variable)
 {
   if(!func)
     return false;
index 5988039ace2317dabdc1742029f78329b1d096ca..67ccafeade78b0c4eeddb998c80d29928962a3e7 100644 (file)
@@ -12,7 +12,7 @@ class RecursorLua4 : public boost::noncopyable
 public:
   explicit RecursorLua4(const std::string& fname);
 
-  bool preresolve(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable);
+  bool preresolve(const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, const vector<pair<uint8_t,string> >* ednsOpts, int& ret, bool* variable);
   bool nxdomain(const ComboAddress& remote, const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable);
   bool nodata(const ComboAddress& remote, const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable);
   bool postresolve(const ComboAddress& remote, const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable);
@@ -49,14 +49,14 @@ private:
     string udpCallback;
     
     std::unordered_map<string,string> data;
-
+    std::vector<pair<uint16_t, string>>* ednsOptions;
     DNSName followupName;
   };
 
   LuaContext* d_lw;
   typedef std::function<bool(std::shared_ptr<DNSQuestion>)> luacall_t;
   luacall_t d_preresolve, d_nxdomain, d_nodata, d_postresolve, d_preoutquery, d_postoutquery;
-  bool genhook(luacall_t& func, const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, int& ret, bool* variable);
+  bool genhook(luacall_t& func, const ComboAddress& remote,const ComboAddress& local, const DNSName& query, const QType& qtype, vector<DNSRecord>& res, const vector<pair<uint8_t,string> >* ednsOpts, int& ret, bool* variable);
   typedef std::function<bool(ComboAddress,ComboAddress, struct dnsheader)> ipfilter_t;
   ipfilter_t d_ipfilter;
 };