1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
26 HREF="net-common-tcpip-manpages-gethostbyname.html"><LINK
29 HREF="net-common-tcpip-manpages-getnameinfo.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-common-tcpip-manpages-gethostbyname.html"
65 >Chapter 38. TCP/IP Library Reference</TD
71 HREF="net-common-tcpip-manpages-getnameinfo.html"
85 NAME="NET-COMMON-TCPIP-MANPAGES-GETIFADDRS">getifaddrs</H1
94 >GETIFADDRS(3) System Library Functions Manual GETIFADDRS(3)
97 getifaddrs - get interface addresses
100 #include <sys/types.h>
101 #include <sys/socket.h>
102 #include <ifaddrs.h>
105 getifaddrs(struct ifaddrs **ifap);
108 freeifaddrs(struct ifaddrs *ifap);
111 The getifaddrs() function stores a reference to a linked list of the net-
112 work interfaces on the local machine in the memory referenced by ifap.
113 The list consists of ifaddrs structures, as defined in the include file
114 <ifaddrs.h>. The ifaddrs structure contains at least the following
117 struct ifaddrs *ifa_next; /* Pointer to next struct */
118 char *ifa_name; /* Interface name */
119 u_int ifa_flags; /* Interface flags */
120 struct sockaddr *ifa_addr; /* Interface address */
121 struct sockaddr *ifa_netmask; /* Interface netmask */
122 struct sockaddr *ifa_broadaddr; /* Interface broadcast address */
123 struct sockaddr *ifa_dstaddr; /* P2P interface destination */
124 void *ifa_data; /* Address specific data */
127 Contains a pointer to the next structure on the list. This field
128 is set to NULL in last structure on the list.
131 Contains the interface name.
134 Contains the interface flags, as set by ifconfig(8).
137 References either the address of the interface or the link level
138 address of the interface, if one exists, otherwise it is NULL.
139 (The sa_family field of the ifa_addr field should be consulted to
140 determine the format of the ifa_addr address.)
143 References the netmask associated with ifa_addr, if one is set,
144 otherwise it is NULL.
147 This field, which should only be referenced for non-P2P inter-
148 faces, references the broadcast address associated with ifa_addr,
149 if one exists, otherwise it is NULL.
152 References the destination address on a P2P interface, if one
153 exists, otherwise it is NULL.
156 References address family specific data. For AF_LINK addresses
157 it contains a pointer to the struct if_data (as defined in
158 include file <net/if.h>) which contains various interface
159 attributes and statistics. For all other address families, it
160 contains a pointer to the struct ifa_data (as defined in include
161 file <net/if.h>) which contains per-address interface statistics.
163 The data returned by getifaddrs() is dynamically allocated and should be
164 freed using freeifaddrs() when no longer needed.
167 Upon successful completion, a value of 0 is returned. Otherwise, a value
168 of -1 is returned and errno is set to indicate the error.
171 The getifaddrs() may fail and set errno for any of the errors specified
172 for the library routines ioctl(2), socket(2), malloc(3), or sysctl(3).
175 If both <net/if.h> and <ifaddrs.h> are being included, <net/if.h> must be
176 included before <ifaddrs.h>.
179 ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8)
182 The getifaddrs() function first appeared in BSDI BSD/OS. The function is
183 supplied on OpenBSD since OpenBSD 2.7.
185 BSD February 24, 2003 BSD
196 SUMMARY="Footer navigation table"
207 HREF="net-common-tcpip-manpages-gethostbyname.html"
225 HREF="net-common-tcpip-manpages-getnameinfo.html"
241 HREF="tcpip-library-reference.html"