1GETNETENT(3)               Linux Programmer's Manual              GETNETENT(3)
2
3
4

NAME

6       getnetent,  getnetbyname, getnetbyaddr, setnetent, endnetent - get net‐
7       work entry
8

SYNOPSIS

10       #include <netdb.h>
11
12       struct netent *getnetent(void);
13
14       struct netent *getnetbyname(const char *name);
15
16       struct netent *getnetbyaddr(uint32_t net, int type);
17
18       void setnetent(int stayopen);
19
20       void endnetent(void);
21

DESCRIPTION

23       The getnetent() function reads the next entry from the  networks  data‐
24       base  and  returns  a netent structure containing the broken-out fields
25       from the entry.  A connection is opened to the database if necessary.
26
27       The getnetbyname() function returns a netent structure  for  the  entry
28       from the database that matches the network name.
29
30       The  getnetbyaddr()  function  returns a netent structure for the entry
31       from the database that matches the network number  net  of  type  type.
32       The net argument must be in host byte order.
33
34       The  setnetent()  function opens a connection to the database, and sets
35       the next entry to the first entry.  If stayopen is non-zero,  then  the
36       connection  to  the database will not be closed between calls to one of
37       the getnet*() functions.
38
39       The endnetent() function closes the connection to the database.
40
41       The netent structure is defined in <netdb.h> as follows:
42
43           struct netent {
44               char      *n_name;     /* official network name */
45               char     **n_aliases;  /* alias list */
46               int        n_addrtype; /* net address type */
47               uint32_t   n_net;      /* network number */
48           }
49
50       The members of the netent structure are:
51
52       n_name The official name of the network.
53
54       n_aliases
55              A NULL-terminated list of alternative names for the network.
56
57       n_addrtype
58              The type of the network number; always AF_INET.
59
60       n_net  The network number in host byte order.
61

RETURN VALUE

63       The getnetent(), getnetbyname() and getnetbyaddr() functions  return  a
64       pointer  to  a statically allocated netent structure, or a NULL pointer
65       if an error occurs or the end of the file is reached.
66

FILES

68       /etc/networks
69              networks database file
70

CONFORMING TO

72       4.3BSD, POSIX.1-2001.
73

NOTES

75       In glibc versions before 2.2, the net argument of getnetbyaddr() was of
76       type long.
77

SEE ALSO

79       getnetent_r(3), getprotoent(3), getservent(3)
80       RFC 1101
81

COLOPHON

83       This  page  is  part of release 3.22 of the Linux man-pages project.  A
84       description of the project, and information about reporting  bugs,  can
85       be found at http://www.kernel.org/doc/man-pages/.
86
87
88
89GNU                               2008-08-19                      GETNETENT(3)
Impressum