Manual Pages for UNIX Darwin command on man ether_addr
MyWebUniversity

Manual Pages for UNIX Darwin command on man ether_addr

ETHERS(3) BSD Library Functions Manual ETHERS(3)

NAME

eetthheerrss, eetthheerrlliinnee, eetthheerraattoonn, eetthheerrnnttooaa, eetthheerrnnttoohhoosstt, eetthheerrhhoossttttoonn

- Ethernet address conversion and lookup routines

LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

##iinncclluuddee <>

int eetthheerrlliinnee(const char *l, struct etheraddr *e, char *hostname); struct etheraddr * eetthheerraattoonn(const char *a); char * eetthheerrnnttooaa(const struct etheraddr *n); int eetthheerrnnttoohhoosstt(char *hostname, const struct etheraddr *e); int eetthheerrhhoossttttoonn(const char *hostname, struct etheraddr *e);

DESCRIPTION

These functions operate on ethernet addresses using an etheraddr struc-

ture, which is defined in the header file : /* * The number of bytes in an ethernet (MAC) address. */

#define ETHERADDRLEN 6

/*

* Structure of a 48-bit Ethernet address.

*/ struct etheraddr { uchar octet[ETHERADDRLEN]; }; The function eetthheerrlliinnee() scans l, an ASCII string in ethers(5) format and sets e to the ethernet address specified in the string and h to the hostname. This function is used to parse lines from /etc/ethers into their component parts. The eetthheerraattoonn() function converts an ASCII representation of an ethernet address into an etheraddr structure. Likewise, eetthheerrnnttooaa() converts an ethernet address specified as an etheraddr structure into an ASCII string. The eetthheerrnnttoohhoosstt() and eetthheerrhhoossttttoonn() functions map ethernet addresses

to their corresponding hostnames as specified in the /etc/ethers data-

base. eetthheerrnnttoohhoosstt() converts from ethernet address to hostname, and eetthheerrhhoossttttoonn() converts from hostname to ethernet address.

RETURN VALUES

eetthheerrlliinnee() returns zero on success and non-zero if it was unable to

parse any part of the supplied line l. It returns the extracted ethernet address in the supplied etheraddr structure e and the hostname in the supplied string h. On success, eetthheerrnnttooaa() returns a pointer to a string containing an ASCII representation of an ethernet address. If it is unable to convert the supplied etheraddr structure, it returns a NULL pointer. Likewise, eetthheerraattoonn() returns a pointer to an etheraddr structure on success and a NULL pointer on failure. The eetthheerrnnttoohhoosstt() and eetthheerrhhoossttttoonn() functions both return zero on

success or non-zero if they were unable to find a match in the

/etc/ethers database. NNOOTTEESS The user must insure that the hostname strings passed to the eetthheerrlliinnee(), eetthheerrnnttoohhoosstt() and eetthheerrhhoossttttoonn() functions are large enough to contain the returned hostnames. NNIISS IINNTTEERRAACCTTIIOONN If the /etc/ethers contains a line with a single + in it, the eetthheerrnnttoohhoosstt() and eetthheerrhhoossttttoonn() functions will attempt to consult the NIS ethers.byname and ethers.byaddr maps in addition to the data in the /etc/ethers file.

SEE ALSO

yp(4), ethers(5)

BUGS

The eetthheerraattoonn() and eetthheerrnnttooaa() functions returns values that are stored in static memory areas which may be overwritten the next time they are called. HISTORY

This particular implementation of the eetthheerrss library functions were writ-

ten for and first appeared in FreeBSD 2.1. BSD April 12, 1995 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™