Back to index

glibc  2.9
Functions | Variables
xdr_mem.c File Reference
#include <string.h>
#include <limits.h>
#include <rpc/rpc.h>

Go to the source code of this file.

Functions

static bool_t xdrmem_getlong (XDR *, long *)
static bool_t xdrmem_putlong (XDR *, const long *)
static bool_t xdrmem_getbytes (XDR *, caddr_t, u_int)
static bool_t xdrmem_putbytes (XDR *, const char *, u_int)
static u_int xdrmem_getpos (const XDR *)
static bool_t xdrmem_setpos (XDR *, u_int)
static int32_txdrmem_inline (XDR *, u_int)
static void xdrmem_destroy (XDR *)
static bool_t xdrmem_getint32 (XDR *, int32_t *)
static bool_t xdrmem_putint32 (XDR *, const int32_t *)
void xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op)

Variables

static struct xdr_ops

Function Documentation

void xdrmem_create ( XDR xdrs,
const caddr_t  addr,
u_int  size,
enum xdr_op  op 
)

Definition at line 75 of file xdr_mem.c.

{
  xdrs->x_op = op;
  /* We have to add the const since the `struct xdr_ops' in `struct XDR'
     is not `const'.  */
  xdrs->x_ops = (struct xdr_ops *) &xdrmem_ops;
  xdrs->x_private = xdrs->x_base = addr;
  xdrs->x_handy = size;
}
static void xdrmem_destroy ( XDR xdrs) [static]

Definition at line 92 of file xdr_mem.c.

{
}
static bool_t xdrmem_getbytes ( XDR xdrs,
caddr_t  addr,
u_int  len 
) [static]

Definition at line 135 of file xdr_mem.c.

{
  if (xdrs->x_handy < len)
    return FALSE;
  xdrs->x_handy -= len;
  memcpy (addr, xdrs->x_private, len);
  xdrs->x_private += len;
  return TRUE;
}
static bool_t xdrmem_getint32 ( XDR xdrs,
int32_t ip 
) [static]

Definition at line 215 of file xdr_mem.c.

{
  if (xdrs->x_handy < 4)
    return FALSE;
  xdrs->x_handy -= 4;
  *ip = ntohl ((*((int32_t *) (xdrs->x_private))));
  xdrs->x_private += 4;
  return TRUE;
}

Here is the call graph for this function:

static bool_t xdrmem_getlong ( XDR xdrs,
long *  lp 
) [static]

Definition at line 102 of file xdr_mem.c.

{
  if (xdrs->x_handy < 4)
    return FALSE;
  xdrs->x_handy -= 4;
  *lp = (int32_t) ntohl ((*((int32_t *) (xdrs->x_private))));
  xdrs->x_private += 4;
  return TRUE;
}

Here is the call graph for this function:

static u_int xdrmem_getpos ( const XDR xdrs) [static]

Definition at line 165 of file xdr_mem.c.

{
  return (u_long) xdrs->x_private - (u_long) xdrs->x_base;
}
static int32_t * xdrmem_inline ( XDR xdrs,
u_int  len 
) [static]

Definition at line 196 of file xdr_mem.c.

{
  int32_t *buf = 0;

  if (xdrs->x_handy >= len)
    {
      xdrs->x_handy -= len;
      buf = (int32_t *) xdrs->x_private;
      xdrs->x_private += len;
    }
  return buf;
}
static bool_t xdrmem_putbytes ( XDR xdrs,
const char *  addr,
u_int  len 
) [static]

Definition at line 150 of file xdr_mem.c.

{
  if (xdrs->x_handy < len)
    return FALSE;
  xdrs->x_handy -= len;
  memcpy (xdrs->x_private, addr, len);
  xdrs->x_private += len;
  return TRUE;
}
static bool_t xdrmem_putint32 ( XDR xdrs,
const int32_t ip 
) [static]

Definition at line 231 of file xdr_mem.c.

{
  if (xdrs->x_handy < 4)
    return FALSE;
  xdrs->x_handy -= 4;
  *(int32_t *) xdrs->x_private = htonl (*ip);
  xdrs->x_private += 4;
  return TRUE;
}

Here is the call graph for this function:

static bool_t xdrmem_putlong ( XDR xdrs,
const long *  lp 
) [static]

Definition at line 118 of file xdr_mem.c.

{
  if (xdrs->x_handy < 4)
    return FALSE;
  xdrs->x_handy -= 4;
  *(int32_t *) xdrs->x_private = htonl (*lp);
  xdrs->x_private += 4;
  return TRUE;
}

Here is the call graph for this function:

static bool_t xdrmem_setpos ( XDR xdrs,
u_int  pos 
) [static]

Definition at line 174 of file xdr_mem.c.

{
  caddr_t newaddr = xdrs->x_base + pos;
  caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
  size_t handy = lastaddr - newaddr;

  if (newaddr > lastaddr
      || newaddr < xdrs->x_base
      || handy != (u_int) handy)
    return FALSE;

  xdrs->x_private = newaddr;
  xdrs->x_handy = (u_int) handy;
  return TRUE;
}

Variable Documentation

struct xdr_ops [static]