Print this page
8330 Add svc_tp_create_addr to libnsl
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/rpc/svc.h
+++ new/usr/src/uts/common/rpc/svc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
26 26 /* All Rights Reserved */
27 27 /*
28 28 * Portions of this source code were derived from Berkeley
29 29 * 4.3 BSD under license from the Regents of the University of
30 30 * California.
31 31 */
32 32
33 33 /*
34 34 * svc.h, Server-side remote procedure call interface.
35 35 */
36 36
37 37 #ifndef _RPC_SVC_H
38 38 #define _RPC_SVC_H
39 39
40 40 #include <rpc/rpc_com.h>
41 41 #include <rpc/rpc_msg.h>
42 42 #include <sys/tihdr.h>
43 43 #include <sys/poll.h>
44 44 #include <sys/tsol/label.h>
45 45
46 46 #ifdef _KERNEL
47 47 #include <rpc/svc_auth.h>
48 48 #include <sys/callb.h>
49 49 #endif /* _KERNEL */
50 50
51 51 /*
52 52 * This interface must manage two items concerning remote procedure calling:
53 53 *
54 54 * 1) An arbitrary number of transport connections upon which rpc requests
55 55 * are received. They are created and registered by routines in svc_generic.c,
56 56 * svc_vc.c and svc_dg.c; they in turn call xprt_register and
57 57 * xprt_unregister.
58 58 *
59 59 * 2) An arbitrary number of locally registered services. Services are
60 60 * described by the following four data: program number, version number,
61 61 * "service dispatch" function, a transport handle, and a boolean that
62 62 * indicates whether or not the exported program should be registered with a
63 63 * local binder service; if true the program's number and version and the
64 64 * address from the transport handle are registered with the binder.
65 65 * These data are registered with rpcbind via svc_reg().
66 66 *
67 67 * A service's dispatch function is called whenever an rpc request comes in
68 68 * on a transport. The request's program and version numbers must match
69 69 * those of the registered service. The dispatch function is passed two
70 70 * parameters, struct svc_req * and SVCXPRT *, defined below.
71 71 */
72 72
73 73 #ifdef __cplusplus
74 74 extern "C" {
75 75 #endif
76 76
77 77 /*
78 78 * Server-side transport handles.
79 79 * The actual type definitions are below.
80 80 */
81 81 #ifdef _KERNEL
82 82 typedef struct __svcmasterxprt SVCMASTERXPRT; /* Master transport handle */
83 83 typedef struct __svcxprt SVCXPRT; /* Per-thread clone handle */
84 84 typedef struct __svcpool SVCPOOL; /* Kernel thread pool */
85 85 #else /* _KERNEL */
86 86 typedef struct __svcxprt SVCXPRT; /* Server transport handle */
87 87 #endif /* _KERNEL */
88 88
89 89 /*
90 90 * Prototype of error handler callback
91 91 */
92 92 #ifndef _KERNEL
93 93 typedef void (*svc_errorhandler_t)(const SVCXPRT* svc, const bool_t isAConn);
94 94 #endif
95 95
96 96 /*
97 97 * Service request.
98 98 *
99 99 * PSARC 2003/523 Contract Private Interface
100 100 * svc_req
101 101 * Changes must be reviewed by Solaris File Sharing
102 102 * Changes must be communicated to contract-2003-523@sun.com
103 103 */
104 104 struct svc_req {
105 105 rpcprog_t rq_prog; /* service program number */
106 106 rpcvers_t rq_vers; /* service protocol version */
107 107 rpcproc_t rq_proc; /* the desired procedure */
108 108 struct opaque_auth rq_cred; /* raw creds from the wire */
109 109 caddr_t rq_clntcred; /* read only cooked cred */
110 110 SVCXPRT *rq_xprt; /* associated transport */
111 111 bslabel_t *rq_label; /* TSOL label of the request */
112 112 };
113 113
114 114 #ifdef _KERNEL
115 115 struct dupreq {
116 116 uint32_t dr_xid;
117 117 rpcproc_t dr_proc;
118 118 rpcvers_t dr_vers;
119 119 rpcprog_t dr_prog;
120 120 struct netbuf dr_addr;
121 121 struct netbuf dr_resp;
122 122 void (*dr_resfree)();
123 123 int dr_status;
124 124 struct dupreq *dr_next;
125 125 struct dupreq *dr_chain;
126 126 };
127 127
128 128 /*
129 129 * States of requests for duplicate request caching.
130 130 */
131 131 #define DUP_NEW 0x00 /* new entry */
132 132 #define DUP_INPROGRESS 0x01 /* request already going */
133 133 #define DUP_DONE 0x02 /* request done */
134 134 #define DUP_DROP 0x03 /* request dropped */
135 135 #define DUP_ERROR 0x04 /* error in dup req cache */
136 136
137 137 /*
138 138 * Prototype for a service dispatch routine.
139 139 */
140 140 typedef void (SVC_DISPATCH)(struct svc_req *, SVCXPRT *);
141 141
142 142 /*
143 143 * The service provider callout.
144 144 * Each entry identifies a dispatch routine to be called
145 145 * for a given RPC program number and a version fitting
146 146 * into the registered range.
147 147 */
148 148 typedef struct {
149 149 rpcprog_t sc_prog; /* RPC Program number */
150 150 rpcvers_t sc_versmin; /* Min version number */
151 151 rpcvers_t sc_versmax; /* Max version number */
152 152 SVC_DISPATCH *sc_dispatch; /* Dispatch routine */
153 153 } SVC_CALLOUT;
154 154
155 155 /*
156 156 * Table of service provider `callouts' for an RPC
157 157 * transport handle. If sct_free is TRUE then transport
158 158 * destructor is supposed to deallocate this table.
159 159 */
160 160 typedef struct {
161 161 size_t sct_size; /* Number of entries */
162 162 bool_t sct_free; /* Deallocate if true */
163 163 SVC_CALLOUT *sct_sc; /* Callout entries */
164 164 } SVC_CALLOUT_TABLE;
165 165
166 166 struct svc_ops {
167 167 bool_t (*xp_recv)(SVCXPRT *, mblk_t *, struct rpc_msg *);
168 168 /* receive incoming requests */
169 169 bool_t (*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
170 170 /* get arguments */
171 171 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *);
172 172 /* send reply */
173 173 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
174 174 /* free mem allocated for args */
175 175 void (*xp_destroy)(SVCMASTERXPRT *);
176 176 /* destroy this struct */
177 177 int (*xp_dup)(struct svc_req *, caddr_t, int,
178 178 struct dupreq **, bool_t *);
179 179 /* check for dup */
180 180 void (*xp_dupdone)(struct dupreq *, caddr_t, void (*)(), int, int);
181 181 /* mark dup entry as completed */
182 182 int32_t *(*xp_getres)(SVCXPRT *, int);
183 183 /* get pointer to response buffer */
184 184 void (*xp_freeres)(SVCXPRT *);
185 185 /* destroy pre-serialized response */
186 186 void (*xp_clone_destroy)(SVCXPRT *);
187 187 /* destroy a clone xprt */
188 188 void (*xp_start)(SVCMASTERXPRT *);
189 189 /* `ready-to-receive' */
190 190 void (*xp_clone_xprt)(SVCXPRT *, SVCXPRT *);
191 191 /* transport specific clone function */
192 192 void (*xp_tattrs) (SVCXPRT *, int, void **);
193 193 };
194 194
195 195 #define SVC_TATTR_ADDRMASK 1
196 196
197 197 #else /* _KERNEL */
198 198 /*
199 199 * Service control requests
200 200 */
201 201 #define SVCGET_VERSQUIET 1
202 202 #define SVCSET_VERSQUIET 2
203 203 #define SVCGET_XID 4
204 204 #define SVCSET_KEEPALIVE 5
205 205 #define SVCSET_CONNMAXREC 6
206 206 #define SVCGET_CONNMAXREC 7
207 207 #define SVCGET_RECVERRHANDLER 8
208 208 #define SVCSET_RECVERRHANDLER 9
209 209
210 210 enum xprt_stat {
211 211 XPRT_DIED,
212 212 XPRT_MOREREQS,
213 213 XPRT_IDLE
214 214 };
215 215
216 216 struct xp_ops {
217 217 #ifdef __STDC__
218 218 bool_t (*xp_recv)(SVCXPRT *, struct rpc_msg *);
219 219 /* receive incoming requests */
220 220 enum xprt_stat (*xp_stat)(SVCXPRT *);
221 221 /* get transport status */
222 222 bool_t (*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
223 223 /* get arguments */
224 224 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *);
225 225 /* send reply */
226 226 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
227 227 /* free mem allocated for args */
228 228 void (*xp_destroy)(SVCXPRT *);
229 229 /* destroy this struct */
230 230 bool_t (*xp_control)(SVCXPRT *, const uint_t, void *);
231 231 /* catch-all control function */
232 232 #else /* __STDC__ */
233 233 bool_t (*xp_recv)(); /* receive incoming requests */
234 234 enum xprt_stat (*xp_stat)(); /* get transport status */
235 235 bool_t (*xp_getargs)(); /* get arguments */
236 236 bool_t (*xp_reply)(); /* send reply */
237 237 bool_t (*xp_freeargs)(); /* free mem allocated for args */
238 238 void (*xp_destroy)(); /* destroy this struct */
239 239 bool_t (*xp_control)(); /* catch-all control function */
240 240 #endif /* __STDC__ */
241 241 };
242 242 #endif /* _KERNEL */
243 243
244 244 #ifdef _KERNEL
245 245 /*
246 246 * SVCPOOL
247 247 * Kernel RPC server-side thread pool structure.
248 248 */
249 249 typedef struct __svcxprt_qnode __SVCXPRT_QNODE; /* Defined in svc.c */
250 250
251 251 struct __svcpool {
252 252 /*
253 253 * Thread pool variables.
254 254 *
255 255 * The pool's thread lock p_thread_lock protects:
256 256 * - p_threads, p_detached_threads, p_reserved_threads and p_closing
257 257 * The pool's request lock protects:
258 258 * - p_asleep, p_drowsy, p_reqs, p_size, p_walkers, p_req_cv.
259 259 * The following fields are `initialized constants':
260 260 * - p_id, p_stksize, p_timeout.
261 261 * Access to p_next and p_prev is protected by the pool
262 262 * list lock.
263 263 */
264 264 SVCPOOL *p_next; /* Next pool in the list */
265 265 SVCPOOL *p_prev; /* Prev pool in the list */
266 266 int p_id; /* Pool id */
267 267 int p_threads; /* Non-detached threads */
268 268 int p_detached_threads; /* Detached threads */
269 269 int p_maxthreads; /* Max threads in the pool */
270 270 int p_redline; /* `Redline' for the pool */
271 271 int p_reserved_threads; /* Reserved threads */
272 272 kmutex_t p_thread_lock; /* Thread lock */
273 273 int p_asleep; /* Asleep threads */
274 274 int p_drowsy; /* Drowsy flag */
275 275 kcondvar_t p_req_cv; /* svc_poll() sleep var. */
276 276 clock_t p_timeout; /* svc_poll() timeout */
277 277 kmutex_t p_req_lock; /* Request lock */
278 278 int p_reqs; /* Pending requests */
279 279 int p_walkers; /* Walking threads */
280 280 int p_max_same_xprt; /* Max reqs from the xprt */
281 281 int p_stksize; /* Stack size for svc_run */
282 282 bool_t p_closing : 1; /* Pool is closing */
283 283
284 284 /*
285 285 * Thread creator variables.
286 286 * The `creator signaled' flag is turned on when a signal is send
287 287 * to the creator thread (to create a new service thread). The
288 288 * creator clears when the thread is created. The protocol is not
289 289 * to signal the creator thread when the flag is on. However,
290 290 * a new thread should signal the creator if there are more
291 291 * requests in the queue.
292 292 *
293 293 * When the pool is closing (ie it has been already unregistered from
294 294 * the pool list) the last thread on the last transport should turn
295 295 * the p_creator_exit flag on. This tells the creator thread to
296 296 * free the pool structure and exit.
297 297 */
298 298 bool_t p_creator_signaled : 1; /* Create requested flag */
299 299 bool_t p_creator_exit : 1; /* If true creator exits */
300 300 kcondvar_t p_creator_cv; /* Creator cond. variable */
301 301 kmutex_t p_creator_lock; /* Creator lock */
302 302
303 303 /*
304 304 * Doubly linked list containing `registered' master transport handles.
305 305 * There is no special structure for a list node. Instead the
306 306 * SVCMASTERXPRT structure has the xp_next and xp_prev fields.
307 307 *
308 308 * The p_lrwlock protects access to xprt->xp_next and xprt->xp_prev.
309 309 * A service thread should also acquire a reader lock before accessing
310 310 * any transports it is no longer linked to (to prevent them from
311 311 * being destroyed).
312 312 *
313 313 * The list lock governs also the `pool is closing' flag.
314 314 */
315 315 size_t p_lcount; /* Current count */
316 316 SVCMASTERXPRT *p_lhead; /* List head */
317 317 krwlock_t p_lrwlock; /* R/W lock */
318 318
319 319 /*
320 320 * Circular linked list for the `xprt-ready' queue (FIFO).
321 321 * Must be initialized with svc_xprt_qinit() before it is used.
322 322 *
323 323 * The writer's end is protected by the pool's request lock
324 324 * (pool->p_req_lock). The reader's end is protected by q_end_lock.
325 325 *
326 326 * When the queue is full the p_qoverflow flag is raised. It stays
327 327 * on until all the pending request are drained.
328 328 */
329 329 size_t p_qsize; /* Number of queue nodes */
330 330 int p_qoverflow : 1; /* Overflow flag */
331 331 __SVCXPRT_QNODE *p_qbody; /* Queue body (array) */
332 332 __SVCXPRT_QNODE *p_qtop; /* Writer's end of FIFO */
333 333 __SVCXPRT_QNODE *p_qend; /* Reader's end of FIFO */
334 334 kmutex_t p_qend_lock; /* Reader's end lock */
335 335
336 336 /*
337 337 * Userspace thread creator variables.
338 338 * Thread creation is actually done in userland, via a thread
339 339 * that is parked in the kernel. When that thread is signaled,
340 340 * it returns back down to the daemon from whence it came and
341 341 * does the lwp create.
342 342 *
343 343 * A parallel "creator" thread runs in the kernel. That is the
344 344 * thread that will signal for the user thread to return to
345 345 * userland and do its work.
346 346 *
347 347 * Since the thread doesn't always exist (there could be a race
348 348 * if two threads are created in rapid succession), we set
349 349 * p_signal_create_thread to FALSE when we're ready to accept work.
350 350 *
351 351 * p_user_exit is set to true when the service pool is about
352 352 * to close. This is done so that the user creation thread
353 353 * can be informed and cleanup any userland state.
354 354 */
355 355
356 356 bool_t p_signal_create_thread : 1; /* Create requested flag */
357 357 bool_t p_user_exit : 1; /* If true creator exits */
358 358 bool_t p_user_waiting : 1; /* Thread waiting for work */
359 359 kcondvar_t p_user_cv; /* Creator cond. variable */
360 360 kmutex_t p_user_lock; /* Creator lock */
361 361 void (*p_offline)(); /* callout for unregister */
362 362 void (*p_shutdown)(); /* callout for shutdown */
363 363
364 364 size_t p_size; /* Total size of queued msgs */
365 365 };
366 366
367 367 /*
368 368 * Server side transport handle (SVCMASTERXPRT).
369 369 * xprt->xp_req_lock governs the following fields in xprt:
370 370 * xp_req_head, xp_req_tail.
371 371 * xprt->xp_thread_lock governs the following fields in xprt:
372 372 * xp_threads, xp_detached_threads.
373 373 *
374 374 * xp_req_tail is only valid if xp_req_head is non-NULL
375 375 *
376 376 * The xp_threads count is the number of attached threads. These threads
377 377 * are able to handle new requests, and it is expected that they will not
378 378 * block for a very long time handling a given request. The
379 379 * xp_detached_threads count is the number of threads that have detached
380 380 * themselves from the transport. These threads can block indefinitely
381 381 * while handling a request. Once they complete the request, they exit.
382 382 *
383 383 * A kernel service provider may register a callback function "closeproc"
384 384 * for a transport. When the transport is closing the last exiting attached
385 385 * thread - xp_threads goes to zero - it calls the callback function, passing
386 386 * it a reference to the transport. This call is made with xp_thread_lock
387 387 * held, so any cleanup bookkeeping it does should be done quickly.
388 388 *
389 389 * When the transport is closing the last exiting thread is supposed
390 390 * to destroy/free the data structure.
391 391 */
392 392 typedef struct __svcxprt_common {
393 393 struct file *xpc_fp;
394 394 struct svc_ops *xpc_ops;
395 395 queue_t *xpc_wq; /* queue to write onto */
396 396 cred_t *xpc_cred; /* cached cred for server to use */
397 397 int32_t xpc_type; /* transport type */
398 398 int xpc_msg_size; /* TSDU or TIDU size */
399 399 struct netbuf xpc_rtaddr; /* remote transport address */
400 400 struct netbuf xpc_lcladdr; /* local transport address */
401 401 char *xpc_netid; /* network token */
402 402 SVC_CALLOUT_TABLE *xpc_sct;
403 403 } __SVCXPRT_COMMON;
404 404
405 405 #define xp_fp xp_xpc.xpc_fp
406 406 #define xp_ops xp_xpc.xpc_ops
407 407 #define xp_wq xp_xpc.xpc_wq
408 408 #define xp_cred xp_xpc.xpc_cred
409 409 #define xp_type xp_xpc.xpc_type
410 410 #define xp_msg_size xp_xpc.xpc_msg_size
411 411 #define xp_rtaddr xp_xpc.xpc_rtaddr
412 412 #define xp_lcladdr xp_xpc.xpc_lcladdr
413 413 #define xp_sct xp_xpc.xpc_sct
414 414 #define xp_netid xp_xpc.xpc_netid
415 415
416 416 struct __svcmasterxprt {
417 417 SVCMASTERXPRT *xp_next; /* Next transport in the list */
418 418 SVCMASTERXPRT *xp_prev; /* Prev transport in the list */
419 419 __SVCXPRT_COMMON xp_xpc; /* Fields common with the clone */
420 420 SVCPOOL *xp_pool; /* Pointer to the pool */
421 421 mblk_t *xp_req_head; /* Request queue head */
422 422 mblk_t *xp_req_tail; /* Request queue tail */
423 423 kmutex_t xp_req_lock; /* Request lock */
424 424 int xp_threads; /* Current num. of attached threads */
425 425 int xp_detached_threads; /* num. of detached threads */
426 426 kmutex_t xp_thread_lock; /* Thread count lock */
427 427 void (*xp_closeproc)(const SVCMASTERXPRT *);
428 428 /* optional; see comments above */
429 429 struct netbuf xp_addrmask; /* address mask */
430 430
431 431 caddr_t xp_p2; /* private: for use by svc ops */
432 432
433 433 int xp_full : 1; /* xprt is full */
434 434 int xp_enable : 1; /* xprt needs to be enabled */
435 435 int xp_reqs; /* number of requests queued */
436 436 size_t xp_size; /* total size of queued msgs */
437 437 };
438 438
439 439 /*
440 440 * Service thread `clone' transport handle (SVCXPRT)
441 441 *
442 442 * PSARC 2003/523 Contract Private Interface
443 443 * SVCXPRT
444 444 * Changes must be reviewed by Solaris File Sharing
445 445 * Changes must be communicated to contract-2003-523@sun.com
446 446 *
447 447 * The xp_p2buf buffer is used as the storage for a transport type
448 448 * specific structure. It is private for the svc ops for a given
449 449 * transport type.
450 450 */
451 451
452 452 #define SVC_P2LEN 128
453 453
454 454 struct __svcxprt {
455 455 __SVCXPRT_COMMON xp_xpc;
456 456 SVCMASTERXPRT *xp_master; /* back ptr to master */
457 457
458 458 /* The following fileds are on a per-thread basis */
459 459 callb_cpr_t *xp_cprp; /* unused padding for Contract */
460 460 bool_t xp_reserved : 1; /* is thread reserved? */
461 461 bool_t xp_detached : 1; /* is thread detached? */
462 462 int xp_same_xprt; /* Reqs from the same xprt */
463 463
464 464 /* The following fields are used on a per-request basis */
465 465 struct opaque_auth xp_verf; /* raw response verifier */
466 466 SVCAUTH xp_auth; /* auth flavor of current req */
467 467 void *xp_cookie; /* a cookie */
468 468 uint32_t xp_xid; /* id */
469 469 XDR xp_xdrin; /* input xdr stream */
470 470 XDR xp_xdrout; /* output xdr stream */
471 471
472 472 /* Private for svc ops */
473 473 char xp_p2buf[SVC_P2LEN]; /* udp_data or cots_data_t */
474 474 /* or clone_rdma_data_t */
475 475 };
476 476 #else /* _KERNEL */
477 477 struct __svcxprt {
478 478 int xp_fd;
479 479 #define xp_sock xp_fd
480 480 ushort_t xp_port;
481 481 /*
482 482 * associated port number.
483 483 * Obsolete, but still used to
484 484 * specify whether rendezvouser
485 485 * or normal connection
486 486 */
487 487 struct xp_ops *xp_ops;
488 488 int xp_addrlen; /* length of remote addr. Obsoleted */
489 489 char *xp_tp; /* transport provider device name */
490 490 char *xp_netid; /* network token */
491 491 struct netbuf xp_ltaddr; /* local transport address */
492 492 struct netbuf xp_rtaddr; /* remote transport address */
493 493 char xp_raddr[16]; /* remote address. Now obsoleted */
494 494 struct opaque_auth xp_verf; /* raw response verifier */
495 495 caddr_t xp_p1; /* private: for use by svc ops */
496 496 caddr_t xp_p2; /* private: for use by svc ops */
497 497 caddr_t xp_p3; /* private: for use by svc lib */
498 498 int xp_type; /* transport type */
499 499 /*
500 500 * callback on client death
501 501 * First parameter is the current structure,
502 502 * Second parameter :
503 503 * - FALSE for the service listener
504 504 * - TRUE for a real connected socket
505 505 */
506 506 svc_errorhandler_t xp_closeclnt;
507 507 };
508 508 #endif /* _KERNEL */
509 509
510 510 /*
511 511 * Approved way of getting address of caller,
512 512 * address mask, and netid of transport.
513 513 */
514 514 #define svc_getrpccaller(x) (&(x)->xp_rtaddr)
515 515 #ifdef _KERNEL
516 516 #define svc_getcaller(x) (&(x)->xp_rtaddr.buf)
517 517 #define svc_getaddrmask(x) (&(x)->xp_master->xp_addrmask)
518 518 #define svc_getnetid(x) ((x)->xp_netid)
519 519 #endif /* _KERNEL */
520 520
521 521 /*
522 522 * Operations defined on an SVCXPRT handle
523 523 */
524 524
525 525 #ifdef _KERNEL
526 526
527 527 #define SVC_GETADDRMASK(clone_xprt, attrflag, tattr) \
528 528 (*(clone_xprt)->xp_ops->xp_tattrs)((clone_xprt), (attrflag), (tattr))
529 529
530 530 #define SVC_CLONE_XPRT(src_xprt, dst_xprt) \
531 531 if ((src_xprt)->xp_ops->xp_clone_xprt) \
532 532 (*(src_xprt)->xp_ops->xp_clone_xprt) \
533 533 (src_xprt, dst_xprt)
534 534
535 535 #define SVC_RECV(clone_xprt, mp, msg) \
536 536 (*(clone_xprt)->xp_ops->xp_recv)((clone_xprt), (mp), (msg))
537 537
538 538 /*
539 539 * PSARC 2003/523 Contract Private Interface
540 540 * SVC_GETARGS
541 541 * Changes must be reviewed by Solaris File Sharing
542 542 * Changes must be communicated to contract-2003-523@sun.com
543 543 */
544 544 #define SVC_GETARGS(clone_xprt, xargs, argsp) \
545 545 (*(clone_xprt)->xp_ops->xp_getargs)((clone_xprt), (xargs), (argsp))
546 546
547 547 #define SVC_REPLY(clone_xprt, msg) \
548 548 (*(clone_xprt)->xp_ops->xp_reply) ((clone_xprt), (msg))
549 549
550 550 #define SVC_FREEARGS(clone_xprt, xargs, argsp) \
551 551 (*(clone_xprt)->xp_ops->xp_freeargs)((clone_xprt), (xargs), (argsp))
552 552
553 553 #define SVC_GETRES(clone_xprt, size) \
554 554 (*(clone_xprt)->xp_ops->xp_getres)((clone_xprt), (size))
555 555
556 556 #define SVC_FREERES(clone_xprt) \
557 557 (*(clone_xprt)->xp_ops->xp_freeres)(clone_xprt)
558 558
559 559 #define SVC_DESTROY(xprt) \
560 560 (*(xprt)->xp_ops->xp_destroy)(xprt)
561 561
562 562 /*
563 563 * PSARC 2003/523 Contract Private Interfaces
564 564 * SVC_DUP, SVC_DUPDONE, SVC_DUP_EXT, SVC_DUPDONE_EXT
565 565 * Changes must be reviewed by Solaris File Sharing
566 566 * Changes must be communicated to contract-2003-523@sun.com
567 567 *
568 568 * SVC_DUP and SVC_DUPDONE are defined here for backward compatibility.
569 569 */
570 570 #define SVC_DUP_EXT(clone_xprt, req, res, size, drpp, dupcachedp) \
571 571 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, dupcachedp)
572 572
573 573 #define SVC_DUPDONE_EXT(clone_xprt, dr, res, resfree, size, status) \
574 574 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, resfree, size, status)
575 575
576 576 #define SVC_DUP(clone_xprt, req, res, size, drpp) \
577 577 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, NULL)
578 578
579 579 #define SVC_DUPDONE(clone_xprt, dr, res, size, status) \
580 580 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, NULL, size, status)
581 581
582 582 #define SVC_CLONE_DESTROY(clone_xprt) \
583 583 (*(clone_xprt)->xp_ops->xp_clone_destroy)(clone_xprt)
584 584
585 585
586 586 #define SVC_START(xprt) \
587 587 (*(xprt)->xp_ops->xp_start)(xprt)
588 588
589 589 #else /* _KERNEL */
590 590
591 591 #define SVC_RECV(xprt, msg) \
592 592 (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
593 593 #define svc_recv(xprt, msg) \
594 594 (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
595 595
596 596 #define SVC_STAT(xprt) \
597 597 (*(xprt)->xp_ops->xp_stat)(xprt)
598 598 #define svc_stat(xprt) \
599 599 (*(xprt)->xp_ops->xp_stat)(xprt)
600 600
601 601 #define SVC_GETARGS(xprt, xargs, argsp) \
602 602 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
603 603 #define svc_getargs(xprt, xargs, argsp) \
604 604 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
605 605
606 606 #define SVC_REPLY(xprt, msg) \
607 607 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
608 608 #define svc_reply(xprt, msg) \
609 609 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
610 610
611 611 #define SVC_FREEARGS(xprt, xargs, argsp) \
612 612 (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
613 613 #define svc_freeargs(xprt, xargs, argsp) \
614 614 (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
615 615
616 616 #define SVC_GETRES(xprt, size) \
617 617 (*(xprt)->xp_ops->xp_getres)((xprt), (size))
618 618 #define svc_getres(xprt, size) \
619 619 (*(xprt)->xp_ops->xp_getres)((xprt), (size))
620 620
621 621 #define SVC_FREERES(xprt) \
622 622 (*(xprt)->xp_ops->xp_freeres)(xprt)
623 623 #define svc_freeres(xprt) \
624 624 (*(xprt)->xp_ops->xp_freeres)(xprt)
625 625
626 626 #define SVC_DESTROY(xprt) \
627 627 (*(xprt)->xp_ops->xp_destroy)(xprt)
628 628 #define svc_destroy(xprt) \
629 629 (*(xprt)->xp_ops->xp_destroy)(xprt)
630 630
631 631 /*
632 632 * PSARC 2003/523 Contract Private Interface
633 633 * SVC_CONTROL
634 634 * Changes must be reviewed by Solaris File Sharing
635 635 * Changes must be communicated to contract-2003-523@sun.com
636 636 */
637 637 #define SVC_CONTROL(xprt, rq, in) \
638 638 (*(xprt)->xp_ops->xp_control)((xprt), (rq), (in))
639 639 #endif /* _KERNEL */
640 640
641 641 /*
642 642 * Pool id's reserved for NFS, NLM, and the NFSv4 callback program.
643 643 */
644 644 #define NFS_SVCPOOL_ID 0x01
645 645 #define NLM_SVCPOOL_ID 0x02
646 646 #define NFS_CB_SVCPOOL_ID 0x03
647 647 #define RDC_SVCPOOL_ID 0x05 /* SNDR, PSARC 2001/699 */
648 648
649 649 struct svcpool_args {
650 650 uint32_t id; /* Pool id */
651 651 uint32_t maxthreads; /* Max threads in the pool */
652 652 uint32_t redline; /* `Redline' for the pool */
653 653 uint32_t qsize; /* `xprt-ready' queue size */
654 654 uint32_t timeout; /* svc_poll() timeout */
655 655 uint32_t stksize; /* svc_run() stack size */
656 656 uint32_t max_same_xprt; /* Max reqs from the same xprt */
657 657 };
658 658
659 659
660 660 #ifdef _KERNEL
661 661 /*
662 662 * Transport registration and thread pool creation.
663 663 */
664 664 extern int svc_xprt_register(SVCMASTERXPRT *, int);
665 665 extern void svc_xprt_unregister(SVCMASTERXPRT *);
666 666 extern int svc_pool_create(struct svcpool_args *);
667 667 extern int svc_wait(int);
668 668 extern int svc_do_run(int);
669 669 #define SVCPSET_SHUTDOWN_PROC 1
670 670 #define SVCPSET_UNREGISTER_PROC 2
671 671 extern int svc_pool_control(int, int, void *);
672 672 #else /* _KERNEL */
673 673 #ifdef __STDC__
674 674 extern bool_t rpc_reg(const rpcprog_t, const rpcvers_t, const rpcproc_t,
675 675 char *(*)(char *), const xdrproc_t, const xdrproc_t,
676 676 const char *);
677 677
678 678 /*
679 679 * Service registration
680 680 *
681 681 * svc_reg(xprt, prog, vers, dispatch, nconf)
682 682 * const SVCXPRT *xprt;
683 683 * const rpcprog_t prog;
684 684 * const rpcvers_t vers;
685 685 * const void (*dispatch)();
686 686 * const struct netconfig *nconf;
687 687 */
688 688 extern bool_t svc_reg(const SVCXPRT *, const rpcprog_t, const rpcvers_t,
689 689 void (*)(struct svc_req *, SVCXPRT *),
690 690 const struct netconfig *);
691 691
692 692 /*
693 693 * Service authentication registration
694 694 *
695 695 * svc_auth_reg(cred_flavor, handler)
696 696 * int cred_flavor;
697 697 * enum auth_stat (*handler)();
698 698 */
699 699 extern int svc_auth_reg(int, enum auth_stat (*)());
700 700
701 701 /*
702 702 * Service un-registration
703 703 *
704 704 * svc_unreg(prog, vers)
705 705 * const rpcprog_t prog;
706 706 * const rpcvers_t vers;
707 707 */
708 708 extern void svc_unreg(const rpcprog_t, const rpcvers_t);
709 709
710 710 /*
711 711 * Transport registration/unregistration.
712 712 *
713 713 * xprt_register(xprt)
714 714 * const SVCXPRT *xprt;
715 715 *
716 716 * xprt_unregister(xprt)
717 717 * const SVCXPRT *xprt;
718 718 */
719 719 extern void xprt_register(const SVCXPRT *);
720 720 extern void xprt_unregister(const SVCXPRT *);
721 721 #else /* __STDC__ */
722 722 extern bool_t rpc_reg();
723 723 extern bool_t svc_reg();
724 724 extern bool_t svc_auth_reg();
725 725 extern void svc_unreg();
726 726 extern void xprt_register();
727 727 extern void xprt_unregister();
728 728 #endif /* __STDC__ */
729 729 #endif /* _KERNEL */
730 730
731 731
732 732 /*
733 733 * When the service routine is called, it must first check to see if it
734 734 * knows about the procedure; if not, it should call svcerr_noproc
735 735 * and return. If so, it should deserialize its arguments via
736 736 * SVC_GETARGS (defined above). If the deserialization does not work,
737 737 * svcerr_decode should be called followed by a return. Successful
738 738 * decoding of the arguments should be followed the execution of the
739 739 * procedure's code and a call to svc_sendreply.
740 740 *
741 741 * Also, if the service refuses to execute the procedure due to too-
742 742 * weak authentication parameters, svcerr_weakauth should be called.
743 743 * Note: do not confuse access-control failure with weak authentication!
744 744 *
745 745 * NB: In pure implementations of rpc, the caller always waits for a reply
746 746 * msg. This message is sent when svc_sendreply is called.
747 747 * Therefore pure service implementations should always call
748 748 * svc_sendreply even if the function logically returns void; use
749 749 * xdr.h - xdr_void for the xdr routine. HOWEVER, connectionful rpc allows
750 750 * for the abuse of pure rpc via batched calling or pipelining. In the
751 751 * case of a batched call, svc_sendreply should NOT be called since
752 752 * this would send a return message, which is what batching tries to avoid.
753 753 * It is the service/protocol writer's responsibility to know which calls are
754 754 * batched and which are not. Warning: responding to batch calls may
755 755 * deadlock the caller and server processes!
756 756 */
757 757 #ifdef __STDC__
758 758 extern bool_t svc_sendreply(const SVCXPRT *, const xdrproc_t, const caddr_t);
759 759 extern void svcerr_decode(const SVCXPRT *);
760 760 extern void svcerr_weakauth(const SVCXPRT *);
761 761 extern void svcerr_noproc(const SVCXPRT *);
762 762 extern void svcerr_progvers(const SVCXPRT *, const rpcvers_t,
763 763 const rpcvers_t);
764 764 extern void svcerr_auth(const SVCXPRT *, const enum auth_stat);
765 765 extern void svcerr_noprog(const SVCXPRT *);
766 766 extern void svcerr_systemerr(const SVCXPRT *);
767 767 extern void svcerr_badcred(const SVCXPRT *);
768 768 #else /* __STDC__ */
769 769 extern bool_t svc_sendreply();
770 770 extern void svcerr_decode();
771 771 extern void svcerr_weakauth();
772 772 extern void svcerr_noproc();
773 773 extern void svcerr_progvers();
774 774 extern void svcerr_auth();
775 775 extern void svcerr_noprog();
776 776 extern void svcerr_systemerr();
777 777 extern void svcerr_badcred();
778 778 #endif /* __STDC__ */
779 779
780 780 #ifdef _KERNEL
781 781 /*
782 782 * Kernel RPC functions.
783 783 */
784 784 extern void svc_init(void);
785 785 extern void svc_cots_init(void);
786 786 extern void svc_clts_init(void);
787 787 extern void mt_kstat_init(void);
788 788 extern void mt_kstat_fini(void);
789 789 extern int svc_tli_kcreate(struct file *, uint_t, char *,
790 790 struct netbuf *, SVCMASTERXPRT **,
791 791 SVC_CALLOUT_TABLE *,
792 792 void (*closeproc)(const SVCMASTERXPRT *),
793 793 int, bool_t);
794 794 extern int svc_clts_kcreate(struct file *, uint_t, struct T_info_ack *,
795 795 SVCMASTERXPRT **);
796 796 extern int svc_cots_kcreate(struct file *, uint_t, struct T_info_ack *,
797 797 SVCMASTERXPRT **);
798 798 extern bool_t svc_queuereq(queue_t *, mblk_t *, bool_t);
799 799 extern void svc_queueclean(queue_t *);
800 800 extern void svc_queueclose(queue_t *);
801 801 extern int svc_reserve_thread(SVCXPRT *);
802 802 extern void svc_unreserve_thread(SVCXPRT *);
803 803 extern callb_cpr_t *svc_detach_thread(SVCXPRT *);
804 804
805 805 /*
806 806 * For RDMA based kRPC.
807 807 * "rdma_xprt_record" is a reference to master transport handles
808 808 * in kRPC thread pools. This is an easy way of tracking and shuting
809 809 * down rdma based kRPC transports on demand.
810 810 * "rdma_xprt_group" is a list of RDMA based mster transport handles
811 811 * or records in a kRPC thread pool.
812 812 */
813 813 typedef struct rdma_xprt_record rdma_xprt_record_t;
814 814 struct rdma_xprt_record {
815 815 int rtr_type; /* Type of rdma; IB/VI/RDDP */
816 816 SVCMASTERXPRT *rtr_xprt_ptr; /* Ptr to master xprt handle */
817 817 rdma_xprt_record_t *rtr_next; /* Ptr to next record */
818 818 };
819 819
820 820 typedef struct {
821 821 int rtg_count; /* Number transport records */
822 822 int rtg_poolid; /* Pool Id for this group */
823 823 rdma_xprt_record_t *rtg_listhead; /* Head of the records list */
824 824 } rdma_xprt_group_t;
825 825
826 826 extern int svc_rdma_kcreate(char *, SVC_CALLOUT_TABLE *, int,
827 827 rdma_xprt_group_t *);
828 828 extern void svc_rdma_kstop(SVCMASTERXPRT *);
829 829 extern void svc_rdma_kdestroy(SVCMASTERXPRT *);
830 830 extern void rdma_stop(rdma_xprt_group_t *);
831 831
832 832 /*
833 833 * GSS cleanup method.
834 834 */
835 835 extern void rpc_gss_cleanup(SVCXPRT *);
836 836 #else /* _KERNEL */
837 837 /*
838 838 * Lowest level dispatching -OR- who owns this process anyway.
839 839 * Somebody has to wait for incoming requests and then call the correct
840 840 * service routine. The routine svc_run does infinite waiting; i.e.,
841 841 * svc_run never returns.
842 842 * Since another (co-existant) package may wish to selectively wait for
843 843 * incoming calls or other events outside of the rpc architecture, the
844 844 * routine svc_getreq_poll is provided. It must be passed pollfds, the
845 845 * "in-place" results of a poll call (see poll, section 2).
846 846 */
847 847
848 848 /*
849 849 * Global keeper of rpc service descriptors in use
850 850 * dynamic; must be inspected before each call to select or poll
851 851 */
852 852 extern pollfd_t *svc_pollfd;
853 853 extern int svc_max_pollfd;
854 854 extern fd_set svc_fdset;
855 855 #define svc_fds svc_fdset.fds_bits[0] /* compatibility */
856 856
857 857 /*
858 858 * A small program implemented by the svc_rpc implementation itself.
859 859 * Also see clnt.h for protocol numbers.
860 860 */
861 861 #ifdef __STDC__
862 862 extern void svc_getreq(int);
863 863 extern void svc_getreq_common(const int);
864 864 extern void svc_getreqset(fd_set *); /* takes fdset instead of int */
865 865 extern void svc_getreq_poll(struct pollfd *, const int);
866 866 extern void svc_run(void);
867 867 extern void svc_exit(void);
868 868 #else /* __STDC__ */
869 869 extern void rpctest_service();
870 870 extern void svc_getreqset();
871 871 extern void svc_getreq();
872 872 extern void svc_getreq_common();
873 873 extern void svc_getreqset(); /* takes fdset instead of int */
874 874 extern void svc_getreq_poll();
875 875 extern void svc_run();
876 876 extern void svc_exit();
877 877 #endif /* __STDC__ */
878 878
879 879 /*
880 880 * Functions used to manage user file descriptors
881 881 */
882 882 typedef int svc_input_id_t;
883 883 typedef void (*svc_callback_t)(svc_input_id_t id, int fd,
884 884 unsigned int events, void* cookie);
885 885
886 886 #ifdef __STDC__
887 887 extern svc_input_id_t svc_add_input(int fd, unsigned int events,
888 888 svc_callback_t user_callback,
889 889 void* cookie);
890 890 extern int svc_remove_input(svc_input_id_t id);
891 891 #else /* __STDC__ */
892 892 extern svc_input_id_t svc_add_input();
893 893 extern int svc_remove_input();
894 894 #endif
895 895
896 896 /*
897 897 * These are the existing service side transport implementations.
898 898 *
899 899 * Transport independent svc_create routine.
900 900 */
901 901 #ifdef __STDC__
902 902 extern int svc_create(void (*)(struct svc_req *, SVCXPRT *),
903 903 const rpcprog_t, const rpcvers_t,
904 904 const char *);
905 905 /*
906 906 * void (*dispatch)(); -- dispatch routine
907 907 * const rpcprog_t prognum; -- program number
908 908 * const rpcvers_t versnum; -- version number
909 909 * const char *nettype; -- network type
910 910 */
911 911
912 912 /*
913 913 * Generic server creation routine. It takes a netconfig structure
914 914 * instead of a nettype.
915 915 */
916 916 extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *),
↓ open down ↓ |
916 lines elided |
↑ open up ↑ |
917 917 const rpcprog_t, const rpcvers_t,
918 918 const struct netconfig *);
919 919 /*
920 920 * void (*dispatch)(); -- dispatch routine
921 921 * const rpcprog_t prognum; -- program number
922 922 * const rpcvers_t versnum; -- version number
923 923 * const struct netconfig *nconf; -- netconfig structure
924 924 */
925 925
926 926 /*
927 + * Variant of svc_tp_create that accepts a binding address.
928 + * If addr == NULL, this is the same as svc_tp_create().
929 + */
930 +extern SVCXPRT *svc_tp_create_addr(void (*)(struct svc_req *, SVCXPRT *),
931 + const rpcprog_t, const rpcvers_t,
932 + const struct netconfig *,
933 + const struct netbuf *);
934 + /*
935 + * void (*dispatch)(); -- dispatch routine
936 + * const rpcprog_t prognum; -- program number
937 + * const rpcvers_t versnum; -- version number
938 + * const struct netconfig *nconf; -- netconfig structure
939 + * const struct netbuf *addr; -- address to bind
940 + */
941 +
942 +/*
927 943 * Generic TLI create routine
928 944 */
929 945 extern SVCXPRT *svc_tli_create(const int, const struct netconfig *,
930 946 const struct t_bind *, const uint_t,
931 947 const uint_t);
932 948 /*
933 949 * const int fd; -- connection end point
934 950 * const struct netconfig *nconf; -- netconfig structure
935 951 * const struct t_bind *bindaddr; -- local bind address
936 952 * const uint_t sendsz; -- max sendsize
937 953 * const uint_t recvsz; -- max recvsize
938 954 */
939 955
940 956 /*
941 957 * Connectionless and connectionful create routines.
942 958 */
943 959 extern SVCXPRT *svc_vc_create(const int, const uint_t, const uint_t);
944 960 /*
945 961 * const int fd; -- open connection end point
946 962 * const uint_t sendsize; -- max send size
947 963 * const uint_t recvsize; -- max recv size
948 964 */
949 965
950 966 extern SVCXPRT *svc_dg_create(const int, const uint_t, const uint_t);
951 967 /*
952 968 * const int fd; -- open connection
953 969 * const uint_t sendsize; -- max send size
954 970 * const uint_t recvsize; -- max recv size
955 971 */
956 972
957 973 /*
958 974 * the routine takes any *open* TLI file
959 975 * descriptor as its first input and is used for open connections.
960 976 */
961 977 extern SVCXPRT *svc_fd_create(const int, const uint_t, const uint_t);
962 978 /*
963 979 * const int fd; -- open connection end point
964 980 * const uint_t sendsize; -- max send size
965 981 * const uint_t recvsize; -- max recv size
966 982 */
967 983
968 984 /*
969 985 * Memory based rpc (for speed check and testing)
970 986 */
971 987 extern SVCXPRT *svc_raw_create(void);
972 988
973 989 /*
974 990 * Creation of service over doors transport.
975 991 */
976 992 extern SVCXPRT *svc_door_create(void (*)(struct svc_req *, SVCXPRT *),
977 993 const rpcprog_t, const rpcvers_t,
978 994 const uint_t);
979 995 /*
980 996 * void (*dispatch)(); -- dispatch routine
981 997 * const rpcprog_t prognum; -- program number
982 998 * const rpcvers_t versnum; -- version number
983 999 * const uint_t sendsize; -- send buffer size
984 1000 */
985 1001
986 1002 /*
987 1003 * Service control interface
988 1004 */
989 1005 extern bool_t svc_control(SVCXPRT *, const uint_t, void *);
990 1006 /*
991 1007 * SVCXPRT *svc; -- service to manipulate
992 1008 * const uint_t req; -- request
993 1009 * void *info; -- argument to request
994 1010 */
995 1011
996 1012 /*
997 1013 * svc_dg_enable_cache() enables the cache on dg transports.
998 1014 */
999 1015 extern int svc_dg_enablecache(SVCXPRT *, const uint_t);
1000 1016 #else /* __STDC__ */
1001 1017 extern int svc_create();
1002 1018 extern SVCXPRT *svc_tp_create();
1003 1019 extern SVCXPRT *svc_tli_create();
1004 1020 extern SVCXPRT *svc_vc_create();
1005 1021 extern SVCXPRT *svc_dg_create();
1006 1022 extern SVCXPRT *svc_fd_create();
1007 1023 extern SVCXPRT *svc_raw_create();
1008 1024 extern SVCXPRT *svc_door_create();
1009 1025 extern int svc_dg_enablecache();
1010 1026 #endif /* __STDC__ */
1011 1027
1012 1028 extern boolean_t is_multilevel(rpcprog_t);
1013 1029
1014 1030 #ifdef PORTMAP
1015 1031 /* For backward compatibility */
1016 1032 #include <rpc/svc_soc.h>
1017 1033 #endif /* PORTMAP */
1018 1034
1019 1035 /*
1020 1036 * For user level MT hot server functions
1021 1037 */
1022 1038
1023 1039 /*
1024 1040 * Different MT modes
1025 1041 */
1026 1042 #define RPC_SVC_MT_NONE 0 /* default, single-threaded */
1027 1043 #define RPC_SVC_MT_AUTO 1 /* automatic MT mode */
1028 1044 #define RPC_SVC_MT_USER 2 /* user MT mode */
1029 1045
1030 1046 #ifdef __STDC__
1031 1047 extern void svc_done(SVCXPRT *);
1032 1048 #else
1033 1049 extern void svc_done();
1034 1050 #endif /* __STDC__ */
1035 1051
1036 1052 /*
1037 1053 * Obtaining local credentials.
1038 1054 */
1039 1055 typedef struct __svc_local_cred_t {
1040 1056 uid_t euid; /* effective uid */
1041 1057 gid_t egid; /* effective gid */
1042 1058 uid_t ruid; /* real uid */
1043 1059 gid_t rgid; /* real gid */
1044 1060 pid_t pid; /* caller's pid, or -1 if not available */
1045 1061 } svc_local_cred_t;
1046 1062
1047 1063 #ifdef __STDC__
1048 1064 struct ucred_s;
1049 1065 extern void svc_fd_negotiate_ucred(int);
1050 1066 extern int svc_getcallerucred(const SVCXPRT *, struct ucred_s **);
1051 1067 extern bool_t svc_get_local_cred(SVCXPRT *, svc_local_cred_t *);
1052 1068 #else
1053 1069 extern void svc_fd_negotiate_ucred();
1054 1070 extern int svc_getcallerucred();
1055 1071 extern bool_t svc_get_local_cred();
1056 1072 #endif /* __STDC__ */
1057 1073
1058 1074 /*
1059 1075 * Private interfaces and structures for user level duplicate request caching.
1060 1076 * The interfaces and data structures are not committed and subject to
1061 1077 * change in future releases. Currently only intended for use by automountd.
1062 1078 */
1063 1079 struct dupreq {
1064 1080 uint32_t dr_xid;
1065 1081 rpcproc_t dr_proc;
1066 1082 rpcvers_t dr_vers;
1067 1083 rpcprog_t dr_prog;
1068 1084 struct netbuf dr_addr;
1069 1085 struct netbuf dr_resp;
1070 1086 int dr_status;
1071 1087 time_t dr_time;
1072 1088 uint_t dr_hash;
1073 1089 struct dupreq *dr_next;
1074 1090 struct dupreq *dr_prev;
1075 1091 struct dupreq *dr_chain;
1076 1092 struct dupreq *dr_prevchain;
1077 1093 };
1078 1094
1079 1095 /*
1080 1096 * The fixedtime state is defined if we want to expand the routines to
1081 1097 * handle and encompass fixed size caches.
1082 1098 */
1083 1099 #define DUPCACHE_FIXEDTIME 0
1084 1100
1085 1101 /*
1086 1102 * States of requests for duplicate request caching.
1087 1103 * These are the same as defined for the kernel.
1088 1104 */
1089 1105 #define DUP_NEW 0x00 /* new entry */
1090 1106 #define DUP_INPROGRESS 0x01 /* request already going */
1091 1107 #define DUP_DONE 0x02 /* request done */
1092 1108 #define DUP_DROP 0x03 /* request dropped */
1093 1109 #define DUP_ERROR 0x04 /* error in dup req cache */
1094 1110
1095 1111 #ifdef __STDC__
1096 1112 extern bool_t __svc_dupcache_init(void *, int, char **);
1097 1113 extern int __svc_dup(struct svc_req *, caddr_t *, uint_t *, char *);
1098 1114 extern int __svc_dupdone(struct svc_req *, caddr_t, uint_t, int, char *);
1099 1115 extern bool_t __svc_vc_dupcache_init(SVCXPRT *, void *, int);
1100 1116 extern int __svc_vc_dup(struct svc_req *, caddr_t *, uint_t *);
1101 1117 extern int __svc_vc_dupdone(struct svc_req *, caddr_t, uint_t, int);
1102 1118 #else
1103 1119 extern bool_t __svc_dupcache_init();
1104 1120 extern int __svc_dup();
1105 1121 extern int __svc_dupdone();
1106 1122 extern bool_t __svc_vc_dupcache_init();
1107 1123 extern int __svc_vc_dup();
1108 1124 extern int __svc_vc_dupdone();
1109 1125 #endif /* __STDC__ */
1110 1126 #endif /* _KERNEL */
1111 1127
1112 1128 #ifdef _KERNEL
1113 1129 /*
1114 1130 * Private interfaces and structures for SVCXPRT cloning.
1115 1131 * The interfaces and data structures are not committed and subject to
1116 1132 * change in future releases.
1117 1133 */
1118 1134 extern SVCXPRT *svc_clone_init(void);
1119 1135 extern void svc_clone_free(SVCXPRT *);
1120 1136 extern void svc_clone_link(SVCMASTERXPRT *, SVCXPRT *, SVCXPRT *);
1121 1137 extern void svc_clone_unlink(SVCXPRT *);
1122 1138 #endif /* _KERNEL */
1123 1139
1124 1140 #ifdef __cplusplus
1125 1141 }
1126 1142 #endif
1127 1143
1128 1144 #endif /* !_RPC_SVC_H */
↓ open down ↓ |
192 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX