4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * Portions of this source code were derived from Berkeley 4.3 BSD
32 * under license from the Regents of the University of California.
35 #ifndef _SOL_RPC_XDR_H_
36 #define _SOL_RPC_XDR_H_
38 #include_next <rpc/xdr.h>
41 * Strangely, my glibc version (2.3.6) doesn't have xdr_control(), so
42 * we have to hack it in here (source taken from OpenSolaris).
43 * By the way, it is assumed the xdrmem implementation is used.
46 #define xdr_control(a,b,c) xdrmem_control(a,b,c)
49 * These are XDR control operators
52 #define XDR_GET_BYTES_AVAIL 1
55 bool_t xc_is_last_record
;
59 typedef struct xdr_bytesrec xdr_bytesrec
;
62 * These are the request arguments to XDR_CONTROL.
64 * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream.
65 * XDR_SKIPBYTES - skips the next N bytes in the XDR stream.
66 * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from
67 * the XDR stream being moved over RDMA
68 * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in
69 * the XDR stream moving over RDMA.
72 #define XDR_SKIPBYTES 3
76 /* FIXME: probably doesn't work */
78 xdrmem_control(XDR
*xdrs
, int request
, void *info
)
86 case XDR_GET_BYTES_AVAIL
:
87 xptr
= (xdr_bytesrec
*)info
;
88 xptr
->xc_is_last_record
= TRUE
;
89 xptr
->xc_num_avail
= xdrs
->x_handy
;
94 * Return the next 4 byte unit in the XDR stream.
96 if (xdrs
->x_handy
< sizeof (int32_t))
98 int32p
= (int32_t *)info
;
99 *int32p
= (int32_t)ntohl((uint32_t)
100 (*((int32_t *)(xdrs
->x_private
))));
105 * Skip the next N bytes in the XDR stream.
107 int32p
= (int32_t *)info
;
108 len
= RNDUP((int)(*int32p
));
109 if ((xdrs
->x_handy
-= len
) < 0)
111 xdrs
->x_private
+= len
;