2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2018-12-03 22:22:59 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/net/net_int.hpp>
|
|
|
|
#include <llarp/util/buffer.hpp>
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2018-12-03 22:22:59 +00:00
|
|
|
#include <string>
|
2022-07-18 20:05:39 +00:00
|
|
|
#include <optional>
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dns
|
|
|
|
{
|
2022-07-18 20:05:39 +00:00
|
|
|
/// decode name from buffer; return nullopt on failure
|
|
|
|
std::optional<std::string>
|
|
|
|
DecodeName(llarp_buffer_t* buf, bool trimTrailingDot = false);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
/// encode name to buffer
|
|
|
|
bool
|
2022-07-18 20:05:39 +00:00
|
|
|
EncodeNameTo(llarp_buffer_t* buf, std::string_view name);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
2022-07-18 20:05:39 +00:00
|
|
|
std::optional<huint128_t>
|
|
|
|
DecodePTR(std::string_view name);
|
2020-09-17 19:18:08 +00:00
|
|
|
|
|
|
|
bool
|
2022-07-18 20:05:39 +00:00
|
|
|
NameIsReserved(std::string_view name);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
} // namespace dns
|
|
|
|
} // namespace llarp
|