HPUX getnetbyadd[3n]






 getnetent(3N)                                                 getnetent(3N)





 NAME
      getnetent(), getnetbyaddr(), getnetbyname(), setnetent(), endnetent()
      - get network entry

 SYNOPSIS
      #include <sys/socket.h>
      #include <netdb.h>

      struct netent *getnetent(void);

      struct netent *getnetbyname(const char *name);

      struct netent *getnetbyaddr(int net, int type);

      int setnetent(int stayopen);

      int endnetent(void);

 DESCRIPTION
      getnetent(), getnetbyname(), and getnetbyaddr() each return a pointer
      to a structure of type netent containing the broken-out fields of a
      line in the network data base, /etc/networks.

      The members of this structure are:

           n_name         The official name of the network.

           n_aliases      A null-terminated list of alternate names for the
                          network.

           n_addrtype     The type of the network number returned; always
                          AF_INET.

           n_net          The network number.

      Functions behave as follows:

           getnetent()         Reads the next line of the file, opening the
                               file if necessary.

           setnetent()         opens and rewinds the file.  If the stayopen
                               flag is non-zero, the network data base is
                               not closed after each call to getnetent()
                               (either directly or indirectly through one of
                               the other getnet* calls).

           endnetent()         Closes the file.

           getnetbyname()      Sequentially searches from the beginning of
                               the file until a network name (among either
                               the official names or the aliases) matching



 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 getnetent(3N)                                                 getnetent(3N)





                               its parameter name is found, or until EOF is
                               encountered.

           getnetbyaddr()      Sequentially searches from the beginning of
                               the file until a network number matching its
                               parameter net is found, or until EOF is
                               encountered.  The parameter net must be in
                               network order.  The parameter type must be
                               the constant AF_INET.  Network numbers are
                               supplied in host order (see byteorder(3N)).

           If the system is running Network Information Service (NFS),
           getnetbyname() and getnetbyaddr() obtain their network
           information from the NIS server (see ypserv(1M) and ypfiles(4)).

 RETURN VALUE
      getnetent(), getnetbyname(), and getnetbyaddr() return a null pointer
      (0) on EOF or when they are unable to open /etc/networks.
      getnetbyaddr() also returns a null pointer if its type parameter is
      invalid.

 WARNINGS
      All information is contained in a static area so it must be copied if
      it is to be saved.

 AUTHOR
      getnetent() was developed by the University of California, Berkeley.

 FILES
      /etc/networks

 SEE ALSO
      ypserv(1M), networks(4), ypfiles(4).





















 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992