2019-01-11 01:19:36 +00:00
|
|
|
#ifndef LLARP_DNS_REC_TYPES_HPP
|
|
|
|
#define LLARP_DNS_REC_TYPES_HPP
|
2018-11-18 23:08:02 +00:00
|
|
|
|
2019-02-02 23:12:42 +00:00
|
|
|
#include <net/net.hpp> // for llarp::Addr , llarp::huint32_t
|
|
|
|
#include <util/types.hpp> // for byte_t
|
2019-01-10 19:41:51 +00:00
|
|
|
|
2018-11-18 23:08:02 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dns
|
|
|
|
{
|
|
|
|
struct record
|
|
|
|
{
|
2018-11-21 23:32:43 +00:00
|
|
|
virtual ~record() = 0;
|
2018-11-18 23:08:02 +00:00
|
|
|
record()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) = 0;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
virtual std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() = 0;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_1a : public record
|
|
|
|
{
|
|
|
|
huint32_t ipaddr;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_1a()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_1a();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_2ns : public record
|
|
|
|
{
|
|
|
|
std::string ns;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_2ns()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_2ns();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct type_6soa : public record
|
|
|
|
{
|
|
|
|
std::string mname;
|
|
|
|
std::string rname;
|
|
|
|
uint32_t serial;
|
|
|
|
uint32_t refresh;
|
|
|
|
uint32_t retry;
|
|
|
|
uint32_t expire;
|
|
|
|
uint32_t minimum;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_6soa()
|
|
|
|
{
|
|
|
|
}
|
2018-11-21 23:32:43 +00:00
|
|
|
type_6soa();
|
|
|
|
|
|
|
|
bool
|
|
|
|
parse(std::vector< byte_t > bytes) override;
|
|
|
|
|
|
|
|
std::vector< byte_t >
|
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_5cname : public record
|
|
|
|
{
|
|
|
|
std::string cname;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_5cname()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_5cname();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_12ptr : public record
|
|
|
|
{
|
|
|
|
std::string revname;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_12ptr()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_12ptr();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_15mx : public record
|
|
|
|
{
|
|
|
|
std::string mx;
|
|
|
|
uint16_t priority;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_15mx()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_15mx();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct type_16txt : public record
|
|
|
|
{
|
|
|
|
std::string txt;
|
|
|
|
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~type_16txt()
|
|
|
|
{
|
|
|
|
}
|
2018-11-18 23:08:02 +00:00
|
|
|
type_16txt();
|
|
|
|
|
|
|
|
bool
|
2018-11-21 23:32:43 +00:00
|
|
|
parse(std::vector< byte_t > bytes) override;
|
2018-11-18 23:08:02 +00:00
|
|
|
|
|
|
|
std::vector< byte_t >
|
2018-11-21 23:32:43 +00:00
|
|
|
to_bytes() override;
|
2018-11-18 23:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dns
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|