Converts between text and binary address formats.
Library (libc.a)
This function converts a network address in ascii into the binary network address. The ascii representation can be CIDR-based (for example, 9.3.149.0/24) or class-based (for example, 9.3.149.0). The af parameter specifies the family of the address. The src parameter points to the string being passed in. The dst parameter points to a buffer where the function will store the resulting numeric address. 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 the string being passed in. |
dst | Points to a buffer where the resulting numeric address is stored. |
size | Specifies the size (in bytes) of the buffer pointed to by the dst parameter. |
If successful, the number of bits, either inputted classfully or specified with /CIDR, is returned. If unsuccessful, a -1 (negative one) is returned (check errno). ENOENT means it was not a valid network specification.