lokinet/llarp/dns/name.hpp

29 lines
584 B
C++
Raw Permalink Normal View History

#pragma once
2018-12-03 22:22:59 +00:00
#include <llarp/net/net_int.hpp>
#include <llarp/util/buffer.hpp>
2018-12-03 22:22:59 +00:00
#include <string>
#include <optional>
2018-12-03 22:22:59 +00:00
namespace llarp
{
namespace dns
{
/// 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
EncodeNameTo(llarp_buffer_t* buf, std::string_view name);
2018-12-03 22:22:59 +00:00
std::optional<huint128_t>
DecodePTR(std::string_view name);
bool
NameIsReserved(std::string_view name);
2018-12-03 22:22:59 +00:00
} // namespace dns
} // namespace llarp