summaryrefslogtreecommitdiff
path: root/louloulibs/network/dns_handler.hpp
blob: 416f85f8090d5f4e3119fd25d4d811c57708eebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <louloulibs.h>
#ifdef UDNS_FOUND

class Poller;

#include <network/dns_socket_handler.hpp>

#include <string>
#include <vector>
#include <memory>

class DNSHandler
{
public:
  explicit DNSHandler(std::shared_ptr<Poller>& poller);
  ~DNSHandler() = default;

  DNSHandler(const DNSHandler&) = delete;
  DNSHandler(DNSHandler&&) = delete;
  DNSHandler& operator=(const DNSHandler&) = delete;
  DNSHandler& operator=(DNSHandler&&) = delete;

  void destroy();

  static void watch();
  static void unwatch();

private:
  /**
   * Manager for the socket returned by udns, that we need to watch with the poller
   */
  static std::unique_ptr<DNSSocketHandler> socket_handler;
};

#endif /* UDNS_FOUND */