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