]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2002 Ian Redfern (redferni@logica.com) |
2 | .\" | |
4b72fb64 | 3 | .\" %%%LICENSE_START(verbatim) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" FreeBSD 4.4 man pages | |
28 | .\" | |
29 | .\" Minor additions, aeb, 2002-07-20 | |
30 | .\" | |
69962544 | 31 | .TH ETHER_ATON 3 2002-07-20 "GNU" "Linux Programmer's Manual" |
fea681da | 32 | .SH NAME |
c13182ef | 33 | ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line, |
fea681da MK |
34 | ether_ntoa_r, ether_aton_r \- Ethernet address manipulation routines |
35 | .SH SYNOPSIS | |
36 | .nf | |
37 | .B #include <netinet/ether.h> | |
38 | .sp | |
b9f02710 | 39 | .BI "char *ether_ntoa(const struct ether_addr *" addr ); |
fea681da | 40 | .sp |
b9f02710 | 41 | .BI "struct ether_addr *ether_aton(const char *" asc ); |
fea681da | 42 | .sp |
b9f02710 | 43 | .BI "int ether_ntohost(char *" hostname ", const struct ether_addr *" addr ); |
fea681da | 44 | .sp |
b9f02710 | 45 | .BI "int ether_hostton(const char *" hostname ", struct ether_addr *" addr ); |
fea681da | 46 | .sp |
b9f02710 MK |
47 | .BI "int ether_line(const char *" line ", struct ether_addr *" addr , |
48 | .BI " char *" hostname ); | |
fea681da MK |
49 | .sp |
50 | /* GNU extensions */ | |
51 | .br | |
b9f02710 | 52 | .BI "char *ether_ntoa_r(const struct ether_addr *" addr ", char *" buf ); |
fea681da | 53 | .sp |
c13182ef | 54 | .BI "struct ether_addr *ether_aton_r(const char *" asc , |
b9f02710 | 55 | .BI " struct ether_addr *" addr ); |
fea681da MK |
56 | .fi |
57 | .SH DESCRIPTION | |
60a90ecd MK |
58 | .BR ether_aton () |
59 | converts the 48-bit Ethernet host address \fIasc\fP | |
fea681da MK |
60 | from the standard hex-digits-and-colons notation into binary data in |
61 | network byte order and returns a pointer to it in a statically | |
62 | allocated buffer, which subsequent calls will | |
60a90ecd MK |
63 | overwrite. |
64 | .BR ether_aton () | |
65 | returns NULL if the address is invalid. | |
fea681da | 66 | .PP |
60a90ecd MK |
67 | The |
68 | .BR ether_ntoa () | |
69 | function converts the Ethernet host address | |
fea681da | 70 | \fIaddr\fP given in network byte order to a string in standard |
7b01461a | 71 | hex-digits-and-colons notation, omitting leading zeros. |
fea681da MK |
72 | The string is returned in a statically allocated buffer, |
73 | which subsequent calls will overwrite. | |
74 | .PP | |
60a90ecd MK |
75 | The |
76 | .BR ether_ntohost () | |
77 | function maps an Ethernet address to the | |
c13182ef | 78 | corresponding hostname in |
836f07c1 | 79 | .I /etc/ethers |
c7094399 | 80 | and returns nonzero if it cannot be found. |
fea681da | 81 | .PP |
60a90ecd MK |
82 | The |
83 | .BR ether_hostton () | |
84 | function maps a hostname to the | |
fea681da | 85 | corresponding Ethernet address in |
836f07c1 | 86 | .I /etc/ethers |
c7094399 | 87 | and returns nonzero if it cannot be found. |
fea681da | 88 | .PP |
60a90ecd MK |
89 | The |
90 | .BR ether_line () | |
91 | function parses a line in | |
836f07c1 | 92 | .I /etc/ethers |
fea681da | 93 | format (ethernet address followed by whitespace followed by |
f81fb444 | 94 | hostname; \(aq#\(aq introduces a comment) and returns an address |
c7094399 | 95 | and hostname pair, or nonzero if it cannot be parsed. |
fea681da MK |
96 | The buffer pointed to by |
97 | .I hostname | |
75b94dc3 | 98 | must be sufficiently long, for example, have the same length as |
fea681da MK |
99 | .IR line . |
100 | .PP | |
60a90ecd MK |
101 | The functions |
102 | .BR ether_ntoa_r () | |
103 | and | |
104 | .BR ether_aton_r () | |
da27f178 | 105 | are reentrant |
79761fe5 | 106 | thread-safe versions of |
60a90ecd MK |
107 | .BR ether_ntoa () |
108 | and | |
109 | .BR ether_aton () | |
fea681da MK |
110 | respectively, and do not use static buffers. |
111 | .PP | |
e859a67a | 112 | The structure \fIether_addr\fP is defined in |
eb12ffbf MK |
113 | .I <net/ethernet.h> |
114 | as: | |
fea681da | 115 | .sp |
a08ea57c | 116 | .in +4n |
fea681da | 117 | .nf |
fea681da | 118 | struct ether_addr { |
aeb4b1fc | 119 | uint8_t ether_addr_octet[6]; |
fea681da | 120 | } |
fea681da | 121 | .fi |
a08ea57c | 122 | .in |
47297adb | 123 | .SH CONFORMING TO |
44a2c328 | 124 | 4.3BSD, SunOS. |
2b2581ee | 125 | .SH BUGS |
d9a10d9d MK |
126 | The glibc 2.2.5 implementation of |
127 | .BR ether_line () | |
128 | is broken. | |
47297adb | 129 | .SH SEE ALSO |
fea681da | 130 | .BR ethers (5) |