pmap_unset Subroutine

Important: The subroutine is exported from both the libc and the libnsl libraries.

pmap_unset Subroutine Exported from the libc Library

Purpose

Destroys the mappings between a remote procedure call and the port.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

pmap_unset ( prognum,  versnum)
u_long prognum, versnum;

Description

The pmap_unset subroutine destroys mappings between the program number and version number of a remote procedure call and the ports on the host portmap daemon.

Parameters

Item Description
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.

pmap_unset Subroutine Exported from the libnsl Library

Purpose

Destroys the mappings between the triplet (the program, version, and protocol) and the port.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
bool_t pmap_unset ( prognum, versnum)
rpcprog_t prognum;
rpcvers_t versnum;

Description

The pmap_unset subroutine destroys mappings between the triplet (the program number, version number, and protocol) and the port of a remote procedure call and the ports on the host portmap daemon. The mapping can be established by the pmap_set subroutine.

Parameters

Item Description
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.

Examples

#include <rpc/rpc.h>
u_short get_free_port(void)
{
  /* Code to obtain a free port */
}

int main()
{
  u_short port = 0;
  rpcprog_t PROGNUM = 0x3ffffff0L;
  rpcvers_t PROGVER = 0x1L;

  /* Obtain a free port */
  port = get_free_port();
  
  /* Set the mapping between triplet [PROGNUM,PROGVER,PROTOCOL] and port */
  if (pmap_set(PROGNUM, PROGVER, IPPROTO_TCP, port) == 0)
  {
    printf("pmap_set() failed");
    exit(1);
  }

  if(pmap_unset(PROGNUM, PROGVER)==0)
  {
    printf("pmap_unset() failed");
    exit(1);
  }

  return 0;
}