ifaddrs

Structure that describes an Internet host

Synopsis:

#include <ifaddrs.h>

struct ifaddrs {
    struct ifaddrs *  ifa_next;
    char *            ifa_name;
    u_int             ifa_flags;
    struct sockaddr * ifa_addr;
    struct sockaddr * ifa_netmask;
    struct sockaddr * ifa_dstaddr;
    void *            ifa_data;
};

Description:

The ifaddrs structure contains the following entries:

ifa_next
A pointer to the next structure in the list. This field is NULL in the last structure in the list.
ifa_name
The interface name.
ifa_flags
The interface flags, as set by the ifconfig utility.
ifa_addr
Either the address of the interface or the link-level address of the interface, if one exists; otherwise it's NULL. See the sa_family member of the sockaddr structure pointed to by ifa_addr to determine the format of the address.
ifa_netmask
The netmask associated with ifa_addr, if one is set; otherwise it's NULL.
ifa_dstaddr
The destination address on a P2P interface, if one exists; otherwise it's NULL. If the interface isn't a P2P interface, ifa_dstaddr contains the broadcast address associated with ifa_addr, if one exists; otherwise it's NULL (see <ifaddr.h>).
ifa_data
Currently, this is set to NULL.

Classification:

Unix

See also:

freeifaddrs(), getifaddrs()