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>
|
2023-10-24 13:18:03 +00:00
|
|
|
|
2022-07-18 20:05:39 +00:00
|
|
|
#include <optional>
|
2023-10-24 13:18:03 +00:00
|
|
|
#include <string>
|
2018-12-03 22:22:59 +00:00
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
namespace llarp::dns
|
2018-12-03 22:22:59 +00:00
|
|
|
{
|
2023-10-19 21:59:57 +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
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
/// encode name to buffer
|
|
|
|
bool
|
|
|
|
EncodeNameTo(llarp_buffer_t* buf, std::string_view name);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
std::optional<huint128_t>
|
|
|
|
DecodePTR(std::string_view name);
|
2020-09-17 19:18:08 +00:00
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
bool
|
|
|
|
NameIsReserved(std::string_view name);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
} // namespace llarp::dns
|