-
首页
-
C4D R23.110 C++ SDK
NetworkIpAddrInterface Class Reference
#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}
公共成员函数
|
MAXON_METHOD
NetworkSockAddrIn
|
GetNetworkSockAddrIn
() const
|
MAXON_METHOD
void
|
SetNetworkSockaddrIn
(const
NetworkSockAddrIn
&sa,
PROTOCOL
protocol)
|
MAXON_METHOD
void
|
重置
()
|
MAXON_METHOD
void
|
Flush
()
|
MAXON_METHOD
void
|
SetIPv4
(
UInt32
ip,
Bool
isHostByteOrder)
|
MAXON_METHOD
void
|
SetIPv4
(
UChar
a,
UChar
b,
UChar
c,
UChar
d)
|
MAXON_METHOD
void
|
SetIPv6
(
UInt16
x1,
UInt16
x2,
UInt16
x3,
UInt16
x4,
UInt16
x5,
UInt16
x6,
UInt16
x7,
UInt16
x8)
|
MAXON_METHOD
void
|
SetIPv4
(const in_addr &in)
|
MAXON_METHOD
void
|
SetIPv6
(const in6_addr &in)
|
MAXON_METHOD
Result
< void >
|
SetIPv4
(const sockaddr_in *in)
|
MAXON_METHOD
Result
< void >
|
SetIPv6
(const sockaddr_in6 *in)
|
MAXON_METHOD
void
|
SetIPv4
(
WILDCARD_IPV4_ADDRESS_TYPE
)
|
MAXON_METHOD
void
|
SetIPv6
(
WILDCARD_IPV6_ADDRESS_TYPE
)
|
MAXON_METHOD
Result
< void >
|
GetIPv4
(
UChar
&a,
UChar
&b,
UChar
&c,
UChar
&d) const
|
MAXON_METHOD
Result
< void >
|
GetIPv6
(
UInt16
&x1,
UInt16
&x2,
UInt16
&x3,
UInt16
&x4,
UInt16
&x5,
UInt16
&x6,
UInt16
&x7,
UInt16
&x8) const
|
MAXON_METHOD
Result
< void >
|
GetIPv4
(sockaddr_in *sockaddr) const
|
MAXON_METHOD
Result
< void >
|
GetIPv6
(sockaddr_in6 *sockaddr) const
|
MAXON_METHOD
PROTOCOL
|
GetProtocol
() const
|
MAXON_METHOD
int
|
GetNativeProtocol
() const
|
MAXON_METHOD
void
|
SetProtocol
(
PROTOCOL
protocol)
|
MAXON_METHOD
Bool
|
IsPrivateAddress
() const
|
MAXON_METHOD
Bool
|
IsMulticastAddress
() const
|
MAXON_METHOD
Bool
|
IsWildcardAddress
() const
|
MAXON_METHOD
Bool
|
IsUnspecified
() const
|
MAXON_METHOD
Bool
|
IsEmpty
() const
|
MAXON_FUNCTION
Bool
|
IsPopulated
() const
|
MAXON_METHOD
Bool
|
IsValid
() const
|
MAXON_METHOD
String
|
GetString
(
Int32
port=0) const
|
String
|
ToString
(const
FormatStatement
*formatStatement=nullptr) const
|
MAXON_METHOD
Bool
|
IsEqual
(const
NetworkIpAddrInterface
*adr) const
|
MAXON_METHOD
Bool
|
IsInSameNetwork
(const
NetworkIpAddr
&otherAddress, const
NetworkIpAddr
&subnetMask) const
|
MAXON_METHOD
HashInt
|
GetHashCode
() const
|
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
GetNetworkSockAddrIn()
Returns the internal POD representation of this address.
◆
SetNetworkSockaddrIn()
Sets the raw
NetworkSockAddrIn
into this class.
-
参数
-
[in]
|
sa
|
Reference to the
NetworkSockAddrIn
值。
|
[in]
|
protocol
|
Type of the IP address given in the variable "in".
|
◆
Reset()
Resets the content of this value. The protocol is set to
PROTOCOL::UNSPEC
.
◆
Flush()
DEPRECATED. Exists for backward compatibility. Use
Reset()
instead.
◆
SetIPv4()
[1/5]
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.
|
◆
SetIPv4()
[2/5]
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.
|
◆
SetIPv6()
[1/4]
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.
|
◆
SetIPv4()
[3/5]
Sets an ip v4 address from the native in_addr structure.
-
参数
-
[in]
|
in
|
Reference to the ip v4 structure.
|
◆
SetIPv6()
[2/4]
Sets an ip v6 address from the native in_addr6 structure.
-
参数
-
[in]
|
in
|
Reference to the ip v6 structure.
|
◆
SetIPv4()
[4/5]
Sets an ip v4 address from the native sockaddr_in structure.
-
参数
-
[in]
|
in
|
Pointer to sockaddr_in structure.
|
◆
SetIPv6()
[3/4]
Sets an ip v4 address from the native sockaddr_in6 structure.
-
参数
-
[in]
|
in
|
Pointer to sockaddr_in6 structure.
|
◆
SetIPv4()
[5/5]
Sets an IP v4 address from the native in_addr structure.
◆
SetIPv6()
[4/4]
Sets an IP v6 address from the native in_addr structure.
◆
GetIPv4()
[1/2]
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".
|
-
返回
-
Returns OK on success or an error if the protocol doesn't match.
◆
GetIPv6()
[1/2]
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".
|
-
返回
-
Returns OK on success or an error if the protocol doesn't match.
◆
GetIPv4()
[2/2]
Returns the IP v4 address as sockaddr_in structure.
-
参数
-
[out]
|
sockaddr
|
Pointer to sockaddr_in structure.
|
-
返回
-
Returns OK on success or an error if the protocol doesn't match.
◆
GetIPv6()
[2/2]
Returns the IP v6 address as sockaddr_in6 structure.
-
参数
-
[out]
|
sockaddr
|
Pointer to sockaddr_in structure.
|
-
返回
-
Returns OK on success or an error if the protocol doesn't match.
◆
GetProtocol()
Returns the type of the IP address used in this object.
◆
GetNativeProtocol()
Returns the type of the IP address used in this object.
◆
SetProtocol()
◆
IsPrivateAddress()
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.
◆
IsMulticastAddress()
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.
◆
IsWildcardAddress()
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.
◆
IsUnspecified()
Returns whether the value of the IP address is unspecified. This is true iff
GetProtocol()
==
PROTOCOL::UNSPEC
.
◆
IsEmpty()
DEPRECATED. Exists for backward compatibility. Use
IsUnspecified()
and
IsWildcardAddress()
instead.
◆
IsPopulated()
DEPRECATED. Exists for backward compatibility. Use
IsUnspecified()
and
IsWildcardAddress()
instead.
◆
IsValid()
DEPRECATED. Exists for backward compatibility. Use
IsUnspecified()
and
IsWildcardAddress()
instead.
◆
GetString()
◆
ToString()
Returns a readable string of the content.
-
参数
-
[in]
|
formatStatement
|
Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
|
-
返回
-
The converted result.
◆
IsEqual()
Compares the object against another given object.
-
参数
-
[in]
|
adr
|
IP address to compare.
|
-
返回
-
True if both ip addresses are identical.
◆
IsInSameNetwork()
Returns if this address is in the same network as other address based on the given subnet mask.
◆
GetHashCode()
Returns the hash value of this object. This value can be used for all HashSet<>/HashMap<> classes.