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