Back to index

glibc  2.9
Functions | Variables
xdr_stdio.c File Reference
#include <rpc/types.h>
#include <stdio.h>
#include <rpc/xdr.h>

Go to the source code of this file.

Functions

static bool_t xdrstdio_getlong (XDR *, long *)
static bool_t xdrstdio_putlong (XDR *, const long *)
static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int)
static bool_t xdrstdio_putbytes (XDR *, const char *, u_int)
static u_int xdrstdio_getpos (const XDR *)
static bool_t xdrstdio_setpos (XDR *, u_int)
static int32_txdrstdio_inline (XDR *, u_int)
static void xdrstdio_destroy (XDR *)
static bool_t xdrstdio_getint32 (XDR *, int32_t *)
static bool_t xdrstdio_putint32 (XDR *, const int32_t *)
void xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)

Variables

static struct xdr_ops

Function Documentation

void xdrstdio_create ( XDR xdrs,
FILE file,
enum xdr_op  op 
)

Definition at line 86 of file xdr_stdio.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 *) &xdrstdio_ops;
  xdrs->x_private = (caddr_t) file;
  xdrs->x_handy = 0;
  xdrs->x_base = 0;
}

Here is the caller graph for this function:

static void xdrstdio_destroy ( XDR xdrs) [static]

Definition at line 102 of file xdr_stdio.c.

{
  (void) fflush ((FILE *) xdrs->x_private);
  /* xx should we close the file ?? */
};

Here is the call graph for this function:

static bool_t xdrstdio_getbytes ( XDR xdrs,
caddr_t  addr,
u_int  len 
) [static]

Definition at line 130 of file xdr_stdio.c.

{
  if ((len != 0) && (fread (addr, (int) len, 1,
                         (FILE *) xdrs->x_private) != 1))
    return FALSE;
  return TRUE;
}
static bool_t xdrstdio_getint32 ( XDR xdrs,
int32_t ip 
) [static]

Definition at line 175 of file xdr_stdio.c.

{
  int32_t mycopy;

  if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
    return FALSE;
  *ip = ntohl (mycopy);
  return TRUE;
}

Here is the call graph for this function:

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

Definition at line 109 of file xdr_stdio.c.

{
  u_int32_t mycopy;

  if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
    return FALSE;
  *lp = (long) ntohl (mycopy);
  return TRUE;
}

Here is the call graph for this function:

static u_int xdrstdio_getpos ( const XDR xdrs) [static]

Definition at line 148 of file xdr_stdio.c.

{
  return (u_int) ftell ((FILE *) xdrs->x_private);
}

Here is the call graph for this function:

static int32_t * xdrstdio_inline ( XDR xdrs,
u_int  len 
) [static]

Definition at line 160 of file xdr_stdio.c.

{
  /*
   * Must do some work to implement this: must insure
   * enough data in the underlying stdio buffer,
   * that the buffer is aligned so that we can indirect through a
   * long *, and stuff this pointer in xdrs->x_buf.  Doing
   * a fread or fwrite to a scratch buffer would defeat
   * most of the gains to be had here and require storage
   * management on this buffer, so we don't do this.
   */
  return NULL;
}
static bool_t xdrstdio_putbytes ( XDR xdrs,
const char *  addr,
u_int  len 
) [static]

Definition at line 139 of file xdr_stdio.c.

{
  if ((len != 0) && (fwrite (addr, (int) len, 1,
                          (FILE *) xdrs->x_private) != 1))
    return FALSE;
  return TRUE;
}

Here is the call graph for this function:

static bool_t xdrstdio_putint32 ( XDR xdrs,
const int32_t ip 
) [static]

Definition at line 186 of file xdr_stdio.c.

{
  int32_t mycopy = htonl (*ip);

  ip = &mycopy;
  if (fwrite ((caddr_t) ip, 4, 1, (FILE *) xdrs->x_private) != 1)
    return FALSE;
  return TRUE;
}

Here is the call graph for this function:

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

Definition at line 120 of file xdr_stdio.c.

{
  int32_t mycopy = htonl ((u_int32_t) *lp);

  if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
    return FALSE;
  return TRUE;
}

Here is the call graph for this function:

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

Definition at line 154 of file xdr_stdio.c.

{
  return fseek ((FILE *) xdrs->x_private, (long) pos, 0) < 0 ? FALSE : TRUE;
}

Here is the call graph for this function:


Variable Documentation

struct xdr_ops [static]