4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <synch.h> /* needed for mutex_t declaration */
35 * Private service definitions
45 #define SVC_VERSQUIET 0x0001 /* keep quiet about version mismatch */
46 #define SVC_DEFUNCT 0x0002 /* xprt is defunct, release asap */
47 #define SVC_DGRAM 0x0004 /* datagram type */
48 #define SVC_RENDEZVOUS 0x0008 /* rendezvous */
49 #define SVC_CONNECTION 0x000c /* connection */
50 #define SVC_DOOR 0x0010 /* door ipc */
51 #define SVC_TYPE_MASK 0x001c /* type mask */
52 #define SVC_FAILED 0x0020 /* send/receive failed, used for VC */
53 #define SVC_ARGS_CHECK 0x0040 /* flag to check for argument completion */
55 #define svc_flags(xprt) (SVCEXT(xprt)->flags)
56 #define version_keepquiet(xprt) (svc_flags(xprt) & SVC_VERSQUIET)
57 #define svc_defunct(xprt) ((svc_flags(xprt) & SVC_DEFUNCT) ? TRUE : FALSE)
58 #define svc_failed(xprt) ((svc_flags(xprt) & SVC_FAILED) ? TRUE : FALSE)
59 #define svc_type(xprt) (svc_flags(xprt) & SVC_TYPE_MASK)
60 #define svc_send_mutex(xprt) (SVCEXT(xprt)->send_mutex)
64 * Copy of GSS parameters, needed for MT operation
68 rpc_gss_service_t service
;
72 } svc_rpc_gss_parms_t
;
75 * Interface to server-side authentication flavors, may vary with
78 * NOTE: This structure is part of an interface, and must not change.
83 int (*svc_ah_unwrap
)();
85 caddr_t svc_ah_private
;
86 svc_rpc_gss_parms_t svc_gss_parms
;
87 rpc_gss_rawcred_t raw_cred
;
91 * The xp_p3 field the the service handle points to the SVCXPRT_EXT
92 * extension structure.
94 typedef struct svcxprt_list_t
{
95 struct svcxprt_list_t
*next
;
99 typedef struct svcxprt_ext_t
{
100 int flags
; /* VERSQUIET, DEFUNCT flag */
101 SVCXPRT
*parent
; /* points to parent (NULL in parent) */
103 struct rpc_msg
*msg
; /* message */
104 struct svc_req
*req
; /* request */
105 char *cred_area
; /* auth work area */
106 int refcnt
; /* number of parent references */
107 SVCXPRT_LIST
*my_xlist
; /* list header for this copy */
108 mutex_t send_mutex
; /* for sequencing sends */
109 SVCAUTH xp_auth
; /* flavor of current request */
112 #define SVCEXT(xprt) ((SVCXPRT_EXT *)((xprt)->xp_p3))
113 #define SVC_XP_AUTH(xprt) (SVCEXT(xprt)->xp_auth)
115 #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \
116 ((*((auth)->svc_ah_ops.svc_ah_wrap))(auth, xdrs, xfunc, xwhere))
117 #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
118 ((*((auth)->svc_ah_ops.svc_ah_unwrap))(auth, xdrs, xfunc, xwhere))
121 * Global/module private data and functions
123 extern SVCXPRT
**svc_xports
;
124 extern XDR
**svc_xdrs
;
125 extern int svc_mt_mode
;
126 extern mutex_t svc_thr_mutex
;
127 extern cond_t svc_thr_fdwait
;
129 extern int svc_nfds_set
;
130 extern int svc_max_fd
;
131 extern mutex_t svc_mutex
;
132 extern mutex_t svc_exit_mutex
;
133 extern int svc_pipe
[2];
134 extern bool_t svc_polling
;
136 SVCXPRT
*svc_xprt_alloc();
137 SVCXPRT
*svc_dg_xprtcopy();
138 SVCXPRT
*svc_vc_xprtcopy();
139 SVCXPRT
*svc_fd_xprtcopy();
141 void svc_xprt_free();
142 void svc_xprt_destroy();
143 void svc_dg_xprtfree();
144 void svc_vc_xprtfree();
145 void svc_fd_xprtfree();
146 void svc_door_xprtfree();
147 void svc_args_done();
148 void _svc_dg_destroy_private();
149 void _svc_vc_destroy_private();
150 void _svc_destroy_private();
152 #define RPC_DOOR_DIR "/var/run/rpc_door"
153 #define RPC_DOOR_RENDEZVOUS "/var/run/rpc_door/rpc_%d.%d"
159 #endif /* !_RPC_SVC_MT_H */