minix/lib/libc/net/ethers.3
Ben Gras 2fe8fb192f Full switch to clang/ELF. Drop ack. Simplify.
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
2012-02-14 14:52:02 +01:00

120 lines
2.9 KiB
Groff

.\" $NetBSD: ethers.3,v 1.13 2003/04/16 13:34:41 wiz Exp $
.\"
.\" Written by roland@frob.com. Public domain.
.\"
.Dd November 2, 1997
.Dt ETHERS 3
.Os
.Sh NAME
.Nm ether_ntoa ,
.Nm ether_aton ,
.Nm ether_ntohost ,
.Nm ether_hostton ,
.Nm ether_line ,
.Nd get ethers entry
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.In net/if.h
.In net/if_ether.h
.Ft char *
.Fn ether_ntoa "const struct ether_addr *e"
.Ft struct ether_addr *
.Fn ether_aton "const char *s"
.Ft int
.Fn ether_ntohost "char *hostname" "const struct ether_addr *e"
.Ft int
.Fn ether_hostton "const char *hostname" "struct ether_addr *e"
.Ft int
.Fn ether_line "const char *line" "struct ether_addr *e" "char *hostname"
.Sh DESCRIPTION
Ethernet addresses are represented by the
following structure:
.Bd -literal -offset indent
struct ether_addr {
u_char ether_addr_octet[6];
};
.Ed
.Pp
The
.Fn ether_ntoa
function converts this structure into an ASCII string of the form
``xx:xx:xx:xx:xx:xx'', consisting of 6 hexadecimal numbers separated
by colons. It returns a pointer to a static buffer that is reused for
each call.
The
.Fn ether_aton
converts an ASCII string of the same form and to a structure
containing the 6 octets of the address. It returns a pointer to a
static structure that is reused for each call.
.Pp
The
.Fn ether_ntohost
and
.Fn ether_hostton
functions interrogate the data base mapping host names to Ethernet
addresses,
.Pa /etc/ethers .
The
.Fn ether_ntohost
function looks up the given Ethernet address and writes the associated
host name into the character buffer passed.
The
.Fn ether_hostton
function looks up the given host name and writes the associated
Ethernet address into the structure passed. Both functions return
zero if they find the requested host name or address, and -1 if not.
Each call reads
.Pa /etc/ethers
from the beginning; if a + appears alone on a line in the file, then
.Fn ether_hostton
will consult the
.Pa ethers.byname
YP map, and
.Fn ether_ntohost
will consult the
.Pa ethers.byaddr
YP map.
.Pp
The
.Fn ether_line
function parses a line from the
.Pa /etc/ethers
file and fills in the passed ``struct ether_addr'' and character
buffer with the Ethernet address and host name on the line. It
returns zero if the line was successfully parsed and -1 if not.
.Pp
The
.Fa hostname
buffer for
.Fn ether_line
and
.Fn ether_ntohost
should be at least
.Dv MAXHOSTNAMELEN
+ 1
characters long, to prevent a buffer overflow during parsing.
.Sh FILES
.Bl -tag -width /etc/ethers -compact
.It Pa /etc/ethers
.El
.Sh SEE ALSO
.Xr ethers 5
.Sh HISTORY
The
.Fn ether_ntoa ,
.Fn ether_aton ,
.Fn ether_ntohost ,
.Fn ether_hostton ,
and
.Fn ether_line
functions were adopted from
.Tn SunOS
and appeared in
.Nx 1.0 .
.Sh BUGS
The data space used by these functions is static; if future use
requires the data, it should be copied before any subsequent calls to
these functions overwrite it.