]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/net/getprotoent.3
lib: Remove ancient SCCS tags.
[FreeBSD/FreeBSD.git] / lib / libc / net / getprotoent.3
1 .\" 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. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .Dd June 4, 1993
29 .Dt GETPROTOENT 3
30 .Os
31 .Sh NAME
32 .Nm getprotoent ,
33 .Nm getprotobynumber ,
34 .Nm getprotobyname ,
35 .Nm setprotoent ,
36 .Nm endprotoent
37 .Nd get protocol entry
38 .Sh LIBRARY
39 .Lb libc
40 .Sh SYNOPSIS
41 .In netdb.h
42 .Ft struct protoent *
43 .Fn getprotoent void
44 .Ft struct protoent *
45 .Fn getprotobyname "const char *name"
46 .Ft struct protoent *
47 .Fn getprotobynumber "int proto"
48 .Ft void
49 .Fn setprotoent "int stayopen"
50 .Ft void
51 .Fn endprotoent void
52 .Sh DESCRIPTION
53 The
54 .Fn getprotoent ,
55 .Fn getprotobyname ,
56 and
57 .Fn getprotobynumber
58 functions
59 each return a pointer to an object with the
60 following structure
61 containing the broken-out
62 fields of a line in the network protocol data base,
63 .Pa /etc/protocols .
64 .Bd -literal -offset indent
65 struct protoent {
66         char    *p_name;        /* official name of protocol */
67         char    **p_aliases;    /* alias list */
68         int     p_proto;        /* protocol number */
69 };
70 .Ed
71 .Pp
72 The members of this structure are:
73 .Bl -tag -width p_aliases
74 .It Fa p_name
75 The official name of the protocol.
76 .It Fa p_aliases
77 A zero terminated list of alternate names for the protocol.
78 .It Fa p_proto
79 The protocol number.
80 .El
81 .Pp
82 The
83 .Fn getprotoent
84 function
85 reads the next line of the file, opening the file if necessary.
86 .Pp
87 The
88 .Fn setprotoent
89 function
90 opens and rewinds the file.
91 If the
92 .Fa stayopen
93 flag is non-zero,
94 the net data base will not be closed after each call to
95 .Fn getprotobyname
96 or
97 .Fn getprotobynumber .
98 .Pp
99 The
100 .Fn endprotoent
101 function
102 closes the file.
103 .Pp
104 The
105 .Fn getprotobyname
106 function
107 and
108 .Fn getprotobynumber
109 sequentially search from the beginning
110 of the file until a matching
111 protocol name or
112 protocol number is found,
113 or until
114 .Dv EOF
115 is encountered.
116 .Sh RETURN VALUES
117 Null pointer returned on
118 .Dv EOF
119 or error.
120 .Sh FILES
121 .Bl -tag -width /etc/protocols -compact
122 .It Pa /etc/protocols
123 .El
124 .Sh SEE ALSO
125 .Xr protocols 5
126 .Sh HISTORY
127 The
128 .Fn getprotoent ,
129 .Fn getprotobynumber ,
130 .Fn getprotobyname ,
131 .Fn setprotoent ,
132 and
133 .Fn endprotoent
134 functions appeared in
135 .Bx 4.2 .
136 .Sh BUGS
137 These functions use a thread-specific data space;
138 if the data is needed for future use, it should be
139 copied before any subsequent calls overwrite it.
140 Only the Internet
141 protocols are currently understood.