svcerr_decode Subroutine

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

svcerr_decode Subroutine Exported from the libc Library

Purpose

Indicates that the service dispatch routine cannot decode the parameters of a request.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

void svcerr_decode ( xprt)
SVCXPRT *xprt;

Description

The svcerr_decode subroutine is called by a service dispatch subroutine that cannot decode the parameters specified in a request. This subroutine sets the status of the Remote Procedure Call (RPC) reply message to the GARBAGE_ARGS condition.

Parameters

Item Description
xprt Points to the RPC service transport handle.

svcerr_decode Subroutine Exported from the libnsl Library

Purpose

Indicates that the service dispatch routine cannot decode the parameters of a request.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
void svcerr_decode ( xprt)
const SVCXPRT *xprt;

Description

The svcerr_decode subroutine is called by a service dispatch subroutine that cannot decode the parameters specified in a request. This subroutine sets the status of the remote procedure call (RPC) reply message to the RPC_CANTDECODEARGS condition.

Parameters

Item Description
xprt Points to the RPC service transport handle.

Examples

#include <rpc/rpc.h>
#include <stdlib.h>
#define PROG 0x3fffffffL
#define VERS 0x1L

static void sample_dispatch();
main()
{
  char *nettype = "tcp";
  int no_of_handles;
 
  /* Create RPC service handle and register with RPCBIND service */
  if((no_of_handles = svc_create(sample_dispatch, PROG, VERS,nettype)) == 0)
  {
    fprintf(stdout, " Error in svc_create ");
    exit(EXIT_FAILURE);
  }
  svc_run();
  return 0;
} 

/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
  int args;
     
  /* decode argument from client using xdr_int() */
  if (svc_getargs(xprt, (xdrproc_t)xdr_int,(caddr_t)&args) == FALSE) 
  {  
 svcerr_decode(xprt);
 fprintf(stdout, " Error in svc_create ");
 return;
  }
}