diff options
Diffstat (limited to 'src/lib/libc/net/getprotoent.3')
-rw-r--r-- | src/lib/libc/net/getprotoent.3 | 213 |
1 files changed, 0 insertions, 213 deletions
diff --git a/src/lib/libc/net/getprotoent.3 b/src/lib/libc/net/getprotoent.3 deleted file mode 100644 index cc2c69836a..0000000000 --- a/src/lib/libc/net/getprotoent.3 +++ /dev/null | |||
@@ -1,213 +0,0 @@ | |||
1 | .\" $OpenBSD: getprotoent.3,v 1.18 2013/06/05 03:39:23 tedu Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 1983, 1991, 1993 | ||
4 | .\" The Regents of the University of California. All rights reserved. | ||
5 | .\" | ||
6 | .\" Redistribution and use in source and binary forms, with or without | ||
7 | .\" modification, are permitted provided that the following conditions | ||
8 | .\" are met: | ||
9 | .\" 1. Redistributions of source code must retain the above copyright | ||
10 | .\" notice, this list of conditions and the following disclaimer. | ||
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer in the | ||
13 | .\" documentation and/or other materials provided with the distribution. | ||
14 | .\" 3. Neither the name of the University nor the names of its contributors | ||
15 | .\" may be used to endorse or promote products derived from this software | ||
16 | .\" without specific prior written permission. | ||
17 | .\" | ||
18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
28 | .\" SUCH DAMAGE. | ||
29 | .\" | ||
30 | .Dd $Mdocdate: June 5 2013 $ | ||
31 | .Dt GETPROTOENT 3 | ||
32 | .Os | ||
33 | .Sh NAME | ||
34 | .Nm getprotoent , | ||
35 | .Nm getprotoent_r , | ||
36 | .Nm getprotobynumber , | ||
37 | .Nm getprotobynumber_r , | ||
38 | .Nm getprotobyname , | ||
39 | .Nm getprotobyname_r , | ||
40 | .Nm setprotoent , | ||
41 | .Nm setprotoent_r , | ||
42 | .Nm endprotoent , | ||
43 | .Nm endprotoent_r | ||
44 | .Nd get protocol entry | ||
45 | .Sh SYNOPSIS | ||
46 | .In netdb.h | ||
47 | .Ft struct protoent * | ||
48 | .Fn getprotoent "void" | ||
49 | .Ft int | ||
50 | .Fn getprotoent_r "struct protoent *protoent" "struct protoent_data *protoent_data" | ||
51 | .Ft struct protoent * | ||
52 | .Fn getprotobyname "const char *name" | ||
53 | .Ft int | ||
54 | .Fn getprotobyname_r "const char *name" "struct protoent *protoent" "struct protoent_data *protoent_data" | ||
55 | .Ft struct protoent * | ||
56 | .Fn getprotobynumber "int proto" | ||
57 | .Ft int | ||
58 | .Fn getprotobynumber_r "int proto" "struct protoent *protoent" "struct protoent_data *protoent_data" | ||
59 | .Ft void | ||
60 | .Fn setprotoent "int stayopen" | ||
61 | .Ft void | ||
62 | .Fn setprotoent_r "int stayopen" "struct protoent_data *protoent_data" | ||
63 | .Ft void | ||
64 | .Fn endprotoent "void" | ||
65 | .Ft void | ||
66 | .Fn endprotoent_r "struct protoent_data *protoent_data" | ||
67 | .Sh DESCRIPTION | ||
68 | The | ||
69 | .Fn getprotoent , | ||
70 | .Fn getprotobyname , | ||
71 | and | ||
72 | .Fn getprotobynumber | ||
73 | functions each return a pointer to an object with the following structure | ||
74 | containing the broken-out fields of a line in the network protocol database, | ||
75 | .Pa /etc/protocols . | ||
76 | .Bd -literal -offset indent | ||
77 | .Pp | ||
78 | struct protoent { | ||
79 | char *p_name; /* official name of protocol */ | ||
80 | char **p_aliases; /* alias list */ | ||
81 | int p_proto; /* protocol number */ | ||
82 | }; | ||
83 | .Ed | ||
84 | .Pp | ||
85 | The members of this structure are: | ||
86 | .Bl -tag -width p_aliases | ||
87 | .It Fa p_name | ||
88 | The official name of the protocol. | ||
89 | .It Fa p_aliases | ||
90 | A null-terminated list of alternate names for the protocol. | ||
91 | .It Fa p_proto | ||
92 | The protocol number. | ||
93 | .El | ||
94 | .Pp | ||
95 | The | ||
96 | .Fn getprotoent | ||
97 | function reads the next line of the file, opening the file if necessary. | ||
98 | .Pp | ||
99 | The | ||
100 | .Fn setprotoent | ||
101 | function opens and rewinds the file. | ||
102 | If the | ||
103 | .Fa stayopen | ||
104 | flag is non-zero, | ||
105 | the protocol database will not be closed after each call to | ||
106 | .Fn getprotobyname | ||
107 | or | ||
108 | .Fn getprotobynumber . | ||
109 | .Pp | ||
110 | The | ||
111 | .Fn endprotoent | ||
112 | function closes the file. | ||
113 | .Pp | ||
114 | The | ||
115 | .Fn getprotobyname | ||
116 | and | ||
117 | .Fn getprotobynumber | ||
118 | functions sequentially search from the beginning of the file until a | ||
119 | matching protocol name or protocol number is found, or until | ||
120 | .Dv EOF | ||
121 | is encountered. | ||
122 | .Pp | ||
123 | The | ||
124 | .Fn getprotoent_r , | ||
125 | .Fn getprotobyport_r , | ||
126 | .Fn getprotobyname_r , | ||
127 | .Fn setprotoent_r , | ||
128 | and | ||
129 | .Fn endprotoent_r | ||
130 | functions are reentrant versions of the above functions that take a | ||
131 | pointer to a | ||
132 | .Vt protoent_data | ||
133 | structure which is used to store state information. | ||
134 | The structure must be zero-filled before it is used | ||
135 | and should be considered opaque for the sake of portability. | ||
136 | .Pp | ||
137 | The | ||
138 | .Fn getprotoent_r , | ||
139 | .Fn getprotobyport_r , | ||
140 | and | ||
141 | .Fn getprotobyname_r | ||
142 | functions | ||
143 | also take a pointer to a | ||
144 | .Vt protoent | ||
145 | structure which is used to store the results of the database lookup. | ||
146 | .Sh RETURN VALUES | ||
147 | The | ||
148 | .Fn getprotoent , | ||
149 | .Fn getprotobyport , | ||
150 | and | ||
151 | .Fn getprotobyname | ||
152 | functions return a pointer to a | ||
153 | .Vt protoent | ||
154 | structure on success or a null pointer if end-of-file | ||
155 | is reached or an error occurs. | ||
156 | .Pp | ||
157 | The | ||
158 | .Fn getprotoent_r , | ||
159 | .Fn getprotobyport_r , | ||
160 | and | ||
161 | .Fn getprotobyname_r | ||
162 | functions return 0 on success or \-1 if end-of-file | ||
163 | is reached or an error occurs. | ||
164 | .Sh FILES | ||
165 | .Bl -tag -width /etc/protocols -compact | ||
166 | .It Pa /etc/protocols | ||
167 | .El | ||
168 | .Sh SEE ALSO | ||
169 | .Xr protocols 5 | ||
170 | .Sh STANDARDS | ||
171 | The | ||
172 | .Fn getprotoent , | ||
173 | .Fn getprotobynumber , | ||
174 | .Fn getprotobyname , | ||
175 | .Fn setprotoent , | ||
176 | and | ||
177 | .Fn endprotoent | ||
178 | functions conform to | ||
179 | .St -p1003.1-2004 . | ||
180 | .Pp | ||
181 | The | ||
182 | .Fn getprotoent_r , | ||
183 | .Fn getprotobyport_r , | ||
184 | .Fn getprotobyname_r , | ||
185 | .Fn setprotoent_r , | ||
186 | and | ||
187 | .Fn endprotoent_r | ||
188 | functions are not currently standardized. | ||
189 | This implementation follows the API used by HP, IBM, and Digital. | ||
190 | .Sh HISTORY | ||
191 | The | ||
192 | .Fn getprotoent , | ||
193 | .Fn getprotobynumber , | ||
194 | .Fn getprotobyname , | ||
195 | .Fn setprotoent , | ||
196 | and | ||
197 | .Fn endprotoent | ||
198 | functions appeared in | ||
199 | .Bx 4.2 . | ||
200 | .Pp | ||
201 | The | ||
202 | .Fn getprotoent_r , | ||
203 | .Fn getprotobyport_r , | ||
204 | .Fn getprotobyname_r , | ||
205 | .Fn setprotoent_r , | ||
206 | and | ||
207 | .Fn endprotoent_r | ||
208 | functions appeared in | ||
209 | .Ox 3.7 . | ||
210 | .Sh BUGS | ||
211 | The non-reentrant functions use a static data space; if the data is needed | ||
212 | for future use, it should be copied before any subsequent calls overwrite it. | ||
213 | Only the Internet protocols are currently understood. | ||