lokinet/llarp/dns/rectypes.hpp

150 lines
2.4 KiB
C++
Raw Normal View History

2019-01-11 01:19:36 +00:00
#ifndef LLARP_DNS_REC_TYPES_HPP
#define LLARP_DNS_REC_TYPES_HPP
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
#include <vector>
namespace llarp
{
namespace dns
{
struct record
{
virtual ~record() = 0;
record()
{
}
virtual bool
parse(std::vector< byte_t > bytes) = 0;
virtual std::vector< byte_t >
to_bytes() = 0;
};
struct type_1a : public record
{
huint32_t ipaddr;
virtual ~type_1a()
{
}
type_1a();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
struct type_2ns : public record
{
std::string ns;
virtual ~type_2ns()
{
}
type_2ns();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
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;
virtual ~type_6soa()
{
}
type_6soa();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
struct type_5cname : public record
{
std::string cname;
virtual ~type_5cname()
{
}
type_5cname();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
struct type_12ptr : public record
{
std::string revname;
virtual ~type_12ptr()
{
}
type_12ptr();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
struct type_15mx : public record
{
std::string mx;
uint16_t priority;
virtual ~type_15mx()
{
}
type_15mx();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
struct type_16txt : public record
{
std::string txt;
virtual ~type_16txt()
{
}
type_16txt();
bool
parse(std::vector< byte_t > bytes) override;
std::vector< byte_t >
to_bytes() override;
};
} // namespace dns
} // namespace llarp
#endif