I'm trying to implement a application that uses the getifaddrs() function from <ifaddrs.h> across multiple platforms. My goal is to retrieve network interface related info (IP, IPv6, Netmask, Broadcast, Scope, and HWAddress).
I have successfully implemented it on Linux, but it seems that the ifaddrs.h header isn't present on the above platforms (HP-UX, AIX, Solaris).
What is the recommended approach for these platforms?
Solaris 11 and later have
getifaddrs()already in libsocket. For older Solaris releases, see the answer to Solaris: Programmatic interface to ifconfig? here on StackOverflow.