#pragma once #include #include class [[gnu::packed]] DNSRecord { public: DNSRecord() {} u16 name() const { return m_name; } u16 type() const { return m_type; } u16 record_class() const { return m_class; } u32 ttl() const { return m_ttl; } u16 data_length() const { return m_data_length; } void* data() { return this + 1; } const void* data() const { return this + 1; } private: NetworkOrdered m_name; NetworkOrdered m_type; NetworkOrdered m_class; NetworkOrdered m_ttl; NetworkOrdered m_data_length; }; static_assert(sizeof(DNSRecord) == 12);