7 #ifndef NAZARA_IPADDRESS_HPP 8 #define NAZARA_IPADDRESS_HPP 10 #include <Nazara/Prerequesites.hpp> 11 #include <Nazara/Core/String.hpp> 12 #include <Nazara/Network/Config.hpp> 13 #include <Nazara/Network/Enums.hpp> 24 using IPv4 = std::array<UInt8, 4>;
25 using IPv6 = std::array<UInt16, 8>;
28 inline IpAddress(
const IPv4& ip, UInt16 port = 0);
29 inline IpAddress(
const IPv6& ip, UInt16 port = 0);
30 inline IpAddress(
const UInt8& a,
const UInt8& b,
const UInt8& c,
const UInt8& d, UInt16 port = 0);
31 inline IpAddress(
const UInt16& a,
const UInt16& b,
const UInt16& c,
const UInt16& d,
const UInt16& e,
const UInt16& f,
const UInt16& g,
const UInt16& h, UInt16 port = 0);
32 inline explicit IpAddress(
const char* address);
38 bool BuildFromAddress(
const char* address);
40 inline UInt16 GetPort()
const;
41 inline NetProtocol GetProtocol()
const;
43 bool IsLoopback()
const;
44 inline bool IsValid()
const;
46 inline void SetPort(UInt16 port);
48 inline IPv4 ToIPv4()
const;
49 inline IPv6 ToIPv6()
const;
51 inline UInt32 ToUInt32()
const;
53 inline explicit operator bool()
const;
58 static String ResolveAddress(
const IpAddress& address,
String* service =
nullptr, ResolveError* error =
nullptr);
59 static std::vector<HostnameInfo> ResolveHostname(NetProtocol procol,
const String& hostname,
const String& protocol =
"http", ResolveError* error =
nullptr);
61 inline friend std::ostream& operator<<(std::ostream& out,
const IpAddress& address);
84 NetProtocol m_protocol;
93 SocketType socketType;
99 #include <Nazara/Network/IpAddress.inl> 101 #endif // NAZARA_IPADDRESS_HPP TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
bool operator<(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1517
Network class that represents an IP address.
Definition: IpAddress.hpp:21
bool operator>(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1566
Core class that represents a string.
Definition: String.hpp:22
bool operator!=(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1503
bool operator==(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1469
bool operator>=(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1580
bool operator<=(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1552