Converts between binary and text address formats.
Library (libc.a)
This function converts a network address and the number of bits in the network part of the address into the CIDR format ascii text (for example, 9.3.149.0/24). The af parameter specifies the family of the address. The src parameter points to a buffer holding an IPv4 address if the af parameter is AF_INET. The bits parameter is the size (in bits) of the buffer pointed to by the src parameter. The dst parameter points to a buffer where the function stores the resulting text string. The size parameter is the size (in bytes) of the buffer pointed to by the dst parameter.
Item | Description |
---|---|
af | Specifies the family of the address. |
src | Points to a buffer holding and IPv4 address if the af parameter is AF_INET. |
bits | Specifies the size of the buffer pointed to by the src parameter. |
dst | Points to a buffer where the resulting text string is stored. |
size | Specifies the size of the buffer pointed to by the dst parameter. |
If successful, a pointer to a buffer containing the text string is returned. If unsuccessful, NULL is returned. Upon failure, errno is set to EAFNOSUPPORT if the af parameter is invalid or ENOSPC if the size of the result buffer is inadequate.