ethers(3n)ethers(3n)Name
ethers, ether_ntoa, ether_aton, ether_ntohost, ether_hostton,
ether_line - Ethernet address mapping operations
Syntax
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
char *
ether_ntoa(e)
struct ether_addr *e;
struct ether_addr *
ether_aton(s)
char *s;
ether_ntohost(hostname, e)
char *hostname;
struct ether_addr *e;
ether_hostton(hostname, e)
char *hostname;
struct ether_addr *e;
ether_line(l, e, hostname)
char *l;
struct ether_addr *e;
char *hostname;
Arguments
The structure is defined as:
struct ether_addr {
u_char ether_addr_octet[6];
};
Description
These routines are useful for mapping 48 bit Ethernet numbers to their
ASCII representations or their corresponding host names, and vice
versa. The mapping is obtained from the database; see
The function converts a 48 bit Ethernet number pointed to by e to its
standard ACSII representation; it returns a pointer to the ASCII
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 converts an ASCII
string in the standard representation back to a 48 bit Ethernet number;
the function returns NULL if the string cannot be scanned successfully.
The function maps an Ethernet number (pointed to by e) to its associ‐
ated hostname. The string pointed to by must be long enough to hold
the hostname and a NULL character. The function returns zero upon suc‐
cess and non-zero upon failure. Inversely, the function maps a host‐
name 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.
The function scans a line (pointed to by l) and sets the hostname and
the Ethernet number (pointed to by e). The string pointed to by must
be long enough to hold the hostname and a NULL character. The function
returns zero upon success and non-zero upon failure. The format of the
scanned line is described by
Files
See Also
packetfilter(4), ethers(5), rarpd(8c)ethers(3n)