2 static char sfs_rpc_callmsg_c_id[] = "@(#)rpc_callmsg.c 2.1 97/10/23";
4 /* @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC */
6 * Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
8 * Standard Performance Evaluation Corporation (SPEC)
9 * 6585 Merchant Place, Suite 100
12 * This product contains benchmarks acquired from several sources who
13 * understand and agree with SPEC's goal of creating fair and objective
14 * benchmarks to measure computer performance.
16 * This copyright notice is placed here only to protect SPEC in the
17 * event the source is misused in any manner that is contrary to the
18 * spirit, the goals and the intent of SPEC.
20 * The source code is provided to the user or company under the license
21 * agreement for the SPEC Benchmark Suite for this product.
24 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
25 * unrestricted use provided that this legend is included on all tape
26 * media and as a part of the software program in whole or part. Users
27 * may copy or modify Sun RPC without charge, but are not authorized
28 * to license or distribute it to anyone else except as part of a product or
29 * program developed by the user.
31 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
32 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
35 * Sun RPC is provided with no support and without any obligation on the
36 * part of Sun Microsystems, Inc. to assist in its use, correction,
37 * modification or enhancement.
39 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
40 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
41 * OR ANY PART THEREOF.
43 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
44 * or profits or other special, indirect and consequential damages, even if
45 * Sun has been advised of the possibility of such damages.
47 * Sun Microsystems, Inc.
49 * Mountain View, California 94043
51 #if !defined(lint) && defined(SCCSIDS)
52 static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
58 * Copyright (C) 1984, Sun Microsystems, Inc.
78 struct opaque_auth *oa;
80 if (xdrs->x_op == XDR_ENCODE) {
81 if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES) {
84 if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) {
87 buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
88 + RNDUP(cmsg->rm_call.cb_cred.oa_length)
89 + 2 * BYTES_PER_XDR_UNIT
90 + RNDUP(cmsg->rm_call.cb_verf.oa_length));
92 IXDR_PUT_LONG(buf, cmsg->rm_xid);
93 IXDR_PUT_ENUM(buf, cmsg->rm_direction);
94 if (cmsg->rm_direction != CALL) {
97 IXDR_PUT_LONG(buf, cmsg->rm_call.cb_rpcvers);
98 if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
101 IXDR_PUT_LONG(buf, cmsg->rm_call.cb_prog);
102 IXDR_PUT_LONG(buf, cmsg->rm_call.cb_vers);
103 IXDR_PUT_LONG(buf, cmsg->rm_call.cb_proc);
104 oa = &cmsg->rm_call.cb_cred;
105 IXDR_PUT_ENUM(buf, oa->oa_flavor);
106 IXDR_PUT_LONG(buf, oa->oa_length);
108 memmove((caddr_t)buf, oa->oa_base, oa->oa_length);
109 buf += RNDUP(oa->oa_length) / sizeof (int32_t);
111 oa = &cmsg->rm_call.cb_verf;
112 IXDR_PUT_ENUM(buf, oa->oa_flavor);
113 IXDR_PUT_LONG(buf, oa->oa_length);
115 memmove((caddr_t)buf, oa->oa_base, oa->oa_length);
117 buf += RNDUP(oa->oa_length) / sizeof (int32_t);
123 if (xdrs->x_op == XDR_DECODE) {
124 buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
126 cmsg->rm_xid = IXDR_GET_LONG(buf);
127 cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type);
128 if (cmsg->rm_direction != CALL) {
131 cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG(buf);
132 if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
135 cmsg->rm_call.cb_prog = IXDR_GET_LONG(buf);
136 cmsg->rm_call.cb_vers = IXDR_GET_LONG(buf);
137 cmsg->rm_call.cb_proc = IXDR_GET_LONG(buf);
138 oa = &cmsg->rm_call.cb_cred;
139 oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
140 oa->oa_length = IXDR_GET_LONG(buf);
142 if (oa->oa_length > MAX_AUTH_BYTES) {
145 if (oa->oa_base == NULL) {
146 oa->oa_base = (caddr_t)
147 mem_alloc(oa->oa_length);
149 buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
151 if (xdr_opaque(xdrs, oa->oa_base,
152 oa->oa_length) == FALSE) {
156 memmove(oa->oa_base, (caddr_t)buf,
159 buf += RNDUP(oa->oa_length) /
164 oa = &cmsg->rm_call.cb_verf;
165 buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
167 if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE ||
168 xdr_u_int(xdrs, &oa->oa_length) == FALSE) {
172 oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
173 oa->oa_length = IXDR_GET_LONG(buf);
176 if (oa->oa_length > MAX_AUTH_BYTES) {
179 if (oa->oa_base == NULL) {
180 oa->oa_base = (caddr_t)
181 mem_alloc(oa->oa_length);
183 buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
185 if (xdr_opaque(xdrs, oa->oa_base,
186 oa->oa_length) == FALSE) {
190 memmove(oa->oa_base, (caddr_t)buf,
193 buf += RNDUP(oa->oa_length) /
202 xdr_uint32_t(xdrs, &(cmsg->rm_xid)) &&
203 xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
204 (cmsg->rm_direction == CALL) &&
205 xdr_uint32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
206 (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
207 xdr_uint32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
208 xdr_uint32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
209 xdr_uint32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
210 xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
211 return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));