summaryrefslogtreecommitdiff
path: root/Servers/LookupServer/DNSRecord.h
blob: f584fc0dd9313857773f539406398b00062c7805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <AK/Types.h>
#include <Kernel/NetworkOrdered.h>

class [[gnu::packed]] DNSRecord {
public:
    DNSRecord() { }

    word name() const { return m_name; }
    word type() const { return m_type; }
    word record_class() const { return m_class; }
    dword ttl() const { return m_ttl; }
    word data_length() const { return m_data_length; }

    void* data() { return this + 1; }
    const void* data() const { return this + 1; }

private:
    NetworkOrdered<word> m_name;
    NetworkOrdered<word> m_type;
    NetworkOrdered<word> m_class;
    NetworkOrdered<dword> m_ttl;
    NetworkOrdered<word> m_data_length;
};

static_assert(sizeof(DNSRecord) == 12);