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
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 reentrant. A function that is not required
60 to be reentrant is not required to be thread-safe.
61
63 Upon successful completion, getprotobyname(), getprotobynumber(), and
64 getprotoent() return a pointer to a protoent structure if the requested
65 entry was found, and a null pointer if the end of the database was
66 reached or the requested entry was not found. Otherwise, a null pointer
67 is returned.
68
70 No errors are defined.
71
72 The following sections are informative.
73
75 None.
76
78 The getprotobyname(), getprotobynumber(), and getprotoent() functions
79 may return pointers to static data, which may be overwritten by subse‐
80 quent calls to any of these functions.
81
83 None.
84
86 None.
87
89 The Base Definitions volume of IEEE Std 1003.1-2001, <netdb.h>
90
92 Portions of this text are reprinted and reproduced in electronic form
93 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
94 -- Portable Operating System Interface (POSIX), The Open Group Base
95 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
96 Electrical and Electronics Engineers, Inc and The Open Group. In the
97 event of any discrepancy between this version and the original IEEE and
98 The Open Group Standard, the original IEEE and The Open Group Standard
99 is the referee document. The original Standard can be obtained online
100 at http://www.opengroup.org/unix/online.html .
101
102
103
104IEEE/The Open Group 2003 ENDPROTOENT(3P)