#include <network_ip_addr.h>
This class represents an Internet Protocol (IP) address. It is version agnostic and supports both IPv4 and IPv6.
@MAXON_ANNOTATION{refclass=false}
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (NetworkIpAddrInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.networkipaddr") | |
|
private |
MAXON_METHOD NetworkSockAddrIn GetNetworkSockAddrIn | ( | ) | const |
Returns the internal POD representation of this address.
MAXON_METHOD void SetNetworkSockaddrIn | ( | const NetworkSockAddrIn & | sa, |
PROTOCOL | protocol | ||
) |
Sets the raw NetworkSockAddrIn into this class.
[in] | sa | Reference to the NetworkSockAddrIn value. |
[in] | protocol | Type of the IP address given in the variable "in". |
MAXON_METHOD void Reset | ( | ) |
Resets the content of this value. The protocol is set to PROTOCOL::UNSPEC.
MAXON_METHOD void Flush | ( | ) |
DEPRECATED. Exists for backward compatibility. Use Reset() instead.
MAXON_METHOD void SetIPv4 | ( | UInt32 | ip, |
Bool | isHostByteOrder | ||
) |
Sets an IPV4 address.
[in] | ip | IP address to be set. |
[in] | isHostByteOrder | True if the address is delivered in the host specific byte order. |
MAXON_METHOD void SetIPv4 | ( | UChar | a, |
UChar | b, | ||
UChar | c, | ||
UChar | d | ||
) |
Sets an IPV4 address.
[in] | a | IP address of the format "a.b.c.d" to be set. |
[in] | b | IP address of the format "a.b.c.d" to be set. |
[in] | c | IP address of the format "a.b.c.d" to be set. |
[in] | d | IP address of the format "a.b.c.d" to be set. |
MAXON_METHOD void SetIPv6 | ( | UInt16 | x1, |
UInt16 | x2, | ||
UInt16 | x3, | ||
UInt16 | x4, | ||
UInt16 | x5, | ||
UInt16 | x6, | ||
UInt16 | x7, | ||
UInt16 | x8 | ||
) |
Sets an IPV6 address.
[in] | x1 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x2 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x3 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x4 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x5 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x6 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x7 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
[in] | x8 | IP address of the format "x1:x2:x3:x4:x5:x6:x7:x8" to be set. |
MAXON_METHOD void SetIPv4 | ( | const in_addr & | in | ) |
Sets an ip v4 address from the native in_addr structure.
[in] | in | Reference to the ip v4 structure. |
MAXON_METHOD void SetIPv6 | ( | const in6_addr & | in | ) |
Sets an ip v6 address from the native in_addr6 structure.
[in] | in | Reference to the ip v6 structure. |
MAXON_METHOD Result<void> SetIPv4 | ( | const sockaddr_in * | in | ) |
Sets an ip v4 address from the native sockaddr_in structure.
[in] | in | Pointer to sockaddr_in structure. |
MAXON_METHOD Result<void> SetIPv6 | ( | const sockaddr_in6 * | in | ) |
Sets an ip v4 address from the native sockaddr_in6 structure.
[in] | in | Pointer to sockaddr_in6 structure. |
MAXON_METHOD void SetIPv4 | ( | WILDCARD_IPV4_ADDRESS_TYPE | ) |
Sets an IP v4 address from the native in_addr structure.
MAXON_METHOD void SetIPv6 | ( | WILDCARD_IPV6_ADDRESS_TYPE | ) |
Sets an IP v6 address from the native in_addr structure.
Returns the IP v4 address.
[out] | a | Returns the 'a' component of the address in the format "a.b.c.d". |
[out] | b | Returns the 'b' component of the address in the format "a.b.c.d". |
[out] | c | Returns the 'c' component of the address in the format "a.b.c.d". |
[out] | d | Returns the 'd' component of the address in the format "a.b.c.d". |
MAXON_METHOD Result<void> GetIPv6 | ( | UInt16 & | x1, |
UInt16 & | x2, | ||
UInt16 & | x3, | ||
UInt16 & | x4, | ||
UInt16 & | x5, | ||
UInt16 & | x6, | ||
UInt16 & | x7, | ||
UInt16 & | x8 | ||
) | const |
Returns the IP v6 address.
[out] | x1 | Returns the 'x1' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x2 | Returns the 'x2' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x3 | Returns the 'x3' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x4 | Returns the 'x4' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x5 | Returns the 'x5' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x6 | Returns the 'x6' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x7 | Returns the 'x7' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
[out] | x8 | Returns the 'x8' component of the address in the format "x1:x2:x3:x4:x5:x6:x7:x8". |
MAXON_METHOD Result<void> GetIPv4 | ( | sockaddr_in * | sockaddr | ) | const |
Returns the IP v4 address as sockaddr_in structure.
[out] | sockaddr | Pointer to sockaddr_in structure. |
MAXON_METHOD Result<void> GetIPv6 | ( | sockaddr_in6 * | sockaddr | ) | const |
Returns the IP v6 address as sockaddr_in6 structure.
[out] | sockaddr | Pointer to sockaddr_in structure. |
MAXON_METHOD PROTOCOL GetProtocol | ( | ) | const |
Returns the type of the IP address used in this object.
MAXON_METHOD int GetNativeProtocol | ( | ) | const |
Returns the type of the IP address used in this object.
MAXON_METHOD void SetProtocol | ( | PROTOCOL | protocol | ) |
MAXON_METHOD Bool IsPrivateAddress | ( | ) | const |
Returns whether the IP address is a private address. The following ranges are defined as private (RFC 1918, Chapter 3): IPv4: 10/8, 172.16/12, 192.168/16 (IPv4) IPv6: fc00::/7 For an invalid address, the result is always false.
MAXON_METHOD Bool IsMulticastAddress | ( | ) | const |
Returns whether the IP address is a multicast address. The following ranges are reserved for multicast: IPv4: 224.0.0.0/4 IPv6: ff00::/8 For an invalid address, the result is always false.
MAXON_METHOD Bool IsWildcardAddress | ( | ) | const |
Returns whether the IP address is a wildcard address. This refers to the following addresses: IPv4: 0.0.0.0 (INADDR_ANY) IPv6: ::0 (in6addr_any) For an invalid address, the result is always false.
MAXON_METHOD Bool IsUnspecified | ( | ) | const |
Returns whether the value of the IP address is unspecified. This is true iff GetProtocol() == PROTOCOL::UNSPEC.
MAXON_METHOD Bool IsEmpty | ( | ) | const |
DEPRECATED. Exists for backward compatibility. Use IsUnspecified() and IsWildcardAddress() instead.
MAXON_FUNCTION Bool IsPopulated | ( | ) | const |
DEPRECATED. Exists for backward compatibility. Use IsUnspecified() and IsWildcardAddress() instead.
MAXON_METHOD Bool IsValid | ( | ) | const |
DEPRECATED. Exists for backward compatibility. Use IsUnspecified() and IsWildcardAddress() instead.
MAXON_METHOD String GetString | ( | Int32 | port = 0 | ) | const |
String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Returns a readable string of the content.
[in] | formatStatement | Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported. |
MAXON_METHOD Bool IsEqual | ( | const NetworkIpAddrInterface * | adr | ) | const |
Compares the object against another given object.
[in] | adr | IP address to compare. |
MAXON_METHOD Bool IsInSameNetwork | ( | const NetworkIpAddr & | otherAddress, |
const NetworkIpAddr & | subnetMask | ||
) | const |
Returns if this address is in the same network as other address based on the given subnet mask.
MAXON_METHOD HashInt GetHashCode | ( | ) | const |
Returns the hash value of this object. This value can be used for all HashSet<>/HashMap<> classes.