You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/dns/rr.hpp

50 lines
1.1 KiB
C++

6 years ago
#ifndef LLARP_DNS_RR_HPP
#define LLARP_DNS_RR_HPP
#include <dns/name.hpp>
#include <dns/serialize.hpp>
6 years ago
#include <llarp/net_int.hpp>
6 years ago
#include <memory>
#include <vector>
6 years ago
namespace llarp
{
namespace dns
{
using RRClass_t = uint16_t;
using RRType_t = uint16_t;
6 years ago
using RR_RData_t = std::vector< byte_t >;
using RR_TTL_t = uint32_t;
6 years ago
struct ResourceRecord : public Serialize
{
ResourceRecord() = default;
ResourceRecord(const ResourceRecord& other);
ResourceRecord(ResourceRecord&& other);
6 years ago
bool
Encode(llarp_buffer_t* buf) const override;
bool
Decode(llarp_buffer_t* buf) override;
friend std::ostream&
operator<<(std::ostream& out, const ResourceRecord& rr)
{
return out << "[RR name=" << rr.rr_name << " type=" << rr.rr_type
<< " class=" << rr.rr_class << " ttl=" << rr.ttl
<< " rdata=[" << rr.rData.size() << " bytes]";
}
6 years ago
Name_t rr_name;
RRType_t rr_type;
RRClass_t rr_class;
RR_TTL_t ttl;
RR_RData_t rData;
};
} // namespace dns
} // namespace llarp
#endif