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 truncation() const { return truncation_
; }
56 bool nx_domain() const { return nx_domain_
; }
58 bool has_record() const { return has_record_
; }
59 RR_collection
get_records();
60 std::vector
<std::string
> get_strings();
62 uint16_t rcode() const { return rcode_
; }
63 uint16_t extended_rcode() const { return extended_rcode_
; }
66 bool xchg_(Resolver
& res
, uint16_t id
);
67 void check_answer_(Resolver
& res
, RR_type type
, char const* name
);
70 uint16_t extended_rcode_
{0};
77 bool authentic_data_
{false};
78 bool bogus_or_indeterminate_
{false};
79 bool truncation_
{false};
80 bool nx_domain_
{false};
81 bool has_record_
{false};
84 inline std::vector
<std::string
>
85 get_strings(Resolver
& res
, RR_type type
, char const* name
)
87 return res
.get_strings(type
, name
);
90 inline std::vector
<std::string
>
91 get_strings(Resolver
& res
, RR_type type
, std::string
const& name
)
93 return res
.get_strings(type
, name
.c_str());
96 inline bool has_record(Resolver
& res
, RR_type type
, char const* name
)
98 Query
q(res
, type
, name
);
99 return q
.has_record();
102 inline bool has_record(Resolver
& res
, RR_type type
, std::string
const& name
)
104 return has_record(res
, type
, name
.c_str());
108 #endif // DNS_DOT_HPP