|
|
rpcbind is a daemon that converts RPC program numbers into network addresses comprehensible to any transport provider. rpcbind supports broadcast RPC. These are the main differences between broadcast RPC and normal RPC calls:
#include <rpc/clnt.h>
#include <rpc/rpcb_clnt.h>
. . .
enum clnt_stat clnt_stat;
. . .
clnt_stat = rpc_broadcast(prognum, versnum, procnum,
inproc, in, outproc, out, eachresult, nettype)
u_long prognum; /* program number */
u_long versnum; /* version number */
u_long procnum; /* procedure number */
xdrproc_t inproc; /* xdr routine for args */
caddr_t in; /* pointer to args */
xdrproc_t outproc; /* xdr routine for results */
caddr_t out; /* pointer to results */
resultproc_t eachresult;/* call with each result gotten */
char *nettype; /* transport type */
The procedure
eachresult
is called each time a valid result is obtained.
It returns a boolean that specifies
whether the user wants more responses.
bool_t done; . . . done = eachresult(resultsp, raddr, nconf) caddr_t resultsp; struct netbuf *addr; /* Addr of responding machine */ struct netconfig *nconf; /* Transport which responded */If done is TRUE, then broadcasting stops and rpc_broadcast returns successfully. Otherwise, the routine waits for another response. The request is rebroadcast after a few seconds of waiting. If no responses come back, the routine returns with RPC_TIMEDOUT.