]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
28 | .\" 386BSD man pages | |
29 | .\" Modified Sat Jul 24 19:26:03 1993 by Rik Faith (faith@cs.unc.edu) | |
b8efb414 | 30 | .TH GETPROTOENT 3 2016-10-08 "GNU" "Linux Programmer's Manual" |
fea681da MK |
31 | .SH NAME |
32 | getprotoent, getprotobyname, getprotobynumber, setprotoent, | |
33 | endprotoent \- get protocol entry | |
34 | .SH SYNOPSIS | |
35 | .nf | |
36 | .B #include <netdb.h> | |
68e4db0a | 37 | .PP |
fea681da | 38 | .B struct protoent *getprotoent(void); |
68e4db0a | 39 | .PP |
fea681da | 40 | .BI "struct protoent *getprotobyname(const char *" name ); |
68e4db0a | 41 | .PP |
fea681da | 42 | .BI "struct protoent *getprotobynumber(int " proto ); |
68e4db0a | 43 | .PP |
fea681da | 44 | .BI "void setprotoent(int " stayopen ); |
68e4db0a | 45 | .PP |
fea681da MK |
46 | .B void endprotoent(void); |
47 | .fi | |
48 | .SH DESCRIPTION | |
60a90ecd MK |
49 | The |
50 | .BR getprotoent () | |
8dea53c5 MK |
51 | function reads the next entry from the protocols database (see |
52 | .BR protocols (5)) | |
c6fa0841 MK |
53 | and returns a |
54 | .I protoent | |
55 | structure | |
8dea53c5 MK |
56 | containing the broken-out fields from the entry. |
57 | A connection is opened to the database if necessary. | |
fea681da | 58 | .PP |
60a90ecd MK |
59 | The |
60 | .BR getprotobyname () | |
c6fa0841 MK |
61 | function returns a |
62 | .I protoent | |
63 | structure | |
8dea53c5 | 64 | for the entry from the database |
c6fa0841 MK |
65 | that matches the protocol name |
66 | .IR name . | |
8dea53c5 | 67 | A connection is opened to the database if necessary. |
fea681da | 68 | .PP |
60a90ecd MK |
69 | The |
70 | .BR getprotobynumber () | |
c6fa0841 MK |
71 | function returns a |
72 | .I protoent | |
73 | structure | |
8dea53c5 | 74 | for the entry from the database |
c6fa0841 MK |
75 | that matches the protocol number |
76 | .IR number . | |
8dea53c5 | 77 | A connection is opened to the database if necessary. |
fea681da | 78 | .PP |
60a90ecd MK |
79 | The |
80 | .BR setprotoent () | |
8dea53c5 MK |
81 | function opens a connection to the database, |
82 | and sets the next entry to the first entry. | |
c6fa0841 MK |
83 | If |
84 | .I stayopen | |
85 | is nonzero, | |
8dea53c5 MK |
86 | then the connection to the database |
87 | will not be closed between calls to one of the | |
88 | .BR getproto* () | |
89 | functions. | |
fea681da | 90 | .PP |
60a90ecd MK |
91 | The |
92 | .BR endprotoent () | |
8dea53c5 | 93 | function closes the connection to the database. |
fea681da | 94 | .PP |
c6fa0841 MK |
95 | The |
96 | .I protoent | |
97 | structure is defined in | |
98 | .I <netdb.h> | |
99 | as follows: | |
fea681da | 100 | .sp |
a08ea57c | 101 | .in +4n |
fea681da | 102 | .nf |
fea681da | 103 | struct protoent { |
7295b7ed MK |
104 | char *p_name; /* official protocol name */ |
105 | char **p_aliases; /* alias list */ | |
106 | int p_proto; /* protocol number */ | |
fea681da | 107 | } |
fea681da | 108 | .fi |
a08ea57c | 109 | .in |
fea681da | 110 | .PP |
c6fa0841 MK |
111 | The members of the |
112 | .I protoent | |
113 | structure are: | |
fea681da MK |
114 | .TP |
115 | .I p_name | |
116 | The official name of the protocol. | |
117 | .TP | |
118 | .I p_aliases | |
8dea53c5 | 119 | A NULL-terminated list of alternative names for the protocol. |
fea681da MK |
120 | .TP |
121 | .I p_proto | |
122 | The protocol number. | |
47297adb | 123 | .SH RETURN VALUE |
60a90ecd MK |
124 | The |
125 | .BR getprotoent (), | |
126 | .BR getprotobyname () | |
127 | and | |
128 | .BR getprotobynumber () | |
b5991a6e | 129 | functions return a pointer to a |
c6fa0841 MK |
130 | statically allocated |
131 | .I protoent | |
b437fdd9 | 132 | structure, or a null pointer if an |
fea681da MK |
133 | error occurs or the end of the file is reached. |
134 | .SH FILES | |
135 | .PD 0 | |
136 | .TP | |
137 | .I /etc/protocols | |
138 | protocol database file | |
139 | .PD | |
18813d7b ZL |
140 | .SH ATTRIBUTES |
141 | For an explanation of the terms used in this section, see | |
142 | .BR attributes (7). | |
143 | .TS | |
144 | allbox; | |
145 | lbw18 lb lbw28 | |
146 | l l l. | |
147 | Interface Attribute Value | |
148 | T{ | |
149 | .BR getprotoent () | |
150 | T} Thread safety T{ | |
151 | MT-Unsafe race:protoent | |
152 | .br | |
153 | race:protoentbuf locale | |
154 | T} | |
155 | T{ | |
156 | .BR getprotobyname () | |
157 | T} Thread safety T{ | |
158 | MT-Unsafe race:protobyname | |
159 | .br | |
160 | locale | |
161 | T} | |
162 | T{ | |
163 | .BR getprotobynumber () | |
164 | T} Thread safety T{ | |
165 | MT-Unsafe race:protobynumber | |
166 | .br | |
167 | locale | |
168 | T} | |
169 | T{ | |
170 | .BR setprotoent (), | |
171 | .br | |
172 | .BR endprotoent () | |
173 | T} Thread safety T{ | |
174 | MT-Unsafe race:protoent | |
175 | .br | |
176 | locale | |
177 | T} | |
178 | .TE | |
179 | ||
180 | In the above table, | |
181 | .I protoent | |
182 | in | |
183 | .I race:protoent | |
184 | signifies that if any of the functions | |
bf7bc8b8 MK |
185 | .BR setprotoent (), |
186 | .BR getprotoent (), | |
18813d7b | 187 | or |
bf7bc8b8 | 188 | .BR endprotoent () |
18813d7b ZL |
189 | are used in parallel in different threads of a program, |
190 | then data races could occur. | |
47297adb | 191 | .SH CONFORMING TO |
23755186 | 192 | POSIX.1-2001, POSIX.1-2008, 4.3BSD. |
47297adb | 193 | .SH SEE ALSO |
fea681da | 194 | .BR getnetent (3), |
a3aef2a2 | 195 | .BR getprotoent_r (3), |
fea681da MK |
196 | .BR getservent (3), |
197 | .BR protocols (5) |