3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
[unleashed.git] / usr / src / uts / common / rpc / svc_auth.h
blob0c13e42fed32fc41ccdb83d9860e5566fb2c15c3
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
29 * Portions of this source code were derived from Berkeley
30 * 4.3 BSD under license from the Regents of the University of
31 * California.
34 #ifndef _RPC_SVC_AUTH_H
35 #define _RPC_SVC_AUTH_H
37 #pragma ident "%Z%%M% %I% %E% SMI"
40 * svc_auth.h, Service side of rpc authentication.
42 #include <rpc/rpcsec_gss.h>
43 #include <rpc/rpc_msg.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 * Server side authenticator
52 #ifdef _KERNEL
54 * Copy of GSS parameters, needed for MT operation
56 typedef struct {
57 bool_t established;
58 rpc_gss_service_t service;
59 uint_t qop_rcvd;
60 void *context;
61 uint_t seq_num;
62 } svc_rpc_gss_parms_t;
65 * sec_svc_control() commands
67 #define RPC_SVC_SET_GSS_CALLBACK 1 /* set rpcsec_gss callback routine */
68 extern bool_t sec_svc_control();
71 * Interface to server-side authentication flavors, may change on
72 * each request.
74 typedef struct {
75 struct svc_auth_ops {
76 int (*svc_ah_wrap)();
77 int (*svc_ah_unwrap)();
78 } svc_ah_ops;
79 caddr_t svc_ah_private;
80 svc_rpc_gss_parms_t svc_gss_parms;
81 rpc_gss_rawcred_t raw_cred;
82 } SVCAUTH;
84 #define SVCAUTH_GSSPARMS(auth) ((svc_rpc_gss_parms_t *)&(auth)->svc_gss_parms)
87 * Auth flavors can now apply a transformation in addition to simple XDR
88 * on the body of a call/response in ways that depend on the flavor being
89 * used. These interfaces provide a generic interface between the
90 * internal RPC frame and the auth flavor specific code to allow the
91 * auth flavor to encode (WRAP) or decode (UNWRAP) the body.
93 #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \
94 ((*((auth)->svc_ah_ops.svc_ah_wrap))(auth, xdrs, xfunc, xwhere))
95 #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
96 ((*((auth)->svc_ah_ops.svc_ah_unwrap))(auth, xdrs, xfunc, xwhere))
99 * Server side authenticator
101 #ifdef __STDC__
102 extern enum auth_stat sec_svc_msg(struct svc_req *, struct rpc_msg *,
103 bool_t *);
104 #else
105 extern enum auth_stat sec_svc_msg();
106 #endif /* __STDC__ */
108 #else
110 #ifdef __STDC__
111 extern enum auth_stat __gss_authenticate(struct svc_req *, struct rpc_msg *,
112 bool_t *);
113 extern enum auth_stat __authenticate(struct svc_req *, struct rpc_msg *);
114 #else
115 extern enum auth_stat __gss_authenticate();
116 extern enum auth_stat __authenticate();
117 #endif /* __STDC__ */
119 #endif /* _KERNEL */
121 #ifdef __cplusplus
123 #endif
125 #endif /* _RPC_SVC_AUTH_H */