2 .\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by Bill Paul.
15 .\" 4. Neither the name of the author nor the names of any co-contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" $FreeBSD: src/lib/libc/net/ethers.3,v 1.18 2001/10/01 16:08:55 ru Exp $
43 .Nd Ethernet address conversion and lookup routines
51 .Fn ether_line "const char *l" "struct ether_addr *e" "char *hostname"
52 .Ft struct ether_addr *
53 .Fn ether_aton "const char *a"
55 .Fn ether_ntoa "const struct ether_addr *n"
57 .Fn ether_ntohost "char *hostname" "const struct ether_addr *e"
59 .Fn ether_hostton "const char *hostname" "struct ether_addr *e"
61 These functions operate on ethernet addresses using an
63 structure, which is defined in the header file
64 .Aq Pa netinet/if_ether.h :
65 .Bd -literal -offset indent
67 * The number of bytes in an ethernet (MAC) address.
69 #define ETHER_ADDR_LEN 6
72 * Structure of a 48-bit Ethernet address.
75 u_char octet[ETHER_ADDR_LEN];
89 to the ethernet address specified in the string and
92 This function is used to parse lines from
94 into their component parts.
100 representation of an ethernet address into an
105 converts an ethernet address specified as an
115 functions map ethernet addresses to their corresponding hostnames
120 converts from ethernet address to hostname, and
122 converts from hostname to ethernet address.
125 returns zero on success and non-zero if it was unable to parse
126 any part of the supplied line
128 It returns the extracted ethernet address in the supplied
132 and the hostname in the supplied string
137 returns a pointer to a string containing an
139 representation of an ethernet address.
140 If it is unable to convert
143 structure, it returns a
148 returns a pointer to an
150 structure on success and a
158 functions both return zero on success or non-zero if they were
159 unable to find a match in the
163 The user must insure that the hostname strings passed to the
168 functions are large enough to contain the returned hostnames.
172 contains a line with a single + in it, the
176 functions will attempt to consult the NIS
180 maps in addition to the data in the
191 functions returns values that are stored in static memory areas
192 which may be overwritten the next time they are called.
194 This particular implementation of the
196 library functions were written for and first appeared in