OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [libc/] [ethers.3] - Blame information for rev 279

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
.\" Copyright (c) 1995
2
.\"     Bill Paul .  All rights reserved.
3
.\"
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\" 3. All advertising materials mentioning features or use of this software
13
.\"    must display the following acknowledgement:
14
.\"     This product includes software developed by Bill Paul.
15
.\" 4. Neither the name of the author nor the names of any co-contributors
16
.\"    may be used to endorse or promote products derived from this software
17
.\"    without specific prior written permission.
18
.\"
19
.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
20
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
.\" SUCH DAMAGE.
30
.\"
31
.\"     $Id: ethers.3,v 1.2 2001-09-27 12:01:53 chris Exp $
32
.\"
33
.Dd April 12, 1995
34
.Dt ETHERS 3
35
.Os FreeBSD 2.1
36
.Sh NAME
37
.Nm ethers ,
38
.Nm ether_line ,
39
.Nm ether_aton ,
40
.Nm ether_ntoa ,
41
.Nm ether_ntohost ,
42
.Nm ether_hostton
43
.Nd Ethernet address conversion and lookup routines
44
.Sh SYNOPSIS
45
.Fd #include 
46
.Fd #include 
47
.Fd #include 
48
.Ft int
49
.Fn ether_line "char *l" "struct ether_addr *e" "char *hostname"
50
.Ft struct ether_addr *
51
.Fn ether_aton "char *a"
52
.Ft char *
53
.Fn ether_ntoa "struct ether_addr *n"
54
.Ft int
55
.Fn ether_ntohost "char *hostname" "struct ether_addr *e"
56
.Ft int
57
.Fn ether_hostton "char *hostname" "struct ether_addr *e"
58
.Sh DESCRIPTION
59
These functions operate on ethernet addresses using an
60
.Ar ether_addr
61
structure, which is defined in the header file
62
.Aq Pa netinet/if_ether.h :
63
.Bd -literal -offset indent
64
/*
65
 * The number of bytes in an ethernet (MAC) address.
66
 */
67
#define ETHER_ADDR_LEN          6
68
 
69
/*
70
 * Structure of a 48-bit Ethernet address.
71
 */
72
struct  ether_addr {
73
        u_char octet[ETHER_ADDR_LEN];
74
};
75
.Ed
76
.Pp
77
The function
78
.Fn ether_line
79
scans
80
.Ar l ,
81
an
82
.Tn ASCII
83
string in
84
.Xr ethers 5
85
format and sets
86
.Ar e
87
to the ethernet address specified in the string and
88
.Ar h
89
to the hostname. This function is used to parse lines from
90
.Pa /etc/ethers
91
into their component parts.
92
.Pp
93
The
94
.Fn ether_aton
95
function converts an
96
.Tn ASCII
97
representation of an ethernet address into an
98
.Ar ether_addr
99
structure. Likewise,
100
.Fn ether_ntoa
101
converts an ethernet address specified as an
102
.Ar ether_addr
103
structure into an
104
.Tn ASCII
105
string.
106
.Pp
107
The
108
.Fn ether_ntohost
109
and
110
.Fn ether_hostton
111
functions map ethernet addresses to their corresponding hostnames
112
as specified in the
113
.Pa /etc/ethers
114
database.
115
.Fn ether_ntohost
116
converts from ethernet address to hostname, and
117
.Fn ether_hostton
118
converts from hostname to ethernet address.
119
.Sh RETURN VALUES
120
.Fn ether_line
121
returns zero on success and non-zero if it was unable to parse
122
any part of the supplied line
123
.Ar l .
124
It returns the extracted ethernet address in the supplied
125
.Ar ether_addr
126
structure
127
.Ar e
128
and the hostname in the supplied string
129
.Ar h .
130
.Pp
131
On success,
132
.Fn ether_ntoa
133
returns a pointer to a string containing an
134
.Tn ASCII
135
representation of an ethernet address. If it is unable to convert
136
the supplied
137
.Ar ether_addr
138
structure, it returns a
139
.Dv NULL
140
pointer. Likewise,
141
.Fn ether_aton
142
returns a pointer to an
143
.Ar ether_addr
144
structure on success and a
145
.Dv NULL
146
pointer on failure.
147
.Pp
148
The
149
.Fn ether_ntohost
150
and
151
.Fn ether_hostton
152
functions both return zero on success or non-zero if they were
153
unable to find a match in the
154
.Pa /etc/ethers
155
database.
156
.Sh NOTES
157
The user must insure that the hostname strings passed to the
158
the
159
.Fn ether_line ,
160
.Fn ether_ntohost
161
and
162
.Fn ether_hostton
163
functions are large enough to contain the returned hostnames.
164
.Sh NIS INTERACTION
165
If the
166
.Pa /etc/ethers
167
contains a line with a single + in it, the
168
.Fn ether_ntohost
169
and
170
.Fn ether_hostton
171
functions will attempt to consult the NIS
172
.Pa ethers.byname
173
and
174
.Pa ethers.byaddr
175
maps in addition to the data in the
176
.Pa /etc/ethers
177
file.
178
.Sh SEE ALSO
179
.Xr yp 4 ,
180
.Xr ethers 5
181
.Sh BUGS
182
.Pp
183
The
184
.Fn ether_aton
185
and
186
.Fn ether_ntoa
187
functions returns values that are stored in static memory areas
188
which may be overwritten the next time they are called.
189
.Sh HISTORY
190
This particular implementation of the
191
.Nm ethers
192
library functions were written for and first appeared in
193
.Fx 2.1 .

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.