Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/rpc/svc.h
39475 views
1
/* $NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $ */
2
3
/*-
4
* SPDX-License-Identifier: BSD-3-Clause
5
*
6
* Copyright (c) 2009, Sun Microsystems, Inc.
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions are met:
11
* - Redistributions of source code must retain the above copyright notice,
12
* this list of conditions and the following disclaimer.
13
* - Redistributions in binary form must reproduce the above copyright notice,
14
* this list of conditions and the following disclaimer in the documentation
15
* and/or other materials provided with the distribution.
16
* - Neither the name of Sun Microsystems, Inc. nor the names of its
17
* contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
* POSSIBILITY OF SUCH DAMAGE.
31
*/
32
33
/*
34
* svc.h, Server-side remote procedure call interface.
35
*
36
* Copyright (C) 1986-1993 by Sun Microsystems, Inc.
37
*/
38
39
#ifndef _RPC_SVC_H
40
#define _RPC_SVC_H
41
#include <sys/cdefs.h>
42
43
#include <sys/queue.h>
44
#include <sys/_lock.h>
45
#include <sys/_mutex.h>
46
#include <sys/_sx.h>
47
#include <sys/condvar.h>
48
#include <sys/sysctl.h>
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
/*
73
* Service control requests
74
*/
75
#define SVCGET_VERSQUIET 1
76
#define SVCSET_VERSQUIET 2
77
#define SVCGET_CONNMAXREC 3
78
#define SVCSET_CONNMAXREC 4
79
80
/*
81
* Operations for rpc_control().
82
*/
83
#define RPC_SVC_CONNMAXREC_SET 0 /* set max rec size, enable nonblock */
84
#define RPC_SVC_CONNMAXREC_GET 1
85
86
enum xprt_stat {
87
XPRT_DIED,
88
XPRT_MOREREQS,
89
XPRT_IDLE
90
};
91
92
struct __rpc_svcxprt;
93
struct mbuf;
94
95
struct xp_ops {
96
/* receive incoming requests */
97
bool_t (*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *,
98
struct sockaddr **, struct mbuf **);
99
/* get transport status */
100
enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *);
101
/* get transport acknowledge sequence */
102
bool_t (*xp_ack)(struct __rpc_svcxprt *, uint32_t *);
103
/* send reply */
104
bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *,
105
struct sockaddr *, struct mbuf *, uint32_t *);
106
/* destroy this struct */
107
void (*xp_destroy)(struct __rpc_svcxprt *);
108
/* catch-all function */
109
bool_t (*xp_control)(struct __rpc_svcxprt *, const u_int, void *);
110
};
111
112
struct __rpc_svcpool;
113
struct __rpc_svcgroup;
114
struct __rpc_svcthread;
115
116
/*
117
* Server side transport handle. In the kernel, transports have a
118
* reference count which tracks the number of currently assigned
119
* worker threads plus one for the service pool's reference.
120
* For NFSv4.1 sessions, a reference is also held for a backchannel.
121
* xp_p2 - Points to the CLIENT structure for the RPC server end
122
* (the client end for callbacks).
123
* Points to the private structure (cl_private) for the
124
* CLIENT structure for the RPC client end (the server
125
* end for callbacks).
126
*/
127
typedef struct __rpc_svcxprt {
128
volatile u_int xp_refs;
129
struct sx xp_lock;
130
struct __rpc_svcpool *xp_pool; /* owning pool (see below) */
131
struct __rpc_svcgroup *xp_group; /* owning group (see below) */
132
TAILQ_ENTRY(__rpc_svcxprt) xp_link;
133
TAILQ_ENTRY(__rpc_svcxprt) xp_alink;
134
bool_t xp_registered; /* xprt_register has been called */
135
bool_t xp_active; /* xprt_active has been called */
136
struct __rpc_svcthread *xp_thread; /* assigned service thread */
137
struct socket* xp_socket;
138
const struct xp_ops *xp_ops;
139
char *xp_netid; /* network token */
140
struct sockaddr_storage xp_ltaddr; /* local transport address */
141
struct sockaddr_storage xp_rtaddr; /* remote transport address */
142
void *xp_p1; /* private: for use by svc ops */
143
void *xp_p2; /* private: for use by svc ops */
144
void *xp_p3; /* private: for use by svc lib */
145
int xp_type; /* transport type */
146
int xp_idletimeout; /* idle time before closing */
147
time_t xp_lastactive; /* time of last RPC */
148
uint64_t xp_sockref; /* set by nfsv4 to identify socket */
149
int xp_upcallset; /* socket upcall is set up */
150
uint32_t xp_snd_cnt; /* # of bytes to send to socket */
151
uint32_t xp_snt_cnt; /* # of bytes sent to socket */
152
bool_t xp_dontrcv; /* Do not receive on the socket */
153
uint32_t xp_tls; /* RPC-over-TLS on socket */
154
int xp_ngrps; /* Cred. from TLS cert. */
155
uid_t xp_uid;
156
gid_t *xp_gidp;
157
int xp_doneddp;
158
} SVCXPRT;
159
160
/*
161
* Interface to server-side authentication flavors.
162
*/
163
typedef struct __rpc_svcauth {
164
const struct svc_auth_ops {
165
int (*svc_ah_wrap)(struct __rpc_svcauth *, struct mbuf **);
166
int (*svc_ah_unwrap)(struct __rpc_svcauth *, struct mbuf **);
167
void (*svc_ah_release)(struct __rpc_svcauth *);
168
} *svc_ah_ops;
169
void *svc_ah_private;
170
} SVCAUTH;
171
172
/*
173
* Server transport extensions (accessed via xp_p3).
174
*/
175
typedef struct __rpc_svcxprt_ext {
176
int xp_flags; /* versquiet */
177
SVCAUTH xp_auth; /* interface to auth methods */
178
} SVCXPRT_EXT;
179
180
/*
181
* The services list
182
* Each entry represents a set of procedures (an rpc program).
183
* The dispatch routine takes request structs and runs the
184
* appropriate procedure.
185
*/
186
struct svc_callout {
187
TAILQ_ENTRY(svc_callout) sc_link;
188
rpcprog_t sc_prog;
189
rpcvers_t sc_vers;
190
char *sc_netid;
191
void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
192
};
193
TAILQ_HEAD(svc_callout_list, svc_callout);
194
195
/*
196
* The services connection loss list
197
* The dispatch routine takes request structs and runs the
198
* appropriate procedure.
199
*/
200
struct svc_loss_callout {
201
TAILQ_ENTRY(svc_loss_callout) slc_link;
202
void (*slc_dispatch)(SVCXPRT *);
203
};
204
TAILQ_HEAD(svc_loss_callout_list, svc_loss_callout);
205
206
/*
207
* Service request
208
*/
209
struct svc_req {
210
STAILQ_ENTRY(svc_req) rq_link; /* list of requests for a thread */
211
struct __rpc_svcthread *rq_thread; /* thread which is to execute this */
212
uint32_t rq_xid; /* RPC transaction ID */
213
uint32_t rq_prog; /* service program number */
214
uint32_t rq_vers; /* service protocol version */
215
uint32_t rq_proc; /* the desired procedure */
216
size_t rq_size; /* space used by request */
217
struct mbuf *rq_args; /* XDR-encoded procedure arguments */
218
struct opaque_auth rq_cred; /* raw creds from the wire */
219
struct opaque_auth rq_verf; /* verifier for the reply */
220
void *rq_clntcred; /* read only cooked cred */
221
SVCAUTH rq_auth; /* interface to auth methods */
222
SVCXPRT *rq_xprt; /* associated transport */
223
struct sockaddr *rq_addr; /* reply address or NULL if connected */
224
void *rq_p1; /* application workspace */
225
int rq_p2; /* application workspace */
226
uint64_t rq_p3; /* application workspace */
227
uint32_t rq_reply_seq; /* reply socket sequence # */
228
char rq_credarea[3*MAX_AUTH_BYTES];
229
};
230
STAILQ_HEAD(svc_reqlist, svc_req);
231
232
#define svc_getrpccaller(rq) \
233
((rq)->rq_addr ? (rq)->rq_addr : \
234
(struct sockaddr *) &(rq)->rq_xprt->xp_rtaddr)
235
236
/*
237
* This structure is used to manage a thread which is executing
238
* requests from a service pool. A service thread is in one of three
239
* states:
240
*
241
* SVCTHREAD_SLEEPING waiting for a request to process
242
* SVCTHREAD_ACTIVE processing a request
243
* SVCTHREAD_EXITING exiting after finishing current request
244
*
245
* Threads which have no work to process sleep on the pool's sp_active
246
* list. When a transport becomes active, it is assigned a service
247
* thread to read and execute pending RPCs.
248
*/
249
typedef struct __rpc_svcthread {
250
struct mtx_padalign st_lock; /* protects st_reqs field */
251
struct __rpc_svcpool *st_pool;
252
SVCXPRT *st_xprt; /* transport we are processing */
253
struct svc_reqlist st_reqs; /* RPC requests to execute */
254
struct cv st_cond; /* sleeping for work */
255
LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */
256
LIST_ENTRY(__rpc_svcthread) st_alink; /* application thread list */
257
int st_p2; /* application workspace */
258
uint64_t st_p3; /* application workspace */
259
} SVCTHREAD;
260
LIST_HEAD(svcthread_list, __rpc_svcthread);
261
262
/*
263
* A thread group contain all information needed to assign subset of
264
* transports to subset of threads. On systems with many CPUs and many
265
* threads that allows to reduce lock congestion and improve performance.
266
* Hundreds of threads on dozens of CPUs sharing the single pool lock do
267
* not scale well otherwise.
268
*/
269
TAILQ_HEAD(svcxprt_list, __rpc_svcxprt);
270
enum svcpool_state {
271
SVCPOOL_INIT, /* svc_run not called yet */
272
SVCPOOL_ACTIVE, /* normal running state */
273
SVCPOOL_THREADWANTED, /* new service thread requested */
274
SVCPOOL_THREADSTARTING, /* new service thread started */
275
SVCPOOL_CLOSING /* svc_exit called */
276
};
277
typedef struct __rpc_svcgroup {
278
struct mtx_padalign sg_lock; /* protect the thread/req lists */
279
struct __rpc_svcpool *sg_pool;
280
enum svcpool_state sg_state; /* current pool state */
281
struct svcxprt_list sg_xlist; /* all transports in the group */
282
struct svcxprt_list sg_active; /* transports needing service */
283
struct svcthread_list sg_idlethreads; /* idle service threads */
284
285
int sg_minthreads; /* minimum service thread count */
286
int sg_maxthreads; /* maximum service thread count */
287
int sg_threadcount; /* current service thread count */
288
time_t sg_lastcreatetime; /* when we last started a thread */
289
time_t sg_lastidlecheck; /* when we last checked idle transports */
290
} SVCGROUP;
291
292
/*
293
* In the kernel, we can't use global variables to store lists of
294
* transports etc. since otherwise we could not have two unrelated RPC
295
* services running, each on its own thread. We solve this by
296
* importing a tiny part of a Solaris kernel concept, SVCPOOL.
297
*
298
* A service pool contains a set of transports and service callbacks
299
* for a set of related RPC services. The pool handle should be passed
300
* when creating new transports etc. Future work may include extending
301
* this to support something similar to the Solaris multi-threaded RPC
302
* server.
303
*/
304
typedef SVCTHREAD *pool_assign_fn(SVCTHREAD *, struct svc_req *);
305
typedef void pool_done_fn(SVCTHREAD *, struct svc_req *);
306
#define SVC_MAXGROUPS 16
307
typedef struct __rpc_svcpool {
308
struct mtx_padalign sp_lock; /* protect the transport lists */
309
const char *sp_name; /* pool name (e.g. "nfsd", "NLM" */
310
enum svcpool_state sp_state; /* current pool state */
311
struct proc *sp_proc; /* process which is in svc_run */
312
struct svc_callout_list sp_callouts; /* (prog,vers)->dispatch list */
313
struct svc_loss_callout_list sp_lcallouts; /* loss->dispatch list */
314
int sp_minthreads; /* minimum service thread count */
315
int sp_maxthreads; /* maximum service thread count */
316
317
/*
318
* Hooks to allow an application to control request to thread
319
* placement.
320
*/
321
pool_assign_fn *sp_assign;
322
pool_done_fn *sp_done;
323
324
/*
325
* These variables are used to put an upper bound on the
326
* amount of memory used by RPC requests which are queued
327
* waiting for execution.
328
*/
329
unsigned long sp_space_low;
330
unsigned long sp_space_high;
331
unsigned long sp_space_used;
332
unsigned long sp_space_used_highest;
333
bool_t sp_space_throttled;
334
int sp_space_throttle_count;
335
336
struct replay_cache *sp_rcache; /* optional replay cache */
337
struct sysctl_ctx_list sp_sysctl;
338
339
int sp_groupcount; /* Number of groups in the pool. */
340
int sp_nextgroup; /* Next group to assign port. */
341
SVCGROUP sp_groups[SVC_MAXGROUPS]; /* Thread/port groups. */
342
} SVCPOOL;
343
344
/*
345
* Operations defined on an SVCXPRT handle
346
*
347
* SVCXPRT *xprt;
348
* struct rpc_msg *msg;
349
* xdrproc_t xargs;
350
* void * argsp;
351
*/
352
#define SVC_ACQUIRE(xprt) \
353
refcount_acquire(&(xprt)->xp_refs)
354
355
#define SVC_RELEASE(xprt) \
356
if (refcount_release(&(xprt)->xp_refs)) \
357
SVC_DESTROY(xprt)
358
359
#define SVC_RECV(xprt, msg, addr, args) \
360
(*(xprt)->xp_ops->xp_recv)((xprt), (msg), (addr), (args))
361
362
#define SVC_STAT(xprt) \
363
(*(xprt)->xp_ops->xp_stat)(xprt)
364
365
#define SVC_ACK(xprt, ack) \
366
((xprt)->xp_ops->xp_ack == NULL ? FALSE : \
367
((ack) == NULL ? TRUE : (*(xprt)->xp_ops->xp_ack)((xprt), (ack))))
368
369
#define SVC_REPLY(xprt, msg, addr, m, seq) \
370
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg), (addr), (m), (seq))
371
372
#define SVC_DESTROY(xprt) \
373
(*(xprt)->xp_ops->xp_destroy)(xprt)
374
375
#define SVC_CONTROL(xprt, rq, in) \
376
(*(xprt)->xp_ops->xp_control)((xprt), (rq), (in))
377
378
#define SVC_EXT(xprt) \
379
((SVCXPRT_EXT *) xprt->xp_p3)
380
381
#define SVC_AUTH(xprt) \
382
(SVC_EXT(xprt)->xp_auth)
383
384
/*
385
* Operations defined on an SVCAUTH handle
386
*/
387
#define SVCAUTH_WRAP(auth, mp) \
388
((auth)->svc_ah_ops->svc_ah_wrap(auth, mp))
389
#define SVCAUTH_UNWRAP(auth, mp) \
390
((auth)->svc_ah_ops->svc_ah_unwrap(auth, mp))
391
#define SVCAUTH_RELEASE(auth) \
392
((auth)->svc_ah_ops->svc_ah_release(auth))
393
394
/*
395
* Service registration
396
*
397
* svc_reg(xprt, prog, vers, dispatch, nconf)
398
* const SVCXPRT *xprt;
399
* const rpcprog_t prog;
400
* const rpcvers_t vers;
401
* const void (*dispatch)();
402
* const struct netconfig *nconf;
403
*/
404
405
__BEGIN_DECLS
406
extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t,
407
void (*)(struct svc_req *, SVCXPRT *),
408
const struct netconfig *);
409
__END_DECLS
410
411
/*
412
* Service un-registration
413
*
414
* svc_unreg(prog, vers)
415
* const rpcprog_t prog;
416
* const rpcvers_t vers;
417
*/
418
419
__BEGIN_DECLS
420
extern void svc_unreg(SVCPOOL *, const rpcprog_t, const rpcvers_t);
421
__END_DECLS
422
423
/*
424
* Service connection loss registration
425
*
426
* svc_loss_reg(xprt, dispatch)
427
* const SVCXPRT *xprt;
428
* const void (*dispatch)();
429
*/
430
431
__BEGIN_DECLS
432
extern bool_t svc_loss_reg(SVCXPRT *, void (*)(SVCXPRT *));
433
__END_DECLS
434
435
/*
436
* Service connection loss un-registration
437
*
438
* svc_loss_unreg(xprt, dispatch)
439
* const SVCXPRT *xprt;
440
* const void (*dispatch)();
441
*/
442
443
__BEGIN_DECLS
444
extern void svc_loss_unreg(SVCPOOL *, void (*)(SVCXPRT *));
445
__END_DECLS
446
447
/*
448
* Transport registration.
449
*
450
* xprt_register(xprt)
451
* SVCXPRT *xprt;
452
*/
453
__BEGIN_DECLS
454
extern void xprt_register(SVCXPRT *);
455
__END_DECLS
456
457
/*
458
* Transport un-register
459
*
460
* xprt_unregister(xprt)
461
* SVCXPRT *xprt;
462
*/
463
__BEGIN_DECLS
464
extern void xprt_unregister(SVCXPRT *);
465
extern void __xprt_unregister_unlocked(SVCXPRT *);
466
__END_DECLS
467
468
/*
469
* Called when a transport has pending requests.
470
*/
471
__BEGIN_DECLS
472
extern void xprt_active(SVCXPRT *);
473
extern void xprt_inactive(SVCXPRT *);
474
extern void xprt_inactive_locked(SVCXPRT *);
475
extern void xprt_inactive_self(SVCXPRT *);
476
__END_DECLS
477
478
/*
479
* When the service routine is called, it must first check to see if it
480
* knows about the procedure; if not, it should call svcerr_noproc
481
* and return. If so, it should deserialize its arguments via
482
* SVC_GETARGS (defined above). If the deserialization does not work,
483
* svcerr_decode should be called followed by a return. Successful
484
* decoding of the arguments should be followed the execution of the
485
* procedure's code and a call to svc_sendreply.
486
*
487
* Also, if the service refuses to execute the procedure due to too-
488
* weak authentication parameters, svcerr_weakauth should be called.
489
* Note: do not confuse access-control failure with weak authentication!
490
*
491
* NB: In pure implementations of rpc, the caller always waits for a reply
492
* msg. This message is sent when svc_sendreply is called.
493
* Therefore pure service implementations should always call
494
* svc_sendreply even if the function logically returns void; use
495
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
496
* for the abuse of pure rpc via batched calling or pipelining. In the
497
* case of a batched call, svc_sendreply should NOT be called since
498
* this would send a return message, which is what batching tries to avoid.
499
* It is the service/protocol writer's responsibility to know which calls are
500
* batched and which are not. Warning: responding to batch calls may
501
* deadlock the caller and server processes!
502
*/
503
504
__BEGIN_DECLS
505
extern bool_t svc_sendreply(struct svc_req *, xdrproc_t, void *);
506
extern bool_t svc_sendreply_mbuf(struct svc_req *, struct mbuf *);
507
extern void svcerr_decode(struct svc_req *);
508
extern void svcerr_weakauth(struct svc_req *);
509
extern void svcerr_noproc(struct svc_req *);
510
extern void svcerr_progvers(struct svc_req *, rpcvers_t, rpcvers_t);
511
extern void svcerr_auth(struct svc_req *, enum auth_stat);
512
extern void svcerr_noprog(struct svc_req *);
513
extern void svcerr_systemerr(struct svc_req *);
514
extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t,
515
char *(*)(char *), xdrproc_t, xdrproc_t,
516
char *);
517
__END_DECLS
518
519
/*
520
* Lowest level dispatching -OR- who owns this process anyway.
521
* Somebody has to wait for incoming requests and then call the correct
522
* service routine. The routine svc_run does infinite waiting; i.e.,
523
* svc_run never returns.
524
* Since another (co-existent) package may wish to selectively wait for
525
* incoming calls or other events outside of the rpc architecture, the
526
* routine svc_getreq is provided. It must be passed readfds, the
527
* "in-place" results of a select system call (see select, section 2).
528
*/
529
530
/*
531
* a small program implemented by the svc_rpc implementation itself;
532
* also see clnt.h for protocol numbers.
533
*/
534
__BEGIN_DECLS
535
extern void rpctest_service(void);
536
__END_DECLS
537
538
__BEGIN_DECLS
539
extern SVCXPRT *svc_xprt_alloc(void);
540
extern void svc_xprt_free(SVCXPRT *);
541
extern void svc_run(SVCPOOL *);
542
extern void svc_exit(SVCPOOL *);
543
extern bool_t svc_getargs(struct svc_req *, xdrproc_t, void *);
544
extern bool_t svc_freeargs(struct svc_req *, xdrproc_t, void *);
545
extern void svc_freereq(struct svc_req *);
546
__END_DECLS
547
548
/*
549
* Socket to use on svcxxx_create call to get default socket
550
*/
551
#define RPC_ANYSOCK -1
552
#define RPC_ANYFD RPC_ANYSOCK
553
554
/*
555
* These are the existing service side transport implementations
556
*/
557
558
__BEGIN_DECLS
559
560
/*
561
* Create a new service pool.
562
*/
563
extern SVCPOOL* svcpool_create(const char *name,
564
struct sysctl_oid_list *sysctl_base);
565
566
/*
567
* Destroy a service pool, including all registered transports.
568
*/
569
extern void svcpool_destroy(SVCPOOL *pool);
570
571
/*
572
* Close a service pool. Similar to svcpool_destroy(), but it does not
573
* free the data structures. As such, the pool can be used again.
574
*/
575
extern void svcpool_close(SVCPOOL *pool);
576
577
/*
578
* Generic server creation routine. It takes a netconfig structure
579
* instead of a nettype.
580
*/
581
582
extern SVCXPRT *svc_tp_create(SVCPOOL *, void (*)(struct svc_req *, SVCXPRT *),
583
const rpcprog_t, const rpcvers_t, const char *uaddr,
584
const struct netconfig *);
585
/*
586
* void (*dispatch)(); -- dispatch routine
587
* const rpcprog_t prognum; -- program number
588
* const rpcvers_t versnum; -- version number
589
* const char *uaddr; -- universal address of service
590
* const struct netconfig *nconf; -- netconfig structure
591
*/
592
593
extern SVCXPRT *svc_dg_create(SVCPOOL *, struct socket *,
594
const size_t, const size_t);
595
/*
596
* struct socket *; -- open connection
597
* const size_t sendsize; -- max send size
598
* const size_t recvsize; -- max recv size
599
*/
600
601
extern SVCXPRT *svc_vc_create(SVCPOOL *, struct socket *,
602
const size_t, const size_t);
603
/*
604
* struct socket *; -- open connection
605
* const size_t sendsize; -- max send size
606
* const size_t recvsize; -- max recv size
607
*/
608
609
extern SVCXPRT *svc_vc_create_backchannel(SVCPOOL *);
610
611
extern void *clnt_bck_create(struct socket *, const rpcprog_t, const rpcvers_t);
612
/*
613
* struct socket *; -- server transport socket
614
* const rpcprog_t prog; -- RPC program number
615
* const rpcvers_t vers; -- RPC program version
616
*/
617
618
/*
619
* Generic TLI create routine
620
*/
621
extern SVCXPRT *svc_tli_create(SVCPOOL *, const struct netconfig *,
622
const struct t_bind *, const size_t, const size_t);
623
/*
624
* const struct netconfig *nconf; -- netconfig structure for network
625
* const struct t_bind *bindaddr; -- local bind address
626
* const size_t sendsz; -- max sendsize
627
* const size_t recvsz; -- max recvsize
628
*/
629
__END_DECLS
630
631
#endif /* !_RPC_SVC_H */
632
633