1ENDNETENT(3P) POSIX Programmer's Manual ENDNETENT(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 endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent — network
13 database functions
14
16 #include <netdb.h>
17
18 void endnetent(void);
19 struct netent *getnetbyaddr(uint32_t net, int type);
20 struct netent *getnetbyname(const char *name);
21 struct netent *getnetent(void);
22 void setnetent(int stayopen);
23
25 These functions shall retrieve information about networks. 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 setnetent() function shall open and rewind the database. If the
31 stayopen argument is non-zero, the connection to the net database shall
32 not be closed after each call to getnetent() (either directly, or indi‐
33 rectly through one of the other getnet*() functions), and the implemen‐
34 tation may maintain an open file descriptor to the database.
35
36 The getnetent() function shall read the next entry of the database,
37 opening and closing a connection to the database as necessary.
38
39 The getnetbyaddr() function shall search the database from the begin‐
40 ning, and find the first entry for which the address family specified
41 by type matches the n_addrtype member and the network number net
42 matches the n_net member, opening and closing a connection to the data‐
43 base as necessary. The net argument shall be the network number in
44 host byte order.
45
46 The getnetbyname() function shall search the database from the begin‐
47 ning and find the first entry for which the network name specified by
48 name matches the n_name member, opening and closing a connection to the
49 database as necessary.
50
51 The getnetbyaddr(), getnetbyname(), and getnetent() functions shall
52 each return a pointer to a netent structure, the members of which shall
53 contain the fields of an entry in the network database.
54
55 The endnetent() function shall close the database, releasing any open
56 file descriptor.
57
58 These functions need not be thread-safe.
59
61 Upon successful completion, getnetbyaddr(), getnetbyname(), and getne‐
62 tent() shall return a pointer to a netent 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 shall be 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 getnetbyaddr(), getnetbyname(), or
72 getnetent(). The returned pointer, and pointers within the structure,
73 might also be invalidated if the calling thread is terminated.
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‐2017, <netdb.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
98 table Operating System Interface (POSIX), The Open Group Base Specifi‐
99 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
100 Electrical and Electronics Engineers, Inc and The Open Group. In the
101 event of any discrepancy between this version and the original IEEE and
102 The Open Group Standard, the original IEEE and The Open Group Standard
103 is the referee document. The original Standard can be obtained online
104 at http://www.opengroup.org/unix/online.html .
105
106 Any typographical or formatting errors that appear in this page are
107 most likely to have been introduced during the conversion of the source
108 files to man page format. To report such errors, see https://www.ker‐
109 nel.org/doc/man-pages/reporting_bugs.html .
110
111
112
113IEEE/The Open Group 2017 ENDNETENT(3P)