diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libc/net/if_indextoname.3 | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/lib/libc/net/if_indextoname.3')
-rw-r--r-- | src/lib/libc/net/if_indextoname.3 | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/src/lib/libc/net/if_indextoname.3 b/src/lib/libc/net/if_indextoname.3 deleted file mode 100644 index 25d2a2722f..0000000000 --- a/src/lib/libc/net/if_indextoname.3 +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | .\" $OpenBSD: if_indextoname.3,v 1.16 2015/11/21 07:48:10 jmc Exp $ | ||
2 | .\" Copyright (c) 1983, 1991, 1993 | ||
3 | .\" The Regents of the University of California. All rights reserved. | ||
4 | .\" | ||
5 | .\" Redistribution and use in source and binary forms, with or without | ||
6 | .\" modification, are permitted provided that the following conditions | ||
7 | .\" are met: | ||
8 | .\" 1. Redistributions of source code must retain the above copyright | ||
9 | .\" notice, this list of conditions and the following disclaimer. | ||
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
11 | .\" notice, this list of conditions and the following disclaimer in the | ||
12 | .\" documentation and/or other materials provided with the distribution. | ||
13 | .\" 3. Neither the name of the University nor the names of its contributors | ||
14 | .\" may be used to endorse or promote products derived from this software | ||
15 | .\" without specific prior written permission. | ||
16 | .\" | ||
17 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
21 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
23 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
24 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
25 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
26 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
27 | .\" SUCH DAMAGE. | ||
28 | .\" | ||
29 | .\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 | ||
30 | .\" | ||
31 | .Dd $Mdocdate: November 21 2015 $ | ||
32 | .Dt IF_NAMETOINDEX 3 | ||
33 | .Os | ||
34 | .Sh NAME | ||
35 | .Nm if_nametoindex , | ||
36 | .Nm if_indextoname , | ||
37 | .Nm if_nameindex , | ||
38 | .Nm if_freenameindex | ||
39 | .Nd convert interface index to name, and vice versa | ||
40 | .Sh SYNOPSIS | ||
41 | .In sys/types.h | ||
42 | .In sys/socket.h | ||
43 | .In net/if.h | ||
44 | .Ft "unsigned int" | ||
45 | .Fn if_nametoindex "const char *ifname" | ||
46 | .Ft "char *" | ||
47 | .Fn if_indextoname "unsigned int ifindex" "char *ifname" | ||
48 | .Ft "struct if_nameindex *" | ||
49 | .Fn if_nameindex "void" | ||
50 | .Ft "void" | ||
51 | .Fn if_freenameindex "struct if_nameindex *ptr" | ||
52 | .Sh DESCRIPTION | ||
53 | These functions map interface indexes to interface names (such as | ||
54 | .Dq lo0 ) , | ||
55 | and vice versa. | ||
56 | .Pp | ||
57 | The | ||
58 | .Fn if_nametoindex | ||
59 | function converts an interface name specified by the | ||
60 | .Fa ifname | ||
61 | argument to an interface index (positive integer value). | ||
62 | If the specified interface does not exist, 0 will be returned. | ||
63 | .Pp | ||
64 | .Fn if_indextoname | ||
65 | converts an interface index specified by the | ||
66 | .Fa ifindex | ||
67 | argument to an interface name. | ||
68 | The | ||
69 | .Fa ifname | ||
70 | argument must point to a buffer of at least | ||
71 | .Dv IF_NAMESIZE | ||
72 | bytes into which the interface name corresponding to the specified index is | ||
73 | returned. | ||
74 | .Pf ( Dv IF_NAMESIZE | ||
75 | is also defined in | ||
76 | .In net/if.h | ||
77 | and its value includes a terminating NUL byte at the end of the | ||
78 | interface name.) | ||
79 | This pointer is also the return value of the function. | ||
80 | If there is no interface corresponding to the specified index, | ||
81 | .Dv NULL | ||
82 | is returned. | ||
83 | .Pp | ||
84 | .Fn if_nameindex | ||
85 | returns an array of | ||
86 | .Vt if_nameindex | ||
87 | structures. | ||
88 | .Vt if_nameindex | ||
89 | is also defined in | ||
90 | .In net/if.h , | ||
91 | and is as follows: | ||
92 | .Bd -literal -offset indent | ||
93 | struct if_nameindex { | ||
94 | unsigned int if_index; /* 1, 2, ... */ | ||
95 | char *if_name; /* NUL-terminated name */ | ||
96 | }; | ||
97 | .Ed | ||
98 | .Pp | ||
99 | The end of the array of structures is indicated by a structure with | ||
100 | an | ||
101 | .Fa if_index | ||
102 | of 0 and an | ||
103 | .Fa if_name | ||
104 | of | ||
105 | .Dv NULL . | ||
106 | The function returns a null pointer on error. | ||
107 | The memory used for this array of structures along with the interface | ||
108 | names pointed to by the | ||
109 | .Fa if_name | ||
110 | members is obtained dynamically. | ||
111 | This memory is freed by the | ||
112 | .Fn if_freenameindex | ||
113 | function. | ||
114 | .Pp | ||
115 | .Fn if_freenameindex | ||
116 | takes a pointer that was returned by | ||
117 | .Fn if_nameindex | ||
118 | as argument | ||
119 | .Pq Fa ptr , | ||
120 | and it reclaims the region allocated. | ||
121 | .Sh DIAGNOSTICS | ||
122 | .Fn if_nametoindex | ||
123 | returns 0 on error, positive integer on success. | ||
124 | .Fn if_indextoname | ||
125 | and | ||
126 | .Fn if_nameindex | ||
127 | return | ||
128 | .Dv NULL | ||
129 | on errors. | ||
130 | .Sh SEE ALSO | ||
131 | .Xr getifaddrs 3 , | ||
132 | .Xr netintro 4 | ||
133 | .Sh STANDARDS | ||
134 | .Rs | ||
135 | .%A R. Gilligan | ||
136 | .%A S. Thomson | ||
137 | .%A J. Bound | ||
138 | .%A J. McCann | ||
139 | .%A W. Stevens | ||
140 | .%D February 2003 | ||
141 | .%R RFC 3493 | ||
142 | .%T Basic Socket Interface Extensions for IPv6 | ||
143 | .Re | ||