3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
[unleashed.git] / usr / src / uts / common / rpc / xdr.h
blob3db775893c88a0fcb2c8da9bd991a641fe5e2cee
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
21 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
24 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
25 /* All Rights Reserved */
27 * Portions of this source code were derived from Berkeley
28 * 4.3 BSD under license from the Regents of the University of
29 * California.
33 * xdr.h, External Data Representation Serialization Routines.
37 #ifndef _RPC_XDR_H
38 #define _RPC_XDR_H
40 #include <sys/byteorder.h> /* For all ntoh* and hton*() kind of macros */
41 #include <rpc/types.h> /* For all ntoh* and hton*() kind of macros */
42 #ifndef _KERNEL
43 #include <stdio.h> /* defines FILE *, used in ANSI C function prototypes */
44 #endif
45 #ifdef _KERNEL
46 #include <sys/stream.h>
47 #endif
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
54 * XDR provides a conventional way for converting between C data
55 * types and an external bit-string representation. Library supplied
56 * routines provide for the conversion on built-in C data types. These
57 * routines and utility routines defined here are used to help implement
58 * a type encode/decode routine for each user-defined type.
60 * Each data type provides a single procedure which takes two arguments:
62 * bool_t
63 * xdrproc(xdrs, argresp)
64 * XDR *xdrs;
65 * <type> *argresp;
67 * xdrs is an instance of a XDR handle, to which or from which the data
68 * type is to be converted. argresp is a pointer to the structure to be
69 * converted. The XDR handle contains an operation field which indicates
70 * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
72 * XDR_DECODE may allocate space if the pointer argresp is null. This
73 * data can be freed with the XDR_FREE operation.
75 * We write only one procedure per data type to make it easy
76 * to keep the encode and decode procedures for a data type consistent.
77 * In many cases the same code performs all operations on a user defined type,
78 * because all the hard work is done in the component type routines.
79 * decode as a series of calls on the nested data types.
83 * Xdr operations. XDR_ENCODE causes the type to be encoded into the
84 * stream. XDR_DECODE causes the type to be extracted from the stream.
85 * XDR_FREE can be used to release the space allocated by an XDR_DECODE
86 * request.
88 enum xdr_op {
89 XDR_ENCODE = 0,
90 XDR_DECODE = 1,
91 XDR_FREE = 2
95 * This is the number of bytes per unit of external data.
97 #define BYTES_PER_XDR_UNIT (4)
98 #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
99 * BYTES_PER_XDR_UNIT)
102 * The XDR handle.
103 * Contains operation which is being applied to the stream,
104 * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
105 * and two private fields for the use of the particular impelementation.
107 * PSARC 2003/523 Contract Private Interface
108 * XDR
109 * Changes must be reviewed by Solaris File Sharing
110 * Changes must be communicated to contract-2003-523@sun.com
112 typedef struct XDR {
113 enum xdr_op x_op; /* operation; fast additional param */
114 struct xdr_ops *x_ops;
115 caddr_t x_public; /* users' data */
116 caddr_t x_private; /* pointer to private data */
117 caddr_t x_base; /* private used for position info */
118 int x_handy; /* extra private word */
119 } XDR;
122 * PSARC 2003/523 Contract Private Interface
123 * xdr_ops
124 * Changes must be reviewed by Solaris File Sharing
125 * Changes must be communicated to contract-2003-523@sun.com
127 struct xdr_ops {
128 #ifdef __STDC__
129 #if !defined(_KERNEL)
130 bool_t (*x_getlong)(struct XDR *, long *);
131 /* get a long from underlying stream */
132 bool_t (*x_putlong)(struct XDR *, long *);
133 /* put a long to " */
134 #endif /* KERNEL */
135 bool_t (*x_getbytes)(struct XDR *, caddr_t, int);
136 /* get some bytes from " */
137 bool_t (*x_putbytes)(struct XDR *, caddr_t, int);
138 /* put some bytes to " */
139 uint_t (*x_getpostn)(struct XDR *);
140 /* returns bytes off from beginning */
141 bool_t (*x_setpostn)(struct XDR *, uint_t);
142 /* lets you reposition the stream */
143 rpc_inline_t *(*x_inline)(struct XDR *, int);
144 /* buf quick ptr to buffered data */
145 void (*x_destroy)(struct XDR *);
146 /* free privates of this xdr_stream */
147 bool_t (*x_control)(struct XDR *, int, void *);
148 #if defined(_LP64) || defined(_KERNEL)
149 bool_t (*x_getint32)(struct XDR *, int32_t *);
150 /* get a int from underlying stream */
151 bool_t (*x_putint32)(struct XDR *, int32_t *);
152 /* put an int to " */
153 #endif /* _LP64 || _KERNEL */
154 #else
155 #if !defined(_KERNEL)
156 bool_t (*x_getlong)(); /* get a long from underlying stream */
157 bool_t (*x_putlong)(); /* put a long to " */
158 #endif /* KERNEL */
159 bool_t (*x_getbytes)(); /* get some bytes from " */
160 bool_t (*x_putbytes)(); /* put some bytes to " */
161 uint_t (*x_getpostn)(); /* returns bytes off from beginning */
162 bool_t (*x_setpostn)(); /* lets you reposition the stream */
163 rpc_inline_t *(*x_inline)();
164 /* buf quick ptr to buffered data */
165 void (*x_destroy)(); /* free privates of this xdr_stream */
166 bool_t (*x_control)();
167 #if defined(_LP64) || defined(_KERNEL)
168 bool_t (*x_getint32)();
169 bool_t (*x_putint32)();
170 #endif /* _LP64 || defined(_KERNEL) */
171 #endif
175 * Operations defined on a XDR handle
177 * XDR *xdrs;
178 * long *longp;
179 * caddr_t addr;
180 * uint_t len;
181 * uint_t pos;
183 #if !defined(_KERNEL)
184 #define XDR_GETLONG(xdrs, longp) \
185 (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
186 #define xdr_getlong(xdrs, longp) \
187 (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
189 #define XDR_PUTLONG(xdrs, longp) \
190 (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
191 #define xdr_putlong(xdrs, longp) \
192 (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
193 #endif /* KERNEL */
196 #if !defined(_LP64) && !defined(_KERNEL)
199 * For binary compatability on ILP32 we do not change the shape
200 * of the XDR structure and the GET/PUTINT32 functions just use
201 * the get/putlong vectors which operate on identically-sized
202 * units of data.
205 #define XDR_GETINT32(xdrs, int32p) \
206 (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p)
207 #define xdr_getint32(xdrs, int32p) \
208 (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p)
210 #define XDR_PUTINT32(xdrs, int32p) \
211 (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p)
212 #define xdr_putint32(xdrs, int32p) \
213 (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p)
215 #else /* !_LP64 && !_KERNEL */
217 #define XDR_GETINT32(xdrs, int32p) \
218 (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
219 #define xdr_getint32(xdrs, int32p) \
220 (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
222 #define XDR_PUTINT32(xdrs, int32p) \
223 (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
224 #define xdr_putint32(xdrs, int32p) \
225 (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
227 #endif /* !_LP64 && !_KERNEL */
229 #define XDR_GETBYTES(xdrs, addr, len) \
230 (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
231 #define xdr_getbytes(xdrs, addr, len) \
232 (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
234 #define XDR_PUTBYTES(xdrs, addr, len) \
235 (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
236 #define xdr_putbytes(xdrs, addr, len) \
237 (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
239 #define XDR_GETPOS(xdrs) \
240 (*(xdrs)->x_ops->x_getpostn)(xdrs)
241 #define xdr_getpos(xdrs) \
242 (*(xdrs)->x_ops->x_getpostn)(xdrs)
244 #define XDR_SETPOS(xdrs, pos) \
245 (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
246 #define xdr_setpos(xdrs, pos) \
247 (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
249 #define XDR_INLINE(xdrs, len) \
250 (*(xdrs)->x_ops->x_inline)(xdrs, len)
251 #define xdr_inline(xdrs, len) \
252 (*(xdrs)->x_ops->x_inline)(xdrs, len)
254 #define XDR_DESTROY(xdrs) \
255 (*(xdrs)->x_ops->x_destroy)(xdrs)
256 #define xdr_destroy(xdrs) \
257 (*(xdrs)->x_ops->x_destroy)(xdrs)
259 #define XDR_CONTROL(xdrs, req, op) \
260 (*(xdrs)->x_ops->x_control)(xdrs, req, op)
261 #define xdr_control(xdrs, req, op) \
262 (*(xdrs)->x_ops->x_control)(xdrs, req, op)
265 * Support struct for discriminated unions.
266 * You create an array of xdrdiscrim structures, terminated with
267 * a entry with a null procedure pointer. The xdr_union routine gets
268 * the discriminant value and then searches the array of structures
269 * for a matching value. If a match is found the associated xdr routine
270 * is called to handle that part of the union. If there is
271 * no match, then a default routine may be called.
272 * If there is no match and no default routine it is an error.
277 * A xdrproc_t exists for each data type which is to be encoded or decoded.
279 * The second argument to the xdrproc_t is a pointer to an opaque pointer.
280 * The opaque pointer generally points to a structure of the data type
281 * to be decoded. If this pointer is 0, then the type routines should
282 * allocate dynamic storage of the appropriate size and return it.
283 * bool_t (*xdrproc_t)(XDR *, void *);
285 #ifdef __cplusplus
286 typedef bool_t (*xdrproc_t)(XDR *, void *);
287 #else
288 #ifdef __STDC__
289 typedef bool_t (*xdrproc_t)(); /* For Backward compatibility */
290 #else
291 typedef bool_t (*xdrproc_t)();
292 #endif
293 #endif
295 #define NULL_xdrproc_t ((xdrproc_t)0)
297 #if defined(_LP64) || defined(_I32LPx)
298 #define xdr_rpcvers(xdrs, versp) xdr_u_int(xdrs, versp)
299 #define xdr_rpcprog(xdrs, progp) xdr_u_int(xdrs, progp)
300 #define xdr_rpcproc(xdrs, procp) xdr_u_int(xdrs, procp)
301 #define xdr_rpcprot(xdrs, protp) xdr_u_int(xdrs, protp)
302 #define xdr_rpcport(xdrs, portp) xdr_u_int(xdrs, portp)
303 #else
304 #define xdr_rpcvers(xdrs, versp) xdr_u_long(xdrs, versp)
305 #define xdr_rpcprog(xdrs, progp) xdr_u_long(xdrs, progp)
306 #define xdr_rpcproc(xdrs, procp) xdr_u_long(xdrs, procp)
307 #define xdr_rpcprot(xdrs, protp) xdr_u_long(xdrs, protp)
308 #define xdr_rpcport(xdrs, portp) xdr_u_long(xdrs, portp)
309 #endif
311 struct xdr_discrim {
312 int value;
313 xdrproc_t proc;
317 * In-line routines for fast encode/decode of primitve data types.
318 * Caveat emptor: these use single memory cycles to get the
319 * data from the underlying buffer, and will fail to operate
320 * properly if the data is not aligned. The standard way to use these
321 * is to say:
322 * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
323 * return (FALSE);
324 * <<< macro calls >>>
325 * where ``count'' is the number of bytes of data occupied
326 * by the primitive data types.
328 * N.B. and frozen for all time: each data type here uses 4 bytes
329 * of external representation.
332 #define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++))
333 #define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)v))
334 #define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
335 #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
337 #if !defined(_KERNEL) && !defined(_LP64)
339 #define IXDR_GET_LONG(buf) ((long)ntohl((ulong_t)*(buf)++))
340 #define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((ulong_t)v))
341 #define IXDR_GET_U_LONG(buf) ((ulong_t)IXDR_GET_LONG(buf))
342 #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
344 #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
345 #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
346 #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
347 #define IXDR_GET_U_SHORT(buf) ((ushort_t)IXDR_GET_LONG(buf))
349 #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
350 #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
351 #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
352 #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
354 #else
356 #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_INT32(buf))
357 #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf))
358 #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf))
359 #define IXDR_GET_U_SHORT(buf) ((ushort_t)IXDR_GET_INT32(buf))
361 #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
362 #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
363 #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
364 #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v)))
366 #endif
368 #ifndef _LITTLE_ENDIAN
369 #define IXDR_GET_HYPER(buf, v) { \
370 *((int32_t *)(&v)) = ntohl(*(uint32_t *)buf++); \
371 *((int32_t *)(((char *)&v) + BYTES_PER_XDR_UNIT)) \
372 = ntohl(*(uint32_t *)buf++); \
374 #define IXDR_PUT_HYPER(buf, v) { \
375 *(buf)++ = (int32_t)htonl(*(uint32_t *) \
376 ((char *)&v)); \
377 *(buf)++ = \
378 (int32_t)htonl(*(uint32_t *)(((char *)&v) \
379 + BYTES_PER_XDR_UNIT)); \
381 #else
383 #define IXDR_GET_HYPER(buf, v) { \
384 *((int32_t *)(((char *)&v) + \
385 BYTES_PER_XDR_UNIT)) \
386 = ntohl(*(uint32_t *)buf++); \
387 *((int32_t *)(&v)) = \
388 ntohl(*(uint32_t *)buf++); \
391 #define IXDR_PUT_HYPER(buf, v) { \
392 *(buf)++ = \
393 (int32_t)htonl(*(uint32_t *)(((char *)&v) + \
394 BYTES_PER_XDR_UNIT)); \
395 *(buf)++ = \
396 (int32_t)htonl(*(uint32_t *)((char *)&v)); \
398 #endif
399 #define IXDR_GET_U_HYPER(buf, v) IXDR_GET_HYPER(buf, v)
400 #define IXDR_PUT_U_HYPER(buf, v) IXDR_PUT_HYPER(buf, v)
404 * These are the "generic" xdr routines.
406 #ifdef __STDC__
407 extern bool_t xdr_void(void);
408 extern bool_t xdr_int(XDR *, int *);
409 extern bool_t xdr_u_int(XDR *, uint_t *);
410 extern bool_t xdr_long(XDR *, long *);
411 extern bool_t xdr_u_long(XDR *, ulong_t *);
412 extern bool_t xdr_short(XDR *, short *);
413 extern bool_t xdr_u_short(XDR *, ushort_t *);
414 extern bool_t xdr_bool(XDR *, bool_t *);
415 extern bool_t xdr_enum(XDR *, enum_t *);
416 extern bool_t xdr_array(XDR *, caddr_t *, uint_t *, const uint_t,
417 const uint_t, const xdrproc_t);
418 extern bool_t xdr_bytes(XDR *, char **, uint_t *, const uint_t);
419 extern bool_t xdr_opaque(XDR *, caddr_t, const uint_t);
420 extern bool_t xdr_string(XDR *, char **, const uint_t);
421 extern bool_t xdr_union(XDR *, enum_t *, char *,
422 const struct xdr_discrim *, const xdrproc_t);
423 extern bool_t xdr_vector(XDR *, char *, const uint_t, const uint_t,
424 const xdrproc_t);
425 extern unsigned int xdr_sizeof(xdrproc_t, void *);
427 extern bool_t xdr_hyper(XDR *, longlong_t *);
428 extern bool_t xdr_longlong_t(XDR *, longlong_t *);
429 extern bool_t xdr_u_hyper(XDR *, u_longlong_t *);
430 extern bool_t xdr_u_longlong_t(XDR *, u_longlong_t *);
432 extern bool_t xdr_char(XDR *, char *);
433 extern bool_t xdr_u_char(XDR *, uchar_t *);
434 extern bool_t xdr_wrapstring(XDR *, char **);
435 extern bool_t xdr_reference(XDR *, caddr_t *, uint_t, const xdrproc_t);
436 extern bool_t xdr_pointer(XDR *, char **, uint_t, const xdrproc_t);
437 extern void xdr_free(xdrproc_t, char *);
438 extern bool_t xdr_time_t(XDR *, time_t *);
440 extern bool_t xdr_int8_t(XDR *, int8_t *);
441 extern bool_t xdr_uint8_t(XDR *, uint8_t *);
442 extern bool_t xdr_int16_t(XDR *, int16_t *);
443 extern bool_t xdr_uint16_t(XDR *, uint16_t *);
444 extern bool_t xdr_int32_t(XDR *, int32_t *);
445 extern bool_t xdr_uint32_t(XDR *, uint32_t *);
446 #if defined(_INT64_TYPE)
447 extern bool_t xdr_int64_t(XDR *, int64_t *);
448 extern bool_t xdr_uint64_t(XDR *, uint64_t *);
449 #endif
451 #ifndef _KERNEL
452 extern bool_t xdr_float(XDR *, float *);
453 extern bool_t xdr_double(XDR *, double *);
454 extern bool_t xdr_quadruple(XDR *, long double *);
455 #endif /* !_KERNEL */
456 #else
457 extern bool_t xdr_void();
458 extern bool_t xdr_int();
459 extern bool_t xdr_u_int();
460 extern bool_t xdr_long();
461 extern bool_t xdr_u_long();
462 extern bool_t xdr_short();
463 extern bool_t xdr_u_short();
464 extern bool_t xdr_bool();
465 extern bool_t xdr_enum();
466 extern bool_t xdr_array();
467 extern bool_t xdr_bytes();
468 extern bool_t xdr_opaque();
469 extern bool_t xdr_string();
470 extern bool_t xdr_union();
471 extern bool_t xdr_vector();
473 extern bool_t xdr_hyper();
474 extern bool_t xdr_longlong_t();
475 extern bool_t xdr_u_hyper();
476 extern bool_t xdr_u_longlong_t();
477 extern bool_t xdr_char();
478 extern bool_t xdr_u_char();
479 extern bool_t xdr_reference();
480 extern bool_t xdr_pointer();
481 extern void xdr_free();
482 extern bool_t xdr_wrapstring();
483 extern bool_t xdr_time_t();
485 extern bool_t xdr_int8_t();
486 extern bool_t xdr_uint8_t();
487 extern bool_t xdr_int16_t();
488 extern bool_t xdr_uint16_t();
489 extern bool_t xdr_int32_t();
490 extern bool_t xdr_uint32_t();
491 #if defined(_INT64_TYPE)
492 extern bool_t xdr_int64_t();
493 extern bool_t xdr_uint64_t();
494 #endif
496 #ifndef _KERNEL
497 extern bool_t xdr_float();
498 extern bool_t xdr_double();
499 extern bool_t xdr_quadruple();
500 #endif /* !_KERNEL */
501 #endif
504 * Common opaque bytes objects used by many rpc protocols;
505 * declared here due to commonality.
507 #define MAX_NETOBJ_SZ 1024
508 struct netobj {
509 uint_t n_len;
510 char *n_bytes;
512 typedef struct netobj netobj;
514 #ifdef __STDC__
515 extern bool_t xdr_netobj(XDR *, netobj *);
516 #else
517 extern bool_t xdr_netobj();
518 #endif
521 * These are XDR control operators
524 #define XDR_GET_BYTES_AVAIL 1
526 struct xdr_bytesrec {
527 bool_t xc_is_last_record;
528 size_t xc_num_avail;
531 typedef struct xdr_bytesrec xdr_bytesrec;
534 * These are the request arguments to XDR_CONTROL.
536 * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream.
537 * XDR_SKIPBYTES - skips the next N bytes in the XDR stream.
538 * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from
539 * the XDR stream being moved over RDMA
540 * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in
541 * the XDR stream moving over RDMA.
543 #ifdef _KERNEL
544 #define XDR_PEEK 2
545 #define XDR_SKIPBYTES 3
546 #define XDR_RDMA_GET_FLAGS 4
547 #define XDR_RDMA_SET_FLAGS 5
548 #define XDR_RDMA_ADD_CHUNK 6
549 #define XDR_RDMA_GET_CHUNK_LEN 7
550 #define XDR_RDMA_SET_WLIST 8
551 #define XDR_RDMA_GET_WLIST 9
552 #define XDR_RDMA_GET_WCINFO 10
553 #define XDR_RDMA_GET_RLIST 11
554 #endif
557 * These are the public routines for the various implementations of
558 * xdr streams.
560 #ifndef _KERNEL
561 #ifdef __STDC__
562 extern void xdrmem_create(XDR *, const caddr_t, const uint_t, const enum
563 xdr_op);
564 /* XDR using memory buffers */
565 extern void xdrstdio_create(XDR *, FILE *, const enum xdr_op);
566 /* XDR using stdio library */
567 extern void xdrrec_create(XDR *, const uint_t, const uint_t, const caddr_t,
568 int (*) (void *, caddr_t, int), int (*) (void *, caddr_t, int));
569 /* XDR pseudo records for tcp */
570 extern bool_t xdrrec_endofrecord(XDR *, bool_t);
571 /* make end of xdr record */
572 extern bool_t xdrrec_skiprecord(XDR *);
573 /* move to beginning of next record */
574 extern bool_t xdrrec_eof(XDR *);
575 extern uint_t xdrrec_readbytes(XDR *, caddr_t, uint_t);
576 /* true if no more input */
577 #else
578 extern void xdrmem_create();
579 extern void xdrstdio_create();
580 extern void xdrrec_create();
581 extern bool_t xdrrec_endofrecord();
582 extern bool_t xdrrec_skiprecord();
583 extern bool_t xdrrec_eof();
584 extern uint_t xdrrec_readbytes();
585 #endif
586 #else
588 #define DLEN(mp) (mp->b_cont ? msgdsize(mp) : (mp->b_wptr - mp->b_rptr))
590 extern void xdrmem_create(XDR *, caddr_t, uint_t, enum xdr_op);
591 extern void xdrmblk_init(XDR *, mblk_t *, enum xdr_op, int);
592 extern bool_t xdrmblk_getmblk(XDR *, mblk_t **, uint_t *);
593 extern bool_t xdrmblk_putmblk(XDR *, mblk_t *, uint_t);
594 extern struct xdr_ops xdrmblk_ops;
595 extern struct xdr_ops xdrrdmablk_ops;
596 extern struct xdr_ops xdrrdma_ops;
598 struct rpc_msg;
599 extern bool_t xdr_callmsg(XDR *, struct rpc_msg *);
600 extern bool_t xdr_replymsg_body(XDR *, struct rpc_msg *);
601 extern bool_t xdr_replymsg_hdr(XDR *, struct rpc_msg *);
603 #endif /* !_KERNEL */
605 #ifdef __cplusplus
607 #endif
609 #endif /* !_RPC_XDR_H */