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
51 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
56 #include <rpc/types.h>
60 /* Solaris Kerberos - 116 resync */
61 static bool_t
xdralloc_putlong();
62 static bool_t
xdralloc_putbytes();
63 static unsigned int xdralloc_getpos();
64 static rpc_inline_t
* xdralloc_inline();
65 static void xdralloc_destroy();
66 static bool_t
xdralloc_notsup_getlong();
67 static bool_t
xdralloc_notsup_getbytes();
68 static bool_t
xdralloc_notsup_setpos();
69 static struct xdr_ops xdralloc_ops
= {
70 xdralloc_notsup_getlong
,
72 xdralloc_notsup_getbytes
,
75 xdralloc_notsup_setpos
,
81 * The procedure xdralloc_create initializes a stream descriptor for a
84 void xdralloc_create(XDR
*xdrs
, enum xdr_op op
)
87 xdrs
->x_ops
= &xdralloc_ops
;
88 xdrs
->x_private
= (caddr_t
) DynCreate(sizeof(char), -4);
89 /* not allowed to fail */
92 caddr_t
xdralloc_getdata(XDR
*xdrs
)
94 return (caddr_t
) DynGet((DynObject
) xdrs
->x_private
, 0);
97 void xdralloc_release(XDR
*xdrs
)
99 DynRelease((DynObject
) xdrs
->x_private
);
102 static void xdralloc_destroy(XDR
*xdrs
)
104 DynDestroy((DynObject
) xdrs
->x_private
);
107 static bool_t
xdralloc_notsup_getlong(
114 static bool_t
xdralloc_putlong(
118 int l
= htonl((uint32_t) *lp
); /* XXX need bounds checking */
120 /* XXX assumes sizeof(int)==4 */
121 if (DynInsert((DynObject
) xdrs
->x_private
,
122 DynSize((DynObject
) xdrs
->x_private
), &l
,
123 sizeof(int)) != DYN_OK
)
129 static bool_t
xdralloc_notsup_getbytes(
132 register unsigned int len
)
138 static bool_t
xdralloc_putbytes(
141 register unsigned int len
)
143 if (DynInsert((DynObject
) xdrs
->x_private
,
144 DynSize((DynObject
) xdrs
->x_private
),
145 addr
, (int) len
) != DYN_OK
)
150 static unsigned int xdralloc_getpos(XDR
*xdrs
)
152 return DynSize((DynObject
) xdrs
->x_private
);
155 static bool_t
xdralloc_notsup_setpos(
164 static rpc_inline_t
*xdralloc_inline(
168 return (rpc_inline_t
*) 0;