created and passed first unit tests for DNS; finished recovery from PingScheduler...
[pingcheck] / src / dns / dnscache.h
index eaca600..3bc1758 100644 (file)
 #include <boost/system/error_code.hpp>
 #include <boost/archive/xml_oarchive.hpp>
 #include <boost/archive/xml_iarchive.hpp>
-#include <boost/serialization/access.hpp>
-#include <boost/serialization/nvp.hpp>
-#include <boost/serialization/split_member.hpp>
-#include <boost/serialization/string.hpp>
 
 #include "host/pinger.h"    // for IoserviceItem
 #include "dns/hostaddress.h"
-#include "dns/timetolive.h"
+#include "dns/cname.h"
 
 typedef std::vector<HostAddress> HostAddressVec;
 typedef std::map<std::string, HostAddressVec> ip_map_type;
-
-// -----------------------------------------------------------------------------
-// CNAME
-// -----------------------------------------------------------------------------
-
-struct Cname
-{   // all public:
-    std::string Host;
-    TimeToLive Ttl;
-
-    Cname();
-    Cname(const std::string &host, const uint32_t ttl);
-    Cname(const std::string &host, const TimeToLive &ttl);
-
-    // serialization
-    friend class boost::serialization::access;
-    template<class Archive>
-    void save(Archive & ar, const unsigned int version) const
-    {
-        ar & BOOST_SERIALIZATION_NVP(Host);
-        ar & BOOST_SERIALIZATION_NVP(Ttl);
-    }
-    template<class Archive>
-    void load(Archive & ar, const unsigned int version)
-    {
-        ar & BOOST_SERIALIZATION_NVP(Host);
-        ar & BOOST_SERIALIZATION_NVP(Ttl);
-    }
-    BOOST_SERIALIZATION_SPLIT_MEMBER()
-};
 typedef std::map<std::string, Cname> cname_map_type;
 
-/// constant to give as cache_file arg to DnsCache constructor
-/// indicating that no cache file should be used
-const std::string DO_NOT_USE_CACHE_FILE = "do not use cache file!";
-
-
 // -----------------------------------------------------------------------------
 // DnsCache
 // -----------------------------------------------------------------------------
@@ -85,6 +46,10 @@ const std::string DO_NOT_USE_CACHE_FILE = "do not use cache file!";
 class DnsCache
 {
 public:
+    /// constant to give as cache_file arg to DnsCache constructor
+    /// indicating that no cache file should be used
+    static const std::string DoNotUseCacheFile;
+
     DnsCache( const IoServiceItem &io_serv,
               const std::string &cache_file );
     ~DnsCache();