lokinet/llarp/dns/name.hpp

26 lines
532 B
C++
Raw Normal View History

#pragma once
2018-12-03 22:22:59 +00:00
#include <llarp/net/net_int.hpp>
#include <llarp/util/buffer.hpp>
#include <optional>
#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);
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