ReactOS 0.4.16-dev-329-g9223134
xdr_reference.c File Reference
#include <wintirpc.h>
#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include "libc_private.h"
Include dependency graph for xdr_reference.c:

Go to the source code of this file.

Functions

bool_t xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
 
bool_t xdr_pointer (XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)
 

Function Documentation

◆ xdr_pointer()

bool_t xdr_pointer ( XDR xdrs,
char **  objpp,
u_int  obj_size,
xdrproc_t  xdr_obj 
)

Definition at line 119 of file xdr_reference.c.

124{
125
126 bool_t more_data;
127
128 more_data = (*objpp != NULL);
129 if (! xdr_bool(xdrs,&more_data)) {
130 return (FALSE);
131 }
132 if (! more_data) {
133 *objpp = NULL;
134 return (TRUE);
135 }
136 return (xdr_reference(xdrs,objpp,obj_size,xdr_obj));
137}
bool_t xdr_bool(XDR *xdrs, bool_t *bp)
Definition: xdr.c:428
#define NULL
Definition: types.h:112
int32_t bool_t
Definition: types.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
Definition: xdr_reference.c:62

Referenced by xdr_rpcbs_addrlist(), xdr_rpcbs_addrlist_ptr(), xdr_rpcbs_rmtcalllist(), and xdr_rpcbs_rmtcalllist_ptr().

◆ xdr_reference()

bool_t xdr_reference ( XDR xdrs,
caddr_t pp,
u_int  size,
xdrproc_t  proc 
)

Definition at line 62 of file xdr_reference.c.

67{
68 caddr_t loc = *pp;
70
71 if (loc == NULL)
72 switch (xdrs->x_op) {
73 case XDR_FREE:
74 return (TRUE);
75
76 case XDR_DECODE:
77 *pp = loc = (caddr_t) mem_alloc(size);
78 if (loc == NULL) {
79 //warnx("xdr_reference: out of memory");
80 return (FALSE);
81 }
82 memset(loc, 0, size);
83 break;
84
85 case XDR_ENCODE:
86 break;
87 }
88
89 stat = (*proc)(xdrs, loc);
90
91 if (xdrs->x_op == XDR_FREE) {
92 mem_free(loc, size);
93 *pp = NULL;
94 }
95 return (stat);
96}
#define stat
Definition: acwin.h:99
#define caddr_t
Definition: ftp.c:24
#define mem_free(ptr, bsize)
Definition: types.h:124
#define mem_alloc(bsize)
Definition: types.h:123
GLsizeiptr size
Definition: glext.h:5919
char * caddr_t
Definition: rosdhcp.h:36
#define memset(x, y, z)
Definition: compat.h:39
enum xdr_op x_op
Definition: xdr.h:104
Definition: stat.h:55
@ XDR_DECODE
Definition: xdr.h:86
@ XDR_FREE
Definition: xdr.h:87
@ XDR_ENCODE
Definition: xdr.h:85

Referenced by xdr_pmaplist(), xdr_pointer(), xdr_rmtcallres(), xdr_rpcb_entry_list_ptr(), and xdr_rpcblist_ptr().