1ENDPROTOENT(P) POSIX Programmer's Manual ENDPROTOENT(P)
2
3
4
6 endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent
7 - network protocol database functions
8
10 #include <netdb.h>
11
12 void endprotoent(void);
13 struct protoent *getprotobyname(const char *name);
14 struct protoent *getprotobynumber(int proto);
15 struct protoent *getprotoent(void);
16 void setprotoent(int stayopen);
17
18
20 These functions shall retrieve information about protocols. This infor‐
21 mation is considered to be stored in a database that can be accessed
22 sequentially or randomly. The implementation of this database is
23 unspecified.
24
25 The setprotoent() function shall open a connection to the database, and
26 set the next entry to the first entry. If the stayopen argument is non-
27 zero, the connection to the network protocol database shall not be
28 closed after each call to getprotoent() (either directly, or indirectly
29 through one of the other getproto*() functions), and the implementation
30 may maintain an open file descriptor for the database.
31
32 The getprotobyname() function shall search the database from the begin‐
33 ning and find the first entry for which the protocol name specified by
34 name matches the p_name member, opening and closing a connection to the
35 database as necessary.
36
37 The getprotobynumber() function shall search the database from the
38 beginning and find the first entry for which the protocol number speci‐
39 fied by proto matches the p_proto member, opening and closing a connec‐
40 tion to the database as necessary.
41
42 The getprotoent() function shall read the next entry of the database,
43 opening and closing a connection to the database as necessary.
44
45 The getprotobyname(), getprotobynumber(), and getprotoent() functions
46 shall each return a pointer to a protoent structure, the members of
47 which shall contain the fields of an entry in the network protocol
48 database.
49
50 The endprotoent() function shall close the connection to the database,
51 releasing any open file descriptor.
52
53 These functions need not be reentrant. A function that is not required
54 to be reentrant is not required to be thread-safe.
55
57 Upon successful completion, getprotobyname(), getprotobynumber(), and
58 getprotoent() return a pointer to a protoent structure if the requested
59 entry was found, and a null pointer if the end of the database was
60 reached or the requested entry was not found. Otherwise, a null pointer
61 is returned.
62
64 No errors are defined.
65
66 The following sections are informative.
67
69 None.
70
72 The getprotobyname(), getprotobynumber(), and getprotoent() functions
73 may return pointers to static data, which may be overwritten by subse‐
74 quent calls to any of these functions.
75
77 None.
78
80 None.
81
83 The Base Definitions volume of IEEE Std 1003.1-2001, <netdb.h>
84
86 Portions of this text are reprinted and reproduced in electronic form
87 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88 -- Portable Operating System Interface (POSIX), The Open Group Base
89 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
90 Electrical and Electronics Engineers, Inc and The Open Group. In the
91 event of any discrepancy between this version and the original IEEE and
92 The Open Group Standard, the original IEEE and The Open Group Standard
93 is the referee document. The original Standard can be obtained online
94 at http://www.opengroup.org/unix/online.html .
95
96
97
98IEEE/The Open Group 2003 ENDPROTOENT(P)