|
|
rpcbind maps RPC program and version numbers to universal addresses, thus making dynamic binding of remote programs possible.
rpcbind is run at a well-known universal address, and other programs register their dynamically allocated transport addresses with it. It then makes those addresses publically available. Universal addresses are defined by the addressing authority of the given transport. They are string representations of the transport address.
rpcbind also aids in broadcast RPC. There is no fixed relationship between the addresses that a given RPC program will have on different machines, so there is no way to broadcast directly to all these programs. rpcbind, however, has a universal address. So, to broadcast to a given program, the client actually sends its message to the rpcbind process on the machine it wishes to reach. rpcbind picks up the broadcast and calls the local service specified by the client. When rpcbind gets a reply from the local service, it passes it on to the client.
/* * rpcb_prot.x * RPCBIND protocol in rpc language *//* * A mapping of (program, version, network ID) to universal address */ struct rpcb { u_long r_prog; /* program number */ u_long r_vers; /* version number */ string r_netid<>; /* network id */ string r_addr<>; /* universal address */ };
/* * A list of mappings */ struct rpcblist { rpcb rpcb_map; struct rpcblist *rpcb_next; };
/* * Arguments of remote calls */ struct rpcb_rmtcallargs { u_long prog; /* program number */ u_long vers; /* version number */ u_long proc; /* procedure number */ opaque args_ptr<>; /* argument */ };
/* * Results of the remote call */ struct rpcb_rmtcallres { string addr_ptr<>; /* remote universal address */ opaque results_ptr<>; /* result */ };
/* * rpcbind procedures */ program RPCBPROG { version RPCBVERS { void RPCBPROC_NULL(void) = 0;
bool RPCBPROC_SET(rpcb) = 1;
bool RPCBPROC_UNSET(rpcb) = 2;
string RPCBPROC_GETADDR(rpcb) = 3;
rpcblist RPCBPROC_DUMP(void) = 4;
rpcb_rmtcallres RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
unsigned int RPCBPROC_GETTIME(void) = 6;
struct netbuf RPCBPROC_UADDR2TADDR(string) = 7;
string RPCBPROC_TADDR2UADDR(struct netbuf) = 8; } = 3; } = 100000;
rpcbind is contacted by way of an assigned address specific to the transport being used. For IP, for example, it is port number 111. Each transport has such an assigned well known address. The following is a description of each of the procedures supported by rpcbind.
This procedure does no work. By convention, procedure zero of any protocol takes no parameters and returns no results.
When a program first becomes available on a machine, it registers itself with the rpcbind program running on the same machine. The program passes its program number prog, version number vers, network identifier netid, and the universal address uaddr on which it awaits service requests.
The procedure returns a boolean response whose value is TRUE if the procedure successfully established the mapping and FALSE otherwise. The procedure refuses to establish a mapping if one already exists for the tuple (prog, vers, netid).
Note that neither netid nor uaddr can be NULL, and that netid should be a valid network identifier on the machine making the call.
When a program becomes unavailable, it should unregister itself with the rpcbind program on the same machine.
The parameters and results have meanings identical to those of RPCBPROC_SET. The mapping of the (prog, vers, netid) tuple with uaddr is deleted.
If netid is NULL, all mappings specified by the tuple (prog, vers, *) and the corresponding universal addresses are deleted.
Given a program number prog, version number vers, and network identifier netid, this procedure returns the universal address on which the program is awaiting call requests.
The netid field of the argument is ignored and the netid is inferred from the netid of the transport on which the request came in.
This procedure lists all entries in rpcbind's database.
The procedure takes no parameters and returns a list of program, version, netid, and universal addresses.
This procedure allows a caller to call another remote procedure on the same machine without knowing the remote procedure's universal address. It is intended for supporting broadcasts to arbitrary remote programs via rpcbind's universal address.
The parameters prog, vers, proc, and the args_ptr are the program number, version number, procedure number, and parameters of the remote procedure.
The procedure returns the remote program's universal address, and the results of the remote procedure.
This procedure returns the local time on its own machine.
This procedure converts universal addresses to transport (netbuf
)
addresses.
RPCBPROC_UADDR2TADDR
is equivalent to
uaddr2taddr
(see
netdir(3N)).
This procedure converts transport (netbuf
) addresses to universal
addresses.
RPCBPROC_TADDR2UADDR
is equivalent to
taddr2uaddr
(see
netdir(3N)).