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
11
13 endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent — network
14 database functions
15
17 #include <netdb.h>
18
19 void endnetent(void);
20 struct netent *getnetbyaddr(uint32_t net, int type);
21 struct netent *getnetbyname(const char *name);
22 struct netent *getnetent(void);
23 void setnetent(int stayopen);
24
26 These functions shall retrieve information about networks. 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 setnetent() function shall open and rewind the database. If the
32 stayopen argument is non-zero, the connection to the net database shall
33 not be closed after each call to getnetent() (either directly, or indi‐
34 rectly through one of the other getnet*() functions), and the implemen‐
35 tation may maintain an open file descriptor to the database.
36
37 The getnetent() function shall read the next entry of the database,
38 opening and closing a connection to the database as necessary.
39
40 The getnetbyaddr() function shall search the database from the begin‐
41 ning, and find the first entry for which the address family specified
42 by type matches the n_addrtype member and the network number net
43 matches the n_net member, opening and closing a connection to the data‐
44 base as necessary. The net argument shall be the network number in
45 host byte order.
46
47 The getnetbyname() function shall search the database from the begin‐
48 ning and find the first entry for which the network name specified by
49 name matches the n_name member, opening and closing a connection to the
50 database as necessary.
51
52 The getnetbyaddr(), getnetbyname(), and getnetent() functions shall
53 each return a pointer to a netent structure, the members of which shall
54 contain the fields of an entry in the network database.
55
56 The endnetent() function shall close the database, releasing any open
57 file descriptor.
58
59 These functions need not be thread-safe.
60
62 Upon successful completion, getnetbyaddr(), getnetbyname(), and getne‐
63 tent() shall return a pointer to a netent 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 shall be 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 getnetbyaddr(), getnetbyname(), or
73 getnetent().
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 ENDNETENT(3P)