From 00a19ff7976daae7b8f7b58958fbacf84ee9cf2d Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Mon, 13 Jan 2003 23:02:11 +0000 Subject: [PATCH] hiero git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@131 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/syncres.hh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 pdns/syncres.hh diff --git a/pdns/syncres.hh b/pdns/syncres.hh new file mode 100644 index 000000000..f2ec6fe2e --- /dev/null +++ b/pdns/syncres.hh @@ -0,0 +1,54 @@ +#ifndef PDNS_SYNCRES_HH +#define PDNS_SYNCRES_HH +#include +#include "dns.hh" +#include "qtype.hh" +#include +#include +#include +#include "lwres.hh" + +/* external functions, opaque to us */ +void replaceCache(const string &qname, const QType &qt, const set& content); +int getCache(const string &qname, const QType& qt, set* res=0); + + +template class SyncRes +{ +public: + int beginResolve(const string &qname, const QType &qtype, vector&ret); + +private: + struct GetBestNSAnswer; + int doResolveAt(set nameservers, string auth, const string &qname, const QType &qtype, vector&ret, + int depth, set&beenthere); + int doResolve(const string &qname, const QType &qtype, vector&ret, int depth, set& beenthere); + bool doCNAMECacheCheck(const string &qname, const QType &qtype, vector&ret, int depth, int &res); + bool doCacheCheck(const string &qname, const QType &qtype, vector&ret, int depth, int &res); + void getBestNSFromCache(const string &qname, set&bestns, int depth, set& beenthere); + void addCruft(const string &qname, vector& ret); + string getBestNSNamesFromCache(const string &qname,set& nsset, int depth, set&beenthere); + void addAuthorityRecords(const string& qname, vector& ret, int depth); + + vector shuffle(set &nameservers); + bool moreSpecificThan(const string& a, const string &b); + string getA(const string &qname, int depth, set& beenthere); +private: + MultiPlexor d_lwr; + static map s_negcache; + struct GetBestNSAnswer + { + string qname; + set bestns; + bool operator<(const GetBestNSAnswer &b) const + { + if(qname