From 6ac9742cab7574e45ea6653158813e4e39ddec5a Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 5 Aug 2015 18:49:07 +0300 Subject: [PATCH] Add searchRecords and searchComments API call --- pdns/dnsbackend.hh | 12 ++++++++++++ pdns/ueberbackend.cc | 15 +++++++++++++++ pdns/ueberbackend.hh | 3 +++ 3 files changed, 30 insertions(+) diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index b4122b96e..e43483fae 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -381,6 +381,18 @@ public: return false; } + //! Search for records, returns true if search was done successfully. + virtual bool searchRecords(const string &pattern, int maxResults, vector& result) + { + return false; + } + + //! Search for comments, returns true if search was done successfully. + virtual bool searchComments(const string &pattern, int maxResults, vector& result) + { + return false; + } + protected: bool mustDo(const string &key); const string &getArg(const string &key); diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 0c48f6916..ab3cefc9a 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -618,6 +618,21 @@ bool UeberBackend::list(const string &target, int domain_id, bool include_disabl return false; } +bool UeberBackend::searchRecords(const string& pattern, int maxResults, vector& result) +{ + bool rc = false; + for ( vector< DNSBackend * >::iterator i = backends.begin(); result.size() < static_cast::size_type>(maxResults) && i != backends.end(); ++i ) + if ((*i)->searchRecords(pattern, maxResults - result.size(), result)) rc = true; + return rc; +} + +bool UeberBackend::searchComments(const string& pattern, int maxResults, vector& result) +{ + bool rc = false; + for ( vector< DNSBackend * >::iterator i = backends.begin(); result.size() < static_cast::size_type>(maxResults) && i != backends.end(); ++i ) + if ((*i)->searchComments(pattern, maxResults - result.size(), result)) rc = true; + return rc; +} AtomicCounter UeberBackend::handle::instances(0); diff --git a/pdns/ueberbackend.hh b/pdns/ueberbackend.hh index 6837ed1b7..c9f1b264f 100644 --- a/pdns/ueberbackend.hh +++ b/pdns/ueberbackend.hh @@ -153,6 +153,9 @@ public: void alsoNotifies(const string &domain, set *ips); void rediscover(string* status=0); void reload(); + + bool searchRecords(const string &pattern, int maxResults, vector& result); + bool searchComments(const string &pattern, int maxResults, vector& result); private: unsigned int d_cache_ttl, d_negcache_ttl; -- 2.40.0