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
11
13 endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent
14 — network protocol database functions
15
17 #include <netdb.h>
18
19 void endprotoent(void);
20 struct protoent *getprotobyname(const char *name);
21 struct protoent *getprotobynumber(int proto);
22 struct protoent *getprotoent(void);
23 void setprotoent(int stayopen);
24
26 These functions shall retrieve information about protocols. This infor‐
27 mation is considered to be stored in a database that can be accessed
28 sequentially or randomly. The implementation of this database is
29 unspecified.
30
31 The setprotoent() function shall open a connection to the database, and
32 set the next entry to the first entry. If the stayopen argument is non-
33 zero, the connection to the network protocol database shall not be
34 closed after each call to getprotoent() (either directly, or indirectly
35 through one of the other getproto*() functions), and the implementation
36 may maintain an open file descriptor for the database.
37
38 The getprotobyname() function shall search the database from the begin‐
39 ning and find the first entry for which the protocol name specified by
40 name matches the p_name member, opening and closing a connection to the
41 database as necessary.
42
43 The getprotobynumber() function shall search the database from the
44 beginning and find the first entry for which the protocol number speci‐
45 fied by proto matches the p_proto member, opening and closing a connec‐
46 tion to the database as necessary.
47
48 The getprotoent() function shall read the next entry of the database,
49 opening and closing a connection to the database as necessary.
50
51 The getprotobyname(), getprotobynumber(), and getprotoent() functions
52 shall each return a pointer to a protoent structure, the members of
53 which shall contain the fields of an entry in the network protocol
54 database.
55
56 The endprotoent() function shall close the connection to the database,
57 releasing any open file descriptor.
58
59 These functions need not be thread-safe.
60
62 Upon successful completion, getprotobyname(), getprotobynumber(), and
63 getprotoent() return a pointer to a protoent structure if the requested
64 entry was found, and a null pointer if the end of the database was
65 reached or the requested entry was not found. Otherwise, a null
66 pointer is returned.
67
68 The application shall not modify the structure to which the return
69 value points, nor any storage areas pointed to by pointers within the
70 structure. The returned pointer, and pointers within the structure,
71 might be invalidated or the structure or the storage areas might be
72 overwritten by a subsequent call to getprotobyname(), getprotobynum‐
73 ber(), or getprotoent().
74
76 No errors are defined.
77
78 The following sections are informative.
79
81 None.
82
84 None.
85
87 None.
88
90 None.
91
93 The Base Definitions volume of POSIX.1‐2008, <netdb.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
98 -- Portable Operating System Interface (POSIX), The Open Group Base
99 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
100 cal and Electronics Engineers, Inc and The Open Group. (This is
101 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/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 2013 ENDPROTOENT(3P)