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.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
29 * Portions of this source code were derived from Berkeley
30 * 4.3 BSD under license from the Regents of the University of
34 #ifndef _RPC_RPC_MSG_H
35 #define _RPC_RPC_MSG_H
37 #pragma ident "%Z%%M% %I% %E% SMI"
42 * rpc message definition
49 #define RPC_MSG_VERSION ((uint32_t)2)
50 #define RPC_SERVICE_PORT ((ushort_t)2048)
53 * Bottom up definition of an rpc message.
54 * NOTE: call and reply use the same overall stuct but
55 * different parts of unions within it.
83 * Reply part of an rpc exchange
87 * Reply to an rpc request that was accepted by the server.
88 * Note: there could be an error even though the request was
91 struct accepted_reply
{
92 struct opaque_auth ar_verf
;
93 enum accept_stat ar_stat
;
103 /* and many other null cases */
105 #define ar_results ru.AR_results
106 #define ar_vers ru.AR_versions
110 * Reply to an rpc request that was rejected by the server.
112 struct rejected_reply
{
113 enum reject_stat rj_stat
;
119 enum auth_stat RJ_why
; /* why authentication did not work */
121 #define rj_vers ru.RJ_versions
122 #define rj_why ru.RJ_why
126 * Body of a reply to an rpc request.
129 enum reply_stat rp_stat
;
131 struct accepted_reply RP_ar
;
132 struct rejected_reply RP_dr
;
134 #define rp_acpt ru.RP_ar
135 #define rp_rjct ru.RP_dr
139 * Body of an rpc request call.
142 rpcvers_t cb_rpcvers
; /* must be equal to two */
146 struct opaque_auth cb_cred
;
147 struct opaque_auth cb_verf
; /* protocol specific - provided by client */
155 enum msg_type rm_direction
;
157 struct call_body RM_cmb
;
158 struct reply_body RM_rmb
;
160 #define rm_call ru.RM_cmb
161 #define rm_reply ru.RM_rmb
163 #define acpted_rply ru.RM_rmb.ru.RP_ar
164 #define rjcted_rply ru.RM_rmb.ru.RP_dr
168 * XDR routine to handle a rpc message.
169 * xdr_callmsg(xdrs, cmsg)
171 * struct rpc_msg *cmsg;
174 extern bool_t
xdr_callmsg(XDR
*, struct rpc_msg
*);
176 extern bool_t
xdr_callmsg();
181 * XDR routine to pre-serialize the static part of a rpc message.
182 * xdr_callhdr(xdrs, cmsg)
184 * struct rpc_msg *cmsg;
187 extern bool_t
xdr_callhdr(XDR
*, struct rpc_msg
*);
189 extern bool_t
xdr_callhdr();
194 * XDR routine to handle a rpc reply.
195 * xdr_replymsg(xdrs, rmsg)
197 * struct rpc_msg *rmsg;
199 * xdr_accepted_reply(xdrs, ar)
201 * const struct accepted_reply *ar;
203 * xdr_rejected_reply(xdrs, rr)
205 * const struct rejected_reply *rr;
208 extern bool_t
xdr_replymsg(XDR
*, struct rpc_msg
*);
209 extern bool_t
xdr_accepted_reply(XDR
*, struct accepted_reply
*);
210 extern bool_t
xdr_rejected_reply(XDR
*, struct rejected_reply
*);
212 extern bool_t
xdr_replymsg();
213 extern bool_t
xdr_accepted_reply();
214 extern bool_t
xdr_rejected_reply();
220 * Fills in the error part of a reply message.
221 * _seterr_reply(msg, error)
222 * struct rpc_msg *msg;
223 * struct rpc_err *error;
226 extern void _seterr_reply(struct rpc_msg
*, struct rpc_err
*);
228 extern void _seterr_reply();
232 * Fills in the error part of a reply message.
233 * __seterr_reply(msg, error)
234 * struct rpc_msg *msg;
235 * struct rpc_err *error;
238 extern void __seterr_reply(struct rpc_msg
*, struct rpc_err
*);
240 extern void __seterr_reply();
246 * Frees any verifier that xdr_replymsg() (DECODE) allocated.
248 bool_t
xdr_rpc_free_verifier(register XDR
*xdrs
, register struct rpc_msg
*msg
);
256 #endif /* _RPC_RPC_MSG_H */