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.10.2.11 2002/02/01 15:51:17 ru Exp $
32 .\" $DragonFly: src/lib/libc/net/ethers.3,v 1.4 2006/05/26 19:39:37 swildner Exp $
44 .Nd Ethernet address conversion and lookup routines
52 .Fn ether_line "const char *l" "struct ether_addr *e" "char *hostname"
53 .Ft struct ether_addr *
54 .Fn ether_aton "const char *a"
56 .Fn ether_ntoa "const struct ether_addr *n"
58 .Fn ether_ntohost "char *hostname" "const struct ether_addr *e"
60 .Fn ether_hostton "const char *hostname" "struct ether_addr *e"
62 These functions operate on ethernet addresses using an
64 structure, which is defined in the header file
65 .In netinet/if_ether.h :
66 .Bd -literal -offset indent
68 * The number of bytes in an ethernet (MAC) address.
70 #define ETHER_ADDR_LEN 6
73 * Structure of a 48-bit Ethernet address.
76 u_char octet[ETHER_ADDR_LEN];
90 to the ethernet address specified in the string and
93 This function is used to parse lines from
95 into their component parts.
101 representation of an ethernet address into an
106 converts an ethernet address specified as an
116 functions map ethernet addresses to their corresponding hostnames
121 converts from ethernet address to hostname, and
123 converts from hostname to ethernet address.
126 returns zero on success and non-zero if it was unable to parse
127 any part of the supplied line
129 It returns the extracted ethernet address in the supplied
133 and the hostname in the supplied string
138 returns a pointer to a string containing an
140 representation of an ethernet address.
141 If it is unable to convert
144 structure, it returns a
149 returns a pointer to an
151 structure on success and a
159 functions both return zero on success or non-zero if they were
160 unable to find a match in the
164 The user must insure that the hostname strings passed to the
169 functions are large enough to contain the returned hostnames.
173 contains a line with a single + in it, the
177 functions will attempt to consult the NIS
181 maps in addition to the data in the
188 This particular implementation of the
190 library functions were written for and first appeared in
197 functions returns values that are stored in static memory areas
198 which may be overwritten the next time they are called.