pmap_rmtcall Subroutine

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

pmap_rmtcall Subroutine Exported from the libc Library

Purpose

Instructs the portmap daemon to make a remote procedure call.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

enum clnt_stat pmap_rmtcall (addrprognumversnumprocnum)\
enum clnt_stat pmap_rmtcall (
inprocinoutprocouttoutportp)
struct sockaddr_in * addr;
u_long  prognum,  versnum,  procnum;
xdrproc_t  inproc;
char * in;
xdrproc_t  outproc;
char * out;
struct timeval  tout;
u_long * portp;

Description

The pmap_rmtcall subroutine is a user interface to the portmap daemon. The routine instructs the host portmap daemon to make a remote procedure call (RPC). Clients consult the portmap daemon when sending out RPC calls for given program numbers. The portmap daemon tells the client the ports to which to send the calls.

Parameters

Item Description
addr Points to the Internet Protocol (IP) address of the host where the remote program that supports the waiting service resides.
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.
procnum Identifies the procedure to be called.
inproc Specifies the eXternal Data Representation (XDR) routine that encodes the remote procedure parameters.
in Points to the address of the procedure arguments.
outproc Specifies the XDR routine that decodes the remote procedure results.
out Points to the address where the results are placed.
tout Sets the time the routine waits for the results to return before sending the call again.
portp Points to the program port number if the procedure succeeds.

pmap_rmtcall Subroutine Exported from the libnsl Library

Purpose

Instructs the portmap daemon to make a remote procedure call.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
enum clnt_stat pmap_rmtcall(addr, prognum, versnum, procnum, in, inproc, out, outproc, tout, portp)
struct sockaddr_in *addr;
rpcprog_t prognum;
rpcvers_t versnum;
rpcproc_t procnum;
caddr_t in;
xdrproc_t inproc;
caddr_t out;
xdrproc_t outproc;
struct timeval tout;
rpcport_t *portp;

Description

The pmap_rmtcall subroutine is a user interface to the portmap daemon. The subroutine instructs the host portmap daemon to make a remote procedure call (RPC) to a procedure on that host on behalf of the caller. Clients consult the portmap daemon when sending out RPC calls for the specified program and version numbers. The portmap daemon tells the client the port number to which to send the calls.

Use the rpcb_rmtcall subroutine instead of the pmap_rmtcall subroutine. The pmap_rmtcall subroutine is compatible only with earlier versions of AIX®.

Parameters

Item Description
addr Points to the Internet Protocol (IP) address of the host where the remote program that supports the waiting service resides.
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.
procnum Identifies the procedure to be called.
inproc Specifies the eXternal Data Representation (XDR) routine that encodes the remote procedure parameters.
in Points to the address of the procedure arguments.
outproc Specifies the XDR routine that decodes the remote procedure results.
out Points to the address where the results are placed.
tout Sets the time the routine waits for the results to return before sending the call again.
portp Specifies the program port number. You can set the parameter value to 0.

Error Codes

The subroutine fails when the following error code is true.

Item Description
RPC_TIMEDOUT
  • The timeout value is too small.
  • The specified program number is not registered at the server side.
  • The specified version number is not registered at the server side.
  • The specified procedure number is not registered at the server side.
  • The server supports only the TCP transport.

Examples

#include <rpc/rpc.h>

int main()
{
  rpcprog_t       PROGNUM=0x3fffffffL;
  rpcvers_t       PROGVER=0x1L;
  rpcproc_t       PROCNUM=0x1L;
  struct sockaddr_in addr;
  int in, out;
  struct timeval  timeout = {25, 0};
  rpcport_t       portp=0;
  enum clnt_stat  cs;

  /*
   * Get the IP address of remote host, on which the procedure to be, called is located.
   * Store the value in addr.
   */

  /* Make a call to pmap_rmtcall() subroutine */
  cs = pmap_rmtcall( &addr, PROGNUM, PROGVER, PROCNUM, &in, 
   xdr_int, &out, xdr_int, timeout, portp); 
  
  if(cs!=RPC_SUCCESS)
  {
    fprintf(stderr,"pmap_rmtcall failed");
    exit(1);
  }

  return 0;
}