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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [libnetworking/] [libc/] [getnetent.3] - Blame information for rev 1767

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

Line No. Rev Author Line
1 158 chris
.\" Copyright (c) 1983, 1991, 1993
2
.\"     The Regents of the University of California.  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 the University of
15
.\"     California, Berkeley and its contributors.
16
.\" 4. Neither the name of the University nor the names of its contributors
17
.\"    may be used to endorse or promote products derived from this software
18
.\"    without specific prior written permission.
19
.\"
20
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
.\" SUCH DAMAGE.
31
.\"
32
.\"     @(#)getnetent.3 8.1 (Berkeley) 6/4/93
33 208 chris
.\"     $Id: getnetent.3,v 1.2 2001-09-27 12:01:53 chris Exp $
34 158 chris
.\"
35
.Dd June 4, 1993
36
.Dt GETNETENT 3
37
.Os BSD 4.2
38
.Sh NAME
39
.Nm getnetent ,
40
.Nm getnetbyaddr ,
41
.Nm getnetbyname ,
42
.Nm setnetent ,
43
.Nm endnetent
44
.Nd get network entry
45
.Sh SYNOPSIS
46
.Fd #include 
47
.Ft struct netent *
48
.Fn getnetent void
49
.Ft struct netent *
50
.Fn getnetbyname "const char *name"
51
.Ft struct netent *
52
.Fn getnetbyaddr "unsigned long net" "int type"
53
.Ft void
54
.Fn setnetent "int stayopen"
55
.Ft void
56
.Fn endnetent void
57
.Sh DESCRIPTION
58
The
59
.Fn getnetent ,
60
.Fn getnetbyname ,
61
and
62
.Fn getnetbyaddr
63
functions
64
each return a pointer to an object with the
65
following structure
66
containing the broken-out
67
fields of a line in the network data base,
68
.Pa /etc/networks .
69
.Bd -literal -offset indent
70
struct  netent {
71
        char            *n_name;        /* official name of net */
72
        char            **n_aliases;    /* alias list */
73
        int             n_addrtype;     /* net number type */
74
        unsigned long   n_net;          /* net number */
75
};
76
.Ed
77
.Pp
78
The members of this structure are:
79
.Bl -tag -width n_addrtype
80
.It Fa n_name
81
The official name of the network.
82
.It Fa n_aliases
83
A zero terminated list of alternate names for the network.
84
.It Fa n_addrtype
85
The type of the network number returned; currently only AF_INET.
86
.It Fa n_net
87
The network number.  Network numbers are returned in machine byte
88
order.
89
.El
90
.Pp
91
The
92
.Fn getnetent
93
function
94
reads the next line of the file, opening the file if necessary.
95
.Pp
96
The
97
.Fn setnetent
98
function
99
opens and rewinds the file.  If the
100
.Fa stayopen
101
flag is non-zero,
102
the net data base will not be closed after each call to
103
.Fn getnetbyname
104
or
105
.Fn getnetbyaddr .
106
.Pp
107
The
108
.Fn endnetent
109
function
110
closes the file.
111
.Pp
112
The
113
.Fn getnetbyname
114
function
115
and
116
.Fn getnetbyaddr
117
sequentially search from the beginning
118
of the file until a matching
119
net name or
120
net address and type is found,
121
or until
122
.Dv EOF
123
is encountered. The
124
.Fa type
125
must be
126
.Dv AF_INET .
127
Network numbers are supplied in host order.
128
.Sh FILES
129
.Bl -tag -width /etc/networks -compact
130
.It Pa /etc/networks
131
.El
132
.Sh DIAGNOSTICS
133
Null pointer
134
(0) returned on
135
.Dv EOF
136
or error.
137
.Sh SEE ALSO
138
.Xr networks 5
139
.Pp
140
.%T RFC 1101
141
.Sh HISTORY
142
The
143
.Fn getnetent ,
144
.Fn getnetbyaddr ,
145
.Fn getnetbyname ,
146
.Fn setnetent ,
147
and
148
.Fn endnetent
149
functions appeared in
150
.Bx 4.2 .
151
.Sh BUGS
152
The data space used by
153
these functions is static; if future use requires the data, it should be
154
copied before any subsequent calls to these functions overwrite it.
155
Only Internet network
156
numbers are currently understood.
157
Expecting network numbers to fit
158
in no more than 32 bits is probably
159
naive.

powered by: WebSVN 2.1.0

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