mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
49de4d5f33
Since all types and class names live in the DNS namespace, we don't need to spell it out twice each time.
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Name.h"
|
|
#include <AK/Types.h>
|
|
|
|
namespace DNS {
|
|
|
|
#define MDNS_WANTS_UNICAST_RESPONSE 0x8000
|
|
|
|
class Question {
|
|
public:
|
|
Question(Name const& name, RecordType record_type, RecordClass class_code, bool mdns_wants_unicast_response)
|
|
: m_name(name)
|
|
, m_record_type(record_type)
|
|
, m_class_code(class_code)
|
|
, m_mdns_wants_unicast_response(mdns_wants_unicast_response)
|
|
{
|
|
}
|
|
|
|
RecordType record_type() const { return m_record_type; }
|
|
RecordClass class_code() const { return m_class_code; }
|
|
u16 raw_class_code() const { return (u16)m_class_code | (m_mdns_wants_unicast_response ? MDNS_WANTS_UNICAST_RESPONSE : 0); }
|
|
Name const& name() const { return m_name; }
|
|
bool mdns_wants_unicast_response() const { return m_mdns_wants_unicast_response; }
|
|
|
|
private:
|
|
Name m_name;
|
|
RecordType m_record_type { 0 };
|
|
RecordClass m_class_code { 0 };
|
|
bool m_mdns_wants_unicast_response { false };
|
|
};
|
|
|
|
}
|