1ENDPROTOENT(3P) POSIX Programmer's Manual ENDPROTOENT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent
13 — network protocol database functions
14
16 #include <netdb.h>
17
18 void endprotoent(void);
19 struct protoent *getprotobyname(const char *name);
20 struct protoent *getprotobynumber(int proto);
21 struct protoent *getprotoent(void);
22 void setprotoent(int stayopen);
23
25 These functions shall retrieve information about protocols. This infor‐
26 mation is considered to be stored in a database that can be accessed
27 sequentially or randomly. The implementation of this database is
28 unspecified.
29
30 The setprotoent() function shall open a connection to the database, and
31 set the next entry to the first entry. If the stayopen argument is non-
32 zero, the connection to the network protocol database shall not be
33 closed after each call to getprotoent() (either directly, or indirectly
34 through one of the other getproto*() functions), and the implementation
35 may maintain an open file descriptor for the database.
36
37 The getprotobyname() function shall search the database from the begin‐
38 ning and find the first entry for which the protocol name specified by
39 name matches the p_name member, opening and closing a connection to the
40 database as necessary.
41
42 The getprotobynumber() function shall search the database from the
43 beginning and find the first entry for which the protocol number speci‐
44 fied by proto matches the p_proto member, opening and closing a connec‐
45 tion to the database as necessary.
46
47 The getprotoent() function shall read the next entry of the database,
48 opening and closing a connection to the database as necessary.
49
50 The getprotobyname(), getprotobynumber(), and getprotoent() functions
51 shall each return a pointer to a protoent structure, the members of
52 which shall contain the fields of an entry in the network protocol
53 database.
54
55 The endprotoent() function shall close the connection to the database,
56 releasing any open file descriptor.
57
58 These functions need not be thread-safe.
59
61 Upon successful completion, getprotobyname(), getprotobynumber(), and
62 getprotoent() return a pointer to a protoent structure if the requested
63 entry was found, and a null pointer if the end of the database was
64 reached or the requested entry was not found. Otherwise, a null
65 pointer is returned.
66
67 The application shall not modify the structure to which the return
68 value points, nor any storage areas pointed to by pointers within the
69 structure. The returned pointer, and pointers within the structure,
70 might be invalidated or the structure or the storage areas might be
71 overwritten by a subsequent call to getprotobyname(), getprotobynum‐
72 ber(), or getprotoent(). The returned pointer, and pointers within the
73 structure, might also be invalidated if the calling thread is termi‐
74 nated.
75
77 No errors are defined.
78
79 The following sections are informative.
80
82 None.
83
85 None.
86
88 None.
89
91 None.
92
94 The Base Definitions volume of POSIX.1‐2017, <netdb.h>
95
97 Portions of this text are reprinted and reproduced in electronic form
98 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
99 table Operating System Interface (POSIX), The Open Group Base Specifi‐
100 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
101 Electrical and Electronics Engineers, Inc and The Open Group. In the
102 event of any discrepancy between this version and the original IEEE and
103 The Open Group Standard, the original IEEE and The Open Group Standard
104 is the referee document. The original Standard can be obtained online
105 at http://www.opengroup.org/unix/online.html .
106
107 Any typographical or formatting errors that appear in this page are
108 most likely to have been introduced during the conversion of the source
109 files to man page format. To report such errors, see https://www.ker‐
110 nel.org/doc/man-pages/reporting_bugs.html .
111
112
113
114IEEE/The Open Group 2017 ENDPROTOENT(3P)