changed how dns deals with cnames and recursion: remember cnames and implement recurs...
[pingcheck] / src / dns / dnscache.h
index 9600901..d48f6c2 100644 (file)
@@ -33,7 +33,8 @@
 #include "dns/hostaddress.h"
 
 typedef std::vector<HostAddress> HostAddressVec;
-typedef std::map<std::string, HostAddressVec> cache_map_type;
+typedef std::map<std::string, HostAddressVec> ip_map_type;
+typedef std::map<std::string, std::string> cname_map_type;
 
 class DnsCache
 {
@@ -43,12 +44,16 @@ public:
     ~DnsCache();
 
     // accessed from ResolverBase subclasses
-    void update(const std::string &host_name, const HostAddressVec &new_data);
-    HostAddressVec& get_data(const std::string &hostname);
+    void update(const std::string &hostname, const HostAddressVec &new_data);
+    void update(const std::string &hostname, const std::string &cname);
+    void update_ttl(const std::string &hostname, const uint32_t ttl);
+    HostAddressVec& get_ips(const std::string &hostname);
+    std::string& get_cname(const std::string &hostname);
 
 // variables
 private:
-    cache_map_type DataCache;
+    ip_map_type IpCache;
+    cname_map_type CnameCache;
     boost::asio::deadline_timer SaveTimer;
     std::string CacheFile;
     bool HasChanged;