Back to index

glibc  2.9
Classes | Defines | Enumerations | Functions
rpc_msg.h File Reference
#include <sys/cdefs.h>
#include <rpc/xdr.h>
#include <rpc/clnt.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  accepted_reply
struct  rejected_reply
struct  reply_body
struct  call_body
struct  rpc_msg
union  accepted_reply.ru
struct  accepted_reply.ru.AR_versions
struct  accepted_reply.ru.AR_results
union  rejected_reply.ru
struct  rejected_reply.ru.RJ_versions
union  reply_body.ru
union  rpc_msg.ru

Defines

#define RPC_MSG_VERSION   ((u_long) 2)
#define RPC_SERVICE_PORT   ((u_short) 2048)
#define ar_results   ru.AR_results
#define ar_vers   ru.AR_versions
#define rj_vers   ru.RJ_versions
#define rj_why   ru.RJ_why
#define rp_acpt   ru.RP_ar
#define rp_rjct   ru.RP_dr
#define rm_call   ru.RM_cmb
#define rm_reply   ru.RM_rmb
#define acpted_rply   ru.RM_rmb.ru.RP_ar
#define rjcted_rply   ru.RM_rmb.ru.RP_dr

Enumerations

enum  msg_type { CALL = 0, REPLY = 1 }
enum  reply_stat { MSG_ACCEPTED = 0, MSG_DENIED = 1 }
enum  accept_stat {
  SUCCESS = 0, PROG_UNAVAIL = 1, PROG_MISMATCH = 2, PROC_UNAVAIL = 3,
  GARBAGE_ARGS = 4, SYSTEM_ERR = 5
}
enum  reject_stat { RPC_MISMATCH = 0, AUTH_ERROR = 1 }

Functions

bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW
bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW
bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW
void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error) __THROW

Class Documentation

struct accepted_reply

Definition at line 91 of file rpc_msg.h.

Class Members
enum accept_stat union
accepted_reply
ru
struct rejected_reply

Definition at line 112 of file rpc_msg.h.

Class Members
enum reject_stat union
rejected_reply
ru
struct reply_body

Definition at line 128 of file rpc_msg.h.

Class Members
enum reply_stat union reply_body ru
struct call_body

Definition at line 141 of file rpc_msg.h.

Class Members
u_long cb_proc
u_long cb_prog
u_long cb_rpcvers
u_long cb_vers
struct rpc_msg

Definition at line 153 of file rpc_msg.h.

Class Members
u_long rm_xid
enum msg_type union rpc_msg ru
union accepted_reply.ru

Definition at line 94 of file rpc_msg.h.

Class Members
ru AR_results
ru AR_versions
struct accepted_reply.ru.AR_versions

Definition at line 95 of file rpc_msg.h.

Class Members
u_long high
u_long low
struct accepted_reply.ru.AR_results

Definition at line 99 of file rpc_msg.h.

Class Members
xdrproc_t proc
caddr_t where
union rejected_reply.ru

Definition at line 114 of file rpc_msg.h.

Class Members
ru RJ_versions
struct rejected_reply.ru.RJ_versions

Definition at line 115 of file rpc_msg.h.

Class Members
u_long high
u_long low
union reply_body.ru

Definition at line 130 of file rpc_msg.h.

union rpc_msg.ru

Definition at line 156 of file rpc_msg.h.


Define Documentation

#define acpted_rply   ru.RM_rmb.ru.RP_ar

Definition at line 163 of file rpc_msg.h.

#define ar_results   ru.AR_results

Definition at line 105 of file rpc_msg.h.

#define ar_vers   ru.AR_versions

Definition at line 106 of file rpc_msg.h.

#define rj_vers   ru.RJ_versions

Definition at line 121 of file rpc_msg.h.

#define rj_why   ru.RJ_why

Definition at line 122 of file rpc_msg.h.

#define rjcted_rply   ru.RM_rmb.ru.RP_dr

Definition at line 164 of file rpc_msg.h.

#define rm_call   ru.RM_cmb

Definition at line 160 of file rpc_msg.h.

#define rm_reply   ru.RM_rmb

Definition at line 161 of file rpc_msg.h.

#define rp_acpt   ru.RP_ar

Definition at line 134 of file rpc_msg.h.

#define rp_rjct   ru.RP_dr

Definition at line 135 of file rpc_msg.h.

#define RPC_MSG_VERSION   ((u_long) 2)

Definition at line 47 of file rpc_msg.h.

#define RPC_SERVICE_PORT   ((u_short) 2048)

Definition at line 48 of file rpc_msg.h.


Enumeration Type Documentation

Enumerator:
SUCCESS 
PROG_UNAVAIL 
PROG_MISMATCH 
PROC_UNAVAIL 
GARBAGE_ARGS 
SYSTEM_ERR 

Definition at line 68 of file rpc_msg.h.

enum msg_type
Enumerator:
CALL 
REPLY 

Definition at line 58 of file rpc_msg.h.

              {
       CALL=0,
       REPLY=1
};
Enumerator:
RPC_MISMATCH 
AUTH_ERROR 

Definition at line 77 of file rpc_msg.h.

enum reply_stat
Enumerator:
MSG_ACCEPTED 
MSG_DENIED 

Definition at line 63 of file rpc_msg.h.


Function Documentation

void _seterr_reply ( struct rpc_msg __msg,
struct rpc_err __error 
)

Definition at line 242 of file rpc_prot.c.

{
  /* optimized for normal, SUCCESSful case */
  switch (msg->rm_reply.rp_stat)
    {
    case MSG_ACCEPTED:
      if (msg->acpted_rply.ar_stat == SUCCESS)
       {
         error->re_status = RPC_SUCCESS;
         return;
       };
      accepted (msg->acpted_rply.ar_stat, error);
      break;

    case MSG_DENIED:
      rejected (msg->rjcted_rply.rj_stat, error);
      break;

    default:
      error->re_status = RPC_FAILED;
      error->re_lb.s1 = (long) (msg->rm_reply.rp_stat);
      break;
    }
  switch (error->re_status)
    {

    case RPC_VERSMISMATCH:
      error->re_vers.low = msg->rjcted_rply.rj_vers.low;
      error->re_vers.high = msg->rjcted_rply.rj_vers.high;
      break;

    case RPC_AUTHERROR:
      error->re_why = msg->rjcted_rply.rj_why;
      break;

    case RPC_PROGVERSMISMATCH:
      error->re_vers.low = msg->acpted_rply.ar_vers.low;
      error->re_vers.high = msg->acpted_rply.ar_vers.high;
      break;
    default:
      break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool_t xdr_callhdr ( XDR __xdrs,
struct rpc_msg __cmsg 
)

Definition at line 160 of file rpc_prot.c.

{

  cmsg->rm_direction = CALL;
  cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
  if (
       (xdrs->x_op == XDR_ENCODE) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_xid)) &&
       INTUSE(xdr_enum) (xdrs, (enum_t *) & (cmsg->rm_direction)) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_prog)))
    return INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_vers));
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool_t xdr_callmsg ( XDR __xdrs,
struct rpc_msg __cmsg 
)

Definition at line 49 of file rpc_cmsg.c.

{
  int32_t *buf;
  struct opaque_auth *oa;

  if (xdrs->x_op == XDR_ENCODE)
    {
      if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES)
       {
         return (FALSE);
       }
      if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES)
       {
         return (FALSE);
       }
      buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT
                     + RNDUP (cmsg->rm_call.cb_cred.oa_length)
                     + 2 * BYTES_PER_XDR_UNIT
                     + RNDUP (cmsg->rm_call.cb_verf.oa_length));
      if (buf != NULL)
       {
         (void) IXDR_PUT_LONG (buf, cmsg->rm_xid);
         (void) IXDR_PUT_ENUM (buf, cmsg->rm_direction);
         if (cmsg->rm_direction != CALL)
           return FALSE;
         (void) IXDR_PUT_LONG (buf, cmsg->rm_call.cb_rpcvers);
         if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION)
           return FALSE;
         (void) IXDR_PUT_LONG (buf, cmsg->rm_call.cb_prog);
         (void) IXDR_PUT_LONG (buf, cmsg->rm_call.cb_vers);
         (void) IXDR_PUT_LONG (buf, cmsg->rm_call.cb_proc);
         oa = &cmsg->rm_call.cb_cred;
         (void) IXDR_PUT_ENUM (buf, oa->oa_flavor);
         (void) IXDR_PUT_INT32 (buf, oa->oa_length);
         if (oa->oa_length)
           {
             memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length);
             buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length));
           }
         oa = &cmsg->rm_call.cb_verf;
         (void) IXDR_PUT_ENUM (buf, oa->oa_flavor);
         (void) IXDR_PUT_INT32 (buf, oa->oa_length);
         if (oa->oa_length)
           {
             memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length);
             /* no real need....
                buf = (long *) ((char *) buf + RNDUP(oa->oa_length));
              */
           }
         return TRUE;
       }
    }
  if (xdrs->x_op == XDR_DECODE)
    {
      buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT);
      if (buf != NULL)
       {
         cmsg->rm_xid = IXDR_GET_LONG (buf);
         cmsg->rm_direction = IXDR_GET_ENUM (buf, enum msg_type);
         if (cmsg->rm_direction != CALL)
           {
             return FALSE;
           }
         cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG (buf);
         if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION)
           {
             return FALSE;
           }
         cmsg->rm_call.cb_prog = IXDR_GET_LONG (buf);
         cmsg->rm_call.cb_vers = IXDR_GET_LONG (buf);
         cmsg->rm_call.cb_proc = IXDR_GET_LONG (buf);
         oa = &cmsg->rm_call.cb_cred;
         oa->oa_flavor = IXDR_GET_ENUM (buf, enum_t);
         oa->oa_length = IXDR_GET_INT32 (buf);
         if (oa->oa_length)
           {
             if (oa->oa_length > MAX_AUTH_BYTES)
              return FALSE;
             if (oa->oa_base == NULL)
              {
                oa->oa_base = (caddr_t)
                  mem_alloc (oa->oa_length);
              }
             buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length));
             if (buf == NULL)
              {
                if (INTUSE(xdr_opaque) (xdrs, oa->oa_base,
                                     oa->oa_length) == FALSE)
                  return FALSE;
              }
             else
              {
                memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length);
                /* no real need....
                   buf = (long *) ((char *) buf
                   + RNDUP(oa->oa_length));
                 */
              }
           }
         oa = &cmsg->rm_call.cb_verf;
         buf = XDR_INLINE (xdrs, 2 * BYTES_PER_XDR_UNIT);
         if (buf == NULL)
           {
             if (INTUSE(xdr_enum) (xdrs, &oa->oa_flavor) == FALSE ||
                INTUSE(xdr_u_int) (xdrs, &oa->oa_length) == FALSE)
              {
                return FALSE;
              }
           }
         else
           {
             oa->oa_flavor = IXDR_GET_ENUM (buf, enum_t);
             oa->oa_length = IXDR_GET_INT32 (buf);
           }
         if (oa->oa_length)
           {
             if (oa->oa_length > MAX_AUTH_BYTES)
              return FALSE;
             if (oa->oa_base == NULL)
              {
                oa->oa_base = (caddr_t)
                  mem_alloc (oa->oa_length);
              }
             buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length));
             if (buf == NULL)
              {
                if (INTUSE(xdr_opaque) (xdrs, oa->oa_base,
                                     oa->oa_length) == FALSE)
                  return FALSE;
              }
             else
              {
                memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length);
                /* no real need...
                   buf = (long *) ((char *) buf
                   + RNDUP(oa->oa_length));
                 */
              }
           }
         return TRUE;
       }
    }
  if (
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_xid)) &&
       INTUSE(xdr_enum) (xdrs, (enum_t *) & (cmsg->rm_direction)) &&
       (cmsg->rm_direction == CALL) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
       (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_prog)) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_vers)) &&
       INTUSE(xdr_u_long) (xdrs, &(cmsg->rm_call.cb_proc)) &&
       INTUSE(xdr_opaque_auth) (xdrs, &(cmsg->rm_call.cb_cred)))
    return INTUSE(xdr_opaque_auth) (xdrs, &(cmsg->rm_call.cb_verf));
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool_t xdr_replymsg ( XDR __xdrs,
struct rpc_msg __rmsg 
)

Definition at line 139 of file rpc_prot.c.

{
  if (INTUSE(xdr_u_long) (xdrs, &(rmsg->rm_xid)) &&
      INTUSE(xdr_enum) (xdrs, (enum_t *) & (rmsg->rm_direction)) &&
      (rmsg->rm_direction == REPLY))
    return INTUSE(xdr_union) (xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat),
                           (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm,
                           NULL_xdrproc_t);
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function: