2018-12-03 22:22:59 +00:00
|
|
|
#ifndef LLARP_DNS_NAME_HPP
|
|
|
|
#define LLARP_DNS_NAME_HPP
|
|
|
|
|
2019-01-11 01:42:02 +00:00
|
|
|
#include <net/net_int.hpp>
|
2019-02-02 23:12:42 +00:00
|
|
|
#include <util/buffer.hpp>
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2018-12-03 22:22:59 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dns
|
|
|
|
{
|
|
|
|
using Name_t = std::string;
|
|
|
|
|
|
|
|
/// decode name from buffer
|
|
|
|
bool
|
2019-04-26 12:11:34 +00:00
|
|
|
DecodeName(llarp_buffer_t* buf, Name_t& name, bool trimTrailingDot = false);
|
2018-12-03 22:22:59 +00:00
|
|
|
|
|
|
|
/// encode name to buffer
|
|
|
|
bool
|
|
|
|
EncodeName(llarp_buffer_t* buf, const Name_t& name);
|
|
|
|
|
|
|
|
bool
|
|
|
|
DecodePTR(const Name_t& name, huint32_t& ip);
|
|
|
|
|
|
|
|
} // namespace dns
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|