]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-if-nametoindex.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-if-nametoindex.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 >if_nametoindex</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="getservent"
26 HREF="net-common-tcpip-manpages-getservent.html"><LINK
27 REL="NEXT"
28 TITLE="inet"
29 HREF="net-common-tcpip-manpages-inet.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-getservent.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-inet.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-IF-NAMETOINDEX">if_nametoindex</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >IF_NAMETOINDEX(3)       System Library Functions Manual      IF_NAMETOINDEX(3)
95
96 NAME
97      if_nametoindex, if_indextoname, if_nameindex, if_freenameindex - convert
98      interface index to name, and vice versa
99
100 SYNOPSIS
101      #include &lt;net/if.h&#62;
102
103      unsigned int
104      if_nametoindex(const char *ifname);
105
106      char *
107      if_indextoname(unsigned int ifindex, char *ifname);
108
109      struct if_nameindex *
110      if_nameindex(void);
111
112      void
113      if_freenameindex(struct if_nameindex *ptr);
114
115 DESCRIPTION
116      These functions map interface indexes to interface names (such as
117      ``lo0''), and vice versa.
118
119      The if_nametoindex() function converts an interface name specified by the
120      ifname argument to an interface index (positive integer value).  If the
121      specified interface does not exist, 0 will be returned.
122
123      if_indextoname() converts an interface index specified by the ifindex
124      argument to an interface name.  The ifname argument must point to a
125      buffer of at least IF_NAMESIZE bytes into which the interface name corre-
126      sponding to the specified index is returned.  (IF_NAMESIZE is also
127      defined in &lt;net/if.h&#62; and its value includes a terminating null byte at
128      the end of the interface name.)  This pointer is also the return value of
129      the function.  If there is no interface corresponding to the specified
130      index, NULL is returned.
131
132      if_nameindex() returns an array of if_nameindex structures.
133      if_nametoindex is also defined in &lt;net/if.h&#62;, and is as follows:
134
135      struct if_nameindex {
136          unsigned int   if_index;  /* 1, 2, ... */
137          char          *if_name;   /* null terminated name: "le0", ... */
138      };
139
140      The end of the array of structures is indicated by a structure with an
141      if_index of 0 and an if_name of NULL.  The function returns a null
142      pointer on error.  The memory used for this array of structures along
143      with the interface names pointed to by the if_name members is obtained
144      dynamically.  This memory is freed by the if_freenameindex() function.
145
146      if_freenameindex() takes a pointer that was returned by if_nameindex() as
147      argument (ptr), and it reclaims the region allocated.
148
149 DIAGNOSTICS
150      if_nametoindex() returns 0 on error, positive integer on success.
151      if_indextoname() and if_nameindex() return NULL on errors.
152
153 SEE ALSO
154      R. Gilligan, S.  Thomson, J. Bound, and W. Stevens, ``Basic Socket Inter-
155      face Extensions for IPv6,'' RFC2553, March 1999.
156
157 STANDARDS
158      These functions are defined in ``Basic Socket Interface Extensions for
159      IPv6'' (RFC2533).
160
161 BSD                              May 21, 1998                              BSD
162     </PRE
163 ></TD
164 ></TR
165 ></TABLE
166 ></DIV
167 ><DIV
168 CLASS="NAVFOOTER"
169 ><HR
170 ALIGN="LEFT"
171 WIDTH="100%"><TABLE
172 SUMMARY="Footer navigation table"
173 WIDTH="100%"
174 BORDER="0"
175 CELLPADDING="0"
176 CELLSPACING="0"
177 ><TR
178 ><TD
179 WIDTH="33%"
180 ALIGN="left"
181 VALIGN="top"
182 ><A
183 HREF="net-common-tcpip-manpages-getservent.html"
184 ACCESSKEY="P"
185 >Prev</A
186 ></TD
187 ><TD
188 WIDTH="34%"
189 ALIGN="center"
190 VALIGN="top"
191 ><A
192 HREF="ecos-ref.html"
193 ACCESSKEY="H"
194 >Home</A
195 ></TD
196 ><TD
197 WIDTH="33%"
198 ALIGN="right"
199 VALIGN="top"
200 ><A
201 HREF="net-common-tcpip-manpages-inet.html"
202 ACCESSKEY="N"
203 >Next</A
204 ></TD
205 ></TR
206 ><TR
207 ><TD
208 WIDTH="33%"
209 ALIGN="left"
210 VALIGN="top"
211 >getservent</TD
212 ><TD
213 WIDTH="34%"
214 ALIGN="center"
215 VALIGN="top"
216 ><A
217 HREF="tcpip-library-reference.html"
218 ACCESSKEY="U"
219 >Up</A
220 ></TD
221 ><TD
222 WIDTH="33%"
223 ALIGN="right"
224 VALIGN="top"
225 >inet</TD
226 ></TR
227 ></TABLE
228 ></DIV
229 ></BODY
230 ></HTML
231 >