base-dns.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
27 #define NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
28 
29 #include "base.hpp"
30 
31 namespace ndn {
32 namespace tools {
33 namespace autoconfig {
34 
38 class BaseDns : public Base
39 {
40 protected:
41  class Error : public std::runtime_error
42  {
43  public:
44  explicit
45  Error(const std::string& what)
46  : std::runtime_error(what)
47  {
48  }
49  };
50 
51  BaseDns(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
52 
58  std::string
59  querySrvRr(const std::string& fqdn);
60 
66  std::string
68 
69 private:
70  union QueryAnswer;
71 
77  std::string
78  parseSrvRr(const QueryAnswer& queryAnswer, int answerSize);
79 };
80 
81 } // namespace autoconfig
82 } // namespace tools
83 } // namespace ndn
84 
85 #endif // NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
Definition: nfd.hpp:35
STL namespace.
std::string querySrvRr(const std::string &fqdn)
Send DNS SRV request for a fqdn fully qualified domain name.
Definition: base-dns.cpp:53
std::string querySrvRrSearch()
Send DNS SRV request using search domain list.
Definition: base-dns.cpp:80
std::function< void(const std::string &)> NextStageCallback
Callback to be called when the stage fails.
Definition: base.hpp:61
Base class for discovery stages.
Definition: base.hpp:45
Base class for stages that use DNS-based guessing.
Definition: base-dns.hpp:38
Error(const std::string &what)
Definition: base-dns.hpp:45
BaseDns(Face &face, KeyChain &keyChain, const NextStageCallback &nextStageOnFailure)
Definition: base-dns.cpp:47