70
71 ENXIO. If there was a system error,
72 such as running out of memory, the
73 return value is 0 and errno is set to
74 the proper value, for example, ENOMEM.
75
76
77 if_indextoname() The if_indextoname() function maps an
78 interface index into its corresponding
79 name. This pointer is also the return
80 value of the function. If there is no
81 interface corresponding to the speci-
82 fied index, NULL is returned, and
83 errno is set to ENXIO, if there was a
84 system error, such as running out of
85 memory, if_indextoname() returns NULL
86 and errno would be set to the proper
87 value, for example, ENOMEM.
88
89
90 *if_nameindex() The if_nameindex() function returns an
91 array of if_nameindex structures, one
92 structure per interface. The
93 if_nameindex structure holds the
94 information about a single interface
95 and is defined when the <net/if.h>
96 header is included:
97
98 struct if_nameindex
99 unsigned int if_index; /* 1, 2, ... */
100 char *if_name; /* null terminated name: "eri0", ... */
101 };
102
103 The end of the array of structures is
104 indicated by a structure with an
105 if_index of 0 and an if_name of NULL.
106 The function returns a null pointer
107 upon an error and sets errno to the
108 appropriate value. The memory used for
109 this array of structures along with
110 the interface names pointed to by the
111 if_name members is obtained dynami-
112 cally. This memory is freed by the
113 if_freenameindex() function.
114
115
116 if_freenameindex() The if_freenameindex() function frees
117 the dynamic memory that was allocated
118 by if_nameindex(). The argument to
119 this function must be a pointer that
120 was returned by if_nameindex().
121
122
|
70
71 ENXIO. If there was a system error,
72 such as running out of memory, the
73 return value is 0 and errno is set to
74 the proper value, for example, ENOMEM.
75
76
77 if_indextoname() The if_indextoname() function maps an
78 interface index into its corresponding
79 name. This pointer is also the return
80 value of the function. If there is no
81 interface corresponding to the speci-
82 fied index, NULL is returned, and
83 errno is set to ENXIO, if there was a
84 system error, such as running out of
85 memory, if_indextoname() returns NULL
86 and errno would be set to the proper
87 value, for example, ENOMEM.
88
89
90 if_nameindex() The if_nameindex() function returns an
91 array of if_nameindex structures, one
92 structure per interface. The
93 if_nameindex structure holds the
94 information about a single interface
95 and is defined when the <net/if.h>
96 header is included:
97
98 struct if_nameindex
99 unsigned int if_index; /* 1, 2, ... */
100 char *if_name; /* "net0", ... */
101 };
102
103 While any IPMP IP interfaces are
104 returned by *if_nameindex()*, the
105 underlying IP interfaces that comprise
106 each IPMP group are not returned.
107
108 The end of the array of structures is
109 indicated by a structure with an
110 if_index of 0 and an if_name of NULL.
111 The function returns a null pointer
112 upon an error and sets errno to the
113 appropriate value. The memory used for
114 this array of structures along with
115 the interface names pointed to by the
116 if_name members is obtained dynami-
117 cally. This memory is freed by the
118 if_freenameindex() function.
119
120
121 if_freenameindex() The if_freenameindex() function frees
122 the dynamic memory that was allocated
123 by if_nameindex(). The argument to
124 this function must be a pointer that
125 was returned by if_nameindex().
126
127
|