|
XSocket API
2.0
XIA Socket Library
|
Xgetifaddrs(), Xfreeifaddrs() - get interface addresses. More...
#include "Xsocket.h"Functions | |
| int | Xgetifaddrs (struct ifaddrs **ifap) |
| get a list of XIA network interfaces More... | |
| void | Xfreeifaddrs (struct ifaddrs *ifa) |
| free memory allocated by Xgetifaddrs More... | |
| void Xfreeifaddrs | ( | struct ifaddrs * | ifa | ) |
Free's the memory allocated by XgetifAddrs().
| ifa | pointer to ifaddr structure to be freed. |
| int Xgetifaddrs | ( | struct ifaddrs ** | ifap | ) |
The Xgetifaddrs() function creates a linked list of structures describing XIA enabled network interfaces of the local system, and stores the address of the first item of the list in *ifap. The list consists of ifaddrs structures, defined as follows:
struct ifaddrs {
struct ifaddrs *ifa_next; // Next item in list
char *ifa_name; // Name of interface
unsigned int ifa_flags; // Flags from SIOCGIFFLAGS
struct sockaddr *ifa_addr; // Address of interface
struct sockaddr *ifa_netmask; // Netmask of interface
union {
struct sockaddr *ifu_broadaddr;
// Broadcast address of interface
struct sockaddr *ifu_dstaddr;
// Point-to-point destination address
} ifa_ifu;
#define ifa_broadaddr ifa_ifu.ifu_broadaddr
#define ifa_dstaddr ifa_ifu.ifu_dstaddr
void *ifa_data; // Address-specific data
};
The ifa_next field contains a pointer to the next structure on the list, or NULL if this is the last item of the list.
The ifa_name points to the null-terminated interface name.
The ifa_flags field contains the interface flags, as returned by the SIOCGIFFLAGS ioctl(2) operation (see netdevice(7) for a list of these flags).
The ifa_addr field points to a structure containing the interface address. Under XIA, these will all be of type sockaddr_x. This field may contain a null pointer.
The ifa_netmask field points will always be NULL under XIA.
Currently the ifa_ifu union will never contain a broadcast address.
The ifa_data pointer will always be NULL
The data returned by Xgetifaddrs() is dynamically allocated and should be freed using Xfreeifaddrs() when no longer needed.
| ifap | pointer to a pointer to accept the returned ifaddrs structure |
1.8.11