summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ethers.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/ethers.3')
-rw-r--r--src/lib/libc/net/ethers.3109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/lib/libc/net/ethers.3 b/src/lib/libc/net/ethers.3
new file mode 100644
index 0000000000..f5db308115
--- /dev/null
+++ b/src/lib/libc/net/ethers.3
@@ -0,0 +1,109 @@
1.\" $OpenBSD: ethers.3,v 1.9 1998/05/12 09:15:19 deraadt Exp $
2.\"
3.\" Written by roland@frob.com. Public domain.
4.\"
5.Dd December 16, 1993
6.Dt ETHERS 3
7.Os
8.Sh NAME
9.Nm ether_aton ,
10.Nm ether_ntoa ,
11.Nm ether_addr ,
12.Nm ether_ntohost ,
13.Nm ether_hostton ,
14.Nm ether_line
15.Nd get ethers entry
16.Sh SYNOPSIS
17.Fd #include <netinet/if_ether.h>
18.Ft char *
19.Fn ether_ntoa "struct ether_addr *e"
20.Ft struct ether_addr *
21.Fn ether_aton "char *s"
22.Ft int
23.Fn ether_ntohost "char *hostname" "struct ether_addr *e"
24.Ft int
25.Fn ether_hostton "char *hostname" "struct ether_addr *e"
26.Ft int
27.Fn ether_line "char *l" "struct ether_addr *e" "char *hostname"
28.Sh DESCRIPTION
29Ethernet addresses are represented by the
30following structure:
31.Bd -literal -offset indent
32struct ether_addr {
33 u_int8_t ether_addr_octet[6];
34};
35.Ed
36.Pp
37The
38.Fn ether_ntoa
39function converts this structure into an ASCII string of the form
40``xx:xx:xx:xx:xx:xx'', consisting of 6 hexadecimal numbers separated
41by colons. It returns a pointer to a static buffer that is reused for
42each call.
43The
44.Fn ether_aton
45converts an ASCII string of the same form and to a structure
46containing the 6 octets of the address. It returns a pointer to a
47static structure that is reused for each call.
48.Pp
49The
50.Fn ether_ntohost
51and
52.Fn ether_hostton
53functions interrogate the data base mapping host names to Ethernet
54addresses,
55.Pa /etc/ethers .
56The
57.Fn ether_ntohost
58function looks up the given Ethernet address and writes the associated
59host name into the character buffer passed. This buffer should be
60.Ev MAXHOSTNAMELEN
61characters in size.
62The
63.Fn ether_hostton
64function looks up the given host name and writes the associated
65Ethernet address into the structure passed. Both functions return
66zero if they find the requested host name or address, and -1 if not.
67.Pp
68Each call reads
69.Pa /etc/ethers
70from the beginning; if a + appears alone on a line in the file, then
71.Fn ether_hostton
72will consult the
73.Pa ethers.byname
74YP map, and
75.Fn ether_ntohost
76will consult the
77.Pa ethers.byaddr
78YP map.
79.Pp
80The
81.Fn ether_line
82function parses a line from the
83.Pa /etc/ethers
84file and fills in the passed ``struct ether_addr'' and character
85buffer with the Ethernet address and host name on the line. It
86returns zero if the line was successfully parsed and -1 if not.
87The character buffer buffer should be
88.Ev MAXHOSTNAMELEN
89characters in size.
90.Sh FILES
91.Bl -tag -width /etc/ethers -compact
92.It Pa /etc/ethers
93.El
94.Sh SEE ALSO
95.Xr ethers 5
96.Sh HISTORY
97The
98.Fn ether_ntoa ,
99.Fn ether_aton ,
100.Fn ether_ntohost ,
101.Fn ether_hostton ,
102and
103.Fn ether_line
104functions were adopted from SunOS and appeared in
105NetBSD 0.9b.
106.Sh BUGS
107The data space used by these functions is static; if future use
108requires the data, it should be copied before any subsequent calls to
109these functions overwrite it.