RTEMS CPU Kit with SuperCore
4.11.3
Main Page
Related Pages
Modules
+
Data Structures
Data Structures
+
Data Fields
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
i
j
l
m
n
o
p
q
r
s
t
u
v
w
+
Variables
_
b
c
d
i
r
+
Typedefs
a
b
c
d
f
h
i
m
o
p
q
r
s
t
u
w
x
+
Enumerations
b
c
d
e
h
i
m
o
p
r
s
t
w
+
Enumerator
c
i
m
p
r
s
t
w
+
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
w
mnt
data0
chrisj
rtems
releases
rtems-release.git
4.11.3
ws-rtems
rtems-4.11.3
cpukit
librpc
include
rpc
svc.h
Go to the documentation of this file.
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: @(#)svc.h 1.35 88/12/17 SMI
30
* from: @(#)svc.h 1.27 94/04/25 SMI
31
* $FreeBSD: src/include/rpc/svc.h,v 1.24 2003/06/15 10:32:01 mbr Exp $
32
*/
33
34
/*
35
* svc.h, Server-side remote procedure call interface.
36
*
37
* Copyright (C) 1986-1993 by Sun Microsystems, Inc.
38
*/
39
40
#ifndef _RPC_SVC_H
41
#define _RPC_SVC_H
42
43
#include <sys/cdefs.h>
44
#include <
rpc/types.h
>
45
#include <
rpc/xdr.h
>
/* xdrproc_t */
46
#include <
sys/socket.h
>
/* socklen_t */
47
#include <
netinet/in.h
>
/* struct sockaddr_in */
48
#include <
rpc/auth.h
>
/* auth_stat */
49
50
/*
51
* This interface must manage two items concerning remote procedure calling:
52
*
53
* 1) An arbitrary number of transport connections upon which rpc requests
54
* are received. The two most notable transports are TCP and UDP; they are
55
* created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
56
* they in turn call xprt_register and xprt_unregister.
57
*
58
* 2) An arbitrary number of locally registered services. Services are
59
* described by the following four data: program number, version number,
60
* "service dispatch" function, a transport handle, and a boolean that
61
* indicates whether or not the exported program should be registered with a
62
* local binder service; if true the program's number and version and the
63
* port number from the transport handle are registered with the binder.
64
* These data are registered with the rpc svc system via svc_register.
65
*
66
* A service's dispatch function is called whenever an rpc request comes in
67
* on a transport. The request's program and version numbers must match
68
* those of the registered service. The dispatch function is passed two
69
* parameters, struct svc_req * and SVCXPRT *, defined below.
70
*/
71
72
enum
xprt_stat {
73
XPRT_DIED,
74
XPRT_MOREREQS,
75
XPRT_IDLE,
76
_XPRT_STAT = 0xffffffff
77
};
78
79
struct
rpc_msg
;
80
81
/*
82
* Server side transport handle
83
*/
84
typedef
struct
__rpc_svcxprt
{
85
int
xp_sock;
86
u_short xp_port;
/* associated port number */
87
struct
xp_ops
{
88
/* receive incoming requests */
89
bool_t (*xp_recv)(
struct
__rpc_svcxprt
*,
struct
rpc_msg
*);
90
/* get transport status */
91
enum
xprt_stat (*xp_stat)(
struct
__rpc_svcxprt
*);
92
/* get arguments */
93
bool_t (*xp_getargs)(
struct
__rpc_svcxprt
*, xdrproc_t,
94
caddr_t args_ptr);
95
/* send reply */
96
bool_t (*xp_reply)(
struct
__rpc_svcxprt
*,
struct
rpc_msg
*);
97
/* free mem allocated for args */
98
bool_t (*xp_freeargs)(
struct
__rpc_svcxprt
*, xdrproc_t,
99
caddr_t args_ptr);
100
/* destroy this struct */
101
void (*xp_destroy)(
struct
__rpc_svcxprt
*);
102
} *
xp_ops
;
103
socklen_t xp_addrlen;
/* length of remote address */
104
struct
sockaddr_in
xp_raddr;
/* remote addr. (backward ABI compat) */
105
struct
opaque_auth
xp_verf;
/* raw response verifier */
106
void
*xp_p1;
/* private: for use by svc ops */
107
void
*xp_p2;
/* private: for use by svc ops */
108
}
SVCXPRT
;
109
110
/*
111
* Service request
112
*/
113
struct
svc_req
{
114
u_int32_t rq_prog;
/* service program number */
115
u_int32_t rq_vers;
/* service protocol version */
116
u_int32_t rq_proc;
/* the desired procedure */
117
struct
opaque_auth
rq_cred;
/* raw creds from the wire */
118
caddr_t rq_clntcred;
/* read only cooked cred */
119
SVCXPRT
*rq_xprt;
/* associated transport */
120
};
121
122
123
/*
124
* Operations defined on an SVCXPRT handle
125
*
126
* SVCXPRT *xprt;
127
* struct rpc_msg *msg;
128
* xdrproc_t xargs;
129
* caddr_t argsp;
130
*/
131
#define SVC_RECV(xprt, msg) \
132
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
133
#define svc_recv(xprt, msg) \
134
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
135
136
#define SVC_STAT(xprt) \
137
(*(xprt)->xp_ops->xp_stat)(xprt)
138
#define svc_stat(xprt) \
139
(*(xprt)->xp_ops->xp_stat)(xprt)
140
141
#define SVC_GETARGS(xprt, xargs, argsp) \
142
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
143
#define svc_getargs(xprt, xargs, argsp) \
144
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
145
146
#define SVC_REPLY(xprt, msg) \
147
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
148
#define svc_reply(xprt, msg) \
149
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
150
151
#define SVC_FREEARGS(xprt, xargs, argsp) \
152
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
153
#define svc_freeargs(xprt, xargs, argsp) \
154
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
155
156
#define SVC_DESTROY(xprt) \
157
(*(xprt)->xp_ops->xp_destroy)(xprt)
158
#define svc_destroy(xprt) \
159
(*(xprt)->xp_ops->xp_destroy)(xprt)
160
161
/*
162
* Transport registration.
163
*
164
* xprt_register(xprt)
165
* SVCXPRT *xprt;
166
*/
167
__BEGIN_DECLS
168
extern
void
xprt_register(
SVCXPRT
*);
169
__END_DECLS
170
171
/*
172
* Transport un-register
173
*
174
* xprt_unregister(xprt)
175
* SVCXPRT *xprt;
176
*/
177
__BEGIN_DECLS
178
extern
void
xprt_unregister(
SVCXPRT
*);
179
__END_DECLS
180
181
182
/*
183
* When the service routine is called, it must first check to see if it
184
* knows about the procedure; if not, it should call svcerr_noproc
185
* and return. If so, it should deserialize its arguments via
186
* SVC_GETARGS (defined above). If the deserialization does not work,
187
* svcerr_decode should be called followed by a return. Successful
188
* decoding of the arguments should be followed the execution of the
189
* procedure's code and a call to svc_sendreply.
190
*
191
* Also, if the service refuses to execute the procedure due to too-
192
* weak authentication parameters, svcerr_weakauth should be called.
193
* Note: do not confuse access-control failure with weak authentication!
194
*
195
* NB: In pure implementations of rpc, the caller always waits for a reply
196
* msg. This message is sent when svc_sendreply is called.
197
* Therefore pure service implementations should always call
198
* svc_sendreply even if the function logically returns void; use
199
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
200
* for the abuse of pure rpc via batched calling or pipelining. In the
201
* case of a batched call, svc_sendreply should NOT be called since
202
* this would send a return message, which is what batching tries to avoid.
203
* It is the service/protocol writer's responsibility to know which calls are
204
* batched and which are not. Warning: responding to batch calls may
205
* deadlock the caller and server processes!
206
*/
207
208
__BEGIN_DECLS
209
extern
bool_t svc_sendreply(
SVCXPRT
*, xdrproc_t,
void
*);
210
extern
void
svcerr_decode(
SVCXPRT
*);
211
extern
void
svcerr_weakauth(
SVCXPRT
*);
212
extern
void
svcerr_noproc(
SVCXPRT
*);
213
extern
void
svcerr_progvers(
SVCXPRT
*, rpcvers_t, rpcvers_t);
214
extern
void
svcerr_auth(
SVCXPRT
*,
enum
auth_stat);
215
extern
void
svcerr_noprog(
SVCXPRT
*);
216
extern
void
svcerr_systemerr(
SVCXPRT
*);
217
__END_DECLS
218
219
/*
220
* Lowest level dispatching -OR- who owns this process anyway.
221
* Somebody has to wait for incoming requests and then call the correct
222
* service routine. The routine svc_run does infinite waiting; i.e.,
223
* svc_run never returns.
224
* Since another (co-existant) package may wish to selectively wait for
225
* incoming calls or other events outside of the rpc architecture, the
226
* routine svc_getreq is provided. It must be passed readfds, the
227
* "in-place" results of a select system call (see select, section 2).
228
*/
229
230
/*
231
* Global keeper of rpc service descriptors in use
232
* dynamic; must be inspected before each call to select
233
*/
234
extern
int
svc_maxfd;
235
extern
fd_set svc_fdset;
236
#define svc_fds svc_fdset.fds_bits[0]
/* compatibility */
237
238
#ifndef _KERNEL
239
/*
240
* a small program implemented by the svc_rpc implementation itself;
241
* also see clnt.h for protocol numbers.
242
*/
243
__BEGIN_DECLS
244
extern
void
rpctest_service(
void
);
245
__END_DECLS
246
#endif
247
248
__BEGIN_DECLS
249
extern
void
svc_getreq(
int
);
250
extern
void
svc_getreqset(fd_set *);
251
extern
void
svc_getreqset2(fd_set *,
int
);
/* XXX: nonstd, undoc */
252
extern
void
svc_run(
void
);
253
__END_DECLS
254
255
/*
256
* Socket to use on svcxxx_create call to get default socket
257
*/
258
#define RPC_ANYSOCK -1
259
#define RPC_ANYFD RPC_ANYSOCK
260
261
/*
262
* These are the existing service side transport implementations
263
*/
264
265
__BEGIN_DECLS
266
/*
267
* Transport independent svc_create routine.
268
*/
269
270
/*
271
* Connectionless and connectionful create routines
272
*/
273
274
extern
SVCXPRT
*svc_vc_create(
const
int
,
const
u_int,
const
u_int);
275
/*
276
* const int fd; -- open connection end point
277
* const u_int sendsize; -- max send size
278
* const u_int recvsize; -- max recv size
279
*/
280
281
/*
282
* Added for compatibility to old rpc 4.0. Obsoleted by svc_vc_create().
283
*/
284
extern
SVCXPRT
*svcunix_create(
int
, u_int, u_int,
char
*);
285
286
/*
287
* Added for compatibility to old rpc 4.0. Obsoleted by svc_fd_create().
288
*/
289
extern
SVCXPRT
*svcunixfd_create(
int
, u_int, u_int);
290
__END_DECLS
291
292
293
/* for backward compatibility */
294
#include <
rpc/svc_soc.h
>
295
296
#endif
/* !_RPC_SVC_H */
xdr.h
auth.h
sockaddr_in
Definition:
in.h:74
in.h
svc_soc.h
rpc_msg
Definition:
rpc_msg.h:159
types.h
opaque_auth
Definition:
auth.h:90
svc_req
Definition:
svc.h:114
socket.h
__rpc_svcxprt::xp_ops
Definition:
svc.h:88
__rpc_svcxprt
Definition:
svc.h:85
Generated by
1.8.13