ethers.3socket (ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2ab) | ethers.3socket (ff3aea39f71c371be25b08deb9efed41f1c95983) |
---|---|
1'\" te 2.\" Copyright 1989 AT&T. 3.\" Copyright (C) 2004, Sun Microsystems, Inc. All Rights Reserved. | 1'\" te 2.\" Copyright 1989 AT&T. 3.\" Copyright (C) 2004, Sun Microsystems, Inc. All Rights Reserved. |
4.\" Copyright (C) 2014, Joyent, Inc. All Rights Reserved. |
|
4.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 5.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 6.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] | 5.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 6.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 7.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] |
7.TH ETHERS 3SOCKET "Apr 5, 2004" | 8.TH ETHERS 3SOCKET "Aug 9, 2014" |
8.SH NAME | 9.SH NAME |
9ethers, ether_ntoa, ether_aton, ether_ntohost, ether_hostton, ether_line \- | 10ethers, ether_ntoa, ether_ntoa_r, ether_aton, ether_aton_r, ether_ntohost, ether_hostton, ether_line \- |
10Ethernet address mapping operations 11.SH SYNOPSIS 12.LP 13.nf 14\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ] 15#include <sys/types.h> 16#include <sys/ethernet.h> 17 18\fBchar *\fR\fBether_ntoa\fR(\fBconst struct ether_addr *\fR\fIe\fR); 19.fi 20 21.LP 22.nf | 11Ethernet address mapping operations 12.SH SYNOPSIS 13.LP 14.nf 15\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ] 16#include <sys/types.h> 17#include <sys/ethernet.h> 18 19\fBchar *\fR\fBether_ntoa\fR(\fBconst struct ether_addr *\fR\fIe\fR); 20.fi 21 22.LP 23.nf |
24\fBchar *\fR\fBether_ntoa_r\fR(\fBconst struct ether_addr *\fR\fIe\fR, \fBchar *\fR\fIs\fR); 25.fi 26 27.LP 28.nf |
|
23\fBstruct ether_addr *\fR\fBether_aton\fR(\fBconst char *\fR\fIs\fR); 24.fi 25 26.LP 27.nf | 29\fBstruct ether_addr *\fR\fBether_aton\fR(\fBconst char *\fR\fIs\fR); 30.fi 31 32.LP 33.nf |
34\fBstruct ether_addr *\fR\fBether_aton_r\fR(\fBconst char *\fR\fIs\fR, \fBstruct ether_addr *\fR\fIe\fR); 35.fi 36 37.LP 38.nf |
|
28\fBint\fR \fBether_ntohost\fR(\fBchar *\fR\fIhostname\fR, \fBconst struct ether_addr *\fR\fIe\fR); 29.fi 30 31.LP 32.nf 33\fBint\fR \fBether_hostton\fR(\fBconst char *\fR\fIhostname\fR, \fBstruct ether_addr *\fR\fIe\fR); 34.fi 35 36.LP 37.nf 38\fBint\fR \fBether_line\fR(\fBconst char *\fR\fIl\fR, \fBstruct ether_addr *\fR\fIe\fR, \fBchar *\fR\fIhostname\fR); 39.fi 40 41.SH DESCRIPTION | 39\fBint\fR \fBether_ntohost\fR(\fBchar *\fR\fIhostname\fR, \fBconst struct ether_addr *\fR\fIe\fR); 40.fi 41 42.LP 43.nf 44\fBint\fR \fBether_hostton\fR(\fBconst char *\fR\fIhostname\fR, \fBstruct ether_addr *\fR\fIe\fR); 45.fi 46 47.LP 48.nf 49\fBint\fR \fBether_line\fR(\fBconst char *\fR\fIl\fR, \fBstruct ether_addr *\fR\fIe\fR, \fBchar *\fR\fIhostname\fR); 50.fi 51 52.SH DESCRIPTION |
42.sp | |
43.LP 44These routines are useful for mapping 48 bit Ethernet numbers to their ASCII 45representations or their corresponding host names, and vice versa. 46.sp 47.LP 48The function \fBether_ntoa()\fR converts a 48 bit Ethernet number pointed to by 49\fIe\fR to its standard \fBASCII\fR representation; it returns a pointer to 50the \fBASCII\fR string. The representation is of the form 51\fIx\fR\|:\|\fIx\fR\|:\|\fIx\fR\|:\| \fIx\fR\|:\|\fIx\fR\|:\|\fIx\fR where 52\fIx\fR is a hexadecimal number between \fB0\fR and \fBff\fR. The function 53\fBether_aton()\fR converts an \fBASCII\fR string in the standard 54representation back to a 48 bit Ethernet number; the function returns 55\fINULL\fR if the string cannot be scanned successfully. 56.sp 57.LP | 53.LP 54These routines are useful for mapping 48 bit Ethernet numbers to their ASCII 55representations or their corresponding host names, and vice versa. 56.sp 57.LP 58The function \fBether_ntoa()\fR converts a 48 bit Ethernet number pointed to by 59\fIe\fR to its standard \fBASCII\fR representation; it returns a pointer to 60the \fBASCII\fR string. The representation is of the form 61\fIx\fR\|:\|\fIx\fR\|:\|\fIx\fR\|:\| \fIx\fR\|:\|\fIx\fR\|:\|\fIx\fR where 62\fIx\fR is a hexadecimal number between \fB0\fR and \fBff\fR. The function 63\fBether_aton()\fR converts an \fBASCII\fR string in the standard 64representation back to a 48 bit Ethernet number; the function returns 65\fINULL\fR if the string cannot be scanned successfully. 66.sp 67.LP |
68The functions \fBether_ntoa()\fR and \fBether_aton()\fR return values in 69per-thread buffers, one for each function. A second call to one of these 70functions will overwrite the previous value. The functions 71\fBether_ntoa_r()\fR and \fBether_aton_r()\fR behave identically to 72their non-reentrant versions; however, instead of using a per-thread 73buffer, they use caller supplied buffers. It is the callers 74responsibility to ensure that the character buffer passed to 75\fBether_ntoa_r()\fR is at least \fBETHERADDRSTRL\fR bytes large -- the 76minimum size to hold the ASCII representation of a 48 bit Ethernet 77number and a null terminator. 78.sp 79.LP |
|
58The function \fBether_ntohost()\fR maps an Ethernet number (pointed to by 59\fIe\fR) to its associated hostname. The string pointed to by hostname must be 60long enough to hold the hostname and a \fINULL\fR character. The function 61returns zero upon success and non-zero upon failure. Inversely, the function 62\fBether_hostton()\fR maps a hostname string to its corresponding Ethernet 63number; the function modifies the Ethernet number pointed to by \fIe\fR. The 64function also returns zero upon success and non-zero upon failure. In order to 65do the mapping, both these functions may lookup one or more of the following --- 4 unchanged lines hidden (view full) --- 70.sp 71.LP 72The function \fBether_line()\fR scans a line, pointed to by \fIl\fR, and sets 73the hostname and the Ethernet number, pointed to by \fIe\fR. The string pointed 74to by hostname must be long enough to hold the hostname and a \fINULL\fR 75character. The function returns zero upon success and non-zero upon failure. 76The format of the scanned line is described by \fBethers\fR(4). 77.SH FILES | 80The function \fBether_ntohost()\fR maps an Ethernet number (pointed to by 81\fIe\fR) to its associated hostname. The string pointed to by hostname must be 82long enough to hold the hostname and a \fINULL\fR character. The function 83returns zero upon success and non-zero upon failure. Inversely, the function 84\fBether_hostton()\fR maps a hostname string to its corresponding Ethernet 85number; the function modifies the Ethernet number pointed to by \fIe\fR. The 86function also returns zero upon success and non-zero upon failure. In order to 87do the mapping, both these functions may lookup one or more of the following --- 4 unchanged lines hidden (view full) --- 92.sp 93.LP 94The function \fBether_line()\fR scans a line, pointed to by \fIl\fR, and sets 95the hostname and the Ethernet number, pointed to by \fIe\fR. The string pointed 96to by hostname must be long enough to hold the hostname and a \fINULL\fR 97character. The function returns zero upon success and non-zero upon failure. 98The format of the scanned line is described by \fBethers\fR(4). 99.SH FILES |
78.sp | |
79.ne 2 80.na 81\fB\fB/etc/ethers\fR\fR 82.ad 83.RS 22n 84Ethernet address to hostname database or domain 85.RE 86 87.sp 88.ne 2 89.na 90\fB\fB/etc/nsswitch.conf\fR\fR 91.ad 92.RS 22n 93configuration file for the name service switch 94.RE 95 96.SH ATTRIBUTES | 100.ne 2 101.na 102\fB\fB/etc/ethers\fR\fR 103.ad 104.RS 22n 105Ethernet address to hostname database or domain 106.RE 107 108.sp 109.ne 2 110.na 111\fB\fB/etc/nsswitch.conf\fR\fR 112.ad 113.RS 22n 114configuration file for the name service switch 115.RE 116 117.SH ATTRIBUTES |
97.sp | |
98.LP 99See \fBattributes\fR(5) for descriptions of the following attributes: 100.sp 101 102.sp 103.TS 104box; 105c | c 106l | l . 107ATTRIBUTE TYPE ATTRIBUTE VALUE 108_ 109MT-Level MT-Safe 110.TE 111 112.SH SEE ALSO | 118.LP 119See \fBattributes\fR(5) for descriptions of the following attributes: 120.sp 121 122.sp 123.TS 124box; 125c | c 126l | l . 127ATTRIBUTE TYPE ATTRIBUTE VALUE 128_ 129MT-Level MT-Safe 130.TE 131 132.SH SEE ALSO |
113.sp | |
114.LP 115\fBethers\fR(4), \fBnsswitch.conf\fR(4), \fBattributes\fR(5) | 133.LP 134\fBethers\fR(4), \fBnsswitch.conf\fR(4), \fBattributes\fR(5) |