diff options
Diffstat (limited to 'src/lib/libc/net/ethers.3')
-rw-r--r-- | src/lib/libc/net/ethers.3 | 119 |
1 files changed, 119 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..0509c121b8 --- /dev/null +++ b/src/lib/libc/net/ethers.3 | |||
@@ -0,0 +1,119 @@ | |||
1 | .\" $OpenBSD: ethers.3,v 1.14 2001/08/06 10:42:26 mpech 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 | ||
40 | .Tn ASCII | ||
41 | string of the form | ||
42 | .Dq xx:xx:xx:xx:xx:xx , | ||
43 | consisting of 6 hexadecimal numbers separated | ||
44 | by colons. | ||
45 | It returns a pointer to a static buffer that is reused for each call. | ||
46 | The | ||
47 | .Fn ether_aton | ||
48 | converts an | ||
49 | .Tn ASCII | ||
50 | string of the same form and to a structure | ||
51 | containing the 6 octets of the address. | ||
52 | It returns a pointer to a static structure that is reused for each call. | ||
53 | .Pp | ||
54 | The | ||
55 | .Fn ether_ntohost | ||
56 | and | ||
57 | .Fn ether_hostton | ||
58 | functions interrogate the database mapping host names to Ethernet | ||
59 | addresses, | ||
60 | .Pa /etc/ethers . | ||
61 | The | ||
62 | .Fn ether_ntohost | ||
63 | function looks up the given Ethernet address and writes the associated | ||
64 | host name into the character buffer passed. | ||
65 | This buffer should be | ||
66 | .Dv MAXHOSTNAMELEN | ||
67 | characters in size. | ||
68 | The | ||
69 | .Fn ether_hostton | ||
70 | function looks up the given host name and writes the associated | ||
71 | Ethernet address into the structure passed. | ||
72 | Both functions return | ||
73 | zero if they find the requested host name or address, and \-1 if not. | ||
74 | .Pp | ||
75 | Each call reads | ||
76 | .Pa /etc/ethers | ||
77 | from the beginning; if a | ||
78 | .Ql + | ||
79 | appears alone on a line in the file, then | ||
80 | .Fn ether_hostton | ||
81 | will consult the | ||
82 | .Pa ethers.byname | ||
83 | YP map, and | ||
84 | .Fn ether_ntohost | ||
85 | will consult the | ||
86 | .Pa ethers.byaddr | ||
87 | YP map. | ||
88 | .Pp | ||
89 | The | ||
90 | .Fn ether_line | ||
91 | function parses a line from the | ||
92 | .Pa /etc/ethers | ||
93 | file and fills in the passed | ||
94 | .Li struct ether_addr | ||
95 | and character buffer with the Ethernet address and host name on the line. | ||
96 | It returns zero if the line was successfully parsed and \-1 if not. | ||
97 | The character buffer should be | ||
98 | .Dv MAXHOSTNAMELEN | ||
99 | characters in size. | ||
100 | .Sh FILES | ||
101 | .Bl -tag -width /etc/ethers -compact | ||
102 | .It Pa /etc/ethers | ||
103 | .El | ||
104 | .Sh SEE ALSO | ||
105 | .Xr ethers 5 | ||
106 | .Sh HISTORY | ||
107 | The | ||
108 | .Fn ether_ntoa , | ||
109 | .Fn ether_aton , | ||
110 | .Fn ether_ntohost , | ||
111 | .Fn ether_hostton , | ||
112 | and | ||
113 | .Fn ether_line | ||
114 | functions were adopted from SunOS and appeared in | ||
115 | .Nx 0.9 b. | ||
116 | .Sh BUGS | ||
117 | The data space used by these functions is static; if future use | ||
118 | requires the data, it should be copied before any subsequent calls to | ||
119 | these functions overwrite it. | ||