diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2021-02-06 17:41:58 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-06 17:52:47 +0100 |
commit | e3135e7ca56daf0b06587b76e999293b02433105 (patch) | |
tree | b774e38b1f376585531a005590544c8ef702d55b /Userland/Services/LookupServer | |
parent | d8967e4dff99accdbb0128e3175526fe881336a8 (diff) | |
download | serenity-e3135e7ca56daf0b06587b76e999293b02433105.zip |
LookupServer: Rename DNSPacket -> DNSPacketHeader
This is a more appropriate name for what the class represents, and we'll be
reusing the name DNSPacket for something different soon.
Diffstat (limited to 'Userland/Services/LookupServer')
-rw-r--r-- | Userland/Services/LookupServer/DNSPacketHeader.h (renamed from Userland/Services/LookupServer/DNSPacket.h) | 6 | ||||
-rw-r--r-- | Userland/Services/LookupServer/DNSRequest.cpp | 4 | ||||
-rw-r--r-- | Userland/Services/LookupServer/DNSResponse.cpp | 10 |
3 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Services/LookupServer/DNSPacket.h b/Userland/Services/LookupServer/DNSPacketHeader.h index 22f9e7f1d2..ce54ffa697 100644 --- a/Userland/Services/LookupServer/DNSPacket.h +++ b/Userland/Services/LookupServer/DNSPacketHeader.h @@ -31,9 +31,9 @@ namespace LookupServer { -class [[gnu::packed]] DNSPacket { +class [[gnu::packed]] DNSPacketHeader { public: - DNSPacket() + DNSPacketHeader() : m_recursion_desired(false) , m_truncated(false) , m_authoritative_answer(false) @@ -114,6 +114,6 @@ private: NetworkOrdered<u16> m_additional_count; }; -static_assert(sizeof(DNSPacket) == 12); +static_assert(sizeof(DNSPacketHeader) == 12); } diff --git a/Userland/Services/LookupServer/DNSRequest.cpp b/Userland/Services/LookupServer/DNSRequest.cpp index 9770eeb258..243c0f727c 100644 --- a/Userland/Services/LookupServer/DNSRequest.cpp +++ b/Userland/Services/LookupServer/DNSRequest.cpp @@ -25,7 +25,7 @@ */ #include "DNSRequest.h" -#include "DNSPacket.h" +#include "DNSPacketHeader.h" #include <AK/MemoryStream.h> #include <AK/StringBuilder.h> #include <arpa/inet.h> @@ -71,7 +71,7 @@ void DNSRequest::add_question(const String& name, u16 record_type, ShouldRandomi ByteBuffer DNSRequest::to_byte_buffer() const { - DNSPacket request_header; + DNSPacketHeader request_header; request_header.set_id(m_id); request_header.set_is_query(); request_header.set_opcode(0); diff --git a/Userland/Services/LookupServer/DNSResponse.cpp b/Userland/Services/LookupServer/DNSResponse.cpp index 77d903f320..a7031906c3 100644 --- a/Userland/Services/LookupServer/DNSResponse.cpp +++ b/Userland/Services/LookupServer/DNSResponse.cpp @@ -25,7 +25,7 @@ */ #include "DNSResponse.h" -#include "DNSPacket.h" +#include "DNSPacketHeader.h" #include "DNSRequest.h" #include <AK/Debug.h> #include <AK/IPv4Address.h> @@ -58,12 +58,12 @@ static_assert(sizeof(DNSRecordWithoutName) == 10); Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t raw_size) { - if (raw_size < sizeof(DNSPacket)) { - dbgln("DNS response not large enough ({} out of {}) to be a DNS packet.", raw_size, sizeof(DNSPacket)); + if (raw_size < sizeof(DNSPacketHeader)) { + dbgln("DNS response not large enough ({} out of {}) to be a DNS packet.", raw_size, sizeof(DNSPacketHeader)); return {}; } - auto& response_header = *(const DNSPacket*)(raw_data); + auto& response_header = *(const DNSPacketHeader*)(raw_data); #if LOOKUPSERVER_DEBUG dbgln("Got response (ID: {})", response_header.id()); dbgln(" Question count: {}", response_header.question_count()); @@ -79,7 +79,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t if (response.code() != DNSResponse::Code::NOERROR) return response; - size_t offset = sizeof(DNSPacket); + size_t offset = sizeof(DNSPacketHeader); for (u16 i = 0; i < response_header.question_count(); ++i) { auto name = parse_dns_name(raw_data, offset, raw_size); |