Convert an IPv4 address in host-order into an IPv4 dotted-decimal notation ASCII string.
Files
net_ascii.h/net_ascii.c
Prototype
Code Block |
---|
void NetASCII_IPv4_to_Str(NET_IPv4_ADDR addr_ip,
CPU_CHAR *p_addr_ip_ascii,
CPU_BOOLEAN lead_zeros,
NET_ERR *p_err); |
Arguments
addr_ip
IPv4 address (in host-order).
paddrp_addr_ip_ascii
Pointer to a memory buffer of size greater than or equal to NET_ASCII_LEN_MAX_ADDR_IPIPv4
bytes to receive the IPv4 address string. Note that the first ASCII character in the string is the most significant nibble of the IP address’s most significant byte and that the last character in the string is the least significant nibble of the IP address’s least significant byte. Example: “10.10.1.65” = 0x0A0A0141
...
Do not prepend leading zeros to each IP IPv4 address byte.
DEF_YES
Prepend leading zeros to each IP IPv4 address byte.
p_err
Pointer to variable that will receive the return error code from this function:
NET_ASCII_ERR_NONE
NET_ERR_FAULT_NULL_PTR
NET_ASCII_ERR_INVALID_CHAR_LEN
Returned Value
None.
Required Configuration
None.Available only if IPv4 is enabled, see IPv4 Layer Configuration
Notes / Warnings
RFC 1983 states that “dotted-decimal notation... refers [to] IPv4 addresses of the form A.B.C.D; where each letter represents, in decimal, one byte of a four-byte IPv4 address.” In other words, the dotted-decimal notation separates four decimal byte values by the dot, or period, character (‘.’). Each decimal value represents one byte of the IPv4 address starting with the most significant byte in network order.
...