8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libbc / inc / include / rpc / rpc_msg.h
blob650df388939867cbed015a8c1925469026eab47d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * rpc message definition
27 * Copyright (C) 1984, Sun Microsystems, Inc.
30 #ifndef _rpc_rpc_msg_h
31 #define _rpc_rpc_msg_h
33 #define RPC_MSG_VERSION ((u_long) 2)
34 #define RPC_SERVICE_PORT ((u_short) 2048)
37 * Bottom up definition of an rpc message.
38 * NOTE: call and reply use the same overall stuct but
39 * different parts of unions within it.
42 enum msg_type {
43 CALL=0,
44 REPLY=1
47 enum reply_stat {
48 MSG_ACCEPTED=0,
49 MSG_DENIED=1
52 enum accept_stat {
53 SUCCESS=0,
54 PROG_UNAVAIL=1,
55 PROG_MISMATCH=2,
56 PROC_UNAVAIL=3,
57 GARBAGE_ARGS=4,
58 SYSTEM_ERR=5
61 enum reject_stat {
62 RPC_MISMATCH=0,
63 AUTH_ERROR=1
67 * Reply part of an rpc exchange
71 * Reply to an rpc request that was accepted by the server.
72 * Note: there could be an error even though the request was
73 * accepted.
75 struct accepted_reply {
76 struct opaque_auth ar_verf;
77 enum accept_stat ar_stat;
78 union {
79 struct {
80 u_long low;
81 u_long high;
82 } AR_versions;
83 struct {
84 caddr_t where;
85 xdrproc_t proc;
86 } AR_results;
87 /* and many other null cases */
88 } ru;
89 #define ar_results ru.AR_results
90 #define ar_vers ru.AR_versions
94 * Reply to an rpc request that was rejected by the server.
96 struct rejected_reply {
97 enum reject_stat rj_stat;
98 union {
99 struct {
100 u_long low;
101 u_long high;
102 } RJ_versions;
103 enum auth_stat RJ_why; /* why authentication did not work */
104 } ru;
105 #define rj_vers ru.RJ_versions
106 #define rj_why ru.RJ_why
110 * Body of a reply to an rpc request.
112 struct reply_body {
113 enum reply_stat rp_stat;
114 union {
115 struct accepted_reply RP_ar;
116 struct rejected_reply RP_dr;
117 } ru;
118 #define rp_acpt ru.RP_ar
119 #define rp_rjct ru.RP_dr
123 * Body of an rpc request call.
125 struct call_body {
126 u_long cb_rpcvers; /* must be equal to two */
127 u_long cb_prog;
128 u_long cb_vers;
129 u_long cb_proc;
130 struct opaque_auth cb_cred;
131 struct opaque_auth cb_verf; /* protocol specific - provided by client */
135 * The rpc message
137 struct rpc_msg {
138 u_long rm_xid;
139 enum msg_type rm_direction;
140 union {
141 struct call_body RM_cmb;
142 struct reply_body RM_rmb;
143 } ru;
144 #define rm_call ru.RM_cmb
145 #define rm_reply ru.RM_rmb
147 #define acpted_rply ru.RM_rmb.ru.RP_ar
148 #define rjcted_rply ru.RM_rmb.ru.RP_dr
152 * XDR routine to handle a rpc message.
153 * xdr_callmsg(xdrs, cmsg)
154 * XDR *xdrs;
155 * struct rpc_msg *cmsg;
157 extern bool_t xdr_callmsg();
160 * XDR routine to pre-serialize the static part of a rpc message.
161 * xdr_callhdr(xdrs, cmsg)
162 * XDR *xdrs;
163 * struct rpc_msg *cmsg;
165 extern bool_t xdr_callhdr();
168 * XDR routine to handle a rpc reply.
169 * xdr_replymsg(xdrs, rmsg)
170 * XDR *xdrs;
171 * struct rpc_msg *rmsg;
173 extern bool_t xdr_replymsg();
176 * Fills in the error part of a reply message.
177 * _seterr_reply(msg, error)
178 * struct rpc_msg *msg;
179 * struct rpc_err *error;
181 extern void _seterr_reply();
183 #endif /*!_rpc_rpc_msg_h*/