Commit | Line | Data |
---|---|---|
15637ed4 RG |
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. | |
9 | * | |
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. | |
13 | * | |
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. | |
17 | * | |
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. | |
21 | * | |
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. | |
25 | * | |
26 | * Sun Microsystems, Inc. | |
27 | * 2550 Garcia Avenue | |
28 | * Mountain View, California 94043 | |
29 | */ | |
30 | /* @(#)rpc_msg.h 1.7 86/07/16 SMI */ | |
31 | ||
32 | /* | |
33 | * rpc_msg.h | |
34 | * rpc message definition | |
35 | * | |
36 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
37 | */ | |
38 | ||
39 | #define RPC_MSG_VERSION ((u_long) 2) | |
40 | #define RPC_SERVICE_PORT ((u_short) 2048) | |
41 | ||
42 | /* | |
43 | * Bottom up definition of an rpc message. | |
44 | * NOTE: call and reply use the same overall stuct but | |
45 | * different parts of unions within it. | |
46 | */ | |
47 | ||
48 | enum msg_type { | |
49 | CALL=0, | |
50 | REPLY=1 | |
51 | }; | |
52 | ||
53 | enum reply_stat { | |
54 | MSG_ACCEPTED=0, | |
55 | MSG_DENIED=1 | |
56 | }; | |
57 | ||
58 | enum accept_stat { | |
59 | SUCCESS=0, | |
60 | PROG_UNAVAIL=1, | |
61 | PROG_MISMATCH=2, | |
62 | PROC_UNAVAIL=3, | |
63 | GARBAGE_ARGS=4, | |
64 | SYSTEM_ERR=5 | |
65 | }; | |
66 | ||
67 | enum reject_stat { | |
68 | RPC_MISMATCH=0, | |
69 | AUTH_ERROR=1 | |
70 | }; | |
71 | ||
72 | /* | |
73 | * Reply part of an rpc exchange | |
74 | */ | |
75 | ||
76 | /* | |
77 | * Reply to an rpc request that was accepted by the server. | |
78 | * Note: there could be an error even though the request was | |
79 | * accepted. | |
80 | */ | |
81 | struct accepted_reply { | |
82 | struct opaque_auth ar_verf; | |
83 | enum accept_stat ar_stat; | |
84 | union { | |
85 | struct { | |
86 | u_long low; | |
87 | u_long high; | |
88 | } AR_versions; | |
89 | struct { | |
90 | caddr_t where; | |
91 | xdrproc_t proc; | |
92 | } AR_results; | |
93 | /* and many other null cases */ | |
94 | } ru; | |
95 | #define ar_results ru.AR_results | |
96 | #define ar_vers ru.AR_versions | |
97 | }; | |
98 | ||
99 | /* | |
100 | * Reply to an rpc request that was rejected by the server. | |
101 | */ | |
102 | struct rejected_reply { | |
103 | enum reject_stat rj_stat; | |
104 | union { | |
105 | struct { | |
106 | u_long low; | |
107 | u_long high; | |
108 | } RJ_versions; | |
109 | enum auth_stat RJ_why; /* why authentication did not work */ | |
110 | } ru; | |
111 | #define rj_vers ru.RJ_versions | |
112 | #define rj_why ru.RJ_why | |
113 | }; | |
114 | ||
115 | /* | |
116 | * Body of a reply to an rpc request. | |
117 | */ | |
118 | struct reply_body { | |
119 | enum reply_stat rp_stat; | |
120 | union { | |
121 | struct accepted_reply RP_ar; | |
122 | struct rejected_reply RP_dr; | |
123 | } ru; | |
124 | #define rp_acpt ru.RP_ar | |
125 | #define rp_rjct ru.RP_dr | |
126 | }; | |
127 | ||
128 | /* | |
129 | * Body of an rpc request call. | |
130 | */ | |
131 | struct call_body { | |
132 | u_long cb_rpcvers; /* must be equal to two */ | |
133 | u_long cb_prog; | |
134 | u_long cb_vers; | |
135 | u_long cb_proc; | |
136 | struct opaque_auth cb_cred; | |
137 | struct opaque_auth cb_verf; /* protocol specific - provided by client */ | |
138 | }; | |
139 | ||
140 | /* | |
141 | * The rpc message | |
142 | */ | |
143 | struct rpc_msg { | |
144 | u_long rm_xid; | |
145 | enum msg_type rm_direction; | |
146 | union { | |
147 | struct call_body RM_cmb; | |
148 | struct reply_body RM_rmb; | |
149 | } ru; | |
150 | #define rm_call ru.RM_cmb | |
151 | #define rm_reply ru.RM_rmb | |
152 | }; | |
153 | #define acpted_rply ru.RM_rmb.ru.RP_ar | |
154 | #define rjcted_rply ru.RM_rmb.ru.RP_dr | |
155 | ||
156 | ||
157 | /* | |
158 | * XDR routine to handle a rpc message. | |
159 | * xdr_callmsg(xdrs, cmsg) | |
160 | * XDR *xdrs; | |
161 | * struct rpc_msg *cmsg; | |
162 | */ | |
163 | extern bool_t xdr_callmsg(); | |
164 | ||
165 | /* | |
166 | * XDR routine to pre-serialize the static part of a rpc message. | |
167 | * xdr_callhdr(xdrs, cmsg) | |
168 | * XDR *xdrs; | |
169 | * struct rpc_msg *cmsg; | |
170 | */ | |
171 | extern bool_t xdr_callhdr(); | |
172 | ||
173 | /* | |
174 | * XDR routine to handle a rpc reply. | |
175 | * xdr_replymsg(xdrs, rmsg) | |
176 | * XDR *xdrs; | |
177 | * struct rpc_msg *rmsg; | |
178 | */ | |
179 | extern bool_t xdr_replymsg(); | |
180 | ||
181 | /* | |
182 | * Fills in the error part of a reply message. | |
183 | * _seterr_reply(msg, error) | |
184 | * struct rpc_msg *msg; | |
185 | * struct rpc_err *error; | |
186 | */ | |
187 | extern void _seterr_reply(); |