1ETHER_ATON(3)              Linux Programmer's Manual             ETHER_ATON(3)
2
3
4

NAME

6       ether_aton,   ether_ntoa,   ether_ntohost,  ether_hostton,  ether_line,
7       ether_ntoa_r, ether_aton_r - Ethernet address manipulation routines
8

SYNOPSIS

10       #include <netinet/ether.h>
11
12       char *
13       ether_ntoa(const struct ether_addr *addr);
14
15       struct ether_addr *
16       ether_aton(const char *asc);
17
18       int
19       ether_ntohost(char *hostname, const struct ether_addr *addr);
20
21       int
22       ether_hostton(const char *hostname, struct ether_addr *addr);
23
24       int
25       ether_line(const char *line, struct ether_addr *addr,
26           char *hostname);
27
28       /* GNU extensions */
29       char *
30       ether_ntoa_r(const struct ether_addr *addr, char *buf);
31
32       struct ether_addr *
33       ether_aton_r(const char *asc, struct ether_addr *addr);
34

DESCRIPTION

36       ether_aton() converts the 48-bit Ethernet host  address  asc  from  the
37       standard  hex-digits-and-colons  notation  into  binary data in network
38       byte order and returns a pointer to it in a statically  allocated  buf‐
39       fer,  which  subsequent calls will overwrite. ether_aton() returns NULL
40       if the address is invalid.
41
42       The ether_ntoa() function converts the Ethernet host address addr given
43       in  network  byte  order  to a string in standard hex-digits-and-colons
44       notation, omitting leading zeroes.  The string is returned in a  stati‐
45       cally allocated buffer, which subsequent calls will overwrite.
46
47       The  ether_ntohost()  function  maps  an Ethernet address to the corre‐
48       sponding hostname in /etc/ethers and returns non-zero if it  cannot  be
49       found.
50
51       The  ether_hostton() function maps a hostname to the corresponding Eth‐
52       ernet address in /etc/ethers and  returns  non-zero  if  it  cannot  be
53       found.
54
55       The ether_line() function parses a line in /etc/ethers format (ethernet
56       address followed by whitespace followed by hostname; '#'  introduces  a
57       comment)  and  returns  an address and hostname pair, or non-zero if it
58       cannot be parsed.  The buffer pointed to by  hostname  must  be  suffi‐
59       ciently long, e.g., have the same length as line.
60
61       The  functions ether_ntoa_r() and ether_aton_r() are re-entrant thread‐
62       safe versions of ether_ntoa() and ether_aton() respectively, and do not
63       use static buffers.
64
65       The structure ether_addr is defined in net/ethernet.h as:
66
67              struct ether_addr {
68                u_int8_t ether_addr_octet[6];
69              }
70

BUGS

72       The glibc 2.2.5 implementation of ether_line() is broken.
73

CONFORMING TO

75       4.3BSD, SunOS
76

SEE ALSO

78       ethers(5)
79
80
81
82BSD                               2002-07-20                     ETHER_ATON(3)
Impressum