dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / krb5 / kadm5 / srv / xdr_alloc.c
blob0a5de8d39dcc5e2df0fe498cde27293f424de485
2 /*
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
13 * copyright.
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.
46 * 2550 Garcia Avenue
47 * Mountain View, California 94043
51 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
55 #include "admin.h"
56 #include <rpc/types.h>
57 #include <rpc/xdr.h>
58 #include <dyn/dyn.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,
71 xdralloc_putlong,
72 xdralloc_notsup_getbytes,
73 xdralloc_putbytes,
74 xdralloc_getpos,
75 xdralloc_notsup_setpos,
76 xdralloc_inline,
77 xdralloc_destroy,
81 * The procedure xdralloc_create initializes a stream descriptor for a
82 * memory buffer.
84 void xdralloc_create(XDR *xdrs, enum xdr_op op)
86 xdrs->x_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(
108 register XDR *xdrs,
109 long *lp)
111 return FALSE;
114 static bool_t xdralloc_putlong(
115 register XDR *xdrs,
116 long *lp)
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)
124 return FALSE;
125 return (TRUE);
129 static bool_t xdralloc_notsup_getbytes(
130 register XDR *xdrs,
131 caddr_t addr,
132 register unsigned int len)
134 return FALSE;
138 static bool_t xdralloc_putbytes(
139 register XDR *xdrs,
140 caddr_t addr,
141 register unsigned int len)
143 if (DynInsert((DynObject) xdrs->x_private,
144 DynSize((DynObject) xdrs->x_private),
145 addr, (int) len) != DYN_OK)
146 return FALSE;
147 return TRUE;
150 static unsigned int xdralloc_getpos(XDR *xdrs)
152 return DynSize((DynObject) xdrs->x_private);
155 static bool_t xdralloc_notsup_setpos(
156 register XDR *xdrs,
157 unsigned int lp)
159 return FALSE;
164 static rpc_inline_t *xdralloc_inline(
165 register XDR *xdrs,
166 int len)
168 return (rpc_inline_t *) 0;