# endnetent

## 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.
    


## NAME



           endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent —
           network database functions
    


## SYNOPSIS



           #include <netdb.h>
    
           void endnetent(void);
           struct netent *getnetbyaddr(uint32_t _net_ , int _type_);
           struct netent *getnetbyname(const char *_name_);
           struct netent *getnetent(void);
           void setnetent(int _stayopen_);
    


## DESCRIPTION



           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.
    
           The _setnetent_() function shall open and rewind the database. If
           the _stayopen_ argument is non-zero, the connection to the _net_
           database shall not be closed after each call to _getnetent_()
           (either directly, or indirectly through one of the other _getnet*_()
           functions), and the implementation may maintain an open file
           descriptor to the database.
    
           The _getnetent_() function shall read the next entry of the
           database, opening and closing a connection to the database as
           necessary.
    
           The _getnetbyaddr_() function shall search the database from the
           beginning, and find the first entry for which the address family
           specified by _type_ matches the _n_addrtype_ member and the network
           number _net_ matches the _n_net_ member, opening and closing a
           connection to the database as necessary.  The _net_ argument shall
           be the network number in host byte order.
    
           The _getnetbyname_() function shall search the database from the
           beginning and find the first entry for which the network name
           specified by _name_ matches the _n_name_ member, opening and closing a
           connection to the database as necessary.
    
           The _getnetbyaddr_(), _getnetbyname_(), and _getnetent_() functions
           shall each return a pointer to a **netent** structure, the members of
           which shall contain the fields of an entry in the network
           database.
    
           The _endnetent_() function shall close the database, releasing any
           open file descriptor.
    
           These functions need not be thread-safe.
    


## RETURN VALUE



           Upon successful completion, _getnetbyaddr_(), _getnetbyname_(), and
           _getnetent_() shall return a pointer to a **netent** 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.
    
           The application shall not modify the structure to which the return
           value points, nor any storage areas pointed to by pointers within
           the structure. The returned pointer, and pointers within the
           structure, might be invalidated or the structure or the storage
           areas might be overwritten by a subsequent call to _getnetbyaddr_(),
           _getnetbyname_(), or _getnetent_().  The returned pointer, and
           pointers within the structure, might also be invalidated if the
           calling thread is terminated.
    


## ERRORS



           No errors are defined.
    
           _The following sections are informative._
    


## EXAMPLES



           None.
    


## APPLICATION USAGE



           None.
    


## RATIONALE



           None.
    


## FUTURE DIRECTIONS



           None.
    


* * *