diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-18 21:39:29 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-18 21:39:29 +0200 |
| commit | da70596895d8135e08f8caac6978117697b4c021 (patch) | |
| tree | 2516785b5434df8453687f05dc8dd877438901ab /dev/Kernel/NetworkKit/IP.hxx | |
| parent | 005de79004c9d30e64bdee6e14e06f9d47d1f2ab (diff) | |
[REFACTOR]
Improved project structure.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/NetworkKit/IP.hxx')
| -rw-r--r-- | dev/Kernel/NetworkKit/IP.hxx | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/dev/Kernel/NetworkKit/IP.hxx b/dev/Kernel/NetworkKit/IP.hxx deleted file mode 100644 index 6003021e..00000000 --- a/dev/Kernel/NetworkKit/IP.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include <KernelKit/DebugOutput.hxx> -#include <NewKit/Defines.hxx> -#include <NewKit/Ref.hxx> -#include <NewKit/String.hxx> - -namespace Kernel -{ - class RawIPAddress6; - class RawIPAddress; - class IPFactory; - - class RawIPAddress final - { - private: - explicit RawIPAddress(char bytes[4]); - ~RawIPAddress() = default; - - RawIPAddress& operator=(const RawIPAddress&) = delete; - RawIPAddress(const RawIPAddress&) = default; - - public: - char* Address(); - - char& operator[](const Size& index); - - bool operator==(const RawIPAddress& ipv6); - bool operator!=(const RawIPAddress& ipv6); - - private: - char fAddr[4]; - - friend IPFactory; // it is the one creating these addresses, thus this - // is why the constructors are private. - }; - - /** - * @brief IPv6 address. - */ - class RawIPAddress6 final - { - private: - explicit RawIPAddress6(char Bytes[8]); - ~RawIPAddress6() = default; - - RawIPAddress6& operator=(const RawIPAddress6&) = delete; - RawIPAddress6(const RawIPAddress6&) = default; - - public: - char* Address() - { - return fAddr; - } - - char& operator[](const Size& index); - - bool operator==(const RawIPAddress6& ipv6); - bool operator!=(const RawIPAddress6& ipv6); - - private: - char fAddr[8]; - - friend IPFactory; - }; - - /** - * @brief IP Creation helpers - */ - class IPFactory final - { - public: - static ErrorOr<StringView> ToStringView(Ref<RawIPAddress6>& ipv6); - static ErrorOr<StringView> ToStringView(Ref<RawIPAddress>& ipv4); - static bool IpCheckVersion4(const char* ip); - }; -} // namespace Kernel |
