'\"macro stdmacro
.if n .pH g3n.rpcbind @(#)rpcbind	40.10 of 1/9/90
.\" Copyright 1989 AT&T
.\" Copyright (c) 1988 Sun Microsystem's, Inc. - All Right's Reserved.
.nr X
.if \nX=0 .ds x} rpcbind 3N "" "\&"
.if \nX=1 .ds x} rpcbind 3N ""
.if \nX=2 .ds x} rpcbind 3N "" "\&"
.if \nX=3 .ds x} rpcbind "" "" "\&"
.TH \*(x}
.SH NAME
.na
\f4rpcbind\fP:  \f4 rpcb_getmaps\f1, \f4rpcb_getaddr\f1, \f4rpcb_gettime\f1, \f4rpcb_rmtcall\f1, \f4rpcb_set\f1, \f4rpcb_unset\f1 \- library routines for RPC bind service
.ad
.SH DESCRIPTION
These routines allow client C programs to make procedure
calls to the RPC binder service.
\f4rpcbind\f1 [see \f4rpcbind\fP(1M)]
maintains a list of mappings between programs
and their universal addresses.
.SS Routines
.P
.ft 4
#include <rpc/rpc.h>
.ft 1
.P
.ft 4
.nf
.sp .5
struct rpcblist *
rpcb_getmaps(const struct netconfig *netconf, const char *host);
.fi
.ft 1
.IP
A user interface to the
\f4rpcbind\f1
service,
which returns a list of the current
RPC program-to-address mappings
on the host named.
It uses the transport specified through
\f2netconf\f1
to contact the remote
\f4rpcbind\f1
service on host
\f2host\f1.
This routine will return \f4NULL\fP,
if the remote
\f4rpcbind\f1
could not be contacted.
.br
.if t .ne 12
.P
.ft 4
.nf
.sp .5
bool_t
rpcb_getaddr(const u_long prognum, const u_long versnum,
	const struct netconfig *netconf, struct netbuf *svcaddr,
	const char *host);
.fi
.ft 1
.IP
A user interface to the
\f4rpcbind\f1
service,
which finds the address of the service
on
\f2host\f1
that is registered with program number
\f2prognum\f1,
version
\f2versnum\f1,
and speaks the transport protocol associated with
\f2netconf\f1.
The address found is returned in
\f2svcaddr\f1.
\f2svcaddr\f1
should be preallocated.
This routine returns \f41\f1 if it succeeds.
A return value of \f40\f1 means that the mapping does not exist
or that the RPC
system failed to contact the remote
\f4rpcbind\f1
service.
In the latter case, the global variable
\f4rpc_createerr\f1
contains the RPC status.
.br
.if t .ne 15
.P
.ft 4
.nf
.sp .5
bool_t
rpcb_gettime(const char *host, time_t *timep);
.fi
.ft 1
.IP
This routine returns the time on
\f2host\f1 in
\f2timep\f1.
If
\f2host\f1
is \f4NULL\fP,
\f4rpcb_gettime\f1
returns the time on its own machine.
This routine returns \f41\fP if it succeeds, \f40\fP if it fails.
\f4rpcb_gettime\f1
can be used to synchronize the time between the
client and the remote server.  
This routine is particularly useful for secure
RPC.
.br
.if t .ne 15
.P
.ft 4
.nf
.sp .5
enum clnt_stat
rpcb_rmtcall(const struct netconfig *netconf, const char *host,
	const u_long prognum, const u_long versnum, const u_long procnum,
	const xdrproc_t inproc, const caddr_t in,
	const xdrproc_t outproc, const caddr_t out,
	const struct timeval tout, struct netbuf  *svcaddr);
.fi
.ft 1
.IP
A user interface to the
\f4rpcbind\f1
service,
which instructs
\f4rpcbind\f1
on
\f2host\f1
to make an RPC
call on your behalf to a procedure on that host.
The parameter
\f2*svcaddr\f1
will be modified to the server's address if the
procedure succeeds
[see \f4rpc_call\f1 and \f4clnt_call\f1 in \f4rpc_clnt_calls\fP(3N)
for the definitions of other parameters].
This procedure should normally be used for a
\(lqping\(rq and nothing else
[see 
\f4rpc_broadcast\f1 in 
\f4rpc_clnt_calls\fP(3N)].
This routine allows programs to do lookup
and call, all in one step.
.br
.if t .ne 9
.P
.ft 4
.nf
.sp .5
bool_t
rpcb_set(const u_long prognum, const u_long versnum,
	const struct netconfig *netconf, const struct netbuf *svcaddr);
.fi
.ft 1
.IP
A user interface to the
\f4rpcbind\f1
service,
which establishes a mapping between the triple
[\f2prognum, versnum, netconf\f4->nc_netid\f1]
and
\f2svcaddr\f1
on the machine's
\f4rpcbind\f1
service.
The value of
\f2transport\f1
must correspond to a network token that is defined by the
netconfig database.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
[See also \f4svc_reg\f1 in \f4rpc_svc_calls\fP(3N)].
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
rpcb_unset(const u_long prognum, const u_long versnum,
	const struct netconfig *netconf);
.fi
.ft 1
.IP
A user interface to the
\f4rpcbind\f1
service,
which destroys all mapping between the triple
[\f2prognum, versnum, netconf\f4->nc_netid\f1]
and the address on the machine's
\f4rpcbind\f1
service.
If 
\f2netconf\f1
is \f4NULL\fP,
\f4rpcb_unset\f1
destroys all mapping between the triple
[\f2prognum, versnum, \f4*\f1]
and the addresses on the machine's
\f4rpcbind\f1
service.
This routine returns \f41\f1 if it succeeds, 
\f40\f1 otherwise.
[See also \f4svc_unreg\f1 in \f4rpc_svc_calls\fP(3N)].
.br
.ne 10
.SH SEE ALSO
.na
\f4rpc_clnt_calls\fP(3N),
\f4rpc_svc_calls\fP(3N),
\f4rpcbind\fP(1M),
\f4rpcinfo\fP(1M).
.ad
