1endnetent(3XNET) X/Open Networking Services Library Functions endnetent(3XNET)
2
3
4
6 endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent - network
7 database functions
8
10 cc [ flag ... ] file ... -lxnet [ library ... ]
11 #include <netdb.h>
12
13 void endnetent(void);struct netent *getnetbyaddr(in_addr_t net, int type);
14
15
16 struct netent *getnetbyname(const char *name);
17
18
19 struct netent *getnetent(void)
20
21
22 void setnetent(int stayopen);
23
24
26 The getnetbyaddr(), getnetbyname() and getnetent(), functions each
27 return a pointer to a netent structure, the members of which contain
28 the fields of an entry in the network database.
29
30
31 The getnetent() function reads the next entry of the database, opening
32 a connection to the database if necessary.
33
34
35 The getnetbyaddr() function searches the database from the beginning,
36 and finds the first entry for which the address family specified by
37 type matches the n_addrtype member and the network number net matches
38 the n_net member, opening a connection to the database if necessary.
39 The net argument is the network number in host byte order.
40
41
42 The getnetbyname() function searches the database from the beginning
43 and finds the first entry for which the network name specified by name
44 matches the n_name member, opening a connection to the database if nec‐
45 essary.
46
47
48 The setnetent() function opens and rewinds the database. If the stay‐
49 open argument is non-zero, the connection to the net database will not
50 be closed after each call to getnetent() (either directly, or indi‐
51 rectly through one of the other getnet*() functions).
52
53
54 The endnetent() function closes the database.
55
57 The getnetbyaddr(), getnetbyname() and getnetent(), functions may
58 return pointers to static data, which may be overwritten by subsequent
59 calls to any of these functions.
60
61
62 These functions are generally used with the Internet address family.
63
65 On successful completion, getnetbyaddr(), getnetbyname() and getne‐
66 tent(), return a pointer to a netent structure if the requested entry
67 was found, and a null pointer if the end of the database was reached or
68 the requested entry was not found. Otherwise, a null pointer is
69 returned.
70
72 No errors are defined.
73
75 See attributes(5) for descriptions of the following attributes:
76
77
78
79
80 ┌─────────────────────────────┬─────────────────────────────┐
81 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │Interface Stability │Standard │
84 ├─────────────────────────────┼─────────────────────────────┤
85 │MT-Level │MT-Safe │
86 └─────────────────────────────┴─────────────────────────────┘
87
89 attributes(5), standards(5)
90
91
92
93SunOS 5.11 10 Jun 2002 endnetent(3XNET)