mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LookupServer: Introduce DNSName
This is a wrapper around a string representing a domain name (such as "example.com"). It never has a trailing dot. For now, this class doesn't do much except wrap the raw string. Subsequent commits will add or move more functionality to it.
This commit is contained in:
parent
de811faf55
commit
ae1e82fd2f
9 changed files with 117 additions and 38 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "DNSName.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
|
@ -33,9 +34,9 @@ namespace LookupServer {
|
|||
|
||||
class DNSAnswer {
|
||||
public:
|
||||
DNSAnswer(const String& name, u16 type, u16 class_code, u32 ttl, const String& record_data);
|
||||
DNSAnswer(const DNSName& name, u16 type, u16 class_code, u32 ttl, const String& record_data);
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
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; }
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
bool has_expired() const;
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
DNSName m_name;
|
||||
u16 m_type { 0 };
|
||||
u16 m_class_code { 0 };
|
||||
u32 m_ttl { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue