xref: /illumos-gate/usr/src/uts/common/rpc/svc.h (revision 214d537c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
220a4b0810SKaren Rochford  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
234a3b0527SAndy Fiddaman  * Copyright 2012 Marcel Telka <marcel@telka.sk>
242695d4f4SMarcel Telka  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
254a3b0527SAndy Fiddaman  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
287c478bd9Sstevel@tonic-gate /* All Rights Reserved */
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
317c478bd9Sstevel@tonic-gate  * 4.3 BSD under license from the Regents of the University of
327c478bd9Sstevel@tonic-gate  * California.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * svc.h, Server-side remote procedure call interface.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef	_RPC_SVC_H
407c478bd9Sstevel@tonic-gate #define	_RPC_SVC_H
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include <rpc/rpc_com.h>
437c478bd9Sstevel@tonic-gate #include <rpc/rpc_msg.h>
447c478bd9Sstevel@tonic-gate #include <sys/tihdr.h>
457c478bd9Sstevel@tonic-gate #include <sys/poll.h>
4645916cd2Sjpk #include <sys/tsol/label.h>
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
497c478bd9Sstevel@tonic-gate #include <rpc/svc_auth.h>
507c478bd9Sstevel@tonic-gate #include <sys/callb.h>
517c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * This interface must manage two items concerning remote procedure calling:
557c478bd9Sstevel@tonic-gate  *
567c478bd9Sstevel@tonic-gate  * 1) An arbitrary number of transport connections upon which rpc requests
577c478bd9Sstevel@tonic-gate  * are received. They are created and registered by routines in svc_generic.c,
587c478bd9Sstevel@tonic-gate  * svc_vc.c and svc_dg.c; they in turn call xprt_register and
597c478bd9Sstevel@tonic-gate  * xprt_unregister.
607c478bd9Sstevel@tonic-gate  *
617c478bd9Sstevel@tonic-gate  * 2) An arbitrary number of locally registered services.  Services are
627c478bd9Sstevel@tonic-gate  * described by the following four data: program number, version number,
637c478bd9Sstevel@tonic-gate  * "service dispatch" function, a transport handle, and a boolean that
647c478bd9Sstevel@tonic-gate  * indicates whether or not the exported program should be registered with a
657c478bd9Sstevel@tonic-gate  * local binder service;  if true the program's number and version and the
667c478bd9Sstevel@tonic-gate  * address from the transport handle are registered with the binder.
677c478bd9Sstevel@tonic-gate  * These data are registered with rpcbind via svc_reg().
687c478bd9Sstevel@tonic-gate  *
697c478bd9Sstevel@tonic-gate  * A service's dispatch function is called whenever an rpc request comes in
707c478bd9Sstevel@tonic-gate  * on a transport.  The request's program and version numbers must match
717c478bd9Sstevel@tonic-gate  * those of the registered service.  The dispatch function is passed two
727c478bd9Sstevel@tonic-gate  * parameters, struct svc_req * and SVCXPRT *, defined below.
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #ifdef __cplusplus
767c478bd9Sstevel@tonic-gate extern "C" {
777c478bd9Sstevel@tonic-gate #endif
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Server-side transport handles.
817c478bd9Sstevel@tonic-gate  * The actual type definitions are below.
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
847c478bd9Sstevel@tonic-gate typedef struct __svcmasterxprt	SVCMASTERXPRT;	/* Master transport handle */
857c478bd9Sstevel@tonic-gate typedef struct __svcxprt	SVCXPRT;	/* Per-thread clone handle */
867c478bd9Sstevel@tonic-gate typedef	struct __svcpool	SVCPOOL;	/* Kernel thread pool	   */
877c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
887c478bd9Sstevel@tonic-gate typedef struct __svcxprt	SVCXPRT;	/* Server transport handle */
897c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  *  Prototype of error handler callback
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate #ifndef _KERNEL
957c478bd9Sstevel@tonic-gate typedef void (*svc_errorhandler_t)(const SVCXPRT* svc, const bool_t isAConn);
967c478bd9Sstevel@tonic-gate #endif
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Service request.
1007c478bd9Sstevel@tonic-gate  *
1017c478bd9Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
1027c478bd9Sstevel@tonic-gate  * svc_req
1037c478bd9Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
1047c478bd9Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate struct svc_req {
1077c478bd9Sstevel@tonic-gate 	rpcprog_t	rq_prog;	/* service program number */
1087c478bd9Sstevel@tonic-gate 	rpcvers_t	rq_vers;	/* service protocol version */
1097c478bd9Sstevel@tonic-gate 	rpcproc_t	rq_proc;	/* the desired procedure */
1107c478bd9Sstevel@tonic-gate 	struct opaque_auth rq_cred;	/* raw creds from the wire */
1117c478bd9Sstevel@tonic-gate 	caddr_t		rq_clntcred;	/* read only cooked cred */
1127c478bd9Sstevel@tonic-gate 	SVCXPRT		*rq_xprt;	/* associated transport */
11345916cd2Sjpk 	bslabel_t	*rq_label;	/* TSOL label of the request */
1147c478bd9Sstevel@tonic-gate };
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #ifdef _KERNEL
1177c478bd9Sstevel@tonic-gate struct dupreq {
1187c478bd9Sstevel@tonic-gate 	uint32_t	dr_xid;
1197c478bd9Sstevel@tonic-gate 	rpcproc_t	dr_proc;
1207c478bd9Sstevel@tonic-gate 	rpcvers_t	dr_vers;
1217c478bd9Sstevel@tonic-gate 	rpcprog_t	dr_prog;
1227c478bd9Sstevel@tonic-gate 	struct netbuf	dr_addr;
1237c478bd9Sstevel@tonic-gate 	struct netbuf	dr_resp;
1247c478bd9Sstevel@tonic-gate 	void		(*dr_resfree)();
1257c478bd9Sstevel@tonic-gate 	int		dr_status;
1267c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_next;
1277c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_chain;
1287c478bd9Sstevel@tonic-gate };
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate /*
1317c478bd9Sstevel@tonic-gate  * States of requests for duplicate request caching.
1327c478bd9Sstevel@tonic-gate  */
1337c478bd9Sstevel@tonic-gate #define	DUP_NEW			0x00	/* new entry */
1347c478bd9Sstevel@tonic-gate #define	DUP_INPROGRESS		0x01	/* request already going */
1357c478bd9Sstevel@tonic-gate #define	DUP_DONE		0x02	/* request done */
1367c478bd9Sstevel@tonic-gate #define	DUP_DROP		0x03	/* request dropped */
1377c478bd9Sstevel@tonic-gate #define	DUP_ERROR		0x04	/* error in dup req cache */
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * Prototype for a service dispatch routine.
1417c478bd9Sstevel@tonic-gate  */
1427c478bd9Sstevel@tonic-gate typedef void (SVC_DISPATCH)(struct svc_req *, SVCXPRT *);
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate /*
1457c478bd9Sstevel@tonic-gate  * The service provider callout.
1467c478bd9Sstevel@tonic-gate  * Each entry identifies a dispatch routine to be called
1477c478bd9Sstevel@tonic-gate  * for a given RPC program number and a version fitting
1487c478bd9Sstevel@tonic-gate  * into the registered range.
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate typedef struct {
1517c478bd9Sstevel@tonic-gate 	rpcprog_t	sc_prog;	/* RPC Program number */
1527c478bd9Sstevel@tonic-gate 	rpcvers_t	sc_versmin;	/* Min version number */
1537c478bd9Sstevel@tonic-gate 	rpcvers_t	sc_versmax;	/* Max version number */
1547c478bd9Sstevel@tonic-gate 	SVC_DISPATCH	*sc_dispatch;	/* Dispatch routine   */
1557c478bd9Sstevel@tonic-gate } SVC_CALLOUT;
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /*
1587c478bd9Sstevel@tonic-gate  * Table of service provider `callouts' for an RPC
1597c478bd9Sstevel@tonic-gate  * transport handle. If sct_free is TRUE then transport
1607c478bd9Sstevel@tonic-gate  * destructor is supposed to deallocate this table.
1617c478bd9Sstevel@tonic-gate  */
1627c478bd9Sstevel@tonic-gate typedef struct {
1637c478bd9Sstevel@tonic-gate 	size_t		sct_size;	/* Number of entries  */
1647c478bd9Sstevel@tonic-gate 	bool_t		sct_free;	/* Deallocate if true */
1657c478bd9Sstevel@tonic-gate 	SVC_CALLOUT	*sct_sc;	/* Callout entries    */
1667c478bd9Sstevel@tonic-gate } SVC_CALLOUT_TABLE;
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate struct svc_ops {
1697c478bd9Sstevel@tonic-gate 	bool_t	(*xp_recv)(SVCXPRT *, mblk_t *, struct rpc_msg *);
1707c478bd9Sstevel@tonic-gate 		/* receive incoming requests */
1717c478bd9Sstevel@tonic-gate 	bool_t	(*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
1727c478bd9Sstevel@tonic-gate 		/* get arguments */
1737c478bd9Sstevel@tonic-gate 	bool_t	(*xp_reply)(SVCXPRT *, struct rpc_msg *);
1747c478bd9Sstevel@tonic-gate 		/* send reply */
1757c478bd9Sstevel@tonic-gate 	bool_t	(*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
1767c478bd9Sstevel@tonic-gate 		/* free mem allocated for args */
1777c478bd9Sstevel@tonic-gate 	void	(*xp_destroy)(SVCMASTERXPRT *);
1787c478bd9Sstevel@tonic-gate 		/* destroy this struct */
1797c478bd9Sstevel@tonic-gate 	int	(*xp_dup)(struct svc_req *, caddr_t, int,
1807c478bd9Sstevel@tonic-gate 				struct dupreq **, bool_t *);
1817c478bd9Sstevel@tonic-gate 		/* check for dup */
1827c478bd9Sstevel@tonic-gate 	void	(*xp_dupdone)(struct dupreq *, caddr_t, void (*)(), int, int);
1837c478bd9Sstevel@tonic-gate 		/* mark dup entry as completed */
1847c478bd9Sstevel@tonic-gate 	int32_t *(*xp_getres)(SVCXPRT *, int);
1857c478bd9Sstevel@tonic-gate 		/* get pointer to response buffer */
1867c478bd9Sstevel@tonic-gate 	void	(*xp_freeres)(SVCXPRT *);
1877c478bd9Sstevel@tonic-gate 		/* destroy pre-serialized response */
1887c478bd9Sstevel@tonic-gate 	void	(*xp_clone_destroy)(SVCXPRT *);
1897c478bd9Sstevel@tonic-gate 		/* destroy a clone xprt */
1907c478bd9Sstevel@tonic-gate 	void	(*xp_start)(SVCMASTERXPRT *);
1917c478bd9Sstevel@tonic-gate 		/* `ready-to-receive' */
19260536ef9SKaren Rochford 	void	(*xp_clone_xprt)(SVCXPRT *, SVCXPRT *);
19360536ef9SKaren Rochford 		/* transport specific clone function */
1944a3b0527SAndy Fiddaman 	void	(*xp_tattrs)(SVCXPRT *, int, void **);
1954a3b0527SAndy Fiddaman 		/* transport specific hold function */
1964a3b0527SAndy Fiddaman 	void	(*xp_hold)(queue_t *);
1974a3b0527SAndy Fiddaman 		/* transport specific release function */
1984a3b0527SAndy Fiddaman 	void	(*xp_release)(queue_t *, mblk_t *, bool_t);
1997c478bd9Sstevel@tonic-gate };
2000a4b0810SKaren Rochford 
2010a4b0810SKaren Rochford #define	SVC_TATTR_ADDRMASK	1
2020a4b0810SKaren Rochford 
2037c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
2047c478bd9Sstevel@tonic-gate /*
2057c478bd9Sstevel@tonic-gate  *	Service control requests
2067c478bd9Sstevel@tonic-gate  */
2077c478bd9Sstevel@tonic-gate #define	SVCGET_VERSQUIET	1
2087c478bd9Sstevel@tonic-gate #define	SVCSET_VERSQUIET	2
2097c478bd9Sstevel@tonic-gate #define	SVCGET_XID		4
2107c478bd9Sstevel@tonic-gate #define	SVCSET_KEEPALIVE	5
2117c478bd9Sstevel@tonic-gate #define	SVCSET_CONNMAXREC	6
2127c478bd9Sstevel@tonic-gate #define	SVCGET_CONNMAXREC	7
2137c478bd9Sstevel@tonic-gate #define	SVCGET_RECVERRHANDLER	8
2147c478bd9Sstevel@tonic-gate #define	SVCSET_RECVERRHANDLER	9
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate enum xprt_stat {
2177c478bd9Sstevel@tonic-gate 	XPRT_DIED,
2187c478bd9Sstevel@tonic-gate 	XPRT_MOREREQS,
2197c478bd9Sstevel@tonic-gate 	XPRT_IDLE
2207c478bd9Sstevel@tonic-gate };
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate struct xp_ops {
2237c478bd9Sstevel@tonic-gate #ifdef	__STDC__
2247c478bd9Sstevel@tonic-gate 	bool_t	(*xp_recv)(SVCXPRT *, struct rpc_msg *);
2257c478bd9Sstevel@tonic-gate 		/* receive incoming requests */
2267c478bd9Sstevel@tonic-gate 	enum xprt_stat (*xp_stat)(SVCXPRT *);
2277c478bd9Sstevel@tonic-gate 		/* get transport status */
2287c478bd9Sstevel@tonic-gate 	bool_t	(*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
2297c478bd9Sstevel@tonic-gate 		/* get arguments */
2307c478bd9Sstevel@tonic-gate 	bool_t	(*xp_reply)(SVCXPRT *,	struct rpc_msg *);
2317c478bd9Sstevel@tonic-gate 		/* send reply */
2327c478bd9Sstevel@tonic-gate 	bool_t	(*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
2337c478bd9Sstevel@tonic-gate 		/* free mem allocated for args */
2347c478bd9Sstevel@tonic-gate 	void	(*xp_destroy)(SVCXPRT *);
2357c478bd9Sstevel@tonic-gate 		/* destroy this struct */
2367c478bd9Sstevel@tonic-gate 	bool_t	(*xp_control)(SVCXPRT *, const uint_t,	void *);
2377c478bd9Sstevel@tonic-gate 		/* catch-all control function */
2387c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
2397c478bd9Sstevel@tonic-gate 	bool_t	(*xp_recv)(); /* receive incoming requests */
2407c478bd9Sstevel@tonic-gate 	enum xprt_stat (*xp_stat)(); /* get transport status */
2417c478bd9Sstevel@tonic-gate 	bool_t	(*xp_getargs)(); /* get arguments */
2427c478bd9Sstevel@tonic-gate 	bool_t	(*xp_reply)(); /* send reply */
2437c478bd9Sstevel@tonic-gate 	bool_t	(*xp_freeargs)(); /* free mem allocated for args */
2447c478bd9Sstevel@tonic-gate 	void	(*xp_destroy)(); /* destroy this struct */
2457c478bd9Sstevel@tonic-gate 	bool_t	(*xp_control)(); /* catch-all control function */
2467c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
2477c478bd9Sstevel@tonic-gate };
2487c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
2517c478bd9Sstevel@tonic-gate /*
2527c478bd9Sstevel@tonic-gate  * SVCPOOL
2537c478bd9Sstevel@tonic-gate  * Kernel RPC server-side thread pool structure.
2547c478bd9Sstevel@tonic-gate  */
2557c478bd9Sstevel@tonic-gate typedef struct __svcxprt_qnode __SVCXPRT_QNODE;	/* Defined in svc.c */
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate struct __svcpool {
2587c478bd9Sstevel@tonic-gate 	/*
2597c478bd9Sstevel@tonic-gate 	 * Thread pool variables.
2607c478bd9Sstevel@tonic-gate 	 *
2617c478bd9Sstevel@tonic-gate 	 * The pool's thread lock p_thread_lock protects:
2627c478bd9Sstevel@tonic-gate 	 * - p_threads, p_detached_threads, p_reserved_threads and p_closing
2637c478bd9Sstevel@tonic-gate 	 * The pool's request lock protects:
2642695d4f4SMarcel Telka 	 * - p_asleep, p_drowsy, p_reqs, p_size, p_walkers, p_req_cv.
2657c478bd9Sstevel@tonic-gate 	 * The following fields are `initialized constants':
2667c478bd9Sstevel@tonic-gate 	 * - p_id, p_stksize, p_timeout.
2677c478bd9Sstevel@tonic-gate 	 * Access to p_next and p_prev is protected by the pool
2687c478bd9Sstevel@tonic-gate 	 * list lock.
2697c478bd9Sstevel@tonic-gate 	 */
2707c478bd9Sstevel@tonic-gate 	SVCPOOL		*p_next;		/* Next pool in the list  */
2717c478bd9Sstevel@tonic-gate 	SVCPOOL		*p_prev;		/* Prev pool in the list  */
2727c478bd9Sstevel@tonic-gate 	int		p_id;			/* Pool id		  */
2737c478bd9Sstevel@tonic-gate 	int		p_threads;		/* Non-detached threads	  */
2747c478bd9Sstevel@tonic-gate 	int		p_detached_threads;	/* Detached threads	  */
2757c478bd9Sstevel@tonic-gate 	int		p_maxthreads;		/* Max threads in the pool */
2767c478bd9Sstevel@tonic-gate 	int		p_redline;		/* `Redline' for the pool */
2777c478bd9Sstevel@tonic-gate 	int		p_reserved_threads;	/* Reserved threads	  */
2787c478bd9Sstevel@tonic-gate 	kmutex_t	p_thread_lock;		/* Thread lock		  */
2797c478bd9Sstevel@tonic-gate 	int		p_asleep;		/* Asleep threads	  */
2807c478bd9Sstevel@tonic-gate 	int		p_drowsy;		/* Drowsy flag		  */
2814a3b0527SAndy Fiddaman 	kcondvar_t	p_req_cv;		/* svc_poll() sleep var.  */
2827c478bd9Sstevel@tonic-gate 	clock_t		p_timeout;		/* svc_poll() timeout	  */
2837c478bd9Sstevel@tonic-gate 	kmutex_t	p_req_lock;		/* Request lock		  */
2847c478bd9Sstevel@tonic-gate 	int		p_reqs;			/* Pending requests	  */
2857c478bd9Sstevel@tonic-gate 	int		p_walkers;		/* Walking threads	  */
2867c478bd9Sstevel@tonic-gate 	int		p_max_same_xprt;	/* Max reqs from the xprt */
2877c478bd9Sstevel@tonic-gate 	int		p_stksize;		/* Stack size for svc_run */
2887c478bd9Sstevel@tonic-gate 	bool_t		p_closing : 1;		/* Pool is closing	  */
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate 	/*
2917c478bd9Sstevel@tonic-gate 	 * Thread creator variables.
2927c478bd9Sstevel@tonic-gate 	 * The `creator signaled' flag is turned on when a signal is send
2937c478bd9Sstevel@tonic-gate 	 * to the creator thread (to create a new service thread). The
2947c478bd9Sstevel@tonic-gate 	 * creator clears when the thread is created. The protocol is not
2957c478bd9Sstevel@tonic-gate 	 * to signal the creator thread when the flag is on. However,
2967c478bd9Sstevel@tonic-gate 	 * a new thread should signal the creator if there are more
2977c478bd9Sstevel@tonic-gate 	 * requests in the queue.
2987c478bd9Sstevel@tonic-gate 	 *
2997c478bd9Sstevel@tonic-gate 	 * When the pool is closing (ie it has been already unregistered from
3007c478bd9Sstevel@tonic-gate 	 * the pool list) the last thread on the last transport should turn
3017c478bd9Sstevel@tonic-gate 	 * the p_creator_exit flag on. This tells the creator thread to
3027c478bd9Sstevel@tonic-gate 	 * free the pool structure and exit.
3037c478bd9Sstevel@tonic-gate 	 */
3047c478bd9Sstevel@tonic-gate 	bool_t		p_creator_signaled : 1;	/* Create requested flag  */
3057c478bd9Sstevel@tonic-gate 	bool_t		p_creator_exit : 1;	/* If true creator exits  */
3067c478bd9Sstevel@tonic-gate 	kcondvar_t	p_creator_cv;		/* Creator cond. variable */
3077c478bd9Sstevel@tonic-gate 	kmutex_t	p_creator_lock;		/* Creator lock		  */
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate 	/*
3107c478bd9Sstevel@tonic-gate 	 * Doubly linked list containing `registered' master transport handles.
3117c478bd9Sstevel@tonic-gate 	 * There is no special structure for a list node. Instead the
3127c478bd9Sstevel@tonic-gate 	 * SVCMASTERXPRT structure has the xp_next and xp_prev fields.
3137c478bd9Sstevel@tonic-gate 	 *
3147c478bd9Sstevel@tonic-gate 	 * The p_lrwlock protects access to xprt->xp_next and xprt->xp_prev.
3157c478bd9Sstevel@tonic-gate 	 * A service thread should also acquire a reader lock before accessing
3167c478bd9Sstevel@tonic-gate 	 * any transports it is no longer linked to (to prevent them from
3177c478bd9Sstevel@tonic-gate 	 * being destroyed).
3187c478bd9Sstevel@tonic-gate 	 *
3197c478bd9Sstevel@tonic-gate 	 * The list lock governs also the `pool is closing' flag.
3207c478bd9Sstevel@tonic-gate 	 */
3217c478bd9Sstevel@tonic-gate 	size_t		p_lcount;		/* Current count	  */
3227c478bd9Sstevel@tonic-gate 	SVCMASTERXPRT	*p_lhead;		/* List head		  */
3237c478bd9Sstevel@tonic-gate 	krwlock_t	p_lrwlock;		/* R/W lock		  */
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate 	/*
3267c478bd9Sstevel@tonic-gate 	 * Circular linked list for the `xprt-ready' queue (FIFO).
3277c478bd9Sstevel@tonic-gate 	 * Must be initialized with svc_xprt_qinit() before it is used.
3287c478bd9Sstevel@tonic-gate 	 *
3297c478bd9Sstevel@tonic-gate 	 * The writer's end is protected by the pool's request lock
3307c478bd9Sstevel@tonic-gate 	 * (pool->p_req_lock). The reader's end is protected by q_end_lock.
3317c478bd9Sstevel@tonic-gate 	 *
3327c478bd9Sstevel@tonic-gate 	 * When the queue is full the p_qoverflow flag is raised. It stays
3337c478bd9Sstevel@tonic-gate 	 * on until all the pending request are drained.
3347c478bd9Sstevel@tonic-gate 	 */
3357c478bd9Sstevel@tonic-gate 	size_t		p_qsize;		/* Number of queue nodes  */
3367c478bd9Sstevel@tonic-gate 	int		p_qoverflow : 1;	/* Overflow flag	  */
3377c478bd9Sstevel@tonic-gate 	__SVCXPRT_QNODE *p_qbody;		/* Queue body (array)	  */
3387c478bd9Sstevel@tonic-gate 	__SVCXPRT_QNODE *p_qtop;		/* Writer's end of FIFO   */
3397c478bd9Sstevel@tonic-gate 	__SVCXPRT_QNODE *p_qend;		/* Reader's end of FIFO	  */
3407c478bd9Sstevel@tonic-gate 	kmutex_t	p_qend_lock;		/* Reader's end lock	  */
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate 	/*
3437c478bd9Sstevel@tonic-gate 	 * Userspace thread creator variables.
3447c478bd9Sstevel@tonic-gate 	 * Thread creation is actually done in userland, via a thread
3457c478bd9Sstevel@tonic-gate 	 * that is parked in the kernel. When that thread is signaled,
3467c478bd9Sstevel@tonic-gate 	 * it returns back down to the daemon from whence it came and
3477c478bd9Sstevel@tonic-gate 	 * does the lwp create.
3487c478bd9Sstevel@tonic-gate 	 *
3497c478bd9Sstevel@tonic-gate 	 * A parallel "creator" thread runs in the kernel. That is the
3507c478bd9Sstevel@tonic-gate 	 * thread that will signal for the user thread to return to
3517c478bd9Sstevel@tonic-gate 	 * userland and do its work.
3527c478bd9Sstevel@tonic-gate 	 *
3537c478bd9Sstevel@tonic-gate 	 * Since the thread doesn't always exist (there could be a race
3547c478bd9Sstevel@tonic-gate 	 * if two threads are created in rapid succession), we set
3557c478bd9Sstevel@tonic-gate 	 * p_signal_create_thread to FALSE when we're ready to accept work.
3567c478bd9Sstevel@tonic-gate 	 *
3577c478bd9Sstevel@tonic-gate 	 * p_user_exit is set to true when the service pool is about
3587c478bd9Sstevel@tonic-gate 	 * to close. This is done so that the user creation thread
3597c478bd9Sstevel@tonic-gate 	 * can be informed and cleanup any userland state.
3607c478bd9Sstevel@tonic-gate 	 */
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate 	bool_t		p_signal_create_thread : 1; /* Create requested flag  */
3637c478bd9Sstevel@tonic-gate 	bool_t		p_user_exit : 1;	/* If true creator exits  */
3647c478bd9Sstevel@tonic-gate 	bool_t		p_user_waiting : 1;	/* Thread waiting for work */
3657c478bd9Sstevel@tonic-gate 	kcondvar_t	p_user_cv;		/* Creator cond. variable */
3667c478bd9Sstevel@tonic-gate 	kmutex_t	p_user_lock;		/* Creator lock		  */
3677c478bd9Sstevel@tonic-gate 	void		(*p_offline)();		/* callout for unregister */
3687c478bd9Sstevel@tonic-gate 	void		(*p_shutdown)();	/* callout for shutdown */
3692695d4f4SMarcel Telka 
3702695d4f4SMarcel Telka 	size_t		p_size;			/* Total size of queued msgs */
3717c478bd9Sstevel@tonic-gate };
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate /*
3747c478bd9Sstevel@tonic-gate  * Server side transport handle (SVCMASTERXPRT).
3757c478bd9Sstevel@tonic-gate  * xprt->xp_req_lock governs the following fields in xprt:
3767c478bd9Sstevel@tonic-gate  *		xp_req_head, xp_req_tail.
3777c478bd9Sstevel@tonic-gate  * xprt->xp_thread_lock governs the following fields in xprt:
3787c478bd9Sstevel@tonic-gate  *		xp_threads, xp_detached_threads.
3797c478bd9Sstevel@tonic-gate  *
3807c478bd9Sstevel@tonic-gate  * xp_req_tail is only valid if xp_req_head is non-NULL
3817c478bd9Sstevel@tonic-gate  *
3827c478bd9Sstevel@tonic-gate  * The xp_threads count is the number of attached threads.  These threads
3837c478bd9Sstevel@tonic-gate  * are able to handle new requests, and it is expected that they will not
3847c478bd9Sstevel@tonic-gate  * block for a very long time handling a given request. The
3857c478bd9Sstevel@tonic-gate  * xp_detached_threads count is the number of threads that have detached
3867c478bd9Sstevel@tonic-gate  * themselves from the transport. These threads can block indefinitely
3877c478bd9Sstevel@tonic-gate  * while handling a request.  Once they complete the request, they exit.
3887c478bd9Sstevel@tonic-gate  *
3897c478bd9Sstevel@tonic-gate  * A kernel service provider may register a callback function "closeproc"
3907c478bd9Sstevel@tonic-gate  * for a transport.  When the transport is closing the last exiting attached
3917c478bd9Sstevel@tonic-gate  * thread - xp_threads goes to zero - it calls the callback function, passing
3927c478bd9Sstevel@tonic-gate  * it a reference to the transport.  This call is made with xp_thread_lock
3937c478bd9Sstevel@tonic-gate  * held, so any cleanup bookkeeping it does should be done quickly.
3947c478bd9Sstevel@tonic-gate  *
3957c478bd9Sstevel@tonic-gate  * When the transport is closing the last exiting thread is supposed
3967c478bd9Sstevel@tonic-gate  * to destroy/free the data structure.
3977c478bd9Sstevel@tonic-gate  */
3987c478bd9Sstevel@tonic-gate typedef struct __svcxprt_common {
3997c478bd9Sstevel@tonic-gate 	struct file	*xpc_fp;
4007c478bd9Sstevel@tonic-gate 	struct svc_ops	*xpc_ops;
4017c478bd9Sstevel@tonic-gate 	queue_t		*xpc_wq;	/* queue to write onto		*/
4027c478bd9Sstevel@tonic-gate 	cred_t		*xpc_cred;	/* cached cred for server to use */
4037c478bd9Sstevel@tonic-gate 	int32_t		xpc_type;	/* transport type		*/
4047c478bd9Sstevel@tonic-gate 	int		xpc_msg_size;	/* TSDU or TIDU size		*/
4057c478bd9Sstevel@tonic-gate 	struct netbuf	xpc_rtaddr;	/* remote transport address	*/
406e810a982Svv 	struct netbuf	xpc_lcladdr;	/* local transport address	*/
4077523bef8SSiddheshwar Mahesh 	char		*xpc_netid;	/* network token		*/
4087c478bd9Sstevel@tonic-gate 	SVC_CALLOUT_TABLE *xpc_sct;
4097c478bd9Sstevel@tonic-gate } __SVCXPRT_COMMON;
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate #define	xp_fp		xp_xpc.xpc_fp
4127c478bd9Sstevel@tonic-gate #define	xp_ops		xp_xpc.xpc_ops
4137c478bd9Sstevel@tonic-gate #define	xp_wq		xp_xpc.xpc_wq
4147c478bd9Sstevel@tonic-gate #define	xp_cred		xp_xpc.xpc_cred
4157c478bd9Sstevel@tonic-gate #define	xp_type		xp_xpc.xpc_type
4167c478bd9Sstevel@tonic-gate #define	xp_msg_size	xp_xpc.xpc_msg_size
4177c478bd9Sstevel@tonic-gate #define	xp_rtaddr	xp_xpc.xpc_rtaddr
418e810a982Svv #define	xp_lcladdr	xp_xpc.xpc_lcladdr
4197c478bd9Sstevel@tonic-gate #define	xp_sct		xp_xpc.xpc_sct
4207523bef8SSiddheshwar Mahesh #define	xp_netid	xp_xpc.xpc_netid
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate struct __svcmasterxprt {
4234a3b0527SAndy Fiddaman 	SVCMASTERXPRT	*xp_next;	/* Next transport in the list	*/
4244a3b0527SAndy Fiddaman 	SVCMASTERXPRT	*xp_prev;	/* Prev transport in the list	*/
4257c478bd9Sstevel@tonic-gate 	__SVCXPRT_COMMON xp_xpc;	/* Fields common with the clone	*/
4267c478bd9Sstevel@tonic-gate 	SVCPOOL		*xp_pool;	/* Pointer to the pool		*/
4277c478bd9Sstevel@tonic-gate 	mblk_t		*xp_req_head;	/* Request queue head		*/
4287c478bd9Sstevel@tonic-gate 	mblk_t		*xp_req_tail;	/* Request queue tail		*/
4297c478bd9Sstevel@tonic-gate 	kmutex_t	xp_req_lock;	/* Request lock			*/
4307c478bd9Sstevel@tonic-gate 	int		xp_threads;	/* Current num. of attached threads */
4317c478bd9Sstevel@tonic-gate 	int		xp_detached_threads; /* num. of detached threads */
4327c478bd9Sstevel@tonic-gate 	kmutex_t	xp_thread_lock;	/* Thread count lock		*/
4337c478bd9Sstevel@tonic-gate 	void		(*xp_closeproc)(const SVCMASTERXPRT *);
4347c478bd9Sstevel@tonic-gate 					/* optional; see comments above	*/
4357c478bd9Sstevel@tonic-gate 	struct netbuf	xp_addrmask;	/* address mask			*/
4367c478bd9Sstevel@tonic-gate 
4377c478bd9Sstevel@tonic-gate 	caddr_t		xp_p2;		/* private: for use by svc ops  */
4382695d4f4SMarcel Telka 
4392695d4f4SMarcel Telka 	int		xp_full : 1;	/* xprt is full			*/
4402695d4f4SMarcel Telka 	int		xp_enable : 1;	/* xprt needs to be enabled	*/
4412695d4f4SMarcel Telka 	int		xp_reqs;	/* number of requests queued	*/
4422695d4f4SMarcel Telka 	size_t		xp_size;	/* total size of queued msgs	*/
4437c478bd9Sstevel@tonic-gate };
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate /*
4467c478bd9Sstevel@tonic-gate  * Service thread `clone' transport handle (SVCXPRT)
4477c478bd9Sstevel@tonic-gate  *
4487c478bd9Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
4497c478bd9Sstevel@tonic-gate  * SVCXPRT
4507c478bd9Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
4517c478bd9Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
4527c478bd9Sstevel@tonic-gate  *
4537c478bd9Sstevel@tonic-gate  * The xp_p2buf buffer is used as the storage for a transport type
4547c478bd9Sstevel@tonic-gate  * specific structure. It is private for the svc ops for a given
4557c478bd9Sstevel@tonic-gate  * transport type.
4567c478bd9Sstevel@tonic-gate  */
4577c478bd9Sstevel@tonic-gate 
4580a701b1eSRobert Gordon #define	SVC_P2LEN   128
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate struct __svcxprt {
4617c478bd9Sstevel@tonic-gate 	__SVCXPRT_COMMON xp_xpc;
4627c478bd9Sstevel@tonic-gate 	SVCMASTERXPRT	*xp_master;	/* back ptr to master		*/
4637c478bd9Sstevel@tonic-gate 
4647c478bd9Sstevel@tonic-gate 	/* The following fileds are on a per-thread basis */
4657c478bd9Sstevel@tonic-gate 	callb_cpr_t	*xp_cprp;	/* unused padding for Contract	*/
4667c478bd9Sstevel@tonic-gate 	bool_t		xp_reserved : 1; /* is thread reserved?		*/
4677c478bd9Sstevel@tonic-gate 	bool_t		xp_detached : 1; /* is thread detached?		*/
4687c478bd9Sstevel@tonic-gate 	int		xp_same_xprt;	/* Reqs from the same xprt	*/
4697c478bd9Sstevel@tonic-gate 
4707c478bd9Sstevel@tonic-gate 	/* The following fields are used on a per-request basis */
4717c478bd9Sstevel@tonic-gate 	struct opaque_auth xp_verf;	/* raw response verifier	*/
4727c478bd9Sstevel@tonic-gate 	SVCAUTH		xp_auth;	/* auth flavor of current req	*/
4737c478bd9Sstevel@tonic-gate 	void		*xp_cookie;	/* a cookie			*/
4747c478bd9Sstevel@tonic-gate 	uint32_t	xp_xid;		/* id				*/
4757c478bd9Sstevel@tonic-gate 	XDR		xp_xdrin;	/* input xdr stream		*/
4767c478bd9Sstevel@tonic-gate 	XDR		xp_xdrout;	/* output xdr stream		*/
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate 	/* Private for svc ops */
4797c478bd9Sstevel@tonic-gate 	char		xp_p2buf[SVC_P2LEN]; /* udp_data or cots_data_t */
4807c478bd9Sstevel@tonic-gate 						/* or clone_rdma_data_t */
4817c478bd9Sstevel@tonic-gate };
4827c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
4837c478bd9Sstevel@tonic-gate struct __svcxprt {
4847c478bd9Sstevel@tonic-gate 	int		xp_fd;
4857c478bd9Sstevel@tonic-gate #define	xp_sock		xp_fd
4867c478bd9Sstevel@tonic-gate 	ushort_t	xp_port;
4877c478bd9Sstevel@tonic-gate 	/*
4887c478bd9Sstevel@tonic-gate 	 * associated port number.
4897c478bd9Sstevel@tonic-gate 	 * Obsolete, but still used to
4907c478bd9Sstevel@tonic-gate 	 * specify whether rendezvouser
4917c478bd9Sstevel@tonic-gate 	 * or normal connection
4927c478bd9Sstevel@tonic-gate 	 */
4937c478bd9Sstevel@tonic-gate 	struct	xp_ops	*xp_ops;
4947c478bd9Sstevel@tonic-gate 	int		xp_addrlen;	/* length of remote addr. Obsoleted */
4957c478bd9Sstevel@tonic-gate 	char		*xp_tp;		/* transport provider device name */
4967c478bd9Sstevel@tonic-gate 	char		*xp_netid;	/* network token */
4977c478bd9Sstevel@tonic-gate 	struct netbuf	xp_ltaddr;	/* local transport address */
4987c478bd9Sstevel@tonic-gate 	struct netbuf	xp_rtaddr;	/* remote transport address */
4997c478bd9Sstevel@tonic-gate 	char		xp_raddr[16];	/* remote address. Now obsoleted */
5007c478bd9Sstevel@tonic-gate 	struct opaque_auth xp_verf;	/* raw response verifier */
5017c478bd9Sstevel@tonic-gate 	caddr_t		xp_p1;		/* private: for use by svc ops */
5027c478bd9Sstevel@tonic-gate 	caddr_t		xp_p2;		/* private: for use by svc ops */
5037c478bd9Sstevel@tonic-gate 	caddr_t		xp_p3;		/* private: for use by svc lib */
5047c478bd9Sstevel@tonic-gate 	int		xp_type;	/* transport type */
5057c478bd9Sstevel@tonic-gate 	/*
5067c478bd9Sstevel@tonic-gate 	 * callback on client death
5077c478bd9Sstevel@tonic-gate 	 * First parameter is the current structure,
5087c478bd9Sstevel@tonic-gate 	 * Second parameter :
5097c478bd9Sstevel@tonic-gate 	 *	- FALSE for the service listener
5107c478bd9Sstevel@tonic-gate 	 *	- TRUE for a real connected socket
5117c478bd9Sstevel@tonic-gate 	 */
5127c478bd9Sstevel@tonic-gate 	svc_errorhandler_t xp_closeclnt;
5137c478bd9Sstevel@tonic-gate };
5147c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate /*
5177c478bd9Sstevel@tonic-gate  *  Approved way of getting address of caller,
5187c478bd9Sstevel@tonic-gate  *  address mask, and netid of transport.
5197c478bd9Sstevel@tonic-gate  */
5207c478bd9Sstevel@tonic-gate #define	svc_getrpccaller(x) (&(x)->xp_rtaddr)
5217c478bd9Sstevel@tonic-gate #ifdef _KERNEL
5227c478bd9Sstevel@tonic-gate #define	svc_getcaller(x) (&(x)->xp_rtaddr.buf)
5237c478bd9Sstevel@tonic-gate #define	svc_getaddrmask(x) (&(x)->xp_master->xp_addrmask)
5247523bef8SSiddheshwar Mahesh #define	svc_getnetid(x) ((x)->xp_netid)
5257c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate /*
5287c478bd9Sstevel@tonic-gate  * Operations defined on an SVCXPRT handle
5297c478bd9Sstevel@tonic-gate  */
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
53260536ef9SKaren Rochford 
5330a4b0810SKaren Rochford #define	SVC_GETADDRMASK(clone_xprt, attrflag, tattr) \
5340a4b0810SKaren Rochford (*(clone_xprt)->xp_ops->xp_tattrs)((clone_xprt), (attrflag), (tattr))
5350a4b0810SKaren Rochford 
53660536ef9SKaren Rochford #define	SVC_CLONE_XPRT(src_xprt, dst_xprt) \
53760536ef9SKaren Rochford 	if ((src_xprt)->xp_ops->xp_clone_xprt) \
53860536ef9SKaren Rochford 		(*(src_xprt)->xp_ops->xp_clone_xprt) \
53960536ef9SKaren Rochford 		    (src_xprt, dst_xprt)
54060536ef9SKaren Rochford 
5414a3b0527SAndy Fiddaman #define	SVC_HOLD(xprt) \
5424a3b0527SAndy Fiddaman 	if ((xprt)->xp_ops->xp_hold) \
5434a3b0527SAndy Fiddaman 		(*(xprt)->xp_ops->xp_hold)((xprt)->xp_wq)
5444a3b0527SAndy Fiddaman 
5454a3b0527SAndy Fiddaman #define	SVC_RELE(xprt, mp, enable) \
5464a3b0527SAndy Fiddaman 	if ((xprt)->xp_ops->xp_release) \
5474a3b0527SAndy Fiddaman 		(*(xprt)->xp_ops->xp_release)((xprt)->xp_wq, (mp), (enable))
5484a3b0527SAndy Fiddaman 
5497c478bd9Sstevel@tonic-gate #define	SVC_RECV(clone_xprt, mp, msg) \
5507c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_recv)((clone_xprt), (mp), (msg))
5517c478bd9Sstevel@tonic-gate 
5527c478bd9Sstevel@tonic-gate /*
5537c478bd9Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
5547c478bd9Sstevel@tonic-gate  * SVC_GETARGS
5557c478bd9Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
5567c478bd9Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
5577c478bd9Sstevel@tonic-gate  */
5587c478bd9Sstevel@tonic-gate #define	SVC_GETARGS(clone_xprt, xargs, argsp) \
5597c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_getargs)((clone_xprt), (xargs), (argsp))
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate #define	SVC_REPLY(clone_xprt, msg) \
5627c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_reply) ((clone_xprt), (msg))
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate #define	SVC_FREEARGS(clone_xprt, xargs, argsp) \
5657c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_freeargs)((clone_xprt), (xargs), (argsp))
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate #define	SVC_GETRES(clone_xprt, size) \
5687c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_getres)((clone_xprt), (size))
5697c478bd9Sstevel@tonic-gate 
5707c478bd9Sstevel@tonic-gate #define	SVC_FREERES(clone_xprt)	\
5717c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_freeres)(clone_xprt)
5727c478bd9Sstevel@tonic-gate 
5737c478bd9Sstevel@tonic-gate #define	SVC_DESTROY(xprt) \
5747c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt)
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate /*
5777c478bd9Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interfaces
5787c478bd9Sstevel@tonic-gate  * SVC_DUP, SVC_DUPDONE, SVC_DUP_EXT, SVC_DUPDONE_EXT
5797c478bd9Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
5807c478bd9Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
5817c478bd9Sstevel@tonic-gate  *
5827c478bd9Sstevel@tonic-gate  * SVC_DUP and SVC_DUPDONE are defined here for backward compatibility.
5837c478bd9Sstevel@tonic-gate  */
5847c478bd9Sstevel@tonic-gate #define	SVC_DUP_EXT(clone_xprt, req, res, size, drpp, dupcachedp) \
5857c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, dupcachedp)
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate #define	SVC_DUPDONE_EXT(clone_xprt, dr, res, resfree, size, status) \
5887c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, resfree, size, status)
5897c478bd9Sstevel@tonic-gate 
5907c478bd9Sstevel@tonic-gate #define	SVC_DUP(clone_xprt, req, res, size, drpp) \
5917c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, NULL)
5927c478bd9Sstevel@tonic-gate 
5937c478bd9Sstevel@tonic-gate #define	SVC_DUPDONE(clone_xprt, dr, res, size, status) \
5947c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, NULL, size, status)
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate #define	SVC_CLONE_DESTROY(clone_xprt) \
5977c478bd9Sstevel@tonic-gate 	(*(clone_xprt)->xp_ops->xp_clone_destroy)(clone_xprt)
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate #define	SVC_START(xprt) \
6017c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_start)(xprt)
6027c478bd9Sstevel@tonic-gate 
6037c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
6047c478bd9Sstevel@tonic-gate 
6057c478bd9Sstevel@tonic-gate #define	SVC_RECV(xprt, msg) \
6067c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
6077c478bd9Sstevel@tonic-gate #define	svc_recv(xprt, msg) \
6087c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate #define	SVC_STAT(xprt) \
6117c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_stat)(xprt)
6127c478bd9Sstevel@tonic-gate #define	svc_stat(xprt) \
6137c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_stat)(xprt)
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate #define	SVC_GETARGS(xprt, xargs, argsp) \
6167c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
6177c478bd9Sstevel@tonic-gate #define	svc_getargs(xprt, xargs, argsp)	\
6187c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
6197c478bd9Sstevel@tonic-gate 
6207c478bd9Sstevel@tonic-gate #define	SVC_REPLY(xprt, msg) \
6217c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
6227c478bd9Sstevel@tonic-gate #define	svc_reply(xprt, msg) \
6237c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
6247c478bd9Sstevel@tonic-gate 
6257c478bd9Sstevel@tonic-gate #define	SVC_FREEARGS(xprt, xargs, argsp) \
6267c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
6277c478bd9Sstevel@tonic-gate #define	svc_freeargs(xprt, xargs, argsp) \
6287c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
6297c478bd9Sstevel@tonic-gate 
6307c478bd9Sstevel@tonic-gate #define	SVC_GETRES(xprt, size) \
6317c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_getres)((xprt), (size))
6327c478bd9Sstevel@tonic-gate #define	svc_getres(xprt, size) \
6337c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_getres)((xprt), (size))
6347c478bd9Sstevel@tonic-gate 
6357c478bd9Sstevel@tonic-gate #define	SVC_FREERES(xprt) \
6367c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_freeres)(xprt)
6377c478bd9Sstevel@tonic-gate #define	svc_freeres(xprt) \
6387c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_freeres)(xprt)
6397c478bd9Sstevel@tonic-gate 
6407c478bd9Sstevel@tonic-gate #define	SVC_DESTROY(xprt) \
6417c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt)
6427c478bd9Sstevel@tonic-gate #define	svc_destroy(xprt) \
6437c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt)
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate /*
6467c478bd9Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
6477c478bd9Sstevel@tonic-gate  * SVC_CONTROL
6487c478bd9Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
6497c478bd9Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
6507c478bd9Sstevel@tonic-gate  */
6517c478bd9Sstevel@tonic-gate #define	SVC_CONTROL(xprt, rq, in) \
6527c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_control)((xprt), (rq), (in))
6537c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
6547c478bd9Sstevel@tonic-gate 
6557c478bd9Sstevel@tonic-gate /*
6567c478bd9Sstevel@tonic-gate  * Pool id's reserved for NFS, NLM, and the NFSv4 callback program.
6577c478bd9Sstevel@tonic-gate  */
6587c478bd9Sstevel@tonic-gate #define	NFS_SVCPOOL_ID		0x01
6597c478bd9Sstevel@tonic-gate #define	NLM_SVCPOOL_ID		0x02
6607c478bd9Sstevel@tonic-gate #define	NFS_CB_SVCPOOL_ID	0x03
6617c478bd9Sstevel@tonic-gate #define	RDC_SVCPOOL_ID		0x05	/* SNDR, PSARC 2001/699 */
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate struct svcpool_args {
6647c478bd9Sstevel@tonic-gate 	uint32_t	id;		/* Pool id */
6657c478bd9Sstevel@tonic-gate 	uint32_t	maxthreads;	/* Max threads in the pool */
6667c478bd9Sstevel@tonic-gate 	uint32_t	redline;	/* `Redline' for the pool */
6677c478bd9Sstevel@tonic-gate 	uint32_t	qsize;		/* `xprt-ready' queue size */
6687c478bd9Sstevel@tonic-gate 	uint32_t	timeout;	/* svc_poll() timeout */
6697c478bd9Sstevel@tonic-gate 	uint32_t	stksize;	/* svc_run() stack size */
6707c478bd9Sstevel@tonic-gate 	uint32_t	max_same_xprt;	/* Max reqs from the same xprt */
6717c478bd9Sstevel@tonic-gate };
6727c478bd9Sstevel@tonic-gate 
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
6757c478bd9Sstevel@tonic-gate /*
6767c478bd9Sstevel@tonic-gate  * Transport registration and thread pool creation.
6777c478bd9Sstevel@tonic-gate  */
6787c478bd9Sstevel@tonic-gate extern int	svc_xprt_register(SVCMASTERXPRT *, int);
6797c478bd9Sstevel@tonic-gate extern void	svc_xprt_unregister(SVCMASTERXPRT *);
6807c478bd9Sstevel@tonic-gate extern int	svc_pool_create(struct svcpool_args *);
6817c478bd9Sstevel@tonic-gate extern int	svc_wait(int);
6827c478bd9Sstevel@tonic-gate extern int	svc_do_run(int);
6837c478bd9Sstevel@tonic-gate #define	SVCPSET_SHUTDOWN_PROC	1
6847c478bd9Sstevel@tonic-gate #define	SVCPSET_UNREGISTER_PROC	2
6857c478bd9Sstevel@tonic-gate extern int	svc_pool_control(int, int, void *);
6867c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
6877c478bd9Sstevel@tonic-gate #ifdef	__STDC__
6887c478bd9Sstevel@tonic-gate extern bool_t	rpc_reg(const rpcprog_t, const rpcvers_t, const rpcproc_t,
6897c478bd9Sstevel@tonic-gate 			char *(*)(char *), const xdrproc_t, const xdrproc_t,
6907c478bd9Sstevel@tonic-gate 			const char *);
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate /*
6937c478bd9Sstevel@tonic-gate  * Service registration
6947c478bd9Sstevel@tonic-gate  *
6957c478bd9Sstevel@tonic-gate  * svc_reg(xprt, prog, vers, dispatch, nconf)
6967c478bd9Sstevel@tonic-gate  *	const SVCXPRT *xprt;
6977c478bd9Sstevel@tonic-gate  *	const rpcprog_t prog;
6987c478bd9Sstevel@tonic-gate  *	const rpcvers_t vers;
6997c478bd9Sstevel@tonic-gate  *	const void (*dispatch)();
7007c478bd9Sstevel@tonic-gate  *	const struct netconfig *nconf;
7017c478bd9Sstevel@tonic-gate  */
7027c478bd9Sstevel@tonic-gate extern bool_t	svc_reg(const SVCXPRT *, const rpcprog_t, const rpcvers_t,
7037c478bd9Sstevel@tonic-gate 			void (*)(struct svc_req *, SVCXPRT *),
7047c478bd9Sstevel@tonic-gate 			const struct netconfig *);
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate /*
7077c478bd9Sstevel@tonic-gate  * Service authentication registration
7087c478bd9Sstevel@tonic-gate  *
7097c478bd9Sstevel@tonic-gate  * svc_auth_reg(cred_flavor, handler)
7107c478bd9Sstevel@tonic-gate  *    int cred_flavor;
7117c478bd9Sstevel@tonic-gate  *    enum auth_stat (*handler)();
7127c478bd9Sstevel@tonic-gate  */
7137c478bd9Sstevel@tonic-gate extern int	svc_auth_reg(int, enum auth_stat (*)());
7147c478bd9Sstevel@tonic-gate 
7157c478bd9Sstevel@tonic-gate /*
7167c478bd9Sstevel@tonic-gate  * Service un-registration
7177c478bd9Sstevel@tonic-gate  *
7187c478bd9Sstevel@tonic-gate  * svc_unreg(prog, vers)
7197c478bd9Sstevel@tonic-gate  *	const rpcprog_t prog;
7207c478bd9Sstevel@tonic-gate  *	const rpcvers_t vers;
7217c478bd9Sstevel@tonic-gate  */
7227c478bd9Sstevel@tonic-gate extern void	svc_unreg(const rpcprog_t, const rpcvers_t);
7237c478bd9Sstevel@tonic-gate 
7247c478bd9Sstevel@tonic-gate /*
7257c478bd9Sstevel@tonic-gate  * Transport registration/unregistration.
7267c478bd9Sstevel@tonic-gate  *
7277c478bd9Sstevel@tonic-gate  * xprt_register(xprt)
7287c478bd9Sstevel@tonic-gate  *	const SVCXPRT *xprt;
7297c478bd9Sstevel@tonic-gate  *
7307c478bd9Sstevel@tonic-gate  * xprt_unregister(xprt)
7317c478bd9Sstevel@tonic-gate  *	const SVCXPRT *xprt;
7327c478bd9Sstevel@tonic-gate  */
7337c478bd9Sstevel@tonic-gate extern void	xprt_register(const SVCXPRT *);
7347c478bd9Sstevel@tonic-gate extern void	xprt_unregister(const SVCXPRT *);
7357c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
7367c478bd9Sstevel@tonic-gate extern bool_t	rpc_reg();
7377c478bd9Sstevel@tonic-gate extern bool_t	svc_reg();
7387c478bd9Sstevel@tonic-gate extern bool_t	svc_auth_reg();
7397c478bd9Sstevel@tonic-gate extern void	svc_unreg();
7407c478bd9Sstevel@tonic-gate extern void	xprt_register();
7417c478bd9Sstevel@tonic-gate extern void	xprt_unregister();
7427c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
7437c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
7447c478bd9Sstevel@tonic-gate 
7454a3b0527SAndy Fiddaman #ifdef _KERNEL
7464a3b0527SAndy Fiddaman /*
7474a3b0527SAndy Fiddaman  * Transport hold and release.
7484a3b0527SAndy Fiddaman  */
7494a3b0527SAndy Fiddaman extern void rpcmod_hold(queue_t *);
7504a3b0527SAndy Fiddaman extern void rpcmod_release(queue_t *, mblk_t *, bool_t);
7514a3b0527SAndy Fiddaman extern void mir_svc_hold(queue_t *);
7524a3b0527SAndy Fiddaman extern void mir_svc_release(queue_t *, mblk_t *, bool_t);
7534a3b0527SAndy Fiddaman #endif /* _KERNEL */
7547c478bd9Sstevel@tonic-gate 
7557c478bd9Sstevel@tonic-gate /*
7567c478bd9Sstevel@tonic-gate  * When the service routine is called, it must first check to see if it
7577c478bd9Sstevel@tonic-gate  * knows about the procedure;  if not, it should call svcerr_noproc
7587c478bd9Sstevel@tonic-gate  * and return.  If so, it should deserialize its arguments via
7597c478bd9Sstevel@tonic-gate  * SVC_GETARGS (defined above).  If the deserialization does not work,
7607c478bd9Sstevel@tonic-gate  * svcerr_decode should be called followed by a return.  Successful
7617c478bd9Sstevel@tonic-gate  * decoding of the arguments should be followed the execution of the
7627c478bd9Sstevel@tonic-gate  * procedure's code and a call to svc_sendreply.
7637c478bd9Sstevel@tonic-gate  *
7647c478bd9Sstevel@tonic-gate  * Also, if the service refuses to execute the procedure due to too-
7657c478bd9Sstevel@tonic-gate  * weak authentication parameters, svcerr_weakauth should be called.
7667c478bd9Sstevel@tonic-gate  * Note: do not confuse access-control failure with weak authentication!
7677c478bd9Sstevel@tonic-gate  *
7687c478bd9Sstevel@tonic-gate  * NB: In pure implementations of rpc, the caller always waits for a reply
7697c478bd9Sstevel@tonic-gate  * msg.  This message is sent when svc_sendreply is called.
7707c478bd9Sstevel@tonic-gate  * Therefore pure service implementations should always call
7717c478bd9Sstevel@tonic-gate  * svc_sendreply even if the function logically returns void;  use
7727c478bd9Sstevel@tonic-gate  * xdr.h - xdr_void for the xdr routine.  HOWEVER, connectionful rpc allows
7737c478bd9Sstevel@tonic-gate  * for the abuse of pure rpc via batched calling or pipelining.  In the
7747c478bd9Sstevel@tonic-gate  * case of a batched call, svc_sendreply should NOT be called since
7757c478bd9Sstevel@tonic-gate  * this would send a return message, which is what batching tries to avoid.
7767c478bd9Sstevel@tonic-gate  * It is the service/protocol writer's responsibility to know which calls are
7777c478bd9Sstevel@tonic-gate  * batched and which are not.  Warning: responding to batch calls may
7787c478bd9Sstevel@tonic-gate  * deadlock the caller and server processes!
7797c478bd9Sstevel@tonic-gate  */
7807c478bd9Sstevel@tonic-gate #ifdef	__STDC__
7817c478bd9Sstevel@tonic-gate extern bool_t	svc_sendreply(const SVCXPRT *, const xdrproc_t,	const caddr_t);
7827c478bd9Sstevel@tonic-gate extern void	svcerr_decode(const SVCXPRT *);
7837c478bd9Sstevel@tonic-gate extern void	svcerr_weakauth(const SVCXPRT *);
7847c478bd9Sstevel@tonic-gate extern void	svcerr_noproc(const SVCXPRT *);
7857c478bd9Sstevel@tonic-gate extern void	svcerr_progvers(const SVCXPRT *, const rpcvers_t,
7867c478bd9Sstevel@tonic-gate     const rpcvers_t);
7877c478bd9Sstevel@tonic-gate extern void	svcerr_auth(const SVCXPRT *, const enum auth_stat);
7887c478bd9Sstevel@tonic-gate extern void	svcerr_noprog(const SVCXPRT *);
7897c478bd9Sstevel@tonic-gate extern void	svcerr_systemerr(const SVCXPRT *);
7902e9d26a4Srmesta extern void	svcerr_badcred(const SVCXPRT *);
7917c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
7927c478bd9Sstevel@tonic-gate extern bool_t	svc_sendreply();
7937c478bd9Sstevel@tonic-gate extern void	svcerr_decode();
7947c478bd9Sstevel@tonic-gate extern void	svcerr_weakauth();
7957c478bd9Sstevel@tonic-gate extern void	svcerr_noproc();
7967c478bd9Sstevel@tonic-gate extern void	svcerr_progvers();
7977c478bd9Sstevel@tonic-gate extern void	svcerr_auth();
7987c478bd9Sstevel@tonic-gate extern void	svcerr_noprog();
7997c478bd9Sstevel@tonic-gate extern void	svcerr_systemerr();
8002e9d26a4Srmesta extern void	svcerr_badcred();
8017c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
8027c478bd9Sstevel@tonic-gate 
8037c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
8047c478bd9Sstevel@tonic-gate /*
8057c478bd9Sstevel@tonic-gate  * Kernel RPC functions.
8067c478bd9Sstevel@tonic-gate  */
8077c478bd9Sstevel@tonic-gate extern void	svc_init(void);
8087c478bd9Sstevel@tonic-gate extern void	svc_cots_init(void);
8097c478bd9Sstevel@tonic-gate extern void	svc_clts_init(void);
8107c478bd9Sstevel@tonic-gate extern void	mt_kstat_init(void);
8117c478bd9Sstevel@tonic-gate extern void	mt_kstat_fini(void);
8127c478bd9Sstevel@tonic-gate extern int	svc_tli_kcreate(struct file *, uint_t, char *,
8137c478bd9Sstevel@tonic-gate 				struct netbuf *, SVCMASTERXPRT **,
8147c478bd9Sstevel@tonic-gate 				SVC_CALLOUT_TABLE *,
8157c478bd9Sstevel@tonic-gate 				void (*closeproc)(const SVCMASTERXPRT *),
8167c478bd9Sstevel@tonic-gate 				int, bool_t);
8177c478bd9Sstevel@tonic-gate extern int	svc_clts_kcreate(struct file *, uint_t, struct T_info_ack *,
8187c478bd9Sstevel@tonic-gate 				SVCMASTERXPRT **);
8197c478bd9Sstevel@tonic-gate extern int	svc_cots_kcreate(struct file *, uint_t, struct T_info_ack *,
8207c478bd9Sstevel@tonic-gate 				SVCMASTERXPRT **);
8212695d4f4SMarcel Telka extern bool_t	svc_queuereq(queue_t *, mblk_t *, bool_t);
8227c478bd9Sstevel@tonic-gate extern void	svc_queueclean(queue_t *);
8237c478bd9Sstevel@tonic-gate extern void	svc_queueclose(queue_t *);
8247c478bd9Sstevel@tonic-gate extern int	svc_reserve_thread(SVCXPRT *);
8257c478bd9Sstevel@tonic-gate extern void	svc_unreserve_thread(SVCXPRT *);
8267c478bd9Sstevel@tonic-gate extern callb_cpr_t *svc_detach_thread(SVCXPRT *);
8277c478bd9Sstevel@tonic-gate 
8287c478bd9Sstevel@tonic-gate /*
8297c478bd9Sstevel@tonic-gate  * For RDMA based kRPC.
8307c478bd9Sstevel@tonic-gate  * "rdma_xprt_record" is a reference to master transport handles
8317c478bd9Sstevel@tonic-gate  * in kRPC thread pools. This is an easy way of tracking and shuting
8327c478bd9Sstevel@tonic-gate  * down rdma based kRPC transports on demand.
8337c478bd9Sstevel@tonic-gate  * "rdma_xprt_group" is a list of RDMA based mster transport handles
8347c478bd9Sstevel@tonic-gate  * or records in a kRPC thread pool.
8357c478bd9Sstevel@tonic-gate  */
8367c478bd9Sstevel@tonic-gate typedef struct rdma_xprt_record		rdma_xprt_record_t;
8377c478bd9Sstevel@tonic-gate struct rdma_xprt_record {
8387c478bd9Sstevel@tonic-gate 	int			rtr_type;	/* Type of rdma; IB/VI/RDDP */
8397c478bd9Sstevel@tonic-gate 	SVCMASTERXPRT		*rtr_xprt_ptr;	/* Ptr to master xprt handle */
8407c478bd9Sstevel@tonic-gate 	rdma_xprt_record_t	*rtr_next;	/* Ptr to next record */
8417c478bd9Sstevel@tonic-gate };
8427c478bd9Sstevel@tonic-gate 
8437c478bd9Sstevel@tonic-gate typedef struct {
8447c478bd9Sstevel@tonic-gate 	int			rtg_count;	/* Number transport records */
8457c478bd9Sstevel@tonic-gate 	int			rtg_poolid;	/* Pool Id for this group */
8467c478bd9Sstevel@tonic-gate 	rdma_xprt_record_t	*rtg_listhead;	/* Head of the records list */
8477c478bd9Sstevel@tonic-gate } rdma_xprt_group_t;
8487c478bd9Sstevel@tonic-gate 
8497c478bd9Sstevel@tonic-gate extern int	svc_rdma_kcreate(char *, SVC_CALLOUT_TABLE *, int,
8507c478bd9Sstevel@tonic-gate 			rdma_xprt_group_t *);
8517c478bd9Sstevel@tonic-gate extern void	svc_rdma_kstop(SVCMASTERXPRT *);
8527c478bd9Sstevel@tonic-gate extern void	svc_rdma_kdestroy(SVCMASTERXPRT *);
85351f34d4bSRajkumar Sivaprakasam extern void	rdma_stop(rdma_xprt_group_t *);
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate /*
8567c478bd9Sstevel@tonic-gate  * GSS cleanup method.
8577c478bd9Sstevel@tonic-gate  */
8587c478bd9Sstevel@tonic-gate extern void	rpc_gss_cleanup(SVCXPRT *);
8597c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
8607c478bd9Sstevel@tonic-gate /*
8617c478bd9Sstevel@tonic-gate  * Lowest level dispatching -OR- who owns this process anyway.
8627c478bd9Sstevel@tonic-gate  * Somebody has to wait for incoming requests and then call the correct
8637c478bd9Sstevel@tonic-gate  * service routine.  The routine svc_run does infinite waiting; i.e.,
8647c478bd9Sstevel@tonic-gate  * svc_run never returns.
8657c478bd9Sstevel@tonic-gate  * Since another (co-existant) package may wish to selectively wait for
8667c478bd9Sstevel@tonic-gate  * incoming calls or other events outside of the rpc architecture, the
8677c478bd9Sstevel@tonic-gate  * routine svc_getreq_poll is provided.  It must be passed pollfds, the
8687c478bd9Sstevel@tonic-gate  * "in-place" results of a poll call (see poll, section 2).
8697c478bd9Sstevel@tonic-gate  */
8707c478bd9Sstevel@tonic-gate 
8717c478bd9Sstevel@tonic-gate /*
8727c478bd9Sstevel@tonic-gate  * Global keeper of rpc service descriptors in use
8737c478bd9Sstevel@tonic-gate  * dynamic; must be inspected before each call to select or poll
8747c478bd9Sstevel@tonic-gate  */
8757c478bd9Sstevel@tonic-gate extern pollfd_t	*svc_pollfd;
8767c478bd9Sstevel@tonic-gate extern int	svc_max_pollfd;
8777c478bd9Sstevel@tonic-gate extern fd_set	svc_fdset;
8787c478bd9Sstevel@tonic-gate #define	svc_fds svc_fdset.fds_bits[0]	/* compatibility */
8797c478bd9Sstevel@tonic-gate 
8807c478bd9Sstevel@tonic-gate /*
8817c478bd9Sstevel@tonic-gate  * A small program implemented by the svc_rpc implementation itself.
8827c478bd9Sstevel@tonic-gate  * Also see clnt.h for protocol numbers.
8837c478bd9Sstevel@tonic-gate  */
8847c478bd9Sstevel@tonic-gate #ifdef __STDC__
8857c478bd9Sstevel@tonic-gate extern void	svc_getreq(int);
8867c478bd9Sstevel@tonic-gate extern void	svc_getreq_common(const int);
8877c478bd9Sstevel@tonic-gate extern void	svc_getreqset(fd_set *); /* takes fdset instead of int */
8887c478bd9Sstevel@tonic-gate extern void	svc_getreq_poll(struct pollfd *, const int);
8897c478bd9Sstevel@tonic-gate extern void	svc_run(void);
8907c478bd9Sstevel@tonic-gate extern void	svc_exit(void);
8917c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
8927c478bd9Sstevel@tonic-gate extern void	rpctest_service();
8937c478bd9Sstevel@tonic-gate extern void	svc_getreqset();
8947c478bd9Sstevel@tonic-gate extern void	svc_getreq();
8957c478bd9Sstevel@tonic-gate extern void	svc_getreq_common();
8967c478bd9Sstevel@tonic-gate extern void	svc_getreqset();	 /* takes fdset instead of int */
8977c478bd9Sstevel@tonic-gate extern void	svc_getreq_poll();
8987c478bd9Sstevel@tonic-gate extern void	svc_run();
8997c478bd9Sstevel@tonic-gate extern void	svc_exit();
9007c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
9017c478bd9Sstevel@tonic-gate 
9027c478bd9Sstevel@tonic-gate /*
9037c478bd9Sstevel@tonic-gate  *  Functions used to manage user file descriptors
9047c478bd9Sstevel@tonic-gate  */
9057c478bd9Sstevel@tonic-gate typedef int svc_input_id_t;
9067c478bd9Sstevel@tonic-gate typedef void (*svc_callback_t)(svc_input_id_t id, int fd,
9077c478bd9Sstevel@tonic-gate 				unsigned int events, void* cookie);
9087c478bd9Sstevel@tonic-gate 
9097c478bd9Sstevel@tonic-gate #ifdef __STDC__
9107c478bd9Sstevel@tonic-gate extern svc_input_id_t svc_add_input(int fd, unsigned int events,
9117c478bd9Sstevel@tonic-gate 				svc_callback_t user_callback,
9127c478bd9Sstevel@tonic-gate 				void* cookie);
9137c478bd9Sstevel@tonic-gate extern int svc_remove_input(svc_input_id_t id);
9147c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
9157c478bd9Sstevel@tonic-gate extern svc_input_id_t svc_add_input();
9167c478bd9Sstevel@tonic-gate extern int	svc_remove_input();
9177c478bd9Sstevel@tonic-gate #endif
9187c478bd9Sstevel@tonic-gate 
9197c478bd9Sstevel@tonic-gate /*
9207c478bd9Sstevel@tonic-gate  * These are the existing service side transport implementations.
9217c478bd9Sstevel@tonic-gate  *
9227c478bd9Sstevel@tonic-gate  * Transport independent svc_create routine.
9237c478bd9Sstevel@tonic-gate  */
9247c478bd9Sstevel@tonic-gate #ifdef __STDC__
9257c478bd9Sstevel@tonic-gate extern int	svc_create(void (*)(struct svc_req *, SVCXPRT *),
9267c478bd9Sstevel@tonic-gate 				const rpcprog_t, const rpcvers_t,
9277c478bd9Sstevel@tonic-gate 				const char *);
9287c478bd9Sstevel@tonic-gate 	/*
9294a3b0527SAndy Fiddaman 	 *	void (*dispatch)();		-- dispatch routine
9307c478bd9Sstevel@tonic-gate 	 *	const rpcprog_t prognum;	-- program number
9317c478bd9Sstevel@tonic-gate 	 *	const rpcvers_t versnum;	-- version number
9327c478bd9Sstevel@tonic-gate 	 *	const char *nettype;		-- network type
9337c478bd9Sstevel@tonic-gate 	 */
9347c478bd9Sstevel@tonic-gate 
9357c478bd9Sstevel@tonic-gate /*
9367c478bd9Sstevel@tonic-gate  * Generic server creation routine. It takes a netconfig structure
9377c478bd9Sstevel@tonic-gate  * instead of a nettype.
9387c478bd9Sstevel@tonic-gate  */
9397c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_tp_create(void (*)(struct svc_req *, SVCXPRT *),
9407c478bd9Sstevel@tonic-gate 				const rpcprog_t, const rpcvers_t,
9417c478bd9Sstevel@tonic-gate 				const struct netconfig *);
9427c478bd9Sstevel@tonic-gate 	/*
9437c478bd9Sstevel@tonic-gate 	 * void (*dispatch)();			-- dispatch routine
9447c478bd9Sstevel@tonic-gate 	 * const rpcprog_t prognum;		-- program number
9457c478bd9Sstevel@tonic-gate 	 * const rpcvers_t versnum;		-- version number
9467c478bd9Sstevel@tonic-gate 	 * const struct netconfig *nconf;	-- netconfig structure
9477c478bd9Sstevel@tonic-gate 	 */
9487c478bd9Sstevel@tonic-gate 
949dec98d2aSGordon Ross /*
950dec98d2aSGordon Ross  * Variant of svc_tp_create that accepts a binding address.
951dec98d2aSGordon Ross  * If addr == NULL, this is the same as svc_tp_create().
952dec98d2aSGordon Ross  */
953dec98d2aSGordon Ross extern SVCXPRT	*svc_tp_create_addr(void (*)(struct svc_req *, SVCXPRT *),
954dec98d2aSGordon Ross 				const rpcprog_t, const rpcvers_t,
955dec98d2aSGordon Ross 				const struct netconfig *,
956dec98d2aSGordon Ross 				const struct netbuf *);
957dec98d2aSGordon Ross 	/*
958dec98d2aSGordon Ross 	 * void (*dispatch)();			-- dispatch routine
959dec98d2aSGordon Ross 	 * const rpcprog_t prognum;		-- program number
960dec98d2aSGordon Ross 	 * const rpcvers_t versnum;		-- version number
961dec98d2aSGordon Ross 	 * const struct netconfig *nconf;	-- netconfig structure
962dec98d2aSGordon Ross 	 * const struct netbuf *addr;		-- address to bind
963dec98d2aSGordon Ross 	 */
964dec98d2aSGordon Ross 
9657c478bd9Sstevel@tonic-gate /*
9667c478bd9Sstevel@tonic-gate  * Generic TLI create routine
9677c478bd9Sstevel@tonic-gate  */
9687c478bd9Sstevel@tonic-gate extern  SVCXPRT	*svc_tli_create(const int, const struct netconfig *,
9697c478bd9Sstevel@tonic-gate 				const struct t_bind *, const uint_t,
9707c478bd9Sstevel@tonic-gate 				const uint_t);
9717c478bd9Sstevel@tonic-gate 	/*
9727c478bd9Sstevel@tonic-gate 	 *	const int fd;			-- connection end point
9737c478bd9Sstevel@tonic-gate 	 *	const struct netconfig *nconf;	-- netconfig structure
9747c478bd9Sstevel@tonic-gate 	 *	const struct t_bind *bindaddr;	-- local bind address
9757c478bd9Sstevel@tonic-gate 	 *	const uint_t sendsz;		-- max sendsize
9767c478bd9Sstevel@tonic-gate 	 *	const uint_t recvsz;		-- max recvsize
9777c478bd9Sstevel@tonic-gate 	 */
9787c478bd9Sstevel@tonic-gate 
9797c478bd9Sstevel@tonic-gate /*
9807c478bd9Sstevel@tonic-gate  * Connectionless and connectionful create routines.
9817c478bd9Sstevel@tonic-gate  */
9827c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_vc_create(const int, const uint_t, const uint_t);
9837c478bd9Sstevel@tonic-gate 	/*
9847c478bd9Sstevel@tonic-gate 	 *	const int fd;			-- open connection end point
9857c478bd9Sstevel@tonic-gate 	 *	const uint_t sendsize;		-- max send size
9867c478bd9Sstevel@tonic-gate 	 *	const uint_t recvsize;		-- max recv size
9877c478bd9Sstevel@tonic-gate 	 */
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_dg_create(const int, const uint_t, const uint_t);
9907c478bd9Sstevel@tonic-gate 	/*
9917c478bd9Sstevel@tonic-gate 	 * const int fd;			-- open connection
9927c478bd9Sstevel@tonic-gate 	 * const uint_t sendsize;		-- max send size
9937c478bd9Sstevel@tonic-gate 	 * const uint_t recvsize;		-- max recv size
9947c478bd9Sstevel@tonic-gate 	 */
9957c478bd9Sstevel@tonic-gate 
9967c478bd9Sstevel@tonic-gate /*
9977c478bd9Sstevel@tonic-gate  * the routine takes any *open* TLI file
9987c478bd9Sstevel@tonic-gate  * descriptor as its first input and is used for open connections.
9997c478bd9Sstevel@tonic-gate  */
10007c478bd9Sstevel@tonic-gate extern  SVCXPRT	*svc_fd_create(const int, const uint_t, const uint_t);
10017c478bd9Sstevel@tonic-gate 	/*
10024a3b0527SAndy Fiddaman 	 *	const int fd;			-- open connection end point
10034a3b0527SAndy Fiddaman 	 *	const uint_t sendsize;		-- max send size
10044a3b0527SAndy Fiddaman 	 *	const uint_t recvsize;		-- max recv size
10057c478bd9Sstevel@tonic-gate 	 */
10067c478bd9Sstevel@tonic-gate 
10077c478bd9Sstevel@tonic-gate /*
10087c478bd9Sstevel@tonic-gate  * Memory based rpc (for speed check and testing)
10097c478bd9Sstevel@tonic-gate  */
10107c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_raw_create(void);
10117c478bd9Sstevel@tonic-gate 
10127c478bd9Sstevel@tonic-gate /*
10137c478bd9Sstevel@tonic-gate  * Creation of service over doors transport.
10147c478bd9Sstevel@tonic-gate  */
10157c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_door_create(void (*)(struct svc_req *, SVCXPRT *),
10167c478bd9Sstevel@tonic-gate 				const rpcprog_t, const rpcvers_t,
10177c478bd9Sstevel@tonic-gate 				const uint_t);
10187c478bd9Sstevel@tonic-gate 	/*
10194a3b0527SAndy Fiddaman 	 *	void (*dispatch)();		-- dispatch routine
10207c478bd9Sstevel@tonic-gate 	 *	const rpcprog_t prognum;	-- program number
10217c478bd9Sstevel@tonic-gate 	 *	const rpcvers_t versnum;	-- version number
10227c478bd9Sstevel@tonic-gate 	 *	const uint_t sendsize;		-- send buffer size
10237c478bd9Sstevel@tonic-gate 	 */
10247c478bd9Sstevel@tonic-gate 
10257c478bd9Sstevel@tonic-gate /*
10267c478bd9Sstevel@tonic-gate  * Service control interface
10277c478bd9Sstevel@tonic-gate  */
10287c478bd9Sstevel@tonic-gate extern	bool_t	svc_control(SVCXPRT *, const uint_t, void *);
10297c478bd9Sstevel@tonic-gate 	/*
10307c478bd9Sstevel@tonic-gate 	 *	SVCXPRT *svc;			-- service to manipulate
10317c478bd9Sstevel@tonic-gate 	 *	const uint_t req;		-- request
10327c478bd9Sstevel@tonic-gate 	 *	void *info;			-- argument to request
10337c478bd9Sstevel@tonic-gate 	 */
10347c478bd9Sstevel@tonic-gate 
10357c478bd9Sstevel@tonic-gate /*
10367c478bd9Sstevel@tonic-gate  * svc_dg_enable_cache() enables the cache on dg transports.
10377c478bd9Sstevel@tonic-gate  */
10387c478bd9Sstevel@tonic-gate extern int svc_dg_enablecache(SVCXPRT *, const uint_t);
10397c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
10407c478bd9Sstevel@tonic-gate extern int	svc_create();
10417c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_tp_create();
10427c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_tli_create();
10437c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_vc_create();
10447c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_dg_create();
10457c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_fd_create();
10467c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_raw_create();
10477c478bd9Sstevel@tonic-gate extern SVCXPRT	*svc_door_create();
10487c478bd9Sstevel@tonic-gate extern int svc_dg_enablecache();
10497c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
10507c478bd9Sstevel@tonic-gate 
105145916cd2Sjpk extern boolean_t is_multilevel(rpcprog_t);
105245916cd2Sjpk 
10537c478bd9Sstevel@tonic-gate #ifdef	PORTMAP
10547c478bd9Sstevel@tonic-gate /* For backward compatibility */
10557c478bd9Sstevel@tonic-gate #include <rpc/svc_soc.h>
10567c478bd9Sstevel@tonic-gate #endif	/* PORTMAP */
10577c478bd9Sstevel@tonic-gate 
10587c478bd9Sstevel@tonic-gate /*
10597c478bd9Sstevel@tonic-gate  * For user level MT hot server functions
10607c478bd9Sstevel@tonic-gate  */
10617c478bd9Sstevel@tonic-gate 
10627c478bd9Sstevel@tonic-gate /*
10637c478bd9Sstevel@tonic-gate  * Different MT modes
10647c478bd9Sstevel@tonic-gate  */
10657c478bd9Sstevel@tonic-gate #define	RPC_SVC_MT_NONE		0	/* default, single-threaded */
10667c478bd9Sstevel@tonic-gate #define	RPC_SVC_MT_AUTO		1	/* automatic MT mode */
10677c478bd9Sstevel@tonic-gate #define	RPC_SVC_MT_USER		2	/* user MT mode */
10687c478bd9Sstevel@tonic-gate 
10697c478bd9Sstevel@tonic-gate #ifdef	__STDC__
10707c478bd9Sstevel@tonic-gate extern void	svc_done(SVCXPRT *);
10717c478bd9Sstevel@tonic-gate #else
10727c478bd9Sstevel@tonic-gate extern void	svc_done();
10737c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
10747c478bd9Sstevel@tonic-gate 
10757c478bd9Sstevel@tonic-gate /*
10767c478bd9Sstevel@tonic-gate  * Obtaining local credentials.
10777c478bd9Sstevel@tonic-gate  */
10787c478bd9Sstevel@tonic-gate typedef struct __svc_local_cred_t {
10797c478bd9Sstevel@tonic-gate 	uid_t	euid;	/* effective uid */
10807c478bd9Sstevel@tonic-gate 	gid_t	egid;	/* effective gid */
10817c478bd9Sstevel@tonic-gate 	uid_t	ruid;	/* real uid */
10827c478bd9Sstevel@tonic-gate 	gid_t	rgid;	/* real gid */
10837c478bd9Sstevel@tonic-gate 	pid_t	pid;	/* caller's pid, or -1 if not available */
10847c478bd9Sstevel@tonic-gate } svc_local_cred_t;
10857c478bd9Sstevel@tonic-gate 
10867c478bd9Sstevel@tonic-gate #ifdef __STDC__
10877c478bd9Sstevel@tonic-gate struct ucred_s;
10887c478bd9Sstevel@tonic-gate extern void	svc_fd_negotiate_ucred(int);
10897c478bd9Sstevel@tonic-gate extern int	svc_getcallerucred(const SVCXPRT *, struct ucred_s **);
10907c478bd9Sstevel@tonic-gate extern bool_t	svc_get_local_cred(SVCXPRT *, svc_local_cred_t *);
10917c478bd9Sstevel@tonic-gate #else
10927c478bd9Sstevel@tonic-gate extern void	svc_fd_negotiate_ucred();
10937c478bd9Sstevel@tonic-gate extern int	svc_getcallerucred();
10947c478bd9Sstevel@tonic-gate extern bool_t	svc_get_local_cred();
10957c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
10967c478bd9Sstevel@tonic-gate 
10977c478bd9Sstevel@tonic-gate /*
10987c478bd9Sstevel@tonic-gate  * Private interfaces and structures for user level duplicate request caching.
10997c478bd9Sstevel@tonic-gate  * The interfaces and data structures are not committed and subject to
11007c478bd9Sstevel@tonic-gate  * change in future releases. Currently only intended for use by automountd.
11017c478bd9Sstevel@tonic-gate  */
11027c478bd9Sstevel@tonic-gate struct dupreq {
11037c478bd9Sstevel@tonic-gate 	uint32_t	dr_xid;
11047c478bd9Sstevel@tonic-gate 	rpcproc_t	dr_proc;
11057c478bd9Sstevel@tonic-gate 	rpcvers_t	dr_vers;
11067c478bd9Sstevel@tonic-gate 	rpcprog_t	dr_prog;
11077c478bd9Sstevel@tonic-gate 	struct netbuf	dr_addr;
11087c478bd9Sstevel@tonic-gate 	struct netbuf	dr_resp;
11097c478bd9Sstevel@tonic-gate 	int		dr_status;
11107c478bd9Sstevel@tonic-gate 	time_t		dr_time;
11117c478bd9Sstevel@tonic-gate 	uint_t		dr_hash;
11127c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_next;
11137c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_prev;
11147c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_chain;
11157c478bd9Sstevel@tonic-gate 	struct dupreq	*dr_prevchain;
11167c478bd9Sstevel@tonic-gate };
11177c478bd9Sstevel@tonic-gate 
11187c478bd9Sstevel@tonic-gate /*
11197c478bd9Sstevel@tonic-gate  * The fixedtime state is defined if we want to expand the routines to
11207c478bd9Sstevel@tonic-gate  * handle and encompass fixed size caches.
11217c478bd9Sstevel@tonic-gate  */
11227c478bd9Sstevel@tonic-gate #define	DUPCACHE_FIXEDTIME	0
11237c478bd9Sstevel@tonic-gate 
11247c478bd9Sstevel@tonic-gate /*
11257c478bd9Sstevel@tonic-gate  * States of requests for duplicate request caching.
11267c478bd9Sstevel@tonic-gate  * These are the same as defined for the kernel.
11277c478bd9Sstevel@tonic-gate  */
11287c478bd9Sstevel@tonic-gate #define	DUP_NEW			0x00	/* new entry */
11297c478bd9Sstevel@tonic-gate #define	DUP_INPROGRESS		0x01	/* request already going */
11307c478bd9Sstevel@tonic-gate #define	DUP_DONE		0x02	/* request done */
11317c478bd9Sstevel@tonic-gate #define	DUP_DROP		0x03	/* request dropped */
11327c478bd9Sstevel@tonic-gate #define	DUP_ERROR		0x04	/* error in dup req cache */
11337c478bd9Sstevel@tonic-gate 
11347c478bd9Sstevel@tonic-gate #ifdef __STDC__
11357c478bd9Sstevel@tonic-gate extern bool_t	__svc_dupcache_init(void *, int, char **);
11367c478bd9Sstevel@tonic-gate extern int	__svc_dup(struct svc_req *, caddr_t *, uint_t *, char *);
11377c478bd9Sstevel@tonic-gate extern int	__svc_dupdone(struct svc_req *, caddr_t, uint_t, int, char *);
11387c478bd9Sstevel@tonic-gate extern bool_t	__svc_vc_dupcache_init(SVCXPRT *, void *, int);
11397c478bd9Sstevel@tonic-gate extern int	__svc_vc_dup(struct svc_req *, caddr_t *, uint_t *);
11407c478bd9Sstevel@tonic-gate extern int	__svc_vc_dupdone(struct svc_req *, caddr_t, uint_t, int);
11417c478bd9Sstevel@tonic-gate #else
11427c478bd9Sstevel@tonic-gate extern bool_t	__svc_dupcache_init();
11437c478bd9Sstevel@tonic-gate extern int	__svc_dup();
11447c478bd9Sstevel@tonic-gate extern int	__svc_dupdone();
11457c478bd9Sstevel@tonic-gate extern bool_t	__svc_vc_dupcache_init();
11467c478bd9Sstevel@tonic-gate extern int	__svc_vc_dup();
11477c478bd9Sstevel@tonic-gate extern int	__svc_vc_dupdone();
11487c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
11497c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
11507c478bd9Sstevel@tonic-gate 
1151bfd8310aSGlenn Barry #ifdef	_KERNEL
1152bfd8310aSGlenn Barry /*
1153bfd8310aSGlenn Barry  * Private interfaces and structures for SVCXPRT cloning.
1154bfd8310aSGlenn Barry  * The interfaces and data structures are not committed and subject to
1155bfd8310aSGlenn Barry  * change in future releases.
1156bfd8310aSGlenn Barry  */
1157bfd8310aSGlenn Barry extern SVCXPRT *svc_clone_init(void);
1158bfd8310aSGlenn Barry extern void svc_clone_free(SVCXPRT *);
115960536ef9SKaren Rochford extern void svc_clone_link(SVCMASTERXPRT *, SVCXPRT *, SVCXPRT *);
1160bfd8310aSGlenn Barry extern void svc_clone_unlink(SVCXPRT *);
1161*214d537cSVitaliy Gusev 
1162*214d537cSVitaliy Gusev /* Get cached preallocated cred */
1163*214d537cSVitaliy Gusev extern cred_t *svc_xprt_cred(SVCXPRT *);
1164bfd8310aSGlenn Barry #endif	/* _KERNEL */
1165bfd8310aSGlenn Barry 
11667c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
11677c478bd9Sstevel@tonic-gate }
11687c478bd9Sstevel@tonic-gate #endif
11697c478bd9Sstevel@tonic-gate 
11707c478bd9Sstevel@tonic-gate #endif	/* !_RPC_SVC_H */
1171