1GETNETENT(3N)                                                    GETNETENT(3N)
2
3
4

NAME

6       getnetent,  getnetbyaddr, getnetbyname, setnetent, endnetent - get net‐
7       work entry
8

SYNOPSIS

10       #include <netdb.h>
11
12       struct netent *getnetent()
13
14       struct netent *getnetbyname(name)
15       char *name;
16
17       struct netent *getnetbyaddr(net, type)
18       long net;
19       int type;
20
21       setnetent(stayopen)
22       int stayopen;
23
24       endnetent()
25

DESCRIPTION

27       Getnetent, getnetbyname, and getnetbyaddr each return a pointer  to  an
28       object with the following structure containing the broken-out fields of
29       a line in the network data base, /etc/networks.
30
31              struct    netent {
32                   char      *n_name;  /* official name of net */
33                   char      **n_aliases;   /* alias list */
34                   int       n_addrtype;    /* net number type */
35                   unsigned long  n_net;         /* net number */
36              };
37
38       The members of this structure are:
39
40       n_name      The official name of the network.
41
42       n_aliases   A zero terminated list of alternate names for the network.
43
44       n_addrtype  The type of the network  number  returned;  currently  only
45                   AF_INET.
46
47       n_net       The  network  number.   Network  numbers  are  returned  in
48                   machine byte order.
49
50       Getnetent reads the next line of the file, opening the file  if  neces‐
51       sary.
52
53       Setnetent  opens  and  rewinds  the file.  If the stayopen flag is non-
54       zero, the net data base will not be closed after each call to getnetby‐
55       name or getnetbyaddr.
56
57       Endnetent closes the file.
58
59       Getnetbyname and getnetbyaddr sequentially search from the beginning of
60       the file until a matching net name or net address and type is found, or
61       until EOF is encountered.  Network numbers are supplied in host order.
62

FILES

64       /etc/networks
65

SEE ALSO

67       networks(5)
68

DIAGNOSTICS

70       Null pointer (0) returned on EOF or error.
71

BUGS

73       All  information  is contained in a static area so it must be copied if
74       it is to be saved.  Only Internet network numbers are currently  under‐
75       stood.   Expecting  network  numbers  to fit in no more than 32 bits is
76       probably naive.
77
78
79
804.2 Berkeley Distribution        May 19, 1986                    GETNETENT(3N)
Impressum