int vm_soc_inet_pton( int af, const char* src, void* dst );
int vm_soc_inet_pton( int af, const char* src, void* dst );
Converts an IPv4 or IPv6 address in its standard text presentation form into its numeric binary form in network byte order. The format of 'x:x:x:x:x:x:d.d.d.d' is not supported.
|
Parameters |
Description |
|
int af |
[IN] Specifies the protocol family, 0 for IPv4 and 1 for IPv6. |
|
const char* src |
[IN] IP address in standard text presentation form ends with '0'. |
|
void* dst |
[OUT] IP address in numeric binary form in network byte order For IPv4, it is a kal_uint8 array with size of at least 4 bytes. For IPv6, it is an ipv6_addr_t variable or compatible kal_uint8 array with size of at least 16 bytes. |
The converted IP address in standard text representation, if the conversion is
successful. If the conversion failed, the NULL is returned.
// IPv4 kal_char ipv4[] = {"192.168.1.1"}; kal_uint8 ipv4_dst[4] = {0}; kal_bool ret = KAL_FALSE; ret = vm_soc_inet_pton(0, ipv4, ipv4_dst); if (ret) { // successfully } // IPv6 VMCHAR ipv6[] = {"FF::EE"}; VMUINT8 ipv6_dst[16] = {0}; VMINT ret; ret = vm_soc_inet_pton(1, ipv6, ipv6_dst); if (ret) { // successfully }
vmsock.h
Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
support@toolsfactory.com.