ReactOS 0.4.15-dev-8102-g108db8f
xdr_mem.c File Reference
#include <wintirpc.h>
#include "namespace.h"
#include <sys/types.h>
#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include "un-namespace.h"
Include dependency graph for xdr_mem.c:

Go to the source code of this file.

Functions

static void xdrmem_destroy (XDR *)
 
static bool_t xdrmem_getlong_aligned (XDR *, long *)
 
static bool_t xdrmem_putlong_aligned (XDR *, const long *)
 
static bool_t xdrmem_getlong_unaligned (XDR *, long *)
 
static bool_t xdrmem_putlong_unaligned (XDR *, const long *)
 
static bool_t xdrmem_getbytes (XDR *, char *, u_int)
 
static bool_t xdrmem_putbytes (XDR *, const char *, u_int)
 
static u_int xdrmem_getpos (XDR *)
 
static bool_t xdrmem_setpos (XDR *, u_int)
 
static int32_txdrmem_inline_aligned (XDR *, u_int)
 
static int32_txdrmem_inline_unaligned (XDR *, u_int)
 
void xdrmem_create (XDR *xdrs, char *addr, u_int size, enum xdr_op op)
 

Variables

static const struct xdr_ops xdrmem_ops_aligned
 
static const struct xdr_ops xdrmem_ops_unaligned
 

Function Documentation

◆ xdrmem_create()

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

Definition at line 94 of file xdr_mem.c.

99{
100
101 xdrs->x_op = op;
102 xdrs->x_ops = (PtrToUlong(addr) & (sizeof(int32_t) - 1))
104 xdrs->x_private = xdrs->x_base = addr;
105 xdrs->x_handy = size;
106}
UINT op
Definition: effect.c:236
#define PtrToUlong(u)
Definition: config.h:107
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLvoid * addr
Definition: glext.h:9621
#define int32_t
Definition: nsiface.idl:56
const struct __rpc_xdr::xdr_ops * x_ops
enum xdr_op x_op
Definition: xdr.h:104
char * x_base
Definition: xdr.h:126
void * x_private
Definition: xdr.h:125
u_int x_handy
Definition: xdr.h:127
static const struct xdr_ops xdrmem_ops_aligned
Definition: xdr_mem.c:67
static const struct xdr_ops xdrmem_ops_unaligned
Definition: xdr_mem.c:78

Referenced by _svcauth_gss(), _svcauth_unix(), authgss_marshal(), authnone_create(), authsspi_marshal(), authunix_create(), authunix_refresh(), authunix_validate(), cache_set(), clnt_dg_create(), clnt_raw_create(), clnt_vc_create(), decode_op_getattr(), decode_readdir_entry(), encode_file_attrs(), info_to_fattr4(), marshal_new_auth(), op_cb_notify_deviceid_args(), replay_cache_read(), replay_cache_write(), replay_validate_args(), rpc_broadcast_exp(), svc_dg_create(), svc_raw_create(), xdr_rpc_gss_unwrap_data(), and xdr_rpc_sspi_unwrap_data().

◆ xdrmem_destroy()

static void xdrmem_destroy ( XDR xdrs)
static

Definition at line 110 of file xdr_mem.c.

112{
113
114}

◆ xdrmem_getbytes()

static bool_t xdrmem_getbytes ( XDR xdrs,
char addr,
u_int  len 
)
static

Definition at line 177 of file xdr_mem.c.

181{
182
183 if (xdrs->x_handy < len)
184 return (FALSE);
185 xdrs->x_handy -= len;
186 memmove(addr, xdrs->x_private, len);
187 xdrs->x_private = (char *)xdrs->x_private + len;
188 return (TRUE);
189}
return
Definition: dirsup.c:529
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLenum GLsizei len
Definition: glext.h:6722
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

◆ xdrmem_getlong_aligned()

static bool_t xdrmem_getlong_aligned ( XDR xdrs,
long lp 
)
static

Definition at line 117 of file xdr_mem.c.

120{
121
122 if (xdrs->x_handy < sizeof(int32_t))
123 return (FALSE);
124 xdrs->x_handy -= sizeof(int32_t);
125 *lp = ntohl(*(u_int32_t *)xdrs->x_private);
126 xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
127 return (TRUE);
128}
INT32 int32_t
Definition: types.h:71
#define ntohl(x)
Definition: module.h:205
unsigned int u_int32_t
Definition: rosdhcp.h:35

◆ xdrmem_getlong_unaligned()

static bool_t xdrmem_getlong_unaligned ( XDR xdrs,
long lp 
)
static

Definition at line 145 of file xdr_mem.c.

148{
149 u_int32_t l;
150
151 if (xdrs->x_handy < sizeof(int32_t))
152 return (FALSE);
153 xdrs->x_handy -= sizeof(int32_t);
154 memmove(&l, xdrs->x_private, sizeof(int32_t));
155 *lp = ntohl(l);
156 xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
157 return (TRUE);
158}
r l[0]
Definition: byte_order.h:168

◆ xdrmem_getpos()

static u_int xdrmem_getpos ( XDR xdrs)
static

Definition at line 207 of file xdr_mem.c.

209{
210
211 /* XXX w/64-bit pointers, u_int not enough! */
212 return (u_int)(PtrToUlong(xdrs->x_private) - PtrToUlong(xdrs->x_base));
213}
UINT32 u_int
Definition: types.h:82

◆ xdrmem_inline_aligned()

static int32_t * xdrmem_inline_aligned ( XDR xdrs,
u_int  len 
)
static

Definition at line 231 of file xdr_mem.c.

234{
235 int32_t *buf = 0;
236
237 if (xdrs->x_handy >= len) {
238 xdrs->x_handy -= len;
239 buf = (int32_t *)xdrs->x_private;
240 xdrs->x_private = (char *)xdrs->x_private + len;
241 }
242 return (buf);
243}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

◆ xdrmem_inline_unaligned()

static int32_t * xdrmem_inline_unaligned ( XDR xdrs,
u_int  len 
)
static

Definition at line 247 of file xdr_mem.c.

250{
251
252 return (0);
253}

◆ xdrmem_putbytes()

static bool_t xdrmem_putbytes ( XDR xdrs,
const char addr,
u_int  len 
)
static

Definition at line 192 of file xdr_mem.c.

196{
197
198 if (xdrs->x_handy < len)
199 return (FALSE);
200 xdrs->x_handy -= len;
201 memmove(xdrs->x_private, addr, len);
202 xdrs->x_private = (char *)xdrs->x_private + len;
203 return (TRUE);
204}

◆ xdrmem_putlong_aligned()

static bool_t xdrmem_putlong_aligned ( XDR xdrs,
const long lp 
)
static

Definition at line 131 of file xdr_mem.c.

134{
135
136 if (xdrs->x_handy < sizeof(int32_t))
137 return (FALSE);
138 xdrs->x_handy -= sizeof(int32_t);
139 *(u_int32_t *)xdrs->x_private = htonl((u_int32_t)*lp);
140 xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
141 return (TRUE);
142}
#define htonl(x)
Definition: module.h:214

◆ xdrmem_putlong_unaligned()

static bool_t xdrmem_putlong_unaligned ( XDR xdrs,
const long lp 
)
static

Definition at line 161 of file xdr_mem.c.

164{
165 u_int32_t l;
166
167 if (xdrs->x_handy < sizeof(int32_t))
168 return (FALSE);
169 xdrs->x_handy -= sizeof(int32_t);
170 l = htonl((u_int32_t)*lp);
171 memmove(xdrs->x_private, &l, sizeof(int32_t));
172 xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
173 return (TRUE);
174}

◆ xdrmem_setpos()

static bool_t xdrmem_setpos ( XDR xdrs,
u_int  pos 
)
static

Definition at line 216 of file xdr_mem.c.

219{
220 char *newaddr = xdrs->x_base + pos;
221 char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy;
222
223 if (newaddr > lastaddr)
224 return (FALSE);
225 xdrs->x_private = newaddr;
226 xdrs->x_handy = (u_int)(lastaddr - newaddr); /* XXX sizeof(u_int) <? sizeof(ptrdiff_t) */
227 return (TRUE);
228}
if(dx< 0)
Definition: linetemp.h:194

Variable Documentation

◆ xdrmem_ops_aligned

const struct xdr_ops xdrmem_ops_aligned
static
Initial value:
= {
}
static u_int xdrmem_getpos(XDR *)
Definition: xdr_mem.c:207
static void xdrmem_destroy(XDR *)
Definition: xdr_mem.c:110
static bool_t xdrmem_putlong_aligned(XDR *, const long *)
Definition: xdr_mem.c:131
static int32_t * xdrmem_inline_aligned(XDR *, u_int)
Definition: xdr_mem.c:231
static bool_t xdrmem_getlong_aligned(XDR *, long *)
Definition: xdr_mem.c:117
static bool_t xdrmem_putbytes(XDR *, const char *, u_int)
Definition: xdr_mem.c:192
static bool_t xdrmem_getbytes(XDR *, char *, u_int)
Definition: xdr_mem.c:177
static bool_t xdrmem_setpos(XDR *, u_int)
Definition: xdr_mem.c:216

Definition at line 67 of file xdr_mem.c.

Referenced by xdrmem_create().

◆ xdrmem_ops_unaligned

const struct xdr_ops xdrmem_ops_unaligned
static
Initial value:
= {
}
static bool_t xdrmem_putlong_unaligned(XDR *, const long *)
Definition: xdr_mem.c:161
static int32_t * xdrmem_inline_unaligned(XDR *, u_int)
Definition: xdr_mem.c:247
static bool_t xdrmem_getlong_unaligned(XDR *, long *)
Definition: xdr_mem.c:145

Definition at line 78 of file xdr_mem.c.

Referenced by xdrmem_create().