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