.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "ENDNETENT" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" endnetent
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent \- network
database functions
.SH SYNOPSIS
.LP
\fB#include <netdb.h>
.br
.sp
void endnetent(void);
.br
struct netent *getnetbyaddr(uint32_t\fP \fInet\fP\fB, int\fP \fItype\fP\fB);
.br
struct netent *getnetbyname(const char *\fP\fIname\fP\fB);
.br
struct netent *getnetent(void);
.br
void setnetent(int\fP \fIstayopen\fP\fB);
.br
\fP
.SH DESCRIPTION
.LP
These functions shall retrieve information about networks. This information
is considered to be stored in a database that can be
accessed sequentially or randomly. The implementation of this database
is unspecified.
.LP
The \fIsetnetent\fP() function shall open and rewind the database.
If the \fIstayopen\fP argument is non-zero, the connection
to the \fInet\fP database shall not be closed after each call to \fIgetnetent\fP()
(either directly, or indirectly through one of
the other \fIgetnet*\fP() functions), and the implementation may maintain
an open file
descriptor to the database.
.LP
The \fIgetnetent\fP() function shall read the next entry of the database,
opening and closing a connection to the database as
necessary.
.LP
The \fIgetnetbyaddr\fP() function shall search the database from the
beginning, and find the first entry for which the address
family specified by \fItype\fP matches the \fIn_addrtype\fP member
and the network number \fInet\fP matches the \fIn_net\fP
member, opening and closing a connection to the database as necessary.
The \fInet\fP argument shall be the network number in host
byte order.
.LP
The \fIgetnetbyname\fP() function shall search the database from the
beginning and find the first entry for which the network
name specified by \fIname\fP matches the \fIn_name\fP member, opening
and closing a connection to the database as necessary.
.LP
The \fIgetnetbyaddr\fP(), \fIgetnetbyname\fP(), and \fIgetnetent\fP()
functions shall each return a pointer to a
\fBnetent\fP structure, the members of which shall contain the fields
of an entry in the network database.
.LP
The \fIendnetent\fP() function shall close the database, releasing
any open file descriptor.
.LP
These functions need not be reentrant. A function that is not required
to be reentrant is not required to be thread-safe.
.SH RETURN VALUE
.LP
Upon successful completion, \fIgetnetbyaddr\fP(), \fIgetnetbyname\fP(),
and \fIgetnetent\fP() shall return a pointer to a
\fBnetent\fP structure if the requested entry was found, and a null
pointer if the end of the database was reached or the
requested entry was not found. Otherwise, a null pointer shall be
returned.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
The \fIgetnetbyaddr\fP(), \fIgetnetbyname\fP(), and \fIgetnetent\fP()
functions may return pointers to static data, which may
be overwritten by subsequent calls to any of these functions.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
The Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<netdb.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
|