xref: /csrg-svn/lib/libc/net/getprotoent.3 (revision 61150)
1*61150Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61150Sbostic.\"	The Regents of the University of California.  All rights reserved.
320526Smckusick.\"
443572Strent.\" %sccs.include.redist.man%
520526Smckusick.\"
6*61150Sbostic.\"     @(#)getprotoent.3	8.1 (Berkeley) 06/04/93
736746Sbostic.\"
848352Scael.Dd
948352Scael.Dt GETPROTOENT 3
1048352Scael.Os BSD 4.2
1148352Scael.Sh NAME
1248352Scael.Nm getprotoent ,
1348352Scael.Nm getprotobynumber ,
1448352Scael.Nm getprotobyname ,
1548352Scael.Nm setprotoent ,
1648352Scael.Nm endprotoent
1748352Scael.Nd get protocol entry
1848352Scael.Sh SYNOPSIS
1948352Scael.Fd #include <netdb.h>
2048352Scael.Ft struct protoent *
2148352Scael.Fn getprotoent
2248352Scael.Ft struct protoent *
2348352Scael.Fn getprotobyname "char *name"
2448352Scael.Ft struct protoent *
2548352Scael.Fn getprotobynumber "int proto"
2648352Scael.Fn setprotoent "int stayopen"
2748352Scael.Fn endprotoent
2848352Scael.Sh DESCRIPTION
2948352ScaelThe
3048352Scael.Fn getprotoent ,
3148352Scael.Fn getprotobyname ,
3220526Smckusickand
3348352Scael.Fn getprotobynumber
3448352Scaelfunctions
3520526Smckusickeach return a pointer to an object with the
3620526Smckusickfollowing structure
3720526Smckusickcontaining the broken-out
3820526Smckusickfields of a line in the network protocol data base,
3948352Scael.Pa /etc/protocols .
4048352Scael.Bd -literal -offset indent
4148352Scael.Pp
4220526Smckusickstruct	protoent {
4320526Smckusick	char	*p_name;	/* official name of protocol */
4420526Smckusick	char	**p_aliases;	/* alias list */
4527925Slepreau	int	p_proto;	/* protocol number */
4620526Smckusick};
4748352Scael.Ed
4848352Scael.Pp
4920526SmckusickThe members of this structure are:
5048352Scael.Bl -tag -width p_aliases
5148352Scael.It Fa p_name
5220526SmckusickThe official name of the protocol.
5348352Scael.It Fa p_aliases
5420526SmckusickA zero terminated list of alternate names for the protocol.
5548352Scael.It Fa p_proto
5620526SmckusickThe protocol number.
5748352Scael.El
5848352Scael.Pp
5948352ScaelThe
6048352Scael.Fn getprotoent
6148352Scaelfunction
6220526Smckusickreads the next line of the file, opening the file if necessary.
6348352Scael.Pp
6448352ScaelThe
6548352Scael.Fn setprotoent
6648352Scaelfunction
6720526Smckusickopens and rewinds the file.  If the
6848352Scael.Fa stayopen
6920526Smckusickflag is non-zero,
7020526Smckusickthe net data base will not be closed after each call to
7148352Scael.Fn getprotobyname
7228279Slepreauor
7348352Scael.Fn getprotobynumber .
7448352Scael.Pp
7548352ScaelThe
7648352Scael.Fn endprotoent
7748352Scaelfunction
7820526Smckusickcloses the file.
7948352Scael.Pp
8048352ScaelThe
8148352Scael.Fn getprotobyname
8248352Scaelfunction
8320526Smckusickand
8448352Scael.Fn getprotobynumber
8520526Smckusicksequentially search from the beginning
8620526Smckusickof the file until a matching
8720526Smckusickprotocol name or
8820526Smckusickprotocol number is found,
8948352Scaelor until
9048352Scael.Dv EOF
9148352Scaelis encountered.
9248352Scael.Sh RETURN VALUES
9320526SmckusickNull pointer
9448352Scael(0) returned on
9548352Scael.Dv EOF
9648352Scaelor error.
9748352Scael.Sh FILES
9848352Scael.Bl -tag -width /etc/protocols -compact
9948352Scael.It Pa /etc/protocols
10048352Scael.El
10148352Scael.Sh SEE ALSO
10248352Scael.Xr protocols 5
10348352Scael.Sh HISTORY
10448352ScaelThe
10548352Scael.Fn getprotoent ,
10648352Scael.Fn getprotobynumber ,
10748352Scael.Fn getprotobyname ,
10848352Scael.Fn setprotoent ,
10948352Scaeland
11048352Scael.Fn endprotoent
11148352Scaelfunctions appeared in
11248352Scael.Bx 4.2 .
11348352Scael.Sh BUGS
11448352ScaelThese functions use a static data space;
11548352Scaelif the data is needed for future use, it should be
11648352Scaelcopied before any subsequent calls overwrite it.
11748352ScaelOnly the Internet
11820526Smckusickprotocols are currently understood.
119