accept more TLS versions, ignore zero return
[ghsmtp.git] / DNS-rrs.cpp
blobdc7dd410ae50959cb1bc122c7016c9133c5af9f6
1 #include "DNS-rrs.hpp"
3 #include "DNS-iostream.hpp"
5 #include <cstring>
7 #include <arpa/inet.h>
9 #include <glog/logging.h>
11 namespace DNS {
13 RR_A::RR_A(uint8_t const* rd, size_t sz)
15 static_assert(sizeof(addr_.sin_addr) == 4);
16 CHECK_EQ(sz, sizeof(addr_.sin_addr));
17 std::memcpy(&addr_.sin_addr, rd, sizeof(addr_.sin_addr));
18 PCHECK(inet_ntop(AF_INET, &addr_.sin_addr, str_, sizeof str_));
21 RR_AAAA::RR_AAAA(uint8_t const* rd, size_t sz)
23 static_assert(sizeof(addr_.sin6_addr) == 16);
24 CHECK_EQ(sz, sizeof(addr_.sin6_addr));
25 std::memcpy(&addr_.sin6_addr, rd, sizeof(addr_.sin6_addr));
26 PCHECK(inet_ntop(AF_INET6, &addr_.sin6_addr, str_, sizeof str_));
29 RR_TLSA::RR_TLSA(uint8_t cert_usage,
30 uint8_t selector,
31 uint8_t matching_type,
32 std::span<octet const> data)
33 : cert_usage_(cert_usage)
34 , selector_(selector)
35 , matching_type_(matching_type)
37 assoc_data_.resize(data.size());
38 std::memcpy(assoc_data_.data(), data.data(), data.size());
41 } // namespace DNS