Deleted Added
full compact
xdr_mem.c (189170) xdr_mem.c (192971)
1/* $NetBSD: xdr_mem.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ */
2
3/*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or

--- 20 unchanged lines hidden (view full) ---

29 * Mountain View, California 94043
30 */
31
32#if defined(LIBC_SCCS) && !defined(lint)
33static char *sccsid2 = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
34static char *sccsid = "@(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";
35#endif
36#include <sys/cdefs.h>
1/* $NetBSD: xdr_mem.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ */
2
3/*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or

--- 20 unchanged lines hidden (view full) ---

29 * Mountain View, California 94043
30 */
31
32#if defined(LIBC_SCCS) && !defined(lint)
33static char *sccsid2 = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
34static char *sccsid = "@(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";
35#endif
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/xdr/xdr_mem.c 189170 2009-02-28 16:21:25Z ed $");
37__FBSDID("$FreeBSD: head/sys/xdr/xdr_mem.c 192971 2009-05-28 08:18:12Z kmacy $");
38
39/*
40 * xdr_mem.h, XDR implementation using memory buffers.
41 *
42 * Copyright (C) 1984, Sun Microsystems, Inc.
43 *
44 * If you have some data to be interpreted as external data representation
45 * or to be converted to external data representation in a memory buffer,

--- 15 unchanged lines hidden (view full) ---

61static bool_t xdrmem_putlong_unaligned(XDR *, const long *);
62static bool_t xdrmem_getbytes(XDR *, char *, u_int);
63static bool_t xdrmem_putbytes(XDR *, const char *, u_int);
64/* XXX: w/64-bit pointers, u_int not enough! */
65static u_int xdrmem_getpos(XDR *);
66static bool_t xdrmem_setpos(XDR *, u_int);
67static int32_t *xdrmem_inline_aligned(XDR *, u_int);
68static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
38
39/*
40 * xdr_mem.h, XDR implementation using memory buffers.
41 *
42 * Copyright (C) 1984, Sun Microsystems, Inc.
43 *
44 * If you have some data to be interpreted as external data representation
45 * or to be converted to external data representation in a memory buffer,

--- 15 unchanged lines hidden (view full) ---

61static bool_t xdrmem_putlong_unaligned(XDR *, const long *);
62static bool_t xdrmem_getbytes(XDR *, char *, u_int);
63static bool_t xdrmem_putbytes(XDR *, const char *, u_int);
64/* XXX: w/64-bit pointers, u_int not enough! */
65static u_int xdrmem_getpos(XDR *);
66static bool_t xdrmem_setpos(XDR *, u_int);
67static int32_t *xdrmem_inline_aligned(XDR *, u_int);
68static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
69
69static bool_t xdrmem_control(XDR *xdrs, int request, void *info);
70
70static const struct xdr_ops xdrmem_ops_aligned = {
71 xdrmem_getlong_aligned,
72 xdrmem_putlong_aligned,
73 xdrmem_getbytes,
74 xdrmem_putbytes,
75 xdrmem_getpos,
76 xdrmem_setpos,
77 xdrmem_inline_aligned,
71static const struct xdr_ops xdrmem_ops_aligned = {
72 xdrmem_getlong_aligned,
73 xdrmem_putlong_aligned,
74 xdrmem_getbytes,
75 xdrmem_putbytes,
76 xdrmem_getpos,
77 xdrmem_setpos,
78 xdrmem_inline_aligned,
78 xdrmem_destroy
79 xdrmem_destroy,
80 xdrmem_control
79};
80
81static const struct xdr_ops xdrmem_ops_unaligned = {
82 xdrmem_getlong_unaligned,
83 xdrmem_putlong_unaligned,
84 xdrmem_getbytes,
85 xdrmem_putbytes,
86 xdrmem_getpos,
87 xdrmem_setpos,
88 xdrmem_inline_unaligned,
81};
82
83static const struct xdr_ops xdrmem_ops_unaligned = {
84 xdrmem_getlong_unaligned,
85 xdrmem_putlong_unaligned,
86 xdrmem_getbytes,
87 xdrmem_putbytes,
88 xdrmem_getpos,
89 xdrmem_setpos,
90 xdrmem_inline_unaligned,
89 xdrmem_destroy
91 xdrmem_destroy,
92 xdrmem_control
90};
91
92/*
93 * The procedure xdrmem_create initializes a stream descriptor for a
94 * memory buffer.
95 */
96void
97xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)

--- 125 unchanged lines hidden (view full) ---

223
224/* ARGSUSED */
225static int32_t *
226xdrmem_inline_unaligned(XDR *xdrs, u_int len)
227{
228
229 return (0);
230}
93};
94
95/*
96 * The procedure xdrmem_create initializes a stream descriptor for a
97 * memory buffer.
98 */
99void
100xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)

--- 125 unchanged lines hidden (view full) ---

226
227/* ARGSUSED */
228static int32_t *
229xdrmem_inline_unaligned(XDR *xdrs, u_int len)
230{
231
232 return (0);
233}
234
235static bool_t
236xdrmem_control(XDR *xdrs, int request, void *info)
237{
238 xdr_bytesrec *xptr;
239 int32_t *l;
240 int len;
241
242 switch (request) {
243
244 case XDR_GET_BYTES_AVAIL:
245 xptr = (xdr_bytesrec *)info;
246 xptr->xc_is_last_record = TRUE;
247 xptr->xc_num_avail = xdrs->x_handy;
248 return (TRUE);
249
250 case XDR_PEEK:
251 /*
252 * Return the next 4 byte unit in the XDR stream.
253 */
254 if (xdrs->x_handy < sizeof (int32_t))
255 return (FALSE);
256 l = (int32_t *)info;
257 *l = (int32_t)ntohl((uint32_t)
258 (*((int32_t *)(xdrs->x_private))));
259 return (TRUE);
260
261 case XDR_SKIPBYTES:
262 /*
263 * Skip the next N bytes in the XDR stream.
264 */
265 l = (int32_t *)info;
266 len = RNDUP((int)(*l));
267 if (xdrs->x_handy < len)
268 return (FALSE);
269 xdrs->x_handy -= len;
270 xdrs->x_private = (char *)xdrs->x_private + len;
271 return (TRUE);
272
273 }
274 return (FALSE);
275}