2 * Copyright (c) 2009, Sun Microsystems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
28 * from: @(#)rpc_msg.h 1.7 86/07/16 SMI
29 * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
30 * $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $
31 * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.15 2003/01/01 18:48:42 schweikh Exp $
36 * rpc message definition
38 * Copyright (C) 1984, Sun Microsystems, Inc.
41 #ifndef _RPC_RPC_MSG_H_
42 #define _RPC_RPC_MSG_H_
44 #define RPC_MSG_VERSION ((u_int32_t) 2)
45 #define RPC_SERVICE_PORT ((u_short) 2048)
48 * Bottom up definition of an rpc message.
49 * NOTE: call and reply use the same overall stuct but
50 * different parts of unions within it.
78 * Reply part of an rpc exchange
82 * Reply to an rpc request that was accepted by the server.
83 * Note: there could be an error even though the request was
86 struct accepted_reply
{
87 struct opaque_auth ar_verf
;
88 enum accept_stat ar_stat
;
98 /* and many other null cases */
100 #define ar_results ru.AR_results
101 #define ar_vers ru.AR_versions
105 * Reply to an rpc request that was rejected by the server.
107 struct rejected_reply
{
108 enum reject_stat rj_stat
;
114 enum auth_stat RJ_why
; /* why authentication did not work */
116 #define rj_vers ru.RJ_versions
117 #define rj_why ru.RJ_why
121 * Body of a reply to an rpc request.
124 enum reply_stat rp_stat
;
126 struct accepted_reply RP_ar
;
127 struct rejected_reply RP_dr
;
129 #define rp_acpt ru.RP_ar
130 #define rp_rjct ru.RP_dr
134 * Body of an rpc request call.
137 rpcvers_t cb_rpcvers
; /* must be equal to two */
141 struct opaque_auth cb_cred
;
142 struct opaque_auth cb_verf
; /* protocol specific - provided by client */
150 enum msg_type rm_direction
;
152 struct call_body RM_cmb
;
153 struct reply_body RM_rmb
;
155 #define rm_call ru.RM_cmb
156 #define rm_reply ru.RM_rmb
158 #define acpted_rply ru.RM_rmb.ru.RP_ar
159 #define rjcted_rply ru.RM_rmb.ru.RP_dr
163 * XDR routine to handle a rpc message.
164 * xdr_callmsg(xdrs, cmsg)
166 * struct rpc_msg *cmsg;
168 extern bool_t
xdr_callmsg(XDR
*, struct rpc_msg
*);
171 * XDR routine to pre-serialize the static part of a rpc message.
172 * xdr_callhdr(xdrs, cmsg)
174 * struct rpc_msg *cmsg;
176 extern bool_t
xdr_callhdr(XDR
*, struct rpc_msg
*);
179 * XDR routine to handle a rpc reply.
180 * xdr_replymsg(xdrs, rmsg)
182 * struct rpc_msg *rmsg;
184 extern bool_t
xdr_replymsg(XDR
*, struct rpc_msg
*);
187 * XDR routine to handle an accepted rpc reply.
188 * xdr_accepted_reply(xdrs, rej)
190 * struct accepted_reply *rej;
192 extern bool_t
xdr_accepted_reply(XDR
*, struct accepted_reply
*);
195 * XDR routine to handle a rejected rpc reply.
196 * xdr_rejected_reply(xdrs, rej)
198 * struct rejected_reply *rej;
200 extern bool_t
xdr_rejected_reply(XDR
*, struct rejected_reply
*);
203 * Fills in the error part of a reply message.
204 * _seterr_reply(msg, error)
205 * struct rpc_msg *msg;
206 * struct rpc_err *error;
208 extern void _seterr_reply(struct rpc_msg
*, struct rpc_err
*);
211 #endif /* !_RPC_RPC_MSG_H_ */