Where is inet_aton? inet_ntoa? inet_addr?

Tagged with LSB
Printer-friendly version

The LSB specifies inet_ntop and inet_pton for address conversion, since these are both IPv4 and IPv6 capable. You can start using these functions by replacing calls of the form

foo.sin_addr.s_addr = inet_addr(cp);

with

inet_pton(AF_INET, cp, &foo.sin_addr);

calls of the form

inet_aton(cp, &foo.sin_addr);

with

inet_pton(AF_INET, cp, &foo.sin_addr);

and calls of the form

ptr = inet_ntoa(foo.sin_addr);

with

char str[INET_ADDRSTRLEN];
ptr = inet_ntop(AF_INET, &foo.sin_addr, str, sizeof(str));
0
Copyright © 2008 Linux Foundation. All rights reserved.
LSB is a trademark of the Linux Foundation. Linux is a registered trademark of Linus Torvalds