URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [libnetworking/] [libc/] [ethers.3] - Rev 1765
Compare with Previous | Blame | View Log
.\" Copyright (c) 1995.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by Bill Paul..\" 4. Neither the name of the author nor the names of any co-contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" $Id: ethers.3,v 1.2 2001-09-27 12:01:53 chris Exp $.\".Dd April 12, 1995.Dt ETHERS 3.Os FreeBSD 2.1.Sh NAME.Nm ethers ,.Nm ether_line ,.Nm ether_aton ,.Nm ether_ntoa ,.Nm ether_ntohost ,.Nm ether_hostton.Nd Ethernet address conversion and lookup routines.Sh SYNOPSIS.Fd #include <sys/types.h>.Fd #include <sys/socket.h>.Fd #include <net/ethernet.h>.Ft int.Fn ether_line "char *l" "struct ether_addr *e" "char *hostname".Ft struct ether_addr *.Fn ether_aton "char *a".Ft char *.Fn ether_ntoa "struct ether_addr *n".Ft int.Fn ether_ntohost "char *hostname" "struct ether_addr *e".Ft int.Fn ether_hostton "char *hostname" "struct ether_addr *e".Sh DESCRIPTIONThese functions operate on ethernet addresses using an.Ar ether_addrstructure, which is defined in the header file.Aq Pa netinet/if_ether.h :.Bd -literal -offset indent/** 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];};.Ed.PpThe function.Fn ether_linescans.Ar l ,an.Tn ASCIIstring in.Xr ethers 5format and sets.Ar eto the ethernet address specified in the string and.Ar hto the hostname. This function is used to parse lines from.Pa /etc/ethersinto their component parts..PpThe.Fn ether_atonfunction converts an.Tn ASCIIrepresentation of an ethernet address into an.Ar ether_addrstructure. Likewise,.Fn ether_ntoaconverts an ethernet address specified as an.Ar ether_addrstructure into an.Tn ASCIIstring..PpThe.Fn ether_ntohostand.Fn ether_hosttonfunctions map ethernet addresses to their corresponding hostnamesas specified in the.Pa /etc/ethersdatabase..Fn ether_ntohostconverts from ethernet address to hostname, and.Fn ether_hosttonconverts from hostname to ethernet address..Sh RETURN VALUES.Fn ether_linereturns zero on success and non-zero if it was unable to parseany part of the supplied line.Ar l .It returns the extracted ethernet address in the supplied.Ar ether_addrstructure.Ar eand the hostname in the supplied string.Ar h ..PpOn success,.Fn ether_ntoareturns a pointer to a string containing an.Tn ASCIIrepresentation of an ethernet address. If it is unable to convertthe supplied.Ar ether_addrstructure, it returns a.Dv NULLpointer. Likewise,.Fn ether_atonreturns a pointer to an.Ar ether_addrstructure on success and a.Dv NULLpointer on failure..PpThe.Fn ether_ntohostand.Fn ether_hosttonfunctions both return zero on success or non-zero if they wereunable to find a match in the.Pa /etc/ethersdatabase..Sh NOTESThe user must insure that the hostname strings passed to thethe.Fn ether_line ,.Fn ether_ntohostand.Fn ether_hosttonfunctions are large enough to contain the returned hostnames..Sh NIS INTERACTIONIf the.Pa /etc/etherscontains a line with a single + in it, the.Fn ether_ntohostand.Fn ether_hosttonfunctions will attempt to consult the NIS.Pa ethers.bynameand.Pa ethers.byaddrmaps in addition to the data in the.Pa /etc/ethersfile..Sh SEE ALSO.Xr yp 4 ,.Xr ethers 5.Sh BUGS.PpThe.Fn ether_atonand.Fn ether_ntoafunctions returns values that are stored in static memory areaswhich may be overwritten the next time they are called..Sh HISTORYThis particular implementation of the.Nm etherslibrary functions were written for and first appeared in.Fx 2.1 .
