6 #include "DNS-message.hpp"
9 #include "iobuffer.hpp"
11 #include <glog/logging.h>
17 Resolver(Resolver
const&) = delete;
18 Resolver
& operator=(Resolver
const&) = delete;
20 Resolver(fs::path config_path
);
22 RR_collection
get_records(RR_type typ
, char const* name
);
23 RR_collection
get_records(RR_type typ
, std::string
const& name
)
25 return get_records(typ
, name
.c_str());
28 std::vector
<std::string
> get_strings(RR_type typ
, char const* name
);
29 std::vector
<std::string
> get_strings(RR_type typ
, std::string
const& name
)
31 return get_strings(typ
, name
.c_str());
34 message
xchg(message
const& q
);
37 std::unique_ptr
<Sock
> ns_sock_
;
44 Query(Query
const&) = delete;
45 Query
& operator=(Query
const&) = delete;
47 Query(Resolver
& res
, RR_type type
, char const* name
);
48 Query(Resolver
& res
, RR_type type
, std::string
const& name
)
49 : Query(res
, type
, name
.c_str())
53 bool authentic_data() const { return authentic_data_
; }
54 bool bogus_or_indeterminate() const { return bogus_or_indeterminate_
; }
55 bool nx_domain() const { return nx_domain_
; }
57 bool has_record() const { return has_record_
; }
58 RR_collection
get_records();
59 std::vector
<std::string
> get_strings();
61 uint16_t rcode() const { return rcode_
; }
62 uint16_t extended_rcode() const { return extended_rcode_
; }
65 bool xchg_(Resolver
& res
, uint16_t id
);
66 void check_answer_(Resolver
& res
, RR_type type
, char const* name
);
69 uint16_t extended_rcode_
{0};
76 bool authentic_data_
{false};
77 bool bogus_or_indeterminate_
{false};
78 bool nx_domain_
{false};
79 bool has_record_
{false};
82 inline std::vector
<std::string
>
83 get_strings(Resolver
& res
, RR_type type
, char const* name
)
85 return res
.get_strings(type
, name
);
88 inline std::vector
<std::string
>
89 get_strings(Resolver
& res
, RR_type type
, std::string
const& name
)
91 return res
.get_strings(type
, name
.c_str());
94 inline bool has_record(Resolver
& res
, RR_type type
, char const* name
)
96 Query
q(res
, type
, name
);
97 return q
.has_record();
100 inline bool has_record(Resolver
& res
, RR_type type
, std::string
const& name
)
102 return has_record(res
, type
, name
.c_str());
106 #endif // DNS_DOT_HPP