'\"macro stdmacro
.if n .pH g4.ethers @(#)ethers	40.4 of 1/29/90
.\" Copyright 1989 AT&T
.\" @(#)ethers.4 1.2 89/07/14 SMI; new on release 3.0
'\" macro stdmacro
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\"
.nr X
.if \nX=0 .ds x} ethers 3N "TCP/IP" "\&"
.if \nX=1 .ds x} ethers 3N "TCP/IP"
.if \nX=2 .ds x} ethers 3N "" "\&"
.if \nX=3 .ds x} ethers "" "" "\&"
.TH \*(x}
.SH NAME
\f4ethers\f1 \- Ethernet address mapping operations
.SH SYNOPSIS
.nf
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
.fi
.LP
.nf
.ft 4
     char *
     ether_ntoa(e)
          struct ether_addr *e;

     struct ether_addr *
     ether_aton(s)
          char *s;
.sp .5
     ether_ntohost(hostname, e)
          char *hostname;
          struct ether_addr *e;
.sp .5
     ether_hostton(hostname, e)
          char *hostname;
          struct ether_addr *e;
.sp .5
     ether_line(l, e, hostname)
          char *l;
          struct ether_addr *e;
          char *hostname;
.fi
.ft 1
.SH DESCRIPTION
These routines are useful for mapping 48 bit Ethernet
numbers to their ASCII representations or their corresponding 
host names, and vice versa.
.LP
The function \f4ether_ntoa()\f1 
converts a 48 bit Ethernet number
pointed to by \f4e\f1 to its standard 
.SM ASCII 
representation; it
returns a pointer to the 
.SM ASCII 
string.  The representation
is of the form \f2x\f1:\f2x\f1:\f2x\f1:\f2x\f1:\f2x\f1:\f2x\f1 
where 
.I x 
is a hexadecimal number
between 0 and ff.  The function 
\f4ether_aton()\f1 
converts an
.SM ASCII 
string in the standard representation back to a 48 bit
Ethernet number;  the function returns 
.SM NULL 
if the string cannot be scanned successfully.
.LP
The function \f4ether_ntohost()\f1 maps an Ethernet number
(pointed to by \f4e\f1) to its associated hostname.  The string
pointed to by hostname must be long enough to hold the 
hostname and a 
.SM NULL 
character.  The function returns zero upon
success and non-zero upon failure.  Inversely, the function
\f4ether_hostton()\f1
maps a hostname string to its corresponding
Ethernet number; the function modifies the  Ethernet number
pointed to by \f4e\f1.  The function also returns zero upon 
success and non-zero upon failure.
.LI
The function 
\f4ether_line()\f1 scans a line (pointed to by \f4l\f1) and
sets the hostname and the Ethernet number (pointed to by \f4e\f1).
The\p
.br
.ne 1i
string pointed to by hostname must be long enough to
hold the hostname and a 
.SM NULL 
character.  The function
returns zero upon success and non-zero upon failure.  The
format of the scanned line is described by \f4ethers\f1(4).
.SH FILES
\f4/etc/ethers\f1 
.SH SEE ALSO
\f4ethers\fP(4)
