I found it in a source file of a client of another dns service (
www.no-ip.com). It's not directly associated with network, but with the "interface" as a device.
see this code....
struct ifreq ifr;
........(omitted)
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
.........(omitted)
strcpy(ifr.ifr_name, device);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0)
"struct ifreq" is defined in /usr/include/linux/if.h so it can hold ip address, netmask, etc, and interface name.
It's cool, isn't it?
But I myself haven't made my own yet