Commit | Line | Data |
---|---|---|
56e6bd55 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
d148e37f | 3 | .\" |
56e6bd55 KB |
4 | .\" Redistribution and use in source and binary forms are permitted |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
d148e37f | 15 | .\" |
56e6bd55 KB |
16 | .\" @(#)getprotoent.3 6.4 (Berkeley) %G% |
17 | .\" | |
18 | .TH GETPROTOENT 3 "" | |
d148e37f KM |
19 | .UC 5 |
20 | .SH NAME | |
56e6bd55 KB |
21 | getprotoent, getprotobynumber, getprotobyname, setprotoent, |
22 | endprotoent \- get protocol entry | |
d148e37f KM |
23 | .SH SYNOPSIS |
24 | .nf | |
25 | .ft B | |
26 | .B #include <netdb.h> | |
27 | .PP | |
28 | .ft B | |
29 | struct protoent *getprotoent() | |
30 | .PP | |
31 | .ft B | |
32 | struct protoent *getprotobyname(name) | |
33 | char *name; | |
34 | .PP | |
35 | .ft B | |
36 | struct protoent *getprotobynumber(proto) | |
37 | int proto; | |
38 | .PP | |
39 | .ft B | |
40 | setprotoent(stayopen) | |
41 | int stayopen | |
42 | .PP | |
43 | .ft B | |
44 | endprotoent() | |
45 | .fi | |
46 | .SH DESCRIPTION | |
47 | .IR Getprotoent , | |
48 | .IR getprotobyname , | |
49 | and | |
50 | .I getprotobynumber | |
51 | each return a pointer to an object with the | |
52 | following structure | |
53 | containing the broken-out | |
54 | fields of a line in the network protocol data base, | |
55 | .IR /etc/protocols . | |
56 | .RS | |
57 | .PP | |
58 | .nf | |
59 | struct protoent { | |
60 | char *p_name; /* official name of protocol */ | |
61 | char **p_aliases; /* alias list */ | |
50159ed7 | 62 | int p_proto; /* protocol number */ |
d148e37f KM |
63 | }; |
64 | .ft R | |
65 | .ad | |
66 | .fi | |
67 | .RE | |
68 | .PP | |
69 | The members of this structure are: | |
70 | .TP \w'p_aliases'u+2n | |
71 | p_name | |
72 | The official name of the protocol. | |
73 | .TP \w'p_aliases'u+2n | |
74 | p_aliases | |
75 | A zero terminated list of alternate names for the protocol. | |
76 | .TP \w'p_aliases'u+2n | |
77 | p_proto | |
78 | The protocol number. | |
79 | .PP | |
80 | .I Getprotoent | |
81 | reads the next line of the file, opening the file if necessary. | |
82 | .PP | |
83 | .I Setprotoent | |
84 | opens and rewinds the file. If the | |
85 | .I stayopen | |
86 | flag is non-zero, | |
87 | the net data base will not be closed after each call to | |
ec178508 JL |
88 | .I getprotobyname |
89 | or | |
90 | .IR getprotobynumber . | |
d148e37f KM |
91 | .PP |
92 | .I Endprotoent | |
93 | closes the file. | |
94 | .PP | |
95 | .I Getprotobyname | |
96 | and | |
97 | .I getprotobynumber | |
98 | sequentially search from the beginning | |
99 | of the file until a matching | |
100 | protocol name or | |
101 | protocol number is found, | |
102 | or until EOF is encountered. | |
103 | .SH FILES | |
104 | /etc/protocols | |
105 | .SH "SEE ALSO" | |
106 | protocols(5) | |
107 | .SH DIAGNOSTICS | |
108 | Null pointer | |
109 | (0) returned on EOF or error. | |
110 | .SH BUGS | |
111 | All information | |
112 | is contained in a static area | |
113 | so it must be copied if it is | |
114 | to be saved. Only the Internet | |
115 | protocols are currently understood. |