]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-getifaddrs.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-getifaddrs.html
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.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >getifaddrs</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="gethostbyname"
26 HREF="net-common-tcpip-manpages-gethostbyname.html"><LINK
27 REL="NEXT"
28 TITLE="getnameinfo"
29 HREF="net-common-tcpip-manpages-getnameinfo.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="net-common-tcpip-manpages-gethostbyname.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-getnameinfo.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-GETIFADDRS">getifaddrs</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >GETIFADDRS(3)           System Library Functions Manual          GETIFADDRS(3)
95
96 NAME
97      getifaddrs - get interface addresses
98
99 SYNOPSIS
100      #include &lt;sys/types.h&#62;
101      #include &lt;sys/socket.h&#62;
102      #include &lt;ifaddrs.h&#62;
103
104      int
105      getifaddrs(struct ifaddrs **ifap);
106
107      void
108      freeifaddrs(struct ifaddrs *ifap);
109
110 DESCRIPTION
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      &lt;ifaddrs.h&#62;.  The ifaddrs structure contains at least the following
115      entries:
116
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 */
125
126      ifa_next
127              Contains a pointer to the next structure on the list.  This field
128              is set to NULL in last structure on the list.
129
130      ifa_name
131              Contains the interface name.
132
133      ifa_flags
134              Contains the interface flags, as set by ifconfig(8).
135
136      ifa_addr
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.)
141
142      ifa_netmask
143              References the netmask associated with ifa_addr, if one is set,
144              otherwise it is NULL.
145
146      ifa_broadaddr
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.
150
151      ifa_dstaddr
152              References the destination address on a P2P interface, if one
153              exists, otherwise it is NULL.
154
155      ifa_data
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 &lt;net/if.h&#62;) 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 &lt;net/if.h&#62;) which contains per-address interface statistics.
162
163      The data returned by getifaddrs() is dynamically allocated and should be
164      freed using freeifaddrs() when no longer needed.
165
166 RETURN VALUES
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.
169
170 ERRORS
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).
173
174 BUGS
175      If both &lt;net/if.h&#62; and &lt;ifaddrs.h&#62; are being included, &lt;net/if.h&#62; must be
176      included before &lt;ifaddrs.h&#62;.
177
178 SEE ALSO
179      ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8)
180
181 HISTORY
182      The getifaddrs() function first appeared in BSDI BSD/OS.  The function is
183      supplied on OpenBSD since OpenBSD 2.7.
184
185 BSD                            February 24, 2003                           BSD
186     </PRE
187 ></TD
188 ></TR
189 ></TABLE
190 ></DIV
191 ><DIV
192 CLASS="NAVFOOTER"
193 ><HR
194 ALIGN="LEFT"
195 WIDTH="100%"><TABLE
196 SUMMARY="Footer navigation table"
197 WIDTH="100%"
198 BORDER="0"
199 CELLPADDING="0"
200 CELLSPACING="0"
201 ><TR
202 ><TD
203 WIDTH="33%"
204 ALIGN="left"
205 VALIGN="top"
206 ><A
207 HREF="net-common-tcpip-manpages-gethostbyname.html"
208 ACCESSKEY="P"
209 >Prev</A
210 ></TD
211 ><TD
212 WIDTH="34%"
213 ALIGN="center"
214 VALIGN="top"
215 ><A
216 HREF="ecos-ref.html"
217 ACCESSKEY="H"
218 >Home</A
219 ></TD
220 ><TD
221 WIDTH="33%"
222 ALIGN="right"
223 VALIGN="top"
224 ><A
225 HREF="net-common-tcpip-manpages-getnameinfo.html"
226 ACCESSKEY="N"
227 >Next</A
228 ></TD
229 ></TR
230 ><TR
231 ><TD
232 WIDTH="33%"
233 ALIGN="left"
234 VALIGN="top"
235 >gethostbyname</TD
236 ><TD
237 WIDTH="34%"
238 ALIGN="center"
239 VALIGN="top"
240 ><A
241 HREF="tcpip-library-reference.html"
242 ACCESSKEY="U"
243 >Up</A
244 ></TD
245 ><TD
246 WIDTH="33%"
247 ALIGN="right"
248 VALIGN="top"
249 >getnameinfo</TD
250 ></TR
251 ></TABLE
252 ></DIV
253 ></BODY
254 ></HTML
255 >