rpcb_unset Subroutine

Purpose

Destroys the mapping between the program, version, netconfig structure and the service address.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
bool_t rpcb_unset(prognum, progver, nconf)
const rpcprog_t prognum;
const rpcvers_t progver;
const struct netconfig *nconf;

Description

The rpcb_unset subroutine destroys a mapping of triplet (program number, version number, and the nc_netid field of the nconf argument) to the address of a remote service. The mapping is destroyed from the rpcbind service of the machine. The nc_netid field of the netconfig structure identifies the network identifier defined by the netconfig database.

Parameters

Item Description
prognum Specifies the program number of the remote program.
progver Specifies the version number of the remote program.
nconf Specifies the protocol associated with the service.

Return Values

Item Description
TRUE successful
FALSE unsuccessful

Error Codes

The rpcb_unset subroutine returns failure if one or more of the following codes are true.

Item Description
RPC_UNKNOWNPROTO The value of the netconfig argument is not valid.
RPC_UNKNOWNADDR The remote service address is not valid.

Examples

#include <rpc/rpc.h>
#include <stdio.h>

int main()
{
    rpcprog_t PROGNUM ;
    rpcvers_t PROGVER ;
    struct netconfig *nconf ;
    struct netbuf *nbuf;
    struct t_bind *bind_addr = NULL;

    /* Get netconfig structure corresponding to tcp transport */ 
    if ((nconf = getnetconfigent("tcp")) == (struct netconfig *) NULL) {
        fprintf(stderr, "getnetconfigent failed");
        exit(1);
    }
    /* 
     * Code to open and bind file descriptor to bind_addr address 
     */
    nbuf = &bind_addr->addr;
    if( rpcb_set(PROGNUM, PROGVER, nconf, nbuf) == FALSE ) {
        fprintf(stderr,"rpcb_set() failed");
        exit(1);
    }
    rpcb_unset(PROGNUM, PROGVER, nconf);
    svc_run();
    return 0;
}