3 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
5 * Openvision retains the copyright to derivative works of
6 * this source code. Do *NOT* create a derivative of this
7 * source code before consulting with your legal department.
8 * Do *NOT* integrate *ANY* of this source code into another
9 * product before consulting with your legal department.
11 * For further information, read the top-level Openvision
12 * copyright which is contained in the top-level MIT Kerberos
15 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
20 /* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */
22 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
23 * unrestricted use provided that this legend is included on all tape
24 * media and as a part of the software program in whole or part. Users
25 * may copy or modify Sun RPC without charge, but are not authorized
26 * to license or distribute it to anyone else except as part of a product or
27 * program developed by the user.
29 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
30 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
33 * Sun RPC is provided with no support and without any obligation on the
34 * part of Sun Microsystems, Inc. to assist in its use, correction,
35 * modification or enhancement.
37 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
38 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
39 * OR ANY PART THEREOF.
41 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
42 * or profits or other special, indirect and consequential damages, even if
43 * Sun has been advised of the possibility of such damages.
45 * Sun Microsystems, Inc.
47 * Mountain View, California 94043
49 #if !defined(lint) && defined(SCCSIDS)
50 static char sccsid
[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
54 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
59 #include <rpc/types.h>
63 /* Solaris Kerberos - 116 resync */
64 static bool_t
xdralloc_putlong();
65 static bool_t
xdralloc_putbytes();
66 static unsigned int xdralloc_getpos();
67 static rpc_inline_t
* xdralloc_inline();
68 static void xdralloc_destroy();
69 static bool_t
xdralloc_notsup_getlong();
70 static bool_t
xdralloc_notsup_getbytes();
71 static bool_t
xdralloc_notsup_setpos();
72 static struct xdr_ops xdralloc_ops
= {
73 xdralloc_notsup_getlong
,
75 xdralloc_notsup_getbytes
,
78 xdralloc_notsup_setpos
,
84 * The procedure xdralloc_create initializes a stream descriptor for a
87 void xdralloc_create(XDR
*xdrs
, enum xdr_op op
)
90 xdrs
->x_ops
= &xdralloc_ops
;
91 xdrs
->x_private
= (caddr_t
) DynCreate(sizeof(char), -4);
92 /* not allowed to fail */
95 caddr_t
xdralloc_getdata(XDR
*xdrs
)
97 return (caddr_t
) DynGet((DynObject
) xdrs
->x_private
, 0);
100 void xdralloc_release(XDR
*xdrs
)
102 DynRelease((DynObject
) xdrs
->x_private
);
105 static void xdralloc_destroy(XDR
*xdrs
)
107 DynDestroy((DynObject
) xdrs
->x_private
);
110 static bool_t
xdralloc_notsup_getlong(
117 static bool_t
xdralloc_putlong(
121 int l
= htonl((uint32_t) *lp
); /* XXX need bounds checking */
123 /* XXX assumes sizeof(int)==4 */
124 if (DynInsert((DynObject
) xdrs
->x_private
,
125 DynSize((DynObject
) xdrs
->x_private
), &l
,
126 sizeof(int)) != DYN_OK
)
132 static bool_t
xdralloc_notsup_getbytes(
135 register unsigned int len
)
141 static bool_t
xdralloc_putbytes(
144 register unsigned int len
)
146 if (DynInsert((DynObject
) xdrs
->x_private
,
147 DynSize((DynObject
) xdrs
->x_private
),
148 addr
, (int) len
) != DYN_OK
)
153 static unsigned int xdralloc_getpos(XDR
*xdrs
)
155 return DynSize((DynObject
) xdrs
->x_private
);
158 static bool_t
xdralloc_notsup_setpos(
167 static rpc_inline_t
*xdralloc_inline(
171 return (rpc_inline_t
*) 0;