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 entry from the protocols
24 database (see protocols(5)) and returns a protoent structure containing
25 the broken-out fields from the entry. A connection is opened to the
26 database if necessary.
27
28 The getprotobyname() function returns a protoent structure for the
29 entry from the database that matches the protocol name name. A connecā
30 tion is opened to the database if necessary.
31
32 The getprotobynumber() function returns a protoent structure for the
33 entry from the database that matches the protocol number number. A
34 connection is opened to the database if necessary.
35
36 The setprotoent() function opens a connection to the database, and sets
37 the next entry to the first entry. If stayopen is nonzero, then the
38 connection to the database will not be closed between calls to one of
39 the getproto*() functions.
40
41 The endprotoent() function closes the connection to the database.
42
43 The protoent structure is defined in <netdb.h> as follows:
44
45 struct protoent {
46 char *p_name; /* official protocol name */
47 char **p_aliases; /* alias list */
48 int p_proto; /* protocol number */
49 }
50
51 The members of the protoent structure are:
52
53 p_name The official name of the protocol.
54
55 p_aliases
56 A NULL-terminated list of alternative names for the protocol.
57
58 p_proto
59 The protocol number.
60
62 The getprotoent(), getprotobyname() and getprotobynumber() functions
63 return a pointer to a statically allocated protoent structure, or a
64 NULL pointer if an error occurs or the end of the file is reached.
65
67 /etc/protocols
68 protocol database file
69
71 4.3BSD, POSIX.1-2001.
72
74 getnetent(3), getprotoent_r(3), getservent(3), protocols(5)
75
77 This page is part of release 3.53 of the Linux man-pages project. A
78 description of the project, and information about reporting bugs, can
79 be found at http://www.kernel.org/doc/man-pages/.
80
81
82
83GNU 2008-08-19 GETPROTOENT(3)