1GETPROTOENT(3) Linux Programmer's Manual GETPROTOENT(3)
2
3
4
6 getprotoent, getprotobyname, getprotobynumber, setprotoent, endprotoent
7 - get protocol entry
8
10 #include <netdb.h>
11
12 struct protoent *getprotoent(void);
13
14 struct protoent *getprotobyname(const char *name);
15
16 struct protoent *getprotobynumber(int proto);
17
18 void setprotoent(int stayopen);
19
20 void endprotoent(void);
21
23 The getprotoent() function reads the next line from the file /etc/pro‐
24 tocols and returns a structure protoent containing the broken out
25 fields from the line. The /etc/protocols file is opened if necessary.
26
27 The getprotobyname() function returns a protoent structure for the line
28 from /etc/protocols that matches the protocol name name.
29
30 The getprotobynumber() function returns a protoent structure for the
31 line that matches the protocol number number.
32
33 The setprotoent() function opens and rewinds the /etc/protocols file.
34 If stayopen is true (1), then the file will not be closed between calls
35 to getprotobyname() or getprotobynumber().
36
37 The endprotoent() function closes /etc/protocols.
38
39 The protoent structure is defined in <netdb.h> as follows:
40
41 struct protoent {
42 char *p_name; /* official protocol name */
43 char **p_aliases; /* alias list */
44 int p_proto; /* protocol number */
45 }
46
47 The members of the protoent structure are:
48
49 p_name The official name of the protocol.
50
51 p_aliases
52 A zero terminated list of alternative names for the protocol.
53
54 p_proto
55 The protocol number.
56
58 The getprotoent(), getprotobyname() and getprotobynumber() functions
59 return the protoent structure, or a NULL pointer if an error occurs or
60 the end of the file is reached.
61
63 /etc/protocols
64 protocol database file
65
67 4.3BSD, POSIX.1-2001.
68
70 getnetent(3), getservent(3), protocols(5)
71
72
73
74BSD 1993-04-24 GETPROTOENT(3)