source: rtems/cpukit/librpc/include/rpc/rpc_msg.h @ f48dc9ac

4.104.114.84.95
Last change on this file since f48dc9ac was 12db3bda, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/25/05 at 15:07:19

Misc. fixes.

  • Property mode set to 100644
File size: 4.4 KB
Line 
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.
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 *
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.
16 *
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.
20 *
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.
24 *
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California  94043
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
31 * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.15 2003/01/01 18:48:42 schweikh Exp $
32 */
33
34/*
35 * rpc_msg.h
36 * rpc message definition
37 *
38 * Copyright (C) 1984, Sun Microsystems, Inc.
39 */
40
41/*
42 * $Id$
43 */
44
45#ifndef _RPC_RPC_MSG_H
46#define _RPC_RPC_MSG_H
47
48#define RPC_MSG_VERSION         ((u_int32_t) 2)
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
57enum msg_type {
58        CALL=0,
59        REPLY=1
60};
61
62enum reply_stat {
63        MSG_ACCEPTED=0,
64        MSG_DENIED=1
65};
66
67enum 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
76enum 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 */
90struct accepted_reply {
91        struct opaque_auth      ar_verf;
92        enum accept_stat        ar_stat;
93        union {
94                struct {
95                        u_int32_t       low;
96                        u_int32_t       high;
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 */
111struct rejected_reply {
112        enum reject_stat rj_stat;
113        union {
114                struct {
115                        u_int32_t low;
116                        u_int32_t high;
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 */
127struct 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 */
140struct call_body {
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;
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 */
152struct rpc_msg {
153        u_int32_t               rm_xid;
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
165__BEGIN_DECLS
166/*
167 * XDR routine to handle a rpc message.
168 * xdr_callmsg(xdrs, cmsg)
169 *      XDR *xdrs;
170 *      struct rpc_msg *cmsg;
171 */
172extern bool_t   xdr_callmsg(XDR *, struct rpc_msg *);
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 */
180extern bool_t   xdr_callhdr(XDR *, struct rpc_msg *);
181
182/*
183 * XDR routine to handle a rpc reply.
184 * xdr_replymsg(xdrs, rmsg)
185 *      XDR *xdrs;
186 *      struct rpc_msg *rmsg;
187 */
188extern bool_t   xdr_replymsg    __P((XDR *, struct rpc_msg *));
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 */
196extern void     _seterr_reply(struct rpc_msg *, struct rpc_err *);
197__END_DECLS
198
199#endif /* !_RPC_RPC_MSG_H */
Note: See TracBrowser for help on using the repository browser.