From bd1598a2b97277e527240f721df14911602cbf11 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 7 Jan 2026 09:51:21 +0100 Subject: chore: kernel: Internal API fixes and improvements. Signed-off-by: Amlal El Mahrouss --- src/kernel/NetworkKit/IP.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/kernel/NetworkKit/IP.h') diff --git a/src/kernel/NetworkKit/IP.h b/src/kernel/NetworkKit/IP.h index d195bbee..38afeb8e 100644 --- a/src/kernel/NetworkKit/IP.h +++ b/src/kernel/NetworkKit/IP.h @@ -18,12 +18,13 @@ class IPFactory; class RawIPAddress final { private: explicit RawIPAddress(UInt8 bytes[4]); + + public: ~RawIPAddress() = default; - RawIPAddress& operator=(const RawIPAddress&) = delete; + RawIPAddress& operator=(const RawIPAddress&) = default; RawIPAddress(const RawIPAddress&) = default; - public: UInt8* Address(); UInt8& operator[](const Size& index); @@ -32,7 +33,7 @@ class RawIPAddress final { BOOL operator!=(const RawIPAddress& ipv6); private: - UInt8 fAddr[4]; + UInt8 fAddr[4] = {}; friend IPFactory; // it is the one creating these addresses, thus this // is why the constructors are private. @@ -44,13 +45,14 @@ class RawIPAddress final { class RawIPAddress6 final { private: explicit RawIPAddress6(UInt8 Bytes[16]); + + public: ~RawIPAddress6() = default; - RawIPAddress6& operator=(const RawIPAddress6&) = delete; + RawIPAddress6& operator=(const RawIPAddress6&) = default; RawIPAddress6(const RawIPAddress6&) = default; - public: - UInt8* Address() { return fAddr; } + UInt8* Address(); UInt8& operator[](const Size& index); @@ -58,7 +60,7 @@ class RawIPAddress6 final { bool operator!=(const RawIPAddress6& ipv6); private: - UInt8 fAddr[16]; + UInt8 fAddr[16] = {}; friend IPFactory; }; @@ -68,9 +70,9 @@ class RawIPAddress6 final { */ class IPFactory final { public: - static ErrorOr ToKString(Ref& ipv6); - static ErrorOr ToKString(Ref& ipv4); - static bool IpCheckVersion4(const Char* ip); + static ErrorOr> ToKString(Ref& ipv6); + static ErrorOr> ToKString(Ref& ipv4); + static bool IpCheckVersion4(const Char* ip); }; } // namespace Kernel -- cgit v1.2.3