mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
7caa87862e
All #ifndef guards on headers have been removed, I think, in favor of #pragma once Headers are now included as `#include "filename"` if the included file resides in the same directory as the file including it, or any subdirectory therein. Otherwise they are included as `#include <project/top/dir/relative/path/filename>` The above does not include system/os headers.
51 lines
1.0 KiB
C++
51 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "name.hpp"
|
|
#include "serialize.hpp"
|
|
#include <llarp/net/net_int.hpp>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace dns
|
|
{
|
|
using RRClass_t = uint16_t;
|
|
using RRType_t = uint16_t;
|
|
using RR_RData_t = std::vector<byte_t>;
|
|
using RR_TTL_t = uint32_t;
|
|
|
|
struct ResourceRecord : public Serialize
|
|
{
|
|
ResourceRecord() = default;
|
|
ResourceRecord(const ResourceRecord& other);
|
|
ResourceRecord(ResourceRecord&& other);
|
|
|
|
bool
|
|
Encode(llarp_buffer_t* buf) const override;
|
|
|
|
bool
|
|
Decode(llarp_buffer_t* buf) override;
|
|
|
|
std::ostream&
|
|
print(std::ostream& stream, int level, int spaces) const;
|
|
|
|
bool
|
|
HasCNameForTLD(const std::string& tld) const;
|
|
|
|
Name_t rr_name;
|
|
RRType_t rr_type;
|
|
RRClass_t rr_class;
|
|
RR_TTL_t ttl;
|
|
RR_RData_t rData;
|
|
};
|
|
|
|
inline std::ostream&
|
|
operator<<(std::ostream& out, const ResourceRecord& rr)
|
|
{
|
|
return rr.print(out, -1, -1);
|
|
}
|
|
} // namespace dns
|
|
} // namespace llarp
|