DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ethers(3N)


ethers: ether_aton, ether_hostton, ether_line, ether_ntoa, ether_ntohost -- Ethernet address mapping operations

Synopsis

cc [options] file -lsocket -lnsl
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>

char *ether_ntoa(ether_addr_t e);

ether_addr_t *ether_aton(char *s);

int ether_ntohost(char *hostname, ether_addr_t e);

int ether_hostton(char *hostname, ether_addr_t e);

int ether_line(char *l, ether_addr_t e, char *hostname);

Description

These routines are useful for mapping 48-bit Ethernet numbers to their ASCII representations or their corresponding hostnames, and vice versa.

The function ether_ntoa converts a 48-bit Ethernet number pointed to by e to its standard ASCII 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 ether_aton 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 ether_ntohost 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 NULL character. The function returns 0 upon success and non-zero upon failure.

Inversely, the function ether_hostton maps a hostname string to its corresponding Ethernet number; the function modifies the Ethernet number pointed to by e. The function also returns 0 upon success and non-zero upon failure.

The function ether_line 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 NULL character. The function returns 0 upon success and non-zero upon failure.

The format of the scanned line is described by ethers(4tcp).

Files

/etc/ethers

Usage

The return values from the ether functions are pointers to static data, which will be overwritten on the next call. For multi-threaded applications, this occurs on a per-thread basis.

References

ethers(4tcp)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004