source: rtems/cpukit/libnetworking/rpc/rpc_msg.h @ 1e039fb3

5
Last change on this file since 1e039fb3 was 16f4661f, checked in by Sebastian Huber <sebastian.huber@…>, on 03/09/18 at 07:38:18

network: Optionally install network headers

Install the network headers only if --enable-networking is specified.

Update #3254.

  • Property mode set to 100644
File size: 4.6 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#ifndef _RPC_RPC_MSG_H
42#define _RPC_RPC_MSG_H
43
44#include <rpc/types.h>
45#include <rpc/xdr.h> /* xdrproc_t */
46#include <rpc/auth.h> /* opaque_auth */
47
48struct rpc_err; /* forward */
49
50#define RPC_MSG_VERSION         ((u_int32_t) 2)
51#define RPC_SERVICE_PORT        ((u_short) 2048)
52
53/*
54 * Bottom up definition of an rpc message.
55 * NOTE: call and reply use the same overall stuct but
56 * different parts of unions within it.
57 */
58
59enum msg_type {
60        CALL=0,
61        REPLY=1,
62        _MSG_TYPE = 0xffffffff
63};
64
65enum reply_stat {
66        MSG_ACCEPTED=0,
67        MSG_DENIED=1,
68        _REPLY_STAT = 0xffffffff
69};
70
71enum accept_stat {
72        SUCCESS=0,
73        PROG_UNAVAIL=1,
74        PROG_MISMATCH=2,
75        PROC_UNAVAIL=3,
76        GARBAGE_ARGS=4,
77        SYSTEM_ERR=5,
78        _ACCEPT_STAT = 0xffffffff
79};
80
81enum reject_stat {
82        RPC_MISMATCH=0,
83        AUTH_ERROR=1,
84        _REJECT_STAT = 0xffffffff
85};
86
87/*
88 * Reply part of an rpc exchange
89 */
90
91/*
92 * Reply to an rpc request that was accepted by the server.
93 * Note: there could be an error even though the request was
94 * accepted.
95 */
96struct accepted_reply {
97        struct opaque_auth      ar_verf;
98        enum accept_stat        ar_stat;
99        union {
100                struct {
101                        rpcvers_t low;
102                        rpcvers_t high;
103                } AR_versions;
104                struct {
105                        caddr_t where;
106                        xdrproc_t proc;
107                } AR_results;
108                /* and many other null cases */
109        } ru;
110#define ar_results      ru.AR_results
111#define ar_vers         ru.AR_versions
112};
113
114/*
115 * Reply to an rpc request that was rejected by the server.
116 */
117struct rejected_reply {
118        enum reject_stat rj_stat;
119        union {
120                struct {
121                        rpcvers_t low;
122                        rpcvers_t high;
123                } RJ_versions;
124                enum auth_stat RJ_why;  /* why authentication did not work */
125        } ru;
126#define rj_vers ru.RJ_versions
127#define rj_why  ru.RJ_why
128};
129
130/*
131 * Body of a reply to an rpc request.
132 */
133struct reply_body {
134        enum reply_stat rp_stat;
135        union {
136                struct accepted_reply RP_ar;
137                struct rejected_reply RP_dr;
138        } ru;
139#define rp_acpt ru.RP_ar
140#define rp_rjct ru.RP_dr
141};
142
143/*
144 * Body of an rpc request call.
145 */
146struct call_body {
147        rpcvers_t cb_rpcvers;   /* must be equal to two */
148        rpcprog_t cb_prog;
149        rpcvers_t cb_vers;
150        rpcproc_t cb_proc;
151        struct opaque_auth cb_cred;
152        struct opaque_auth cb_verf; /* protocol specific - provided by client */
153};
154
155/*
156 * The rpc message
157 */
158struct rpc_msg {
159        u_int32_t               rm_xid;
160        enum msg_type           rm_direction;
161        union {
162                struct call_body RM_cmb;
163                struct reply_body RM_rmb;
164        } ru;
165#define rm_call         ru.RM_cmb
166#define rm_reply        ru.RM_rmb
167};
168#define acpted_rply     ru.RM_rmb.ru.RP_ar
169#define rjcted_rply     ru.RM_rmb.ru.RP_dr
170
171__BEGIN_DECLS
172/*
173 * XDR routine to handle a rpc message.
174 * xdr_callmsg(xdrs, cmsg)
175 *      XDR *xdrs;
176 *      struct rpc_msg *cmsg;
177 */
178extern bool_t   xdr_callmsg(XDR *, struct rpc_msg *);
179
180/*
181 * XDR routine to pre-serialize the static part of a rpc message.
182 * xdr_callhdr(xdrs, cmsg)
183 *      XDR *xdrs;
184 *      struct rpc_msg *cmsg;
185 */
186extern bool_t   xdr_callhdr(XDR *, struct rpc_msg *);
187
188/*
189 * XDR routine to handle a rpc reply.
190 * xdr_replymsg(xdrs, rmsg)
191 *      XDR *xdrs;
192 *      struct rpc_msg *rmsg;
193 */
194extern bool_t   xdr_replymsg(XDR *, struct rpc_msg *);
195
196/*
197 * Fills in the error part of a reply message.
198 * _seterr_reply(msg, error)
199 *      struct rpc_msg *msg;
200 *      struct rpc_err *error;
201 */
202extern void     _seterr_reply(struct rpc_msg *, struct rpc_err *);
203__END_DECLS
204
205#endif /* !_RPC_RPC_MSG_H */
Note: See TracBrowser for help on using the repository browser.