2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified Sat Jul 24 21:48:06 1993 by Rik Faith (faith@cs.unc.edu)
11 .TH getnetent 3 (date) "Linux man-pages (unreleased)"
13 getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent \-
17 .RI ( libc ", " \-lc )
22 .B struct netent *getnetent(void);
24 .BI "struct netent *getnetbyname(const char *" name );
25 .BI "struct netent *getnetbyaddr(uint32_t " net ", int " type );
27 .BI "void setnetent(int " stayopen );
28 .B void endnetent(void);
33 function reads the next entry from the networks database
37 the broken-out fields from the entry.
38 A connection is opened to the database if necessary.
45 for the entry from the database
46 that matches the network
54 for the entry from the database
55 that matches the network number
61 argument must be in host byte order.
65 function opens a connection to the database,
66 and sets the next entry to the first entry.
70 then the connection to the database
71 will not be closed between calls to one of the
77 function closes the connection to the database.
81 structure is defined in
88 char *n_name; /* official network name */
89 char **n_aliases; /* alias list */
90 int n_addrtype; /* net address type */
91 uint32_t n_net; /* network number */
101 The official name of the network.
104 A NULL-terminated list of alternative names for the network.
107 The type of the network number; always
111 The network number in host byte order.
118 functions return a pointer to a
121 structure, or a null pointer if an
122 error occurs or the end of the file is reached.
126 networks database file
128 For an explanation of the terms used in this section, see
136 Interface Attribute Value
140 MT-Unsafe race:netent
141 race:netentbuf env locale
146 MT-Unsafe race:netbyname
152 MT-Unsafe race:netbyaddr
159 MT-Unsafe race:netent env
170 signifies that if any of the functions
175 are used in parallel in different threads of a program,
176 then data races could occur.
178 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
180 Before glibc 2.2, the