#include <rpc/rpc.h> #include <netconfig.h> bool_t rpcb_unset(const u_long prognum, const u_long versnum, const struct netconfig *netconf);
The rpcb_unset() function is an interface to the RPC service package (RPCBind), which destroys the mapping between the triple (prognum, versnum, netconf->nc_netid) and the address on the host machine's RPCBind service. If netconf is NULL, rpcb_unset() destroys all mapping between the above triple and the addresses on the machine's RPCBind service.
The caller of the rpcb_unset() API must have execute (*X) authority to the /etc directory and must have read (*R) authority to the netconfig file.
TRUE (1) | rpcb_unset was successful. |
FALSE (0) | rpcb_unset was unsuccessful. |
Upon failure, rpcb_unset() sets the global structure rpc_createerr. The rpc_createerr.cf_stat variable contains a status value, which indicates the error reason. The rpc_createerr.cf_error.re_errno variable is meaningful when some status values are set.
The rpc_createerr.cf_stat variable can be set to one of the following values:
[RPC_INTR] | Interrupted RPC call. An exception has occurred in the RPC API. The rpc_createerr.cf_error.re_errno is set to EUNKNOWN. |
[RPC_RPCBFAILURE] | Unable to contact the RPCBind daemon. |
This API calls clnt_tli_create() and clnt_call() APIs in order to perform its task. It inherits RPC_SYSTEMERROR from clnt_tli_create() API and it inherits all error conditions from clnt_call() API except RPC_TIMEDOUT and RPC_FAILED.
Message ID | Error Message Text |
---|---|
CPIA1B1 I | A problem was encountered in the RPC client. |
CPIA1B2 I | TI-RPC encountered a problem in the transport protocol. |
CPIA1B8 I | A problem occurred while trying to contact the RPCBind daemon. |
CPE3418 E | Possible APAR condition or hardware failure. |
CPF3CF2 E | Error(s) occurred during running of &1 API. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how rpcb_unset() is used:
/* Define remote program number and version */ #define RMTPROGNUM (u_long)0x3fffffffL #define RMTPROGVER (u_long)0x1 #include <stdio.h> #include <rpc/rpc.h> #include <netconfig.h> main() { struct netconfig *nconf; ... /* Returns a pointer to nconf corresponding to NETCONF */ if ((nconf = getnetconfigent("UDP")) == (struct netconfig *)NULL) { fprintf(stderr, "Cannot get netconfig entry for UDP\n"); exit(1); } ... /* Destroy the connect with the RPCBind daemon */ if (!rpcb_unset(RMTPROGNUM, RMTPROGVER, nconf)){ fprintf(stderr, "rpcb_unset failed!!\n"); exit(1); } ... }
Top | Remote Procedure Call (RPC) APIs | APIs by category |