1ethers(3SOCKET) Sockets Library Functions ethers(3SOCKET)
2
3
4
6 ethers, ether_ntoa, ether_aton, ether_ntohost, ether_hostton,
7 ether_line - Ethernet address mapping operations
8
10 cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]
11 #include <sys/types.h>
12 #include <sys/ethernet.h>
13
14 char *ether_ntoa(const struct ether_addr *e);
15
16
17 struct ether_addr *ether_aton(const char *s);
18
19
20 int ether_ntohost(char *hostname, const struct ether_addr *e);
21
22
23 int ether_hostton(const char *hostname, struct ether_addr *e);
24
25
26 int ether_line(const char *l, struct ether_addr *e, char *hostname);
27
28
30 These routines are useful for mapping 48 bit Ethernet numbers to their
31 ASCII representations or their corresponding host names, and vice
32 versa.
33
34
35 The function ether_ntoa() converts a 48 bit Ethernet number pointed to
36 by e to its standard ASCII representation; it returns a pointer to
37 the ASCII string. The representation is of the form x:x:x: x:x:x
38 where x is a hexadecimal number between 0 and ff. The function
39 ether_aton() converts an ASCII string in the standard representation
40 back to a 48 bit Ethernet number; the function returns NULL if the
41 string cannot be scanned successfully.
42
43
44 The function ether_ntohost() maps an Ethernet number (pointed to by e)
45 to its associated hostname. The string pointed to by hostname must be
46 long enough to hold the hostname and a NULL character. The function
47 returns zero upon success and non-zero upon failure. Inversely, the
48 function ether_hostton() maps a hostname string to its corresponding
49 Ethernet number; the function modifies the Ethernet number pointed to
50 by e. The function also returns zero upon success and non-zero upon
51 failure. In order to do the mapping, both these functions may lookup
52 one or more of the following sources: the ethers file, the NIS maps
53 ethers.byname and ethers.byaddr and the NIS+ table ethers. The sources
54 and their lookup order are specified in the /etc/nsswitch.conf file.
55 See nsswitch.conf(4) for details.
56
57
58 The function ether_line() scans a line, pointed to by l, and sets the
59 hostname and the Ethernet number, pointed to by e. The string pointed
60 to by hostname must be long enough to hold the hostname and a NULL
61 character. The function returns zero upon success and non-zero upon
62 failure. The format of the scanned line is described by ethers(4).
63
65 /etc/ethers Ethernet address to hostname database or domain
66
67
68 /etc/nsswitch.conf configuration file for the name service switch
69
70
72 See attributes(5) for descriptions of the following attributes:
73
74
75
76
77 ┌─────────────────────────────┬─────────────────────────────┐
78 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
79 ├─────────────────────────────┼─────────────────────────────┤
80 │MT-Level │MT-Safe │
81 └─────────────────────────────┴─────────────────────────────┘
82
84 ethers(4), nsswitch.conf(4), attributes(5)
85
86
87
88SunOS 5.11 5 Apr 2004 ethers(3SOCKET)