Sockets Library Functions ethers(3SOCKET)
NAME
ethers, etherntoa, etheraton, etherntohost,
etherhostton, etherline - Ethernet address mapping opera-
tions
SYNOPSIS
cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]
#include
#include
char *etherntoa(const struct etheraddr *e);
struct etheraddr *etheraton(const char *s);
int etherntohost(char *hostname, const struct etheraddr *e);
int etherhostton(const char *hostname, struct etheraddr *e);
int etherline(const char *l, struct etheraddr *e, char *hostname);
DESCRIPTION
These routines are useful for mapping 48 bit Ethernet
numbers to their ASCI representations or their correspond-
ing host names, and vice versa.
The function etherntoa() converts a 48 bit Ethernet number
pointed to by e to its standard ASCI representation; it
returns a pointer to the ASCI string. The representation
is of the form x:x:x: x:x:x where x is a hexadecimal number
between 0 and ff. The function etheraton() converts an
ASCI string in the standard representation back to a 48 bit
Ethernet number; the function returns NUL if the string
cannot be scanned successfully.
The function etherntohost() maps an Ethernet number
(pointed to by e) to its associated hostname. The string
pointed to by hostname must be long enough to hold the
hostname and a NUL character. The function returns zero
upon success and non-zero upon failure. Inversely, the
function etherhostton() maps a hostname string to its
corresponding Ethernet number; the function modifies the
Ethernet number pointed to by e. The function also returns
zero upon success and non-zero upon failure. In order to do
the mapping, both these functions may lookup one or more of
the following sources: the ethers file, the NIS maps
SunOS 5.11 Last change: 5 Apr 2004 1
Sockets Library Functions ethers(3SOCKET)
ethers.byname and ethers.byaddr and the NIS] table ethers.
The sources and their lookup order are specified in the
/etc/nsswitch.conf file. See nsswitch.conf(4) for details.
The function etherline() scans a line, pointed to by l,
and sets the hostname and the Ethernet number, pointed to by
e. The string pointed to by hostname must be long enough to
hold the hostname and a NUL character. The function
returns zero upon success and non-zero upon failure. The
format of the scanned line is described by ethers(4).
FILES
/etc/ethers Ethernet address to hostname database
or domain
/etc/nsswitch.conf configuration file for the name ser-
vice switch
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level MT-Safe
SEE ALSO
ethers(4), nsswitch.conf(4), attributes(5)
SunOS 5.11 Last change: 5 Apr 2004 2
|