DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

getrpcent(3rpc)


getrpcent, getrpcbyname, getrpcbynumber, setrpcent, endrpcent -- get rpc server entry

Synopsis

cc [options] file -lnsl
#include <rpc/rpc.h>
#include <rpc/rpcent.h>
#include <rpc/nettype.h>

struct rpcent *getrpcent(void);

struct rpcent *getrpcbyname(char *name);

struct rpcent *getrpcbynumber(int number);

int setrpcent(int stayopen);

int endrpcent(void);

Description

getrpcent, getrpcbynumber, and getrpcbyname each return a pointer to an object with the following structure containing the broken-out fields of a line in the rpc program number data base, /etc/rpc. This data base is used to convert rpc program numbers to server names.

Structure definitions

The rpcent structure is defined in rpcent.h and has the following members:
   char *r_name;		/* name of server for this rpc program */
   char **r_aliases;	/* alias list */
   int r_number;		/* rpc program number */
The members of this structure are:

r_name
Official name of the server.

r_aliases
A zero-terminated array of alternate names for the server.

r_number
The rpc program number.

getrpcent reads the next line of the file, opening the file if necessary.

getrpcbyname and getrpcbynumber sequentially search from the beginning of the file until a matching name or number is found, or until an EOF is encountered.

setrpcent opens and rewinds the file. If the stayopen flag is non-zero, the rpc data base will not be closed after each call to getrpcent (either directly, or indirectly through one of the other getrpc calls).

endrpcent closes the file.

Files

/etc/rpc
/var/yp/domainname/rpc.bynumber

Return values

A NULL pointer is returned on an EOF or error.

References

rpc(4tcp)

Notices

All information is contained in a static area, so it must be copied if it is to be saved. For multi-threaded applications, this must be done on a per-thread basis.

The Network Information Service (NIS) will be used to obtain RPC server entries when its installed and running. Otherwise, entries will be read from /etc/rpc.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004