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