0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd::rfc1035: Add reverse qtype mapping.

This commit is contained in:
Jason Volk 2018-09-30 19:35:03 -07:00
parent 5a627efaad
commit b43b094f2c
2 changed files with 14 additions and 0 deletions

View file

@ -24,6 +24,7 @@ namespace ircd::rfc1035
enum class op :uint8_t;
extern const std::array<string_view, 25> rcode;
extern const std::unordered_map<string_view, uint16_t> qtype;
extern const std::map<uint16_t, string_view> rqtype;
const_buffer make_name(const mutable_buffer &out, const string_view &fqdn);
size_t parse_name(const mutable_buffer &out, const const_buffer &in);

View file

@ -549,3 +549,16 @@ ircd::rfc1035::qtype
{ "DOA", 259 }, // Digital Object Architecture [draft-durand-doa-over-dns]
{ "TA", 32768 }, // DNSSEC Trust Authorities [Sam_Weiler][http://cameo.library.cmu.edu/]
};
decltype(ircd::rfc1035::rqtype)
ircd::rfc1035::rqtype{[]
{
std::map<uint16_t, string_view> ret;
std::transform(begin(qtype), end(qtype), std::inserter(ret, ret.end()), []
(const auto &pair) -> std::pair<uint16_t, string_view>
{
return { pair.second, pair.first };
});
return ret;
}()};