Returns program-to-address mappings.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
struct rpcblist *rpcb_getmaps(nconf, host)
const struct netconfig *nconf;
const char *host;
The rpcb_getmaps subroutine returns a list of remote procedure call (RPC) program-to-address mappings for on a remote host. The host parameter represents the host from which the list of mappings is returned. The remote rpcbind service on the host is contacted by the transport specified by the nconf parameter. The subroutine returns a null value if the remote rpcbind service cannot be contacted.
Item | Description |
---|---|
nconf | Specifies the protocol associated with the service. |
host | Specifies the host name on which the server resides. |
Item | Description |
---|---|
a pointer to the rpcblist structure | successful |
FALSE | unsuccessful |
Item | Description |
---|---|
RPC_UNKNOWNHOST | The host name is not valid. |
RPC_N2AXLATEFAILURE | The value of the nconf argument is not valid. |
#include <stdlib.h>
#include <rpc/rpc.h>
int main()
{
/* The Remote host on which server is implemented */
char hostname[255] ;
struct netconfig *nconf;
struct rpcblist *rpclist = NULL;
/* Get pointer to struct netconfig for udp transport */
nconf = getnetconfigent("udp");
if (nconf == (struct netconfig *) NULL) {
fprintf(stdout, "\nerror in getnconfigent!\n");
exit(1);
}
rpclist = (struct rpcblist *)rpcb_getmaps(nconf, hostname);
if (rpclist == NULL) {
fprintf(stderr,"could not get the rpcblist on remote host\n");
clnt_pcreateerror("rpcb_getmap:");
exit(1);
}
return 0;
}