source: rtems-libbsd/freebsd/include/rpc/rpc_msg.h @ 9880635

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 9880635 was 9880635, checked in by Sebastian Huber <sebastian.huber@…>, on 06/09/16 at 08:48:05

RPC(3): Port to RTEMS

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[028aaaf]1/*      $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $        */
2
[7eeb079]3/*-
4 * Copyright (c) 2009, Sun Microsystems, Inc.
5 * All rights reserved.
[028aaaf]6 *
[7eeb079]7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * - Redistributions of source code must retain the above copyright notice,
10 *   this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 *   this list of conditions and the following disclaimer in the documentation
13 *   and/or other materials provided with the distribution.
14 * - Neither the name of Sun Microsystems, Inc. nor the names of its
15 *   contributors may be used to endorse or promote products derived
16 *   from this software without specific prior written permission.
[028aaaf]17 *
[7eeb079]18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
[028aaaf]29 *
30 *      from: @(#)rpc_msg.h 1.7 86/07/16 SMI
31 *      from: @(#)rpc_msg.h     2.1 88/07/29 4.0 RPCSRC
32 * $FreeBSD$
33 */
34
35/*
36 * rpc_msg.h
37 * rpc message definition
38 *
39 * Copyright (C) 1984, Sun Microsystems, Inc.
40 */
41
42#ifndef _RPC_RPC_MSG_H
43#define _RPC_RPC_MSG_H
44
45#define RPC_MSG_VERSION         ((u_int32_t) 2)
46#define RPC_SERVICE_PORT        ((u_short) 2048)
47
48/*
49 * Bottom up definition of an rpc message.
50 * NOTE: call and reply use the same overall stuct but
51 * different parts of unions within it.
52 */
53
54enum msg_type {
55        CALL=0,
[9880635]56        REPLY=1,
57        _MSG_TYPE = 0xffffffff
[028aaaf]58};
59
60enum reply_stat {
61        MSG_ACCEPTED=0,
[9880635]62        MSG_DENIED=1,
63        _REPLY_STAT = 0xffffffff
[028aaaf]64};
65
66enum accept_stat {
67        SUCCESS=0,
68        PROG_UNAVAIL=1,
69        PROG_MISMATCH=2,
70        PROC_UNAVAIL=3,
71        GARBAGE_ARGS=4,
[9880635]72        SYSTEM_ERR=5,
73        _ACCEPT_STAT = 0xffffffff
[028aaaf]74};
75
76enum reject_stat {
77        RPC_MISMATCH=0,
[9880635]78        AUTH_ERROR=1,
79        _REJECT_STAT = 0xffffffff
[028aaaf]80};
81
82/*
83 * Reply part of an rpc exchange
84 */
85
86/*
87 * Reply to an rpc request that was accepted by the server.
88 * Note: there could be an error even though the request was
89 * accepted.
90 */
91struct accepted_reply {
92        struct opaque_auth      ar_verf;
93        enum accept_stat        ar_stat;
94        union {
95                struct {
96                        rpcvers_t low;
97                        rpcvers_t high;
98                } AR_versions;
99                struct {
100                        caddr_t where;
101                        xdrproc_t proc;
102                } AR_results;
103                /* and many other null cases */
104        } ru;
105#define ar_results      ru.AR_results
106#define ar_vers         ru.AR_versions
107};
108
109/*
110 * Reply to an rpc request that was rejected by the server.
111 */
112struct rejected_reply {
113        enum reject_stat rj_stat;
114        union {
115                struct {
116                        rpcvers_t low;
117                        rpcvers_t high;
118                } RJ_versions;
119                enum auth_stat RJ_why;  /* why authentication did not work */
120        } ru;
121#define rj_vers ru.RJ_versions
122#define rj_why  ru.RJ_why
123};
124
125/*
126 * Body of a reply to an rpc request.
127 */
128struct reply_body {
129        enum reply_stat rp_stat;
130        union {
131                struct accepted_reply RP_ar;
132                struct rejected_reply RP_dr;
133        } ru;
134#define rp_acpt ru.RP_ar
135#define rp_rjct ru.RP_dr
136};
137
138/*
139 * Body of an rpc request call.
140 */
141struct call_body {
142        rpcvers_t cb_rpcvers;   /* must be equal to two */
143        rpcprog_t cb_prog;
144        rpcvers_t cb_vers;
145        rpcproc_t cb_proc;
146        struct opaque_auth cb_cred;
147        struct opaque_auth cb_verf; /* protocol specific - provided by client */
148};
149
150/*
151 * The rpc message
152 */
153struct rpc_msg {
154        u_int32_t               rm_xid;
155        enum msg_type           rm_direction;
156        union {
157                struct call_body RM_cmb;
158                struct reply_body RM_rmb;
159        } ru;
160#define rm_call         ru.RM_cmb
161#define rm_reply        ru.RM_rmb
162};
163#define acpted_rply     ru.RM_rmb.ru.RP_ar
164#define rjcted_rply     ru.RM_rmb.ru.RP_dr
165
166__BEGIN_DECLS
167/*
168 * XDR routine to handle a rpc message.
169 * xdr_callmsg(xdrs, cmsg)
170 *      XDR *xdrs;
171 *      struct rpc_msg *cmsg;
172 */
173extern bool_t   xdr_callmsg(XDR *, struct rpc_msg *);
174
175/*
176 * XDR routine to pre-serialize the static part of a rpc message.
177 * xdr_callhdr(xdrs, cmsg)
178 *      XDR *xdrs;
179 *      struct rpc_msg *cmsg;
180 */
181extern bool_t   xdr_callhdr(XDR *, struct rpc_msg *);
182
183/*
184 * XDR routine to handle a rpc reply.
185 * xdr_replymsg(xdrs, rmsg)
186 *      XDR *xdrs;
187 *      struct rpc_msg *rmsg;
188 */
189extern bool_t   xdr_replymsg(XDR *, struct rpc_msg *);
190
191
192/*
193 * XDR routine to handle an accepted rpc reply.
194 * xdr_accepted_reply(xdrs, rej)
195 *      XDR *xdrs;
196 *      struct accepted_reply *rej;
197 */
198extern bool_t   xdr_accepted_reply(XDR *, struct accepted_reply *);
199
200/*
201 * XDR routine to handle a rejected rpc reply.
202 * xdr_rejected_reply(xdrs, rej)
203 *      XDR *xdrs;
204 *      struct rejected_reply *rej;
205 */
206extern bool_t   xdr_rejected_reply(XDR *, struct rejected_reply *);
207
208/*
209 * Fills in the error part of a reply message.
210 * _seterr_reply(msg, error)
211 *      struct rpc_msg *msg;
212 *      struct rpc_err *error;
213 */
214extern void     _seterr_reply(struct rpc_msg *, struct rpc_err *);
215__END_DECLS
216
217#endif /* !_RPC_RPC_MSG_H */
Note: See TracBrowser for help on using the repository browser.