*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> ether_hostton (3)              
Title
Content
Arch
Section
 

ETHERS(3)

Contents


NAME    [Toc]    [Back]

     ethers, ether_line, ether_aton, ether_ntoa, ether_ntohost, ether_hostton
     -- Ethernet address conversion and lookup routines

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/socket.h>
     #include <net/ethernet.h>

     int
     ether_line(const char *l, struct ether_addr *e, char *hostname);

     struct ether_addr *
     ether_aton(const char *a);

     char *
     ether_ntoa(const struct ether_addr *n);

     int
     ether_ntohost(char *hostname, const struct ether_addr *e);

     int
     ether_hostton(const char *hostname, struct ether_addr *e);

DESCRIPTION    [Toc]    [Back]

     These functions operate on ethernet addresses using an ether_addr structure,
 which is defined in the header file <netinet/if_ether.h>:

	   /*
	    * The number of bytes in an ethernet (MAC) address.
	    */
	   #define ETHER_ADDR_LEN	   6

	   /*
	    * Structure of a 48-bit Ethernet address.
	    */
	   struct  ether_addr {
		   u_char octet[ETHER_ADDR_LEN];
	   };

     The function ether_line() 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 ether_aton() function converts an ASCII representation of an ethernet
     address into an ether_addr structure.  Likewise, ether_ntoa() converts an
     ethernet address specified as an ether_addr structure into an ASCII
     string.

     The ether_ntohost() and ether_hostton() functions map ethernet addresses
     to their corresponding hostnames as specified in the /etc/ethers database.
  The ether_ntohost() function converts from ethernet address to
     hostname, and ether_hostton() converts from hostname to ethernet address.

RETURN VALUES    [Toc]    [Back]

     The ether_line() function 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 ether_addr structure e and the
     hostname in the supplied string h.

     On success, ether_ntoa() returns a pointer to a string containing an
     ASCII representation of an ethernet address.  If it is unable to convert
     the supplied ether_addr structure, it returns a NULL pointer.  Likewise,
     ether_aton() returns a pointer to an ether_addr structure on success and
     a NULL pointer on failure.

     The ether_ntohost() and ether_hostton() functions both return zero on
     success or non-zero if they were unable to find a match in the
     /etc/ethers database.

NOTES    [Toc]    [Back]

     The user must insure that the hostname strings passed to the
     ether_line(), ether_ntohost() and ether_hostton() functions are large
     enough to contain the returned hostnames.

NIS INTERACTION    [Toc]    [Back]

     If the /etc/ethers contains a line with a single + in it, the
     ether_ntohost() and ether_hostton() 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    [Toc]    [Back]

      
      
     ethers(5), yp(8)

BUGS    [Toc]    [Back]

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

HISTORY    [Toc]    [Back]

     This particular implementation of the ethers library functions were written
 for and first appeared in FreeBSD 2.1.


FreeBSD 5.2.1			April 12, 1995			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
ipx FreeBSD IPX address conversion routines
ipx_addr FreeBSD IPX address conversion routines
ipx_ntoa FreeBSD IPX address conversion routines
ipx OpenBSD IPX address conversion routines
ipx_addr OpenBSD IPX address conversion routines
ipx_ntoa OpenBSD IPX address conversion routines
ns NetBSD Xerox NS(tm) address conversion routines
ns_ntoa NetBSD Xerox NS(tm) address conversion routines
ns_addr NetBSD Xerox NS(tm) address conversion routines
ns OpenBSD Xerox NS(tm) address conversion routines
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service