1 /* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */
4 * Copyright (c) 2009, 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 met:
9 * - Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * - Neither the name of Sun Microsystems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
30 * from: @(#)rpc_msg.h 1.7 86/07/16 SMI
31 * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
32 * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.15 2003/01/01 18:48:42 schweikh Exp $
37 * rpc message definition
39 * Copyright (C) 1984, Sun Microsystems, Inc.
42 /* NFSv4.1 client for Windows
43 * Copyright © 2012 The Regents of the University of Michigan
45 * Olga Kornievskaia <aglo@umich.edu>
46 * Casey Bodley <cbodley@umich.edu>
48 * This library is free software; you can redistribute it and/or modify it
49 * under the terms of the GNU Lesser General Public License as published by
50 * the Free Software Foundation; either version 2.1 of the License, or (at
51 * your option) any later version.
53 * This library is distributed in the hope that it will be useful, but
54 * without any warranty; without even the implied warranty of merchantability
55 * or fitness for a particular purpose. See the GNU Lesser General Public
56 * License for more details.
58 * You should have received a copy of the GNU Lesser General Public License
59 * along with this library; if not, write to the Free Software Foundation,
60 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
63 #ifndef _TIRPC_RPC_MSG_H
64 #define _TIRPC_RPC_MSG_H
66 #define RPC_MSG_VERSION ((u_int32_t) 2)
67 #define RPC_SERVICE_PORT ((u_short) 2048)
72 * Bottom up definition of an rpc message.
73 * NOTE: call and reply use the same overall stuct but
74 * different parts of unions within it.
102 * Reply part of an rpc exchange
106 * Reply to an rpc request that was accepted by the server.
107 * Note: there could be an error even though the request was
110 struct accepted_reply
{
111 struct opaque_auth ar_verf
;
112 enum accept_stat ar_stat
;
122 /* and many other null cases */
124 #define ar_results ru.AR_results
125 #define ar_vers ru.AR_versions
129 * Reply to an rpc request that was rejected by the server.
131 struct rejected_reply
{
132 enum reject_stat rj_stat
;
138 enum auth_stat RJ_why
; /* why authentication did not work */
140 #define rj_vers ru.RJ_versions
141 #define rj_why ru.RJ_why
145 * Body of a reply to an rpc request.
148 enum reply_stat rp_stat
;
150 struct accepted_reply RP_ar
;
151 struct rejected_reply RP_dr
;
153 #define rp_acpt ru.RP_ar
154 #define rp_rjct ru.RP_dr
158 * Body of an rpc request call.
161 rpcvers_t cb_rpcvers
; /* must be equal to two */
165 struct opaque_auth cb_cred
;
166 struct opaque_auth cb_verf
; /* protocol specific - provided by client */
174 enum msg_type rm_direction
;
176 struct call_body RM_cmb
;
177 struct reply_body RM_rmb
;
179 #define rm_call ru.RM_cmb
180 #define rm_reply ru.RM_rmb
182 #define acpted_rply ru.RM_rmb.ru.RP_ar
183 #define rjcted_rply ru.RM_rmb.ru.RP_dr
187 * XDR routine to handle a rpc message.
188 * xdr_callmsg(xdrs, cmsg)
190 * struct rpc_msg *cmsg;
192 extern bool_t
xdr_callmsg(XDR
*, struct rpc_msg
*);
195 * XDR routine to pre-serialize the static part of a rpc message.
196 * xdr_callhdr(xdrs, cmsg)
198 * struct rpc_msg *cmsg;
200 extern bool_t
xdr_callhdr(XDR
*, struct rpc_msg
*);
203 * XDR routine to handle a rpc reply.
204 * xdr_replymsg(xdrs, rmsg)
206 * struct rpc_msg *rmsg;
208 extern bool_t
xdr_replymsg(XDR
*, struct rpc_msg
*);
211 * XDR routine to read just xid and direction, then union
212 * xdr_getxiddir(xdrs, rmsg)
214 * struct rpc_msg *rmsg;
216 extern bool_t
xdr_getxiddir(XDR
*, struct rpc_msg
*);
217 extern bool_t
xdr_getreplyunion(XDR
*, struct rpc_msg
*);
218 extern bool_t
xdr_getcallbody(XDR
*, struct rpc_msg
*);
221 * XDR routine to handle an accepted rpc reply.
222 * xdr_accepted_reply(xdrs, rej)
224 * struct accepted_reply *rej;
226 extern bool_t
xdr_accepted_reply(XDR
*, struct accepted_reply
*);
229 * XDR routine to handle a rejected rpc reply.
230 * xdr_rejected_reply(xdrs, rej)
232 * struct rejected_reply *rej;
234 extern bool_t
xdr_rejected_reply(XDR
*, struct rejected_reply
*);
237 * Fills in the error part of a reply message.
238 * _seterr_reply(msg, error)
239 * struct rpc_msg *msg;
240 * struct rpc_err *error;
242 extern void _seterr_reply(struct rpc_msg
*, struct rpc_err
*);
245 #endif /* !_TIRPC_RPC_MSG_H */