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