Getifaddrs – Comtrol eCos User Manual

Page 521

Advertising
background image

Chapter 38. TCP/IP Library Reference

YP does not support any address families other than AF_INET and uses the

traditional database format.

BSD

March 13, 1997

BSD

getifaddrs

GETIFADDRS(3)

System Library Functions Manual

GETIFADDRS(3)

NAME

getifaddrs - get interface addresses

SYNOPSIS

#include

<

sys/types.h>

#include

<

sys/socket.h>

#include

<

ifaddrs.h>

int

getifaddrs(struct ifaddrs **ifap);

void

freeifaddrs(struct ifaddrs *ifap);

DESCRIPTION

The getifaddrs() function stores a reference to a linked list of the net-

work interfaces on the local machine in the memory referenced by ifap.

The list consists of ifaddrs structures, as defined in the include file

<

ifaddrs.h>.

The ifaddrs structure contains at least the following

entries:

struct ifaddrs

*ifa_next;

/* Pointer to next struct */

char

*ifa_name;

/* Interface name */

u_int

ifa_flags;

/* Interface flags */

struct sockaddr

*ifa_addr;

/* Interface address */

struct sockaddr

*ifa_netmask;

/* Interface netmask */

struct sockaddr

*ifa_broadaddr;

/* Interface broadcast address */

struct sockaddr

*ifa_dstaddr;

/* P2P interface destination */

void

*ifa_data;

/* Address specific data */

ifa_next

Contains a pointer to the next structure on the list.

This field

is set to NULL in last structure on the list.

ifa_name

Contains the interface name.

ifa_flags

Contains the interface flags, as set by ifconfig(8).

ifa_addr

References either the address of the interface or the link level

417

Advertising