Commit | Line | Data |
---|---|---|
56e6bd55 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
d148e37f | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
d148e37f | 5 | .\" |
91cff1e1 | 6 | .\" @(#)getprotoent.3 6.5 (Berkeley) %G% |
56e6bd55 KB |
7 | .\" |
8 | .TH GETPROTOENT 3 "" | |
d148e37f KM |
9 | .UC 5 |
10 | .SH NAME | |
56e6bd55 KB |
11 | getprotoent, getprotobynumber, getprotobyname, setprotoent, |
12 | endprotoent \- get protocol entry | |
d148e37f KM |
13 | .SH SYNOPSIS |
14 | .nf | |
15 | .ft B | |
16 | .B #include <netdb.h> | |
17 | .PP | |
18 | .ft B | |
19 | struct protoent *getprotoent() | |
20 | .PP | |
21 | .ft B | |
22 | struct protoent *getprotobyname(name) | |
23 | char *name; | |
24 | .PP | |
25 | .ft B | |
26 | struct protoent *getprotobynumber(proto) | |
27 | int proto; | |
28 | .PP | |
29 | .ft B | |
30 | setprotoent(stayopen) | |
31 | int stayopen | |
32 | .PP | |
33 | .ft B | |
34 | endprotoent() | |
35 | .fi | |
36 | .SH DESCRIPTION | |
37 | .IR Getprotoent , | |
38 | .IR getprotobyname , | |
39 | and | |
40 | .I getprotobynumber | |
41 | each return a pointer to an object with the | |
42 | following structure | |
43 | containing the broken-out | |
44 | fields of a line in the network protocol data base, | |
45 | .IR /etc/protocols . | |
46 | .RS | |
47 | .PP | |
48 | .nf | |
49 | struct protoent { | |
50 | char *p_name; /* official name of protocol */ | |
51 | char **p_aliases; /* alias list */ | |
50159ed7 | 52 | int p_proto; /* protocol number */ |
d148e37f KM |
53 | }; |
54 | .ft R | |
55 | .ad | |
56 | .fi | |
57 | .RE | |
58 | .PP | |
59 | The members of this structure are: | |
60 | .TP \w'p_aliases'u+2n | |
61 | p_name | |
62 | The official name of the protocol. | |
63 | .TP \w'p_aliases'u+2n | |
64 | p_aliases | |
65 | A zero terminated list of alternate names for the protocol. | |
66 | .TP \w'p_aliases'u+2n | |
67 | p_proto | |
68 | The protocol number. | |
69 | .PP | |
70 | .I Getprotoent | |
71 | reads the next line of the file, opening the file if necessary. | |
72 | .PP | |
73 | .I Setprotoent | |
74 | opens and rewinds the file. If the | |
75 | .I stayopen | |
76 | flag is non-zero, | |
77 | the net data base will not be closed after each call to | |
ec178508 JL |
78 | .I getprotobyname |
79 | or | |
80 | .IR getprotobynumber . | |
d148e37f KM |
81 | .PP |
82 | .I Endprotoent | |
83 | closes the file. | |
84 | .PP | |
85 | .I Getprotobyname | |
86 | and | |
87 | .I getprotobynumber | |
88 | sequentially search from the beginning | |
89 | of the file until a matching | |
90 | protocol name or | |
91 | protocol number is found, | |
92 | or until EOF is encountered. | |
93 | .SH FILES | |
94 | /etc/protocols | |
95 | .SH "SEE ALSO" | |
96 | protocols(5) | |
97 | .SH DIAGNOSTICS | |
98 | Null pointer | |
99 | (0) returned on EOF or error. | |
100 | .SH BUGS | |
101 | All information | |
102 | is contained in a static area | |
103 | so it must be copied if it is | |
104 | to be saved. Only the Internet | |
105 | protocols are currently understood. |