Update.
[glibc.git] / sunrpc / rpc / rpc_msg.h
blob8f6b6a9da4bc354cf599825d817164e09bbd6055
1 /* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */
2 /*
3 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4 * unrestricted use provided that this legend is included on all tape
5 * media and as a part of the software program in whole or part. Users
6 * may copy or modify Sun RPC without charge, but are not authorized
7 * to license or distribute it to anyone else except as part of a product or
8 * program developed by the user.
10 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 * Sun RPC is provided with no support and without any obligation on the
15 * part of Sun Microsystems, Inc. to assist in its use, correction,
16 * modification or enhancement.
18 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 * OR ANY PART THEREOF.
22 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 * or profits or other special, indirect and consequential damages, even if
24 * Sun has been advised of the possibility of such damages.
26 * Sun Microsystems, Inc.
27 * 2550 Garcia Avenue
28 * Mountain View, California 94043
30 /* @(#)rpc_msg.h 1.7 86/07/16 SMI */
32 #ifndef _RPC_MSG_H
33 #define _RPC_MSG_H 1
34 #include <sys/cdefs.h>
36 #include <rpc/clnt.h>
39 * rpc_msg.h
40 * rpc message definition
42 * Copyright (C) 1984, Sun Microsystems, Inc.
45 #define RPC_MSG_VERSION ((u_long) 2)
46 #define RPC_SERVICE_PORT ((u_short) 2048)
48 __BEGIN_DECLS
51 * Bottom up definition of an rpc message.
52 * NOTE: call and reply use the same overall struct but
53 * different parts of unions within it.
56 enum msg_type {
57 CALL=0,
58 REPLY=1
61 enum reply_stat {
62 MSG_ACCEPTED=0,
63 MSG_DENIED=1
66 enum accept_stat {
67 SUCCESS=0,
68 PROG_UNAVAIL=1,
69 PROG_MISMATCH=2,
70 PROC_UNAVAIL=3,
71 GARBAGE_ARGS=4,
72 SYSTEM_ERR=5
75 enum reject_stat {
76 RPC_MISMATCH=0,
77 AUTH_ERROR=1
81 * Reply part of an rpc exchange
85 * Reply to an rpc request that was accepted by the server.
86 * Note: there could be an error even though the request was
87 * accepted.
89 struct accepted_reply {
90 struct opaque_auth ar_verf;
91 enum accept_stat ar_stat;
92 union {
93 struct {
94 u_long low;
95 u_long high;
96 } AR_versions;
97 struct {
98 caddr_t where;
99 xdrproc_t proc;
100 } AR_results;
101 /* and many other null cases */
102 } ru;
103 #define ar_results ru.AR_results
104 #define ar_vers ru.AR_versions
108 * Reply to an rpc request that was rejected by the server.
110 struct rejected_reply {
111 enum reject_stat rj_stat;
112 union {
113 struct {
114 u_long low;
115 u_long high;
116 } RJ_versions;
117 enum auth_stat RJ_why; /* why authentication did not work */
118 } ru;
119 #define rj_vers ru.RJ_versions
120 #define rj_why ru.RJ_why
124 * Body of a reply to an rpc request.
126 struct reply_body {
127 enum reply_stat rp_stat;
128 union {
129 struct accepted_reply RP_ar;
130 struct rejected_reply RP_dr;
131 } ru;
132 #define rp_acpt ru.RP_ar
133 #define rp_rjct ru.RP_dr
137 * Body of an rpc request call.
139 struct call_body {
140 u_long cb_rpcvers; /* must be equal to two */
141 u_long cb_prog;
142 u_long cb_vers;
143 u_long cb_proc;
144 struct opaque_auth cb_cred;
145 struct opaque_auth cb_verf; /* protocol specific - provided by client */
149 * The rpc message
151 struct rpc_msg {
152 u_long rm_xid;
153 enum msg_type rm_direction;
154 union {
155 struct call_body RM_cmb;
156 struct reply_body RM_rmb;
157 } ru;
158 #define rm_call ru.RM_cmb
159 #define rm_reply ru.RM_rmb
161 #define acpted_rply ru.RM_rmb.ru.RP_ar
162 #define rjcted_rply ru.RM_rmb.ru.RP_dr
166 * XDR routine to handle a rpc message.
167 * xdr_callmsg(xdrs, cmsg)
168 * XDR *xdrs;
169 * struct rpc_msg *cmsg;
171 extern bool_t xdr_callmsg __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
174 * XDR routine to pre-serialize the static part of a rpc message.
175 * xdr_callhdr(xdrs, cmsg)
176 * XDR *xdrs;
177 * struct rpc_msg *cmsg;
179 extern bool_t xdr_callhdr __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
182 * XDR routine to handle a rpc reply.
183 * xdr_replymsg(xdrs, rmsg)
184 * XDR *xdrs;
185 * struct rpc_msg *rmsg;
187 extern bool_t xdr_replymsg __P ((XDR *__xdrs, struct rpc_msg *__rmsg));
190 * Fills in the error part of a reply message.
191 * _seterr_reply(msg, error)
192 * struct rpc_msg *msg;
193 * struct rpc_err *error;
195 extern void _seterr_reply __P ((struct rpc_msg *__msg,
196 struct rpc_err *__error));
198 __END_DECLS
200 #endif /* rpc/rpc_msg.h */