diff options
author | cvs2svn <admin@example.com> | 1998-10-19 21:47:13 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 1998-10-19 21:47:13 +0000 |
commit | f954a53a9a7dced3fb4c80b1e8dd267981ae025d (patch) | |
tree | c667406046ddb1efca5ed4316b02e43494241660 /src/lib/libc/net/ethers.3 | |
parent | 536c76cbb863bab152f19842ab88772c01e922c7 (diff) | |
download | openbsd-OPENBSD_2_4.tar.gz openbsd-OPENBSD_2_4.tar.bz2 openbsd-OPENBSD_2_4.zip |
This commit was manufactured by cvs2git to create branch 'OPENBSD_2_4'.OPENBSD_2_4
Diffstat (limited to 'src/lib/libc/net/ethers.3')
-rw-r--r-- | src/lib/libc/net/ethers.3 | 109 |
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 | ||
29 | Ethernet addresses are represented by the | ||
30 | following structure: | ||
31 | .Bd -literal -offset indent | ||
32 | struct ether_addr { | ||
33 | u_int8_t ether_addr_octet[6]; | ||
34 | }; | ||
35 | .Ed | ||
36 | .Pp | ||
37 | The | ||
38 | .Fn ether_ntoa | ||
39 | function converts this structure into an ASCII string of the form | ||
40 | ``xx:xx:xx:xx:xx:xx'', consisting of 6 hexadecimal numbers separated | ||
41 | by colons. It returns a pointer to a static buffer that is reused for | ||
42 | each call. | ||
43 | The | ||
44 | .Fn ether_aton | ||
45 | converts an ASCII string of the same form and to a structure | ||
46 | containing the 6 octets of the address. It returns a pointer to a | ||
47 | static structure that is reused for each call. | ||
48 | .Pp | ||
49 | The | ||
50 | .Fn ether_ntohost | ||
51 | and | ||
52 | .Fn ether_hostton | ||
53 | functions interrogate the data base mapping host names to Ethernet | ||
54 | addresses, | ||
55 | .Pa /etc/ethers . | ||
56 | The | ||
57 | .Fn ether_ntohost | ||
58 | function looks up the given Ethernet address and writes the associated | ||
59 | host name into the character buffer passed. This buffer should be | ||
60 | .Ev MAXHOSTNAMELEN | ||
61 | characters in size. | ||
62 | The | ||
63 | .Fn ether_hostton | ||
64 | function looks up the given host name and writes the associated | ||
65 | Ethernet address into the structure passed. Both functions return | ||
66 | zero if they find the requested host name or address, and -1 if not. | ||
67 | .Pp | ||
68 | Each call reads | ||
69 | .Pa /etc/ethers | ||
70 | from the beginning; if a + appears alone on a line in the file, then | ||
71 | .Fn ether_hostton | ||
72 | will consult the | ||
73 | .Pa ethers.byname | ||
74 | YP map, and | ||
75 | .Fn ether_ntohost | ||
76 | will consult the | ||
77 | .Pa ethers.byaddr | ||
78 | YP map. | ||
79 | .Pp | ||
80 | The | ||
81 | .Fn ether_line | ||
82 | function parses a line from the | ||
83 | .Pa /etc/ethers | ||
84 | file and fills in the passed ``struct ether_addr'' and character | ||
85 | buffer with the Ethernet address and host name on the line. It | ||
86 | returns zero if the line was successfully parsed and -1 if not. | ||
87 | The character buffer buffer should be | ||
88 | .Ev MAXHOSTNAMELEN | ||
89 | characters 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 | ||
97 | The | ||
98 | .Fn ether_ntoa , | ||
99 | .Fn ether_aton , | ||
100 | .Fn ether_ntohost , | ||
101 | .Fn ether_hostton , | ||
102 | and | ||
103 | .Fn ether_line | ||
104 | functions were adopted from SunOS and appeared in | ||
105 | NetBSD 0.9b. | ||
106 | .Sh BUGS | ||
107 | The data space used by these functions is static; if future use | ||
108 | requires the data, it should be copied before any subsequent calls to | ||
109 | these functions overwrite it. | ||