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