Back to index

glibc  2.9
Classes | Defines | Functions | Variables
clnt_raw.c File Reference
#include <rpc/rpc.h>
#include <rpc/svc.h>
#include <rpc/xdr.h>
#include <libintl.h>

Go to the source code of this file.

Classes

struct  clntraw_private_s

Defines

#define MCALL_MSG_SIZE   24

Functions

static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval)
static void clntraw_abort (void)
static void clntraw_geterr (CLIENT *, struct rpc_err *)
static bool_t clntraw_freeres (CLIENT *, xdrproc_t, caddr_t)
static bool_t clntraw_control (CLIENT *, int, char *)
static void clntraw_destroy (CLIENT *)
CLIENTclntraw_create (u_long prog, u_long vers)

Variables

static struct clntraw_private_sclntraw_private
static struct clnt_ops

Class Documentation

struct clntraw_private_s

Definition at line 55 of file clnt_raw.c.

Class Members
char _raw_buf
CLIENT client_object
char mashl_callmsg
u_int mcnt
XDR xdr_stream

Define Documentation

#define MCALL_MSG_SIZE   24

Definition at line 50 of file clnt_raw.c.


Function Documentation

static void clntraw_abort ( void  ) [static]

Definition at line 243 of file clnt_raw.c.

{
}
static enum clnt_stat clntraw_call ( CLIENT h,
u_long  proc,
xdrproc_t  xargs,
caddr_t  argsp,
xdrproc_t  xresults,
caddr_t  resultsp,
struct timeval  timeout 
) [static]

Definition at line 136 of file clnt_raw.c.

{
  struct clntraw_private_s *clp = clntraw_private;
  XDR *xdrs = &clp->xdr_stream;
  struct rpc_msg msg;
  enum clnt_stat status;
  struct rpc_err error;

  if (clp == NULL)
    return RPC_FAILED;
call_again:
  /*
   * send request
   */
  xdrs->x_op = XDR_ENCODE;
  XDR_SETPOS (xdrs, 0);
  ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++;
  if ((!XDR_PUTBYTES (xdrs, clp->mashl_callmsg, clp->mcnt)) ||
      (!XDR_PUTLONG (xdrs, (long *) &proc)) ||
      (!AUTH_MARSHALL (h->cl_auth, xdrs)) ||
      (!(*xargs) (xdrs, argsp)))
    {
      return (RPC_CANTENCODEARGS);
    }
  (void) XDR_GETPOS (xdrs); /* called just to cause overhead */

  /*
   * We have to call server input routine here because this is
   * all going on in one process. Yuk.
   */
  INTUSE(svc_getreq) (1);

  /*
   * get results
   */
  xdrs->x_op = XDR_DECODE;
  XDR_SETPOS (xdrs, 0);
  msg.acpted_rply.ar_verf = _null_auth;
  msg.acpted_rply.ar_results.where = resultsp;
  msg.acpted_rply.ar_results.proc = xresults;
  if (!INTUSE(xdr_replymsg) (xdrs, &msg))
    return RPC_CANTDECODERES;
  _seterr_reply (&msg, &error);
  status = error.re_status;

  if (status == RPC_SUCCESS)
    {
      if (!AUTH_VALIDATE (h->cl_auth, &msg.acpted_rply.ar_verf))
       {
         status = RPC_AUTHERROR;
       }
    }                       /* end successful completion */
  else
    {
      if (AUTH_REFRESH (h->cl_auth))
       goto call_again;
    }                       /* end of unsuccessful completion */

  if (status == RPC_SUCCESS)
    {
      if (!AUTH_VALIDATE (h->cl_auth, &msg.acpted_rply.ar_verf))
       {
         status = RPC_AUTHERROR;
       }
      if (msg.acpted_rply.ar_verf.oa_base != NULL)
       {
         xdrs->x_op = XDR_FREE;
         (void) INTUSE(xdr_opaque_auth) (xdrs, &(msg.acpted_rply.ar_verf));
       }
    }

  return status;
}

Here is the call graph for this function:

static bool_t clntraw_control ( CLIENT cl,
int  i,
char *  c 
) [static]

Definition at line 248 of file clnt_raw.c.

{
  return FALSE;
}
CLIENT* clntraw_create ( u_long  prog,
u_long  vers 
)

Definition at line 91 of file clnt_raw.c.

{
  struct clntraw_private_s *clp = clntraw_private;
  struct rpc_msg call_msg;
  XDR *xdrs;
  CLIENT *client;

  if (clp == 0)
    {
      clp = (struct clntraw_private_s *) calloc (1, sizeof (*clp));
      if (clp == 0)
       return (0);
      clntraw_private = clp;
    }
  xdrs = &clp->xdr_stream;
  client = &clp->client_object;
  /*
   * pre-serialize the static part of the call msg and stash it away
   */
  call_msg.rm_direction = CALL;
  call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
  call_msg.rm_call.cb_prog = prog;
  call_msg.rm_call.cb_vers = vers;
  INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
  if (!INTUSE(xdr_callhdr) (xdrs, &call_msg))
    {
      perror (_ ("clnt_raw.c: fatal header serialization error"));
    }
  clp->mcnt = XDR_GETPOS (xdrs);
  XDR_DESTROY (xdrs);

  /*
   * Set xdrmem for client/server shared buffer
   */
  INTUSE(xdrmem_create) (xdrs, clp->_raw_buf, UDPMSGSIZE, XDR_FREE);

  /*
   * create client handle
   */
  client->cl_ops = (struct clnt_ops *) &client_ops;
  client->cl_auth = INTUSE(authnone_create) ();
  return client;
}

Here is the call graph for this function:

static void clntraw_destroy ( CLIENT cl) [static]

Definition at line 254 of file clnt_raw.c.

{
}
static bool_t clntraw_freeres ( CLIENT cl,
xdrproc_t  xdr_res,
caddr_t  res_ptr 
) [static]

Definition at line 224 of file clnt_raw.c.

{
  struct clntraw_private_s *clp = clntraw_private;
  XDR *xdrs = &clp->xdr_stream;
  bool_t rval;

  if (clp == NULL)
    {
      rval = (bool_t) RPC_FAILED;
      return rval;
    }
  xdrs->x_op = XDR_FREE;
  return (*xdr_res) (xdrs, res_ptr);
}
static void clntraw_geterr ( CLIENT cl,
struct rpc_err err 
) [static]

Definition at line 218 of file clnt_raw.c.

{
}

Variable Documentation

struct clnt_ops [static]

Definition at line 66 of file clnt_raw.c.