DESCRIPTION
The routines addr2ascii and ascii2addr are used to convert network addresses between binary form and a printable form appropriate to the address family. Both functions take an af argument, specifying the address family to be used in the conversion process. (Currently, only the AF_INET and AF_LINK address families are supported.) The addr2ascii function is used to convert binary, network-format addresses into printable form. In addition to af, there are three other arguments. The addrp argument is a pointer to the network address to be converted. The len argument is the length of the address. The buf argument is an optional pointer to a caller-allocated buffer to hold the result; if a null pointer is passed, addr2ascii uses a statically-allocated buffer.
The ascii2addr function performs the inverse operation to addr2ascii. In addition to af, it takes two arguments, ascii and result. The ascii argument is a pointer to the string which is to be converted into binary. The result argument is a pointer to an appropriate network address structure for the specified family.
The following gives the appropriate structure to use for binary addresses in the specified family: