HP 3000 Manuals

GETNETENT [ Berkeley Sockets/iX Reference Manual ] MPE/iX 5.0 Documentation


Berkeley Sockets/iX Reference Manual

GETNETENT 

C Interface 

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

          struct netent *getnetent()

          struct netent *getnetbyname(name)
          char *name;

          struct netent *getnetbyaddr(net, type)
          long net;
          int type;
          setnetent(stayopen)
          int stayopen;

          endnetent()

Description 

The getnetent, getnetbyname, and getnetbyaddr subroutines each return a
pointer to an object with the following structure.  This structure
contains fields found in the network protocol database, /etc/networks.

     struct    netent {
         char *n_name;       /* official name of net */
         char **n_aliases;   /* alias list           */
         int  n_addrtype;    /* net number type      */
         long n_net;         /* net number           */
     };

The members of this structure are as follows:

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.  Network numbers are returned
                      in machine byte order.

The getnetent subroutine reads the next line of the file, opening the
file if necessary.

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

The endnetent subroutine closes the file.

The getnetbyname subroutine sequentially searches from the beginning of
the file until a network name (among either the official names or the
aliases) matching its parameter name is found, or until EOF is
encountered.

The getnetbyaddr subroutine 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.  (Refer to the inet section.)

Restrictions 

All information is contained in a static area, so it must be copied if it
is to be saved.  Only Internet network numbers are currently understood.

Return Value 

The getnetent, getnetbyname, and getnetbyaddr subroutines return a null
pointer (0) on EOF or when they are unable to open NETWORKS.NET.SYS. The
getnetbyaddr subroutine also returns a null pointer if its parameter type 
is invalid.

MPE/iX Specific 

The name of the networks file on MPE/iX is NETWORKS.NET.SYS, as opposed
to /etc/networks on HP-UX.

Author 

UCB (University of California at Berkeley)

Files 

NETWORKS.NET.SYS

See Also 

networks



MPE/iX 5.0 Documentation