diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/if_indextoname.3 | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/src/lib/libc/net/if_indextoname.3 b/src/lib/libc/net/if_indextoname.3 deleted file mode 100644 index 8ffc35a5fa..0000000000 --- a/src/lib/libc/net/if_indextoname.3 +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | .\" $OpenBSD: if_indextoname.3,v 1.11 2007/05/31 19:19:30 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: May 31 2007 $ | ||
| 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 | .Fd #include <sys/types.h> | ||
| 42 | .Fd #include <sys/socket.h> | ||
| 43 | .Fd #include <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 | .Aq Pa 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 | .Aq Pa 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 networking 4 | ||
| 133 | .Rs | ||
| 134 | .%A R. Gilligan | ||
| 135 | .%A S. Thomson | ||
| 136 | .%A J. Bound | ||
| 137 | .%A W. Stevens | ||
| 138 | .%T Basic Socket Interface Extensions for IPv6 | ||
| 139 | .%R RFC 2553 | ||
| 140 | .%D March 1999 | ||
| 141 | .Re | ||
| 142 | .Sh STANDARDS | ||
| 143 | These functions are defined in ``Basic Socket Interface Extensions for IPv6'' | ||
| 144 | .Pq RFC 2533 . | ||
