1 .\" Copyright (c) 1995 Bill Paul <wpaul@ctr.columbia.edu>.
2 .\" Copyright (c) 2007 Robert N. M. Watson
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by Bill Paul.
16 .\" 4. Neither the name of the author nor the names of any co-contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 .Nd Ethernet address conversion and lookup routines
54 .Fn ether_line "const char *l" "struct ether_addr *e" "char *hostname"
55 .Ft struct ether_addr *
56 .Fn ether_aton "const char *a"
57 .Ft struct ether_addr *
58 .Fn ether_aton_r "const char *a" "struct ether_addr *e"
60 .Fn ether_ntoa "const struct ether_addr *n"
62 .Fn ether_ntoa_r "const struct ether_addr *n" "char *buf"
64 .Fn ether_ntohost "char *hostname" "const struct ether_addr *e"
66 .Fn ether_hostton "const char *hostname" "struct ether_addr *e"
68 These functions operate on ethernet addresses using an
70 structure, which is defined in the header file
72 .Bd -literal -offset indent
74 * The number of bytes in an ethernet (MAC) address.
76 #define ETHER_ADDR_LEN 6
79 * Structure of a 48-bit Ethernet address.
82 u_char octet[ETHER_ADDR_LEN];
96 to the ethernet address specified in the string and
99 This function is used to parse lines from
101 into their component parts.
109 representation of ethernet addresses into
117 convert ethernet addresses specified as
127 functions map ethernet addresses to their corresponding hostnames
134 converts from ethernet address to hostname, and
136 converts from hostname to ethernet address.
141 returns zero on success and non-zero if it was unable to parse
142 any part of the supplied line
144 It returns the extracted ethernet address in the supplied
148 and the hostname in the supplied string
155 functions return a pointer to a string containing an
157 representation of an ethernet address.
158 If it is unable to convert
161 structure, it returns a
165 stores the result in a static buffer;
167 stores the result in a user-passed buffer.
173 return a pointer to an
175 structure on success and a
179 stores the result in a static buffer;
181 stores the result in a user-passed buffer.
187 functions both return zero on success or non-zero if they were
188 unable to find a match in the
192 The user must ensure that the hostname strings passed to the
197 functions are large enough to contain the returned hostnames.
201 contains a line with a single + in it, the
205 functions will attempt to consult the NIS
209 maps in addition to the data in the
216 This particular implementation of the
218 library functions were written for and first appeared in
220 Thread-safe function variants first appeared in
227 functions returns values that are stored in static memory areas
228 which may be overwritten the next time they are called.
231 accepts a character buffer pointer, but not a buffer length.
232 The caller must ensure adequate space is available in the buffer in order to
233 avoid a buffer overflow.