Allow any old and crufty protocol version
[ghsmtp.git] / TLD.hpp
blob61daa37f38751d4825cb1060b610fb05d0d9c796
1 #ifndef TLD_DOT_HPP
2 #define TLD_DOT_HPP
4 #include <glog/logging.h>
6 extern "C" {
7 #include <libpsl.h>
10 class TLD {
11 public:
12 TLD(TLD const&) = delete;
13 TLD& operator=(TLD const&) = delete;
15 TLD()
16 : ctx_(CHECK_NOTNULL(psl_latest(nullptr)))
19 ~TLD() { psl_free(ctx_); }
21 char const* get_registered_domain(char const* dom) const
23 return psl_registrable_domain(ctx_, dom);
26 char const* get_registered_domain(std::string const& dom) const
28 return get_registered_domain(dom.c_str());
31 private:
32 psl_ctx_t* ctx_;
35 #endif // TLD_DOT_HPP