3 * rpc message definition
5 * Copyright (C) 1984, Sun Microsystems, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials
16 * provided with the distribution.
17 * * Neither the name of Sun Microsystems, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <sys/cdefs.h>
43 #define RPC_MSG_VERSION ((u_long) 2)
44 #define RPC_SERVICE_PORT ((u_short) 2048)
49 * Bottom up definition of an rpc message.
50 * NOTE: call and reply use the same overall struct but
51 * different parts of unions within it.
79 * Reply part of an rpc exchange
83 * Reply to an rpc request that was accepted by the server.
84 * Note: there could be an error even though the request was
87 struct accepted_reply {
88 struct opaque_auth ar_verf;
89 enum accept_stat ar_stat;
99 /* and many other null cases */
101 #define ar_results ru.AR_results
102 #define ar_vers ru.AR_versions
106 * Reply to an rpc request that was rejected by the server.
108 struct rejected_reply {
109 enum reject_stat rj_stat;
115 enum auth_stat RJ_why; /* why authentication did not work */
117 #define rj_vers ru.RJ_versions
118 #define rj_why ru.RJ_why
122 * Body of a reply to an rpc request.
125 enum reply_stat rp_stat;
127 struct accepted_reply RP_ar;
128 struct rejected_reply RP_dr;
130 #define rp_acpt ru.RP_ar
131 #define rp_rjct ru.RP_dr
135 * Body of an rpc request call.
138 u_long cb_rpcvers; /* must be equal to two */
142 struct opaque_auth cb_cred;
143 struct opaque_auth cb_verf; /* protocol specific - provided by client */
151 enum msg_type rm_direction;
153 struct call_body RM_cmb;
154 struct reply_body RM_rmb;
156 #define rm_call ru.RM_cmb
157 #define rm_reply ru.RM_rmb
159 #define acpted_rply ru.RM_rmb.ru.RP_ar
160 #define rjcted_rply ru.RM_rmb.ru.RP_dr
164 * XDR routine to handle a rpc message.
165 * xdr_callmsg(xdrs, cmsg)
167 * struct rpc_msg *cmsg;
169 extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
172 * XDR routine to pre-serialize the static part of a rpc message.
173 * xdr_callhdr(xdrs, cmsg)
175 * struct rpc_msg *cmsg;
177 extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
180 * XDR routine to handle a rpc reply.
181 * xdr_replymsg(xdrs, rmsg)
183 * struct rpc_msg *rmsg;
185 extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW;
188 * Fills in the error part of a reply message.
189 * _seterr_reply(msg, error)
190 * struct rpc_msg *msg;
191 * struct rpc_err *error;
193 extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error)
198 #endif /* rpc/rpc_msg.h */