17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50a701b1eSRobert Gordon * Common Development and Distribution License (the "License"). 60a701b1eSRobert Gordon * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 20*5dde82e7SMarcel Telka */ 21*5dde82e7SMarcel Telka 22*5dde82e7SMarcel Telka /* 23*5dde82e7SMarcel Telka * Copyright 2016 Nexenta Systems, Inc. All rights reserved. 24*5dde82e7SMarcel Telka */ 25*5dde82e7SMarcel Telka 26*5dde82e7SMarcel Telka /* 27c242f9a0Schunli zhang - Sun Microsystems - Irvine United States * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 287c478bd9Sstevel@tonic-gate * Use is subject to license terms. 297c478bd9Sstevel@tonic-gate */ 307c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 317c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 347c478bd9Sstevel@tonic-gate * 4.3 BSD under license from the Regents of the University of 357c478bd9Sstevel@tonic-gate * California. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * xdr.h, External Data Representation Serialization Routines. 407c478bd9Sstevel@tonic-gate * 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #ifndef _RPC_XDR_H 447c478bd9Sstevel@tonic-gate #define _RPC_XDR_H 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #include <sys/byteorder.h> /* For all ntoh* and hton*() kind of macros */ 477c478bd9Sstevel@tonic-gate #include <rpc/types.h> /* For all ntoh* and hton*() kind of macros */ 48b819cea2SGordon Ross #if !defined(_KERNEL) && !defined(_FAKE_KERNEL) 497c478bd9Sstevel@tonic-gate #include <stdio.h> /* defines FILE *, used in ANSI C function prototypes */ 50b819cea2SGordon Ross #else /* _KERNEL */ 517c478bd9Sstevel@tonic-gate #include <sys/stream.h> 52b819cea2SGordon Ross #endif /* _KERNEL */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #ifdef __cplusplus 557c478bd9Sstevel@tonic-gate extern "C" { 567c478bd9Sstevel@tonic-gate #endif 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * XDR provides a conventional way for converting between C data 607c478bd9Sstevel@tonic-gate * types and an external bit-string representation. Library supplied 617c478bd9Sstevel@tonic-gate * routines provide for the conversion on built-in C data types. These 627c478bd9Sstevel@tonic-gate * routines and utility routines defined here are used to help implement 637c478bd9Sstevel@tonic-gate * a type encode/decode routine for each user-defined type. 647c478bd9Sstevel@tonic-gate * 657c478bd9Sstevel@tonic-gate * Each data type provides a single procedure which takes two arguments: 667c478bd9Sstevel@tonic-gate * 677c478bd9Sstevel@tonic-gate * bool_t 687c478bd9Sstevel@tonic-gate * xdrproc(xdrs, argresp) 697c478bd9Sstevel@tonic-gate * XDR *xdrs; 707c478bd9Sstevel@tonic-gate * <type> *argresp; 717c478bd9Sstevel@tonic-gate * 727c478bd9Sstevel@tonic-gate * xdrs is an instance of a XDR handle, to which or from which the data 737c478bd9Sstevel@tonic-gate * type is to be converted. argresp is a pointer to the structure to be 747c478bd9Sstevel@tonic-gate * converted. The XDR handle contains an operation field which indicates 757c478bd9Sstevel@tonic-gate * which of the operations (ENCODE, DECODE * or FREE) is to be performed. 767c478bd9Sstevel@tonic-gate * 777c478bd9Sstevel@tonic-gate * XDR_DECODE may allocate space if the pointer argresp is null. This 787c478bd9Sstevel@tonic-gate * data can be freed with the XDR_FREE operation. 797c478bd9Sstevel@tonic-gate * 807c478bd9Sstevel@tonic-gate * We write only one procedure per data type to make it easy 817c478bd9Sstevel@tonic-gate * to keep the encode and decode procedures for a data type consistent. 827c478bd9Sstevel@tonic-gate * In many cases the same code performs all operations on a user defined type, 837c478bd9Sstevel@tonic-gate * because all the hard work is done in the component type routines. 847c478bd9Sstevel@tonic-gate * decode as a series of calls on the nested data types. 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* 887c478bd9Sstevel@tonic-gate * Xdr operations. XDR_ENCODE causes the type to be encoded into the 897c478bd9Sstevel@tonic-gate * stream. XDR_DECODE causes the type to be extracted from the stream. 907c478bd9Sstevel@tonic-gate * XDR_FREE can be used to release the space allocated by an XDR_DECODE 917c478bd9Sstevel@tonic-gate * request. 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate enum xdr_op { 947c478bd9Sstevel@tonic-gate XDR_ENCODE = 0, 957c478bd9Sstevel@tonic-gate XDR_DECODE = 1, 967c478bd9Sstevel@tonic-gate XDR_FREE = 2 977c478bd9Sstevel@tonic-gate }; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * This is the number of bytes per unit of external data. 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate #define BYTES_PER_XDR_UNIT (4) 1037c478bd9Sstevel@tonic-gate #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ 1047c478bd9Sstevel@tonic-gate * BYTES_PER_XDR_UNIT) 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate /* 1077c478bd9Sstevel@tonic-gate * The XDR handle. 1087c478bd9Sstevel@tonic-gate * Contains operation which is being applied to the stream, 1097c478bd9Sstevel@tonic-gate * an operations vector for the paticular implementation (e.g. see xdr_mem.c), 1107c478bd9Sstevel@tonic-gate * and two private fields for the use of the particular impelementation. 1117c478bd9Sstevel@tonic-gate * 1127c478bd9Sstevel@tonic-gate * PSARC 2003/523 Contract Private Interface 1137c478bd9Sstevel@tonic-gate * XDR 1147c478bd9Sstevel@tonic-gate * Changes must be reviewed by Solaris File Sharing 1157c478bd9Sstevel@tonic-gate * Changes must be communicated to contract-2003-523@sun.com 1167c478bd9Sstevel@tonic-gate */ 1177c478bd9Sstevel@tonic-gate typedef struct XDR { 1187c478bd9Sstevel@tonic-gate enum xdr_op x_op; /* operation; fast additional param */ 1197c478bd9Sstevel@tonic-gate struct xdr_ops *x_ops; 1207c478bd9Sstevel@tonic-gate caddr_t x_public; /* users' data */ 1217c478bd9Sstevel@tonic-gate caddr_t x_private; /* pointer to private data */ 1227c478bd9Sstevel@tonic-gate caddr_t x_base; /* private used for position info */ 1237c478bd9Sstevel@tonic-gate int x_handy; /* extra private word */ 1247c478bd9Sstevel@tonic-gate } XDR; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * PSARC 2003/523 Contract Private Interface 1287c478bd9Sstevel@tonic-gate * xdr_ops 1297c478bd9Sstevel@tonic-gate * Changes must be reviewed by Solaris File Sharing 1307c478bd9Sstevel@tonic-gate * Changes must be communicated to contract-2003-523@sun.com 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate struct xdr_ops { 1337c478bd9Sstevel@tonic-gate #ifdef __STDC__ 1347c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) 1357c478bd9Sstevel@tonic-gate bool_t (*x_getlong)(struct XDR *, long *); 1367c478bd9Sstevel@tonic-gate /* get a long from underlying stream */ 1377c478bd9Sstevel@tonic-gate bool_t (*x_putlong)(struct XDR *, long *); 1387c478bd9Sstevel@tonic-gate /* put a long to " */ 1397c478bd9Sstevel@tonic-gate #endif /* KERNEL */ 1407c478bd9Sstevel@tonic-gate bool_t (*x_getbytes)(struct XDR *, caddr_t, int); 1417c478bd9Sstevel@tonic-gate /* get some bytes from " */ 1427c478bd9Sstevel@tonic-gate bool_t (*x_putbytes)(struct XDR *, caddr_t, int); 1437c478bd9Sstevel@tonic-gate /* put some bytes to " */ 1447c478bd9Sstevel@tonic-gate uint_t (*x_getpostn)(struct XDR *); 1457c478bd9Sstevel@tonic-gate /* returns bytes off from beginning */ 1467c478bd9Sstevel@tonic-gate bool_t (*x_setpostn)(struct XDR *, uint_t); 1477c478bd9Sstevel@tonic-gate /* lets you reposition the stream */ 1487c478bd9Sstevel@tonic-gate rpc_inline_t *(*x_inline)(struct XDR *, int); 1497c478bd9Sstevel@tonic-gate /* buf quick ptr to buffered data */ 1507c478bd9Sstevel@tonic-gate void (*x_destroy)(struct XDR *); 1517c478bd9Sstevel@tonic-gate /* free privates of this xdr_stream */ 1527c478bd9Sstevel@tonic-gate bool_t (*x_control)(struct XDR *, int, void *); 1537c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_KERNEL) 1547c478bd9Sstevel@tonic-gate bool_t (*x_getint32)(struct XDR *, int32_t *); 1557c478bd9Sstevel@tonic-gate /* get a int from underlying stream */ 1567c478bd9Sstevel@tonic-gate bool_t (*x_putint32)(struct XDR *, int32_t *); 1577c478bd9Sstevel@tonic-gate /* put an int to " */ 1587c478bd9Sstevel@tonic-gate #endif /* _LP64 || _KERNEL */ 1597c478bd9Sstevel@tonic-gate #else 1607c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) 1617c478bd9Sstevel@tonic-gate bool_t (*x_getlong)(); /* get a long from underlying stream */ 1627c478bd9Sstevel@tonic-gate bool_t (*x_putlong)(); /* put a long to " */ 1637c478bd9Sstevel@tonic-gate #endif /* KERNEL */ 1647c478bd9Sstevel@tonic-gate bool_t (*x_getbytes)(); /* get some bytes from " */ 1657c478bd9Sstevel@tonic-gate bool_t (*x_putbytes)(); /* put some bytes to " */ 1667c478bd9Sstevel@tonic-gate uint_t (*x_getpostn)(); /* returns bytes off from beginning */ 1677c478bd9Sstevel@tonic-gate bool_t (*x_setpostn)(); /* lets you reposition the stream */ 1687c478bd9Sstevel@tonic-gate rpc_inline_t *(*x_inline)(); 1697c478bd9Sstevel@tonic-gate /* buf quick ptr to buffered data */ 1707c478bd9Sstevel@tonic-gate void (*x_destroy)(); /* free privates of this xdr_stream */ 1717c478bd9Sstevel@tonic-gate bool_t (*x_control)(); 1727c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_KERNEL) 1737c478bd9Sstevel@tonic-gate bool_t (*x_getint32)(); 1747c478bd9Sstevel@tonic-gate bool_t (*x_putint32)(); 1757c478bd9Sstevel@tonic-gate #endif /* _LP64 || defined(_KERNEL) */ 1767c478bd9Sstevel@tonic-gate #endif 1777c478bd9Sstevel@tonic-gate }; 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * Operations defined on a XDR handle 1817c478bd9Sstevel@tonic-gate * 1827c478bd9Sstevel@tonic-gate * XDR *xdrs; 1837c478bd9Sstevel@tonic-gate * long *longp; 1847c478bd9Sstevel@tonic-gate * caddr_t addr; 1857c478bd9Sstevel@tonic-gate * uint_t len; 1867c478bd9Sstevel@tonic-gate * uint_t pos; 1877c478bd9Sstevel@tonic-gate */ 1887c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) 1897c478bd9Sstevel@tonic-gate #define XDR_GETLONG(xdrs, longp) \ 1907c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getlong)(xdrs, longp) 1917c478bd9Sstevel@tonic-gate #define xdr_getlong(xdrs, longp) \ 1927c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getlong)(xdrs, longp) 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate #define XDR_PUTLONG(xdrs, longp) \ 1957c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putlong)(xdrs, longp) 1967c478bd9Sstevel@tonic-gate #define xdr_putlong(xdrs, longp) \ 1977c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putlong)(xdrs, longp) 1987c478bd9Sstevel@tonic-gate #endif /* KERNEL */ 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_KERNEL) 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate /* 2047c478bd9Sstevel@tonic-gate * For binary compatability on ILP32 we do not change the shape 2057c478bd9Sstevel@tonic-gate * of the XDR structure and the GET/PUTINT32 functions just use 2067c478bd9Sstevel@tonic-gate * the get/putlong vectors which operate on identically-sized 2077c478bd9Sstevel@tonic-gate * units of data. 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate #define XDR_GETINT32(xdrs, int32p) \ 2117c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p) 2127c478bd9Sstevel@tonic-gate #define xdr_getint32(xdrs, int32p) \ 2137c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p) 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate #define XDR_PUTINT32(xdrs, int32p) \ 2167c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p) 2177c478bd9Sstevel@tonic-gate #define xdr_putint32(xdrs, int32p) \ 2187c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p) 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate #else /* !_LP64 && !_KERNEL */ 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #define XDR_GETINT32(xdrs, int32p) \ 2237c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) 2247c478bd9Sstevel@tonic-gate #define xdr_getint32(xdrs, int32p) \ 2257c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #define XDR_PUTINT32(xdrs, int32p) \ 2287c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) 2297c478bd9Sstevel@tonic-gate #define xdr_putint32(xdrs, int32p) \ 2307c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate #endif /* !_LP64 && !_KERNEL */ 2337c478bd9Sstevel@tonic-gate 2347c478bd9Sstevel@tonic-gate #define XDR_GETBYTES(xdrs, addr, len) \ 2357c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) 2367c478bd9Sstevel@tonic-gate #define xdr_getbytes(xdrs, addr, len) \ 2377c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #define XDR_PUTBYTES(xdrs, addr, len) \ 2407c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) 2417c478bd9Sstevel@tonic-gate #define xdr_putbytes(xdrs, addr, len) \ 2427c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate #define XDR_GETPOS(xdrs) \ 2457c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getpostn)(xdrs) 2467c478bd9Sstevel@tonic-gate #define xdr_getpos(xdrs) \ 2477c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_getpostn)(xdrs) 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate #define XDR_SETPOS(xdrs, pos) \ 2507c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) 2517c478bd9Sstevel@tonic-gate #define xdr_setpos(xdrs, pos) \ 2527c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate #define XDR_INLINE(xdrs, len) \ 2557c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_inline)(xdrs, len) 2567c478bd9Sstevel@tonic-gate #define xdr_inline(xdrs, len) \ 2577c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_inline)(xdrs, len) 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate #define XDR_DESTROY(xdrs) \ 2607c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_destroy)(xdrs) 2617c478bd9Sstevel@tonic-gate #define xdr_destroy(xdrs) \ 2627c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_destroy)(xdrs) 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate #define XDR_CONTROL(xdrs, req, op) \ 2657c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_control)(xdrs, req, op) 2667c478bd9Sstevel@tonic-gate #define xdr_control(xdrs, req, op) \ 2677c478bd9Sstevel@tonic-gate (*(xdrs)->x_ops->x_control)(xdrs, req, op) 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate /* 2707c478bd9Sstevel@tonic-gate * Support struct for discriminated unions. 2717c478bd9Sstevel@tonic-gate * You create an array of xdrdiscrim structures, terminated with 2727c478bd9Sstevel@tonic-gate * a entry with a null procedure pointer. The xdr_union routine gets 2737c478bd9Sstevel@tonic-gate * the discriminant value and then searches the array of structures 2747c478bd9Sstevel@tonic-gate * for a matching value. If a match is found the associated xdr routine 2757c478bd9Sstevel@tonic-gate * is called to handle that part of the union. If there is 2767c478bd9Sstevel@tonic-gate * no match, then a default routine may be called. 2777c478bd9Sstevel@tonic-gate * If there is no match and no default routine it is an error. 2787c478bd9Sstevel@tonic-gate */ 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * A xdrproc_t exists for each data type which is to be encoded or decoded. 2837c478bd9Sstevel@tonic-gate * 2847c478bd9Sstevel@tonic-gate * The second argument to the xdrproc_t is a pointer to an opaque pointer. 2857c478bd9Sstevel@tonic-gate * The opaque pointer generally points to a structure of the data type 2867c478bd9Sstevel@tonic-gate * to be decoded. If this pointer is 0, then the type routines should 2877c478bd9Sstevel@tonic-gate * allocate dynamic storage of the appropriate size and return it. 2887c478bd9Sstevel@tonic-gate * bool_t (*xdrproc_t)(XDR *, void *); 2897c478bd9Sstevel@tonic-gate */ 2907c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2917c478bd9Sstevel@tonic-gate typedef bool_t (*xdrproc_t)(XDR *, void *); 2927c478bd9Sstevel@tonic-gate #else 2937c478bd9Sstevel@tonic-gate #ifdef __STDC__ 2947c478bd9Sstevel@tonic-gate typedef bool_t (*xdrproc_t)(); /* For Backward compatibility */ 2957c478bd9Sstevel@tonic-gate #else 2967c478bd9Sstevel@tonic-gate typedef bool_t (*xdrproc_t)(); 2977c478bd9Sstevel@tonic-gate #endif 2987c478bd9Sstevel@tonic-gate #endif 2997c478bd9Sstevel@tonic-gate 3007c478bd9Sstevel@tonic-gate #define NULL_xdrproc_t ((xdrproc_t)0) 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 3037c478bd9Sstevel@tonic-gate #define xdr_rpcvers(xdrs, versp) xdr_u_int(xdrs, versp) 3047c478bd9Sstevel@tonic-gate #define xdr_rpcprog(xdrs, progp) xdr_u_int(xdrs, progp) 3057c478bd9Sstevel@tonic-gate #define xdr_rpcproc(xdrs, procp) xdr_u_int(xdrs, procp) 3067c478bd9Sstevel@tonic-gate #define xdr_rpcprot(xdrs, protp) xdr_u_int(xdrs, protp) 3077c478bd9Sstevel@tonic-gate #define xdr_rpcport(xdrs, portp) xdr_u_int(xdrs, portp) 3087c478bd9Sstevel@tonic-gate #else 3097c478bd9Sstevel@tonic-gate #define xdr_rpcvers(xdrs, versp) xdr_u_long(xdrs, versp) 3107c478bd9Sstevel@tonic-gate #define xdr_rpcprog(xdrs, progp) xdr_u_long(xdrs, progp) 3117c478bd9Sstevel@tonic-gate #define xdr_rpcproc(xdrs, procp) xdr_u_long(xdrs, procp) 3127c478bd9Sstevel@tonic-gate #define xdr_rpcprot(xdrs, protp) xdr_u_long(xdrs, protp) 3137c478bd9Sstevel@tonic-gate #define xdr_rpcport(xdrs, portp) xdr_u_long(xdrs, portp) 3147c478bd9Sstevel@tonic-gate #endif 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate struct xdr_discrim { 3177c478bd9Sstevel@tonic-gate int value; 3187c478bd9Sstevel@tonic-gate xdrproc_t proc; 3197c478bd9Sstevel@tonic-gate }; 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate /* 3227c478bd9Sstevel@tonic-gate * In-line routines for fast encode/decode of primitve data types. 3237c478bd9Sstevel@tonic-gate * Caveat emptor: these use single memory cycles to get the 3247c478bd9Sstevel@tonic-gate * data from the underlying buffer, and will fail to operate 3257c478bd9Sstevel@tonic-gate * properly if the data is not aligned. The standard way to use these 3267c478bd9Sstevel@tonic-gate * is to say: 3277c478bd9Sstevel@tonic-gate * if ((buf = XDR_INLINE(xdrs, count)) == NULL) 3287c478bd9Sstevel@tonic-gate * return (FALSE); 3297c478bd9Sstevel@tonic-gate * <<< macro calls >>> 3307c478bd9Sstevel@tonic-gate * where ``count'' is the number of bytes of data occupied 3317c478bd9Sstevel@tonic-gate * by the primitive data types. 3327c478bd9Sstevel@tonic-gate * 3337c478bd9Sstevel@tonic-gate * N.B. and frozen for all time: each data type here uses 4 bytes 3347c478bd9Sstevel@tonic-gate * of external representation. 3357c478bd9Sstevel@tonic-gate */ 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate #define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) 3387c478bd9Sstevel@tonic-gate #define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)v)) 3397c478bd9Sstevel@tonic-gate #define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) 3407c478bd9Sstevel@tonic-gate #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v))) 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) && !defined(_LP64) 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate #define IXDR_GET_LONG(buf) ((long)ntohl((ulong_t)*(buf)++)) 3457c478bd9Sstevel@tonic-gate #define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((ulong_t)v)) 3467c478bd9Sstevel@tonic-gate #define IXDR_GET_U_LONG(buf) ((ulong_t)IXDR_GET_LONG(buf)) 3477c478bd9Sstevel@tonic-gate #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) 3507c478bd9Sstevel@tonic-gate #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) 3517c478bd9Sstevel@tonic-gate #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) 3527c478bd9Sstevel@tonic-gate #define IXDR_GET_U_SHORT(buf) ((ushort_t)IXDR_GET_LONG(buf)) 3537c478bd9Sstevel@tonic-gate 3547c478bd9Sstevel@tonic-gate #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) 3557c478bd9Sstevel@tonic-gate #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) 3567c478bd9Sstevel@tonic-gate #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) 3577c478bd9Sstevel@tonic-gate #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate #else 3607c478bd9Sstevel@tonic-gate 3617c478bd9Sstevel@tonic-gate #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_INT32(buf)) 3627c478bd9Sstevel@tonic-gate #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf)) 3637c478bd9Sstevel@tonic-gate #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf)) 3647c478bd9Sstevel@tonic-gate #define IXDR_GET_U_SHORT(buf) ((ushort_t)IXDR_GET_INT32(buf)) 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf), ((int)(v))) 3677c478bd9Sstevel@tonic-gate #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf), ((int)(v))) 3687c478bd9Sstevel@tonic-gate #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v))) 3697c478bd9Sstevel@tonic-gate #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_INT32((buf), ((int)(v))) 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate #endif 3727c478bd9Sstevel@tonic-gate 3737c478bd9Sstevel@tonic-gate #ifndef _LITTLE_ENDIAN 3747c478bd9Sstevel@tonic-gate #define IXDR_GET_HYPER(buf, v) { \ 3757c478bd9Sstevel@tonic-gate *((int32_t *)(&v)) = ntohl(*(uint32_t *)buf++); \ 3767c478bd9Sstevel@tonic-gate *((int32_t *)(((char *)&v) + BYTES_PER_XDR_UNIT)) \ 3777c478bd9Sstevel@tonic-gate = ntohl(*(uint32_t *)buf++); \ 3787c478bd9Sstevel@tonic-gate } 3797c478bd9Sstevel@tonic-gate #define IXDR_PUT_HYPER(buf, v) { \ 3807c478bd9Sstevel@tonic-gate *(buf)++ = (int32_t)htonl(*(uint32_t *) \ 3817c478bd9Sstevel@tonic-gate ((char *)&v)); \ 3827c478bd9Sstevel@tonic-gate *(buf)++ = \ 3837c478bd9Sstevel@tonic-gate (int32_t)htonl(*(uint32_t *)(((char *)&v) \ 3847c478bd9Sstevel@tonic-gate + BYTES_PER_XDR_UNIT)); \ 3857c478bd9Sstevel@tonic-gate } 3867c478bd9Sstevel@tonic-gate #else 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate #define IXDR_GET_HYPER(buf, v) { \ 3897c478bd9Sstevel@tonic-gate *((int32_t *)(((char *)&v) + \ 3907c478bd9Sstevel@tonic-gate BYTES_PER_XDR_UNIT)) \ 3917c478bd9Sstevel@tonic-gate = ntohl(*(uint32_t *)buf++); \ 3927c478bd9Sstevel@tonic-gate *((int32_t *)(&v)) = \ 3937c478bd9Sstevel@tonic-gate ntohl(*(uint32_t *)buf++); \ 3947c478bd9Sstevel@tonic-gate } 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate #define IXDR_PUT_HYPER(buf, v) { \ 3977c478bd9Sstevel@tonic-gate *(buf)++ = \ 3987c478bd9Sstevel@tonic-gate (int32_t)htonl(*(uint32_t *)(((char *)&v) + \ 3997c478bd9Sstevel@tonic-gate BYTES_PER_XDR_UNIT)); \ 4007c478bd9Sstevel@tonic-gate *(buf)++ = \ 4017c478bd9Sstevel@tonic-gate (int32_t)htonl(*(uint32_t *)((char *)&v)); \ 4027c478bd9Sstevel@tonic-gate } 4037c478bd9Sstevel@tonic-gate #endif 4047c478bd9Sstevel@tonic-gate #define IXDR_GET_U_HYPER(buf, v) IXDR_GET_HYPER(buf, v) 4057c478bd9Sstevel@tonic-gate #define IXDR_PUT_U_HYPER(buf, v) IXDR_PUT_HYPER(buf, v) 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate /* 4097c478bd9Sstevel@tonic-gate * These are the "generic" xdr routines. 4107c478bd9Sstevel@tonic-gate */ 4117c478bd9Sstevel@tonic-gate #ifdef __STDC__ 4127c478bd9Sstevel@tonic-gate extern bool_t xdr_void(void); 4137c478bd9Sstevel@tonic-gate extern bool_t xdr_int(XDR *, int *); 4147c478bd9Sstevel@tonic-gate extern bool_t xdr_u_int(XDR *, uint_t *); 4157c478bd9Sstevel@tonic-gate extern bool_t xdr_long(XDR *, long *); 4167c478bd9Sstevel@tonic-gate extern bool_t xdr_u_long(XDR *, ulong_t *); 4177c478bd9Sstevel@tonic-gate extern bool_t xdr_short(XDR *, short *); 4187c478bd9Sstevel@tonic-gate extern bool_t xdr_u_short(XDR *, ushort_t *); 4197c478bd9Sstevel@tonic-gate extern bool_t xdr_bool(XDR *, bool_t *); 4207c478bd9Sstevel@tonic-gate extern bool_t xdr_enum(XDR *, enum_t *); 4217c478bd9Sstevel@tonic-gate extern bool_t xdr_array(XDR *, caddr_t *, uint_t *, const uint_t, 4227c478bd9Sstevel@tonic-gate const uint_t, const xdrproc_t); 4237c478bd9Sstevel@tonic-gate extern bool_t xdr_bytes(XDR *, char **, uint_t *, const uint_t); 4247c478bd9Sstevel@tonic-gate extern bool_t xdr_opaque(XDR *, caddr_t, const uint_t); 4257c478bd9Sstevel@tonic-gate extern bool_t xdr_string(XDR *, char **, const uint_t); 4267c478bd9Sstevel@tonic-gate extern bool_t xdr_union(XDR *, enum_t *, char *, 4277c478bd9Sstevel@tonic-gate const struct xdr_discrim *, const xdrproc_t); 4281fcced4cSJordan Brown extern bool_t xdr_vector(XDR *, char *, const uint_t, const uint_t, 4291fcced4cSJordan Brown const xdrproc_t); 4307c478bd9Sstevel@tonic-gate extern unsigned int xdr_sizeof(xdrproc_t, void *); 4317c478bd9Sstevel@tonic-gate 4327c478bd9Sstevel@tonic-gate extern bool_t xdr_hyper(XDR *, longlong_t *); 4337c478bd9Sstevel@tonic-gate extern bool_t xdr_longlong_t(XDR *, longlong_t *); 4347c478bd9Sstevel@tonic-gate extern bool_t xdr_u_hyper(XDR *, u_longlong_t *); 4357c478bd9Sstevel@tonic-gate extern bool_t xdr_u_longlong_t(XDR *, u_longlong_t *); 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate extern bool_t xdr_char(XDR *, char *); 4381fcced4cSJordan Brown extern bool_t xdr_u_char(XDR *, uchar_t *); 4397c478bd9Sstevel@tonic-gate extern bool_t xdr_wrapstring(XDR *, char **); 4407c478bd9Sstevel@tonic-gate extern bool_t xdr_reference(XDR *, caddr_t *, uint_t, const xdrproc_t); 4417c478bd9Sstevel@tonic-gate extern bool_t xdr_pointer(XDR *, char **, uint_t, const xdrproc_t); 4427c478bd9Sstevel@tonic-gate extern void xdr_free(xdrproc_t, char *); 4437c478bd9Sstevel@tonic-gate extern bool_t xdr_time_t(XDR *, time_t *); 4447c478bd9Sstevel@tonic-gate 4457c478bd9Sstevel@tonic-gate extern bool_t xdr_int8_t(XDR *, int8_t *); 4467c478bd9Sstevel@tonic-gate extern bool_t xdr_uint8_t(XDR *, uint8_t *); 4477c478bd9Sstevel@tonic-gate extern bool_t xdr_int16_t(XDR *, int16_t *); 4487c478bd9Sstevel@tonic-gate extern bool_t xdr_uint16_t(XDR *, uint16_t *); 4497c478bd9Sstevel@tonic-gate extern bool_t xdr_int32_t(XDR *, int32_t *); 4507c478bd9Sstevel@tonic-gate extern bool_t xdr_uint32_t(XDR *, uint32_t *); 4517c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE) 4527c478bd9Sstevel@tonic-gate extern bool_t xdr_int64_t(XDR *, int64_t *); 4537c478bd9Sstevel@tonic-gate extern bool_t xdr_uint64_t(XDR *, uint64_t *); 4547c478bd9Sstevel@tonic-gate #endif 4557c478bd9Sstevel@tonic-gate 4567c478bd9Sstevel@tonic-gate #ifndef _KERNEL 4577c478bd9Sstevel@tonic-gate extern bool_t xdr_float(XDR *, float *); 4587c478bd9Sstevel@tonic-gate extern bool_t xdr_double(XDR *, double *); 4597c478bd9Sstevel@tonic-gate extern bool_t xdr_quadruple(XDR *, long double *); 4607c478bd9Sstevel@tonic-gate #endif /* !_KERNEL */ 4617c478bd9Sstevel@tonic-gate #else 4627c478bd9Sstevel@tonic-gate extern bool_t xdr_void(); 4637c478bd9Sstevel@tonic-gate extern bool_t xdr_int(); 4647c478bd9Sstevel@tonic-gate extern bool_t xdr_u_int(); 4657c478bd9Sstevel@tonic-gate extern bool_t xdr_long(); 4667c478bd9Sstevel@tonic-gate extern bool_t xdr_u_long(); 4677c478bd9Sstevel@tonic-gate extern bool_t xdr_short(); 4687c478bd9Sstevel@tonic-gate extern bool_t xdr_u_short(); 4697c478bd9Sstevel@tonic-gate extern bool_t xdr_bool(); 4707c478bd9Sstevel@tonic-gate extern bool_t xdr_enum(); 4717c478bd9Sstevel@tonic-gate extern bool_t xdr_array(); 4727c478bd9Sstevel@tonic-gate extern bool_t xdr_bytes(); 4737c478bd9Sstevel@tonic-gate extern bool_t xdr_opaque(); 4747c478bd9Sstevel@tonic-gate extern bool_t xdr_string(); 4757c478bd9Sstevel@tonic-gate extern bool_t xdr_union(); 4761fcced4cSJordan Brown extern bool_t xdr_vector(); 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate extern bool_t xdr_hyper(); 4797c478bd9Sstevel@tonic-gate extern bool_t xdr_longlong_t(); 4807c478bd9Sstevel@tonic-gate extern bool_t xdr_u_hyper(); 4817c478bd9Sstevel@tonic-gate extern bool_t xdr_u_longlong_t(); 4827c478bd9Sstevel@tonic-gate extern bool_t xdr_char(); 4831fcced4cSJordan Brown extern bool_t xdr_u_char(); 4847c478bd9Sstevel@tonic-gate extern bool_t xdr_reference(); 4857c478bd9Sstevel@tonic-gate extern bool_t xdr_pointer(); 4867c478bd9Sstevel@tonic-gate extern void xdr_free(); 4877c478bd9Sstevel@tonic-gate extern bool_t xdr_wrapstring(); 4887c478bd9Sstevel@tonic-gate extern bool_t xdr_time_t(); 4897c478bd9Sstevel@tonic-gate 4907c478bd9Sstevel@tonic-gate extern bool_t xdr_int8_t(); 4917c478bd9Sstevel@tonic-gate extern bool_t xdr_uint8_t(); 4927c478bd9Sstevel@tonic-gate extern bool_t xdr_int16_t(); 4937c478bd9Sstevel@tonic-gate extern bool_t xdr_uint16_t(); 4947c478bd9Sstevel@tonic-gate extern bool_t xdr_int32_t(); 4957c478bd9Sstevel@tonic-gate extern bool_t xdr_uint32_t(); 4967c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE) 4977c478bd9Sstevel@tonic-gate extern bool_t xdr_int64_t(); 4987c478bd9Sstevel@tonic-gate extern bool_t xdr_uint64_t(); 4997c478bd9Sstevel@tonic-gate #endif 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate #ifndef _KERNEL 5027c478bd9Sstevel@tonic-gate extern bool_t xdr_float(); 5037c478bd9Sstevel@tonic-gate extern bool_t xdr_double(); 5047c478bd9Sstevel@tonic-gate extern bool_t xdr_quadruple(); 5057c478bd9Sstevel@tonic-gate #endif /* !_KERNEL */ 5067c478bd9Sstevel@tonic-gate #endif 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gate /* 5097c478bd9Sstevel@tonic-gate * Common opaque bytes objects used by many rpc protocols; 5107c478bd9Sstevel@tonic-gate * declared here due to commonality. 5117c478bd9Sstevel@tonic-gate */ 5127c478bd9Sstevel@tonic-gate #define MAX_NETOBJ_SZ 1024 5137c478bd9Sstevel@tonic-gate struct netobj { 5147c478bd9Sstevel@tonic-gate uint_t n_len; 5157c478bd9Sstevel@tonic-gate char *n_bytes; 5167c478bd9Sstevel@tonic-gate }; 5177c478bd9Sstevel@tonic-gate typedef struct netobj netobj; 5187c478bd9Sstevel@tonic-gate 5197c478bd9Sstevel@tonic-gate #ifdef __STDC__ 5207c478bd9Sstevel@tonic-gate extern bool_t xdr_netobj(XDR *, netobj *); 5217c478bd9Sstevel@tonic-gate #else 5227c478bd9Sstevel@tonic-gate extern bool_t xdr_netobj(); 5237c478bd9Sstevel@tonic-gate #endif 5247c478bd9Sstevel@tonic-gate 5257c478bd9Sstevel@tonic-gate /* 5267c478bd9Sstevel@tonic-gate * These are XDR control operators 5277c478bd9Sstevel@tonic-gate */ 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate #define XDR_GET_BYTES_AVAIL 1 5307c478bd9Sstevel@tonic-gate 5317c478bd9Sstevel@tonic-gate struct xdr_bytesrec { 5327c478bd9Sstevel@tonic-gate bool_t xc_is_last_record; 5337c478bd9Sstevel@tonic-gate size_t xc_num_avail; 5347c478bd9Sstevel@tonic-gate }; 5357c478bd9Sstevel@tonic-gate 5367c478bd9Sstevel@tonic-gate typedef struct xdr_bytesrec xdr_bytesrec; 5377c478bd9Sstevel@tonic-gate 5387c478bd9Sstevel@tonic-gate /* 5397c478bd9Sstevel@tonic-gate * These are the request arguments to XDR_CONTROL. 5407c478bd9Sstevel@tonic-gate * 5417c478bd9Sstevel@tonic-gate * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream. 5427c478bd9Sstevel@tonic-gate * XDR_SKIPBYTES - skips the next N bytes in the XDR stream. 5437c478bd9Sstevel@tonic-gate * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from 5447c478bd9Sstevel@tonic-gate * the XDR stream being moved over RDMA 5457c478bd9Sstevel@tonic-gate * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in 5467c478bd9Sstevel@tonic-gate * the XDR stream moving over RDMA. 5477c478bd9Sstevel@tonic-gate */ 5487c478bd9Sstevel@tonic-gate #ifdef _KERNEL 5497c478bd9Sstevel@tonic-gate #define XDR_PEEK 2 5507c478bd9Sstevel@tonic-gate #define XDR_SKIPBYTES 3 5510a701b1eSRobert Gordon #define XDR_RDMA_GET_FLAGS 4 5520a701b1eSRobert Gordon #define XDR_RDMA_SET_FLAGS 5 5530a701b1eSRobert Gordon #define XDR_RDMA_ADD_CHUNK 6 5540a701b1eSRobert Gordon #define XDR_RDMA_GET_CHUNK_LEN 7 5550a701b1eSRobert Gordon #define XDR_RDMA_SET_WLIST 8 5560a701b1eSRobert Gordon #define XDR_RDMA_GET_WLIST 9 5570a701b1eSRobert Gordon #define XDR_RDMA_GET_WCINFO 10 5580a701b1eSRobert Gordon #define XDR_RDMA_GET_RLIST 11 5597c478bd9Sstevel@tonic-gate #endif 5607c478bd9Sstevel@tonic-gate 5617c478bd9Sstevel@tonic-gate /* 5627c478bd9Sstevel@tonic-gate * These are the public routines for the various implementations of 5637c478bd9Sstevel@tonic-gate * xdr streams. 5647c478bd9Sstevel@tonic-gate */ 565b819cea2SGordon Ross #if !defined(_KERNEL) && !defined(_FAKE_KERNEL) 5667c478bd9Sstevel@tonic-gate #ifdef __STDC__ 5677c478bd9Sstevel@tonic-gate extern void xdrmem_create(XDR *, const caddr_t, const uint_t, const enum 5687c478bd9Sstevel@tonic-gate xdr_op); 5697c478bd9Sstevel@tonic-gate /* XDR using memory buffers */ 5707c478bd9Sstevel@tonic-gate extern void xdrstdio_create(XDR *, FILE *, const enum xdr_op); 5717c478bd9Sstevel@tonic-gate /* XDR using stdio library */ 5727c478bd9Sstevel@tonic-gate extern void xdrrec_create(XDR *, const uint_t, const uint_t, const caddr_t, 5737c478bd9Sstevel@tonic-gate int (*) (void *, caddr_t, int), int (*) (void *, caddr_t, int)); 5747c478bd9Sstevel@tonic-gate /* XDR pseudo records for tcp */ 5757c478bd9Sstevel@tonic-gate extern bool_t xdrrec_endofrecord(XDR *, bool_t); 5767c478bd9Sstevel@tonic-gate /* make end of xdr record */ 5777c478bd9Sstevel@tonic-gate extern bool_t xdrrec_skiprecord(XDR *); 5787c478bd9Sstevel@tonic-gate /* move to beginning of next record */ 5797c478bd9Sstevel@tonic-gate extern bool_t xdrrec_eof(XDR *); 5807c478bd9Sstevel@tonic-gate extern uint_t xdrrec_readbytes(XDR *, caddr_t, uint_t); 5817c478bd9Sstevel@tonic-gate /* true if no more input */ 5827c478bd9Sstevel@tonic-gate #else 5837c478bd9Sstevel@tonic-gate extern void xdrmem_create(); 5847c478bd9Sstevel@tonic-gate extern void xdrstdio_create(); 5857c478bd9Sstevel@tonic-gate extern void xdrrec_create(); 5867c478bd9Sstevel@tonic-gate extern bool_t xdrrec_endofrecord(); 5877c478bd9Sstevel@tonic-gate extern bool_t xdrrec_skiprecord(); 5887c478bd9Sstevel@tonic-gate extern bool_t xdrrec_eof(); 5897c478bd9Sstevel@tonic-gate extern uint_t xdrrec_readbytes(); 5907c478bd9Sstevel@tonic-gate #endif 5917c478bd9Sstevel@tonic-gate #else 5927c478bd9Sstevel@tonic-gate 593c242f9a0Schunli zhang - Sun Microsystems - Irvine United States #define DLEN(mp) (mp->b_cont ? msgdsize(mp) : (mp->b_wptr - mp->b_rptr)) 594c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 5957c478bd9Sstevel@tonic-gate extern void xdrmem_create(XDR *, caddr_t, uint_t, enum xdr_op); 5967c478bd9Sstevel@tonic-gate extern void xdrmblk_init(XDR *, mblk_t *, enum xdr_op, int); 5977c478bd9Sstevel@tonic-gate extern bool_t xdrmblk_getmblk(XDR *, mblk_t **, uint_t *); 5987c478bd9Sstevel@tonic-gate extern bool_t xdrmblk_putmblk(XDR *, mblk_t *, uint_t); 599*5dde82e7SMarcel Telka extern bool_t xdrmblk_putmblk_raw(XDR *, mblk_t *); 6007c478bd9Sstevel@tonic-gate extern struct xdr_ops xdrmblk_ops; 6010a701b1eSRobert Gordon extern struct xdr_ops xdrrdmablk_ops; 6020a701b1eSRobert Gordon extern struct xdr_ops xdrrdma_ops; 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate struct rpc_msg; 6057c478bd9Sstevel@tonic-gate extern bool_t xdr_callmsg(XDR *, struct rpc_msg *); 6067c478bd9Sstevel@tonic-gate extern bool_t xdr_replymsg_body(XDR *, struct rpc_msg *); 6077c478bd9Sstevel@tonic-gate extern bool_t xdr_replymsg_hdr(XDR *, struct rpc_msg *); 6087c478bd9Sstevel@tonic-gate 6097c478bd9Sstevel@tonic-gate #endif /* !_KERNEL */ 6107c478bd9Sstevel@tonic-gate 6117c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6127c478bd9Sstevel@tonic-gate } 6137c478bd9Sstevel@tonic-gate #endif 6147c478bd9Sstevel@tonic-gate 6157c478bd9Sstevel@tonic-gate #endif /* !_RPC_XDR_H */ 616