summaryrefslogtreecommitdiff
path: root/src/network/dns_handler.hpp
blob: c6944521bcf3860783a1db978579d46a93ee915b (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 <biboumi.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 */