diff options
Diffstat (limited to 'Private/NetworkKit')
| -rw-r--r-- | Private/NetworkKit/IP.hpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Private/NetworkKit/IP.hpp b/Private/NetworkKit/IP.hpp index 7323296f..13fa0c9d 100644 --- a/Private/NetworkKit/IP.hpp +++ b/Private/NetworkKit/IP.hpp @@ -18,22 +18,19 @@ namespace hCore { class RawIPAddress6; class RawIPAddress; -class NetworkManager; +class IPFactory; class RawIPAddress final { private: - RawIPAddress(char bytes[4]); + explicit RawIPAddress(char bytes[4]); ~RawIPAddress() = default; RawIPAddress &operator=(const RawIPAddress &) = delete; RawIPAddress(const RawIPAddress &) = default; public: - char *Address() - { - return m_Addr; - } + char *Address(); char &operator[](const Size &index); @@ -43,14 +40,17 @@ class RawIPAddress final private: char m_Addr[4]; - friend NetworkManager; // it is the one creating these addresses, thus this + friend IPFactory; // it is the one creating these addresses, thus this // is why the constructors are private. }; +/** + * @brief IPv6 address. + */ class RawIPAddress6 final { private: - RawIPAddress6(char Bytes[8]); + explicit RawIPAddress6(char Bytes[8]); ~RawIPAddress6() = default; RawIPAddress6 &operator=(const RawIPAddress6 &) = delete; @@ -70,15 +70,18 @@ class RawIPAddress6 final private: char m_Addr[8]; - friend NetworkManager; + friend IPFactory; }; -class IPHelper +/** + * @brief IP Creation helpers + */ +class IPFactory final { public: static ErrorOr<StringView> ToStringView(Ref<RawIPAddress6> ipv6); static ErrorOr<StringView> ToStringView(Ref<RawIPAddress> ipv4); - static bool IpCheckV4(const char *ip); + static bool IpCheckVersion4(const char *ip); }; } // namespace hCore |
