Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getnetent(3N) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ypserv(1M)

networks(4)

ypfiles(4)

GETNETENT(3N)  —  Series 300 and 800 Only

NAME

getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent − get network entry

SYNOPSIS

#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)
int net, type;

setnetent(stayopen)
int stayopen

endnetent()

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. 

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 will not be 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 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 Yellow Pages (NFS), getnetbyname and getnetbyaddr get the network information from the YP 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 parameter type is invalid. 

WARNINGS

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

DEPENDENCIES

Implemented on the Series 300 and 800 only. 

AUTHOR

UCB (University of California at Berkeley)

FILES

/etc/networks

SEE ALSO

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

INTERNATIONAL SUPPORT

8-bit data, messages. 

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026