1ENDNETENT(3P)              POSIX Programmer's Manual             ENDNETENT(3P)
2
3
4

PROLOG

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

NAME

12       endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent  -  network
13       database functions
14

SYNOPSIS

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
24

DESCRIPTION

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 reentrant. A function that is not  required
60       to be reentrant is not required to be thread-safe.
61

RETURN VALUE

63       Upon  successful completion, getnetbyaddr(), getnetbyname(), and getne‐
64       tent() shall return a pointer to a netent 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       shall be returned.
68

ERRORS

70       No errors are defined.
71
72       The following sections are informative.
73

EXAMPLES

75       None.
76

APPLICATION USAGE

78       The  getnetbyaddr(),  getnetbyname(),  and  getnetent()  functions  may
79       return pointers to static data, which may be overwritten by  subsequent
80       calls to any of these functions.
81

RATIONALE

83       None.
84

FUTURE DIRECTIONS

86       None.
87

SEE ALSO

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                        ENDNETENT(3P)
Impressum