summaryrefslogtreecommitdiff
path: root/Userland/Services/LookupServer/DNSAnswer.h
blob: c73a9f6a1f95612a60e93e2c7e5f21ca9528a461 (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
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "DNSName.h"
#include <AK/String.h>
#include <AK/Types.h>

namespace LookupServer {

class DNSAnswer {
public:
    DNSAnswer(const DNSName& name, u16 type, u16 class_code, u32 ttl, const String& record_data);

    const DNSName& name() const { return m_name; }
    u16 type() const { return m_type; }
    u16 class_code() const { return m_class_code; }
    u32 ttl() const { return m_ttl; }
    const String& record_data() const { return m_record_data; }

    bool has_expired() const;

private:
    DNSName m_name;
    u16 m_type { 0 };
    u16 m_class_code { 0 };
    u32 m_ttl { 0 };
    time_t m_expiration_time { 0 };
    String m_record_data;
};

}