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