Mercurial > illumos > illumos-gate
annotate usr/src/uts/common/fs/smbclnt/netsmb/smb_conn.h @ 13394:96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Garrett D'Amore <garrett@nexenta.com>
author | Gordon Ross <gwr@nexenta.com> |
---|---|
date | Thu, 30 Jun 2011 17:58:05 -0400 |
parents | ed3411181494 |
children | 35e2d64a5cf6 |
rev | line source |
---|---|
6007 | 1 /* |
2 * Copyright (c) 2000-2001 Boris Popov | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. All advertising materials mentioning features or use of this software | |
14 * must display the following acknowledgement: | |
15 * This product includes software developed by Boris Popov. | |
16 * 4. Neither the name of the author nor the names of any co-contributors | |
17 * may be used to endorse or promote products derived from this software | |
18 * without specific prior written permission. | |
19 * | |
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 * SUCH DAMAGE. | |
31 * | |
32 * $Id: smb_conn.h,v 1.32.42.1 2005/05/27 02:35:29 lindak Exp $ | |
33 */ | |
34 | |
35 /* | |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
36 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
37 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
6007 | 38 * Use is subject to license terms. |
39 */ | |
40 | |
41 #ifndef _SMB_CONN_H | |
42 #define _SMB_CONN_H | |
43 | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
44 #include <sys/dditypes.h> |
6007 | 45 #include <sys/t_lock.h> |
46 #include <sys/queue.h> /* for SLIST below */ | |
47 #include <sys/uio.h> | |
48 #include <netsmb/smb_dev.h> | |
49 | |
50 /* | |
51 * Credentials of user/process for processing in the connection procedures | |
52 */ | |
53 typedef struct smb_cred { | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
54 struct cred *scr_cred; |
6007 | 55 } smb_cred_t; |
56 | |
57 /* | |
58 * Common object flags | |
59 */ | |
60 #define SMBO_GONE 0x1000000 | |
61 | |
62 /* | |
63 * Bits in vc_flags (a.k.a. vc_co.co_flags) | |
64 * Many of these were duplicates of SMBVOPT_ flags | |
65 * and we now keep those too instead of merging | |
66 * them into vc_flags. | |
67 */ | |
68 | |
69 #define SMBV_WIN95 0x0010 /* used to apply bugfixes for this OS */ | |
70 #define SMBV_NT4 0x0020 /* used when NT4 issues invalid resp */ | |
8271
792589b3384f
6565868 Client should do packet signing
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
6294
diff
changeset
|
71 #define SMBV_UNICODE 0x0040 /* conn configured to use Unicode */ |
6007 | 72 |
73 /* | |
74 * Note: the common "obj" level uses this GONE flag by | |
75 * the name SMBO_GONE. Keep this alias as a reminder. | |
76 */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
77 #define SMBV_GONE SMBO_GONE |
6007 | 78 |
79 /* | |
80 * bits in smb_share ss_flags (a.k.a. ss_co.co_flags) | |
81 */ | |
82 #define SMBS_RECONNECTING 0x0002 | |
83 #define SMBS_CONNECTED 0x0004 | |
84 #define SMBS_TCON_WAIT 0x0008 | |
11332
ed3411181494
6650611 Attribute cache logic needs improvement
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
10023
diff
changeset
|
85 #define SMBS_FST_FAT 0x0010 /* share FS Type is FAT */ |
6007 | 86 /* |
87 * Note: the common "obj" level uses this GONE flag by | |
88 * the name SMBO_GONE. Keep this alias as a reminder. | |
89 */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
90 #define SMBS_GONE SMBO_GONE |
6007 | 91 |
92 struct smb_rq; | |
93 /* This declares struct smb_rqhead */ | |
94 TAILQ_HEAD(smb_rqhead, smb_rq); | |
95 | |
96 #define SMB_NBTIMO 15 | |
97 #define SMB_DEFRQTIMO 30 /* 30 for oplock revoke/writeback */ | |
98 #define SMBWRTTIMO 60 | |
99 #define SMBSSNSETUPTIMO 60 | |
100 #define SMBNOREPLYWAIT (0) | |
101 | |
102 #define SMB_DIALECT(vcp) ((vcp)->vc_sopt.sv_proto) | |
103 | |
104 /* | |
105 * Connection object | |
106 */ | |
107 | |
108 #define SMB_CO_LOCK(cp) mutex_enter(&(cp)->co_lock) | |
109 #define SMB_CO_UNLOCK(cp) mutex_exit(&(cp)->co_lock) | |
110 | |
111 /* | |
112 * Common part of smb_vc, smb_share | |
113 * Locking: co_lock protects most | |
114 * fields in this struct, except | |
115 * as noted below: | |
116 */ | |
117 struct smb_connobj { | |
118 kmutex_t co_lock; | |
119 int co_level; /* SMBL_ */ | |
120 int co_flags; | |
121 int co_usecount; | |
122 | |
123 /* Note: must lock co_parent before child. */ | |
124 struct smb_connobj *co_parent; | |
125 | |
126 /* this.co_lock protects the co_children list */ | |
127 SLIST_HEAD(, smb_connobj) co_children; | |
128 | |
129 /* | |
130 * Linkage in parent's list of children. | |
131 * Must hold parent.co_lock to traverse. | |
132 */ | |
133 SLIST_ENTRY(smb_connobj) co_next; | |
134 | |
135 /* These two are set only at creation. */ | |
136 void (*co_gone)(struct smb_connobj *); | |
137 void (*co_free)(struct smb_connobj *); | |
138 }; | |
139 typedef struct smb_connobj smb_connobj_t; | |
140 | |
141 /* | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
142 * "Level" in the connection object hierarchy |
6007 | 143 */ |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
144 #define SMBL_SM 0 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
145 #define SMBL_VC 1 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
146 #define SMBL_SHARE 2 |
6007 | 147 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
148 /* |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
149 * Virtual Circuit to a server (really connection + session). |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
150 * Yes, calling this a "Virtual Circuit" is confusining, |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
151 * because it has nothing to do with the SMB notion of a |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
152 * "Virtual Circuit". |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
153 */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
154 typedef struct smb_vc { |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
155 struct smb_connobj vc_co; /* keep first! See CPTOVC */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
156 enum smbiod_state vc_state; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
157 kcondvar_t vc_statechg; |
6007 | 158 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
159 zoneid_t vc_zoneid; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
160 uid_t vc_owner; /* Unix owner */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
161 int vc_genid; /* "generation" ID */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
162 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
163 int vc_mackeylen; /* length of MAC key */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
164 uint8_t *vc_mackey; /* MAC key */ |
6007 | 165 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
166 ksema_t vc_sendlock; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
167 struct smb_tran_desc *vc_tdesc; /* transport ops. vector */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
168 void *vc_tdata; /* transport control block */ |
6007 | 169 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
170 kcondvar_t iod_idle; /* IOD thread idle CV */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
171 krwlock_t iod_rqlock; /* iod_rqlist */ |
6007 | 172 struct smb_rqhead iod_rqlist; /* list of outstanding reqs */ |
173 struct _kthread *iod_thr; /* the IOD (reader) thread */ | |
174 int iod_flags; /* see SMBIOD_* below */ | |
175 int iod_newrq; /* send needed (iod_rqlock) */ | |
176 int iod_muxfull; /* maxmux limit reached */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
177 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
178 /* This is copied in/out when IOD enters/returns */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
179 smbioc_ssn_work_t vc_work; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
180 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
181 /* session identity, etc. */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
182 smbioc_ossn_t vc_ssn; |
6007 | 183 } smb_vc_t; |
184 | |
185 #define vc_lock vc_co.co_lock | |
186 #define vc_flags vc_co.co_flags | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
187 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
188 /* defines for members in vc_ssn */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
189 #define vc_owner vc_ssn.ssn_owner |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
190 #define vc_srvname vc_ssn.ssn_srvname |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
191 #define vc_srvaddr vc_ssn.ssn_id.id_srvaddr |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
192 #define vc_domain vc_ssn.ssn_id.id_domain |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
193 #define vc_username vc_ssn.ssn_id.id_user |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
194 #define vc_vopt vc_ssn.ssn_vopt |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
195 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
196 /* defines for members in vc_work */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
197 #define vc_sopt vc_work.wk_sopt |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
198 #define vc_maxmux vc_work.wk_sopt.sv_maxmux |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
199 #define vc_tran_fd vc_work.wk_iods.is_tran_fd |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
200 #define vc_hflags vc_work.wk_iods.is_hflags |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
201 #define vc_hflags2 vc_work.wk_iods.is_hflags2 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
202 #define vc_smbuid vc_work.wk_iods.is_smbuid |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
203 #define vc_next_mid vc_work.wk_iods.is_next_mid |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
204 #define vc_txmax vc_work.wk_iods.is_txmax |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
205 #define vc_rwmax vc_work.wk_iods.is_rwmax |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
206 #define vc_rxmax vc_work.wk_iods.is_rxmax |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
207 #define vc_wxmax vc_work.wk_iods.is_wxmax |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
208 #define vc_ssn_key vc_work.wk_iods.is_ssn_key |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
209 #define vc_next_seq vc_work.wk_iods.is_next_seq |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
210 #define vc_u_mackey vc_work.wk_iods.is_u_mackey |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
211 #define vc_u_maclen vc_work.wk_iods.is_u_maclen |
6007 | 212 |
213 #define SMB_VC_LOCK(vcp) mutex_enter(&(vcp)->vc_lock) | |
214 #define SMB_VC_UNLOCK(vcp) mutex_exit(&(vcp)->vc_lock) | |
215 | |
216 #define SMB_UNICODE_STRINGS(vcp) ((vcp)->vc_hflags2 & SMB_FLAGS2_UNICODE) | |
217 | |
218 /* Bits in iod_flags */ | |
219 #define SMBIOD_RUNNING 0x0001 | |
220 #define SMBIOD_SHUTDOWN 0x0002 | |
221 | |
222 /* | |
223 * smb_share structure describes connection to the given SMB share (tree). | |
224 * Connection to share is always built on top of the VC. | |
225 */ | |
226 | |
227 typedef struct smb_share { | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
228 struct smb_connobj ss_co; /* keep first! See CPTOSS */ |
6007 | 229 kcondvar_t ss_conn_done; /* wait for reconnect */ |
230 int ss_conn_waiters; | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
231 int ss_vcgenid; /* check VC generation ID */ |
6007 | 232 uint16_t ss_tid; /* TID */ |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
233 uint16_t ss_options; /* option support bits */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
234 smbioc_oshare_t ss_ioc; |
6007 | 235 } smb_share_t; |
236 | |
237 #define ss_lock ss_co.co_lock | |
238 #define ss_flags ss_co.co_flags | |
239 | |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
240 #define ss_use ss_ioc.sh_use |
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
241 #define ss_type ss_ioc.sh_type |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
242 #define ss_name ss_ioc.sh_name |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
243 #define ss_pass ss_ioc.sh_pass |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
244 |
6007 | 245 #define SMB_SS_LOCK(ssp) mutex_enter(&(ssp)->ss_lock) |
246 #define SMB_SS_UNLOCK(ssp) mutex_exit(&(ssp)->ss_lock) | |
247 | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
248 #define CPTOVC(cp) ((struct smb_vc *)((void *)(cp))) |
6007 | 249 #define VCTOCP(vcp) (&(vcp)->vc_co) |
250 | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
251 #define CPTOSS(cp) ((struct smb_share *)((void *)(cp))) |
6007 | 252 #define SSTOVC(ssp) CPTOVC(((ssp)->ss_co.co_parent)) |
253 #define SSTOCP(ssp) (&(ssp)->ss_co) | |
254 | |
255 /* | |
256 * Call-back operations vector, so the netsmb module | |
257 * can notify smbfs about events affecting mounts. | |
258 * Installed in netsmb after smbfs loads. | |
259 */ | |
260 typedef struct smb_fscb { | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
261 /* Called when the VC has disconnected. */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
262 void (*fscb_disconn)(smb_share_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
263 /* Called when the VC has reconnected. */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
264 void (*fscb_connect)(smb_share_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
265 /* Called when the server becomes unresponsive. */ |
6007 | 266 void (*fscb_down)(smb_share_t *); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
267 /* Called when the server is responding again. */ |
6007 | 268 void (*fscb_up)(smb_share_t *); |
269 } smb_fscb_t; | |
270 /* Install the above vector, or pass NULL to clear it. */ | |
11332
ed3411181494
6650611 Attribute cache logic needs improvement
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
10023
diff
changeset
|
271 void smb_fscb_set(smb_fscb_t *); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
272 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
273 /* |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
274 * The driver per open instance object. |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
275 * Mostly used in: smb_dev.c, smb_usr.c |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
276 */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
277 typedef struct smb_dev { |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
278 dev_info_t *sd_dip; /* ptr to dev_info node */ |
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
279 struct cred *sd_cred; /* per dev credentails */ |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
280 struct smb_vc *sd_vc; /* Reference to VC */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
281 struct smb_share *sd_share; /* Reference to share if any */ |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
282 int sd_level; /* SMBL_VC, ... */ |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
283 int sd_vcgenid; /* Generation of share or VC */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
284 int sd_poll; /* Future use */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
285 int sd_seq; /* Kind of minor number/instance no */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
286 int sd_flags; /* State of connection */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
287 #define NSMBFL_OPEN 0x0001 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
288 #define NSMBFL_IOD 0x0002 |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
289 int sd_smbfid; /* library read/write */ |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
290 zoneid_t zoneid; /* Zone id */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
291 } smb_dev_t; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
292 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
293 extern const uint32_t nsmb_version; |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
294 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
295 /* |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
296 * smb_dev.c |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
297 */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
298 int smb_dev2share(int fd, struct smb_share **sspp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
299 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
300 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
301 /* |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
302 * smb_usr.c |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
303 */ |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
304 int smb_usr_get_flags2(smb_dev_t *sdp, intptr_t arg, int flags); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
305 int smb_usr_get_ssnkey(smb_dev_t *sdp, intptr_t arg, int flags); |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
306 int smb_usr_dup_dev(smb_dev_t *sdp, intptr_t arg, int flags); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
307 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
308 int smb_usr_simplerq(smb_dev_t *sdp, intptr_t arg, int flags, cred_t *cr); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
309 int smb_usr_t2request(smb_dev_t *sdp, intptr_t arg, int flags, cred_t *cr); |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
310 |
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
311 int smb_usr_closefh(smb_dev_t *, cred_t *); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
312 int smb_usr_rw(smb_dev_t *sdp, int cmd, intptr_t arg, int flags, cred_t *cr); |
13394
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
313 int smb_usr_ntcreate(smb_dev_t *, intptr_t, int, cred_t *); |
96340372b72d
1120 Use real file descriptors for smbfs named pipes.
Gordon Ross <gwr@nexenta.com>
parents:
11332
diff
changeset
|
314 int smb_usr_printjob(smb_dev_t *, intptr_t, int, cred_t *); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
315 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
316 int smb_usr_get_ssn(smb_dev_t *, int, intptr_t, int, cred_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
317 int smb_usr_drop_ssn(smb_dev_t *sdp, int cmd); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
318 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
319 int smb_usr_get_tree(smb_dev_t *, int, intptr_t, int, cred_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
320 int smb_usr_drop_tree(smb_dev_t *sdp, int cmd); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
321 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
322 int smb_usr_iod_work(smb_dev_t *sdp, intptr_t arg, int flags, cred_t *cr); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
323 int smb_usr_iod_ioctl(smb_dev_t *sdp, int cmd, intptr_t arg, int flags); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
324 |
6007 | 325 |
326 /* | |
327 * IOD functions | |
328 */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
329 int smb_iod_create(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
330 int smb_iod_destroy(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
331 int smb_iod_connect(smb_vc_t *vcp); |
11332
ed3411181494
6650611 Attribute cache logic needs improvement
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
10023
diff
changeset
|
332 void smb_iod_disconnect(smb_vc_t *vcp); |
6007 | 333 int smb_iod_addrq(struct smb_rq *rqp); |
334 int smb_iod_multirq(struct smb_rq *rqp); | |
335 int smb_iod_waitrq(struct smb_rq *rqp); | |
11332
ed3411181494
6650611 Attribute cache logic needs improvement
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
10023
diff
changeset
|
336 void smb_iod_removerq(struct smb_rq *rqp); |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
337 void smb_iod_shutdown_share(smb_share_t *ssp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
338 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
339 void smb_iod_sendall(smb_vc_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
340 int smb_iod_recvall(smb_vc_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
341 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
342 int smb_iod_vc_work(smb_vc_t *, cred_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
343 int smb_iod_vc_idle(smb_vc_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
344 int smb_iod_vc_rcfail(smb_vc_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
345 int smb_iod_reconnect(smb_vc_t *); |
6007 | 346 |
347 /* | |
348 * Session level functions | |
349 */ | |
350 int smb_sm_init(void); | |
351 int smb_sm_idle(void); | |
352 void smb_sm_done(void); | |
353 | |
354 /* | |
355 * VC level functions | |
356 */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
357 void smb_vc_hold(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
358 void smb_vc_rele(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
359 void smb_vc_kill(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
360 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
361 int smb_vc_findcreate(smbioc_ossn_t *, smb_cred_t *, smb_vc_t **); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
362 int smb_vc_create(smbioc_ossn_t *ossn, smb_cred_t *scred, smb_vc_t **vcpp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
363 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
364 const char *smb_vc_getpass(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
365 uint16_t smb_vc_nextmid(smb_vc_t *vcp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
366 void *smb_vc_getipaddr(smb_vc_t *vcp, int *ipvers); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
367 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
368 typedef void (*walk_share_func_t)(smb_share_t *); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
369 void smb_vc_walkshares(struct smb_vc *, walk_share_func_t); |
6007 | 370 |
371 /* | |
372 * share level functions | |
373 */ | |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
374 |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
375 int smb_share_findcreate(smbioc_tcon_t *, smb_vc_t *, |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
376 smb_share_t **, smb_cred_t *); |
6007 | 377 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
378 void smb_share_hold(smb_share_t *ssp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
379 void smb_share_rele(smb_share_t *ssp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
380 void smb_share_kill(smb_share_t *ssp); |
6007 | 381 |
10023
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
382 void smb_share_invalidate(smb_share_t *ssp); |
71bf38dba3d6
6584198 SMB Client needs authentication improvements
Gordon Ross <Gordon.Ross@Sun.COM>
parents:
8271
diff
changeset
|
383 int smb_share_tcon(smb_share_t *, smb_cred_t *); |
6007 | 384 |
385 #endif /* _SMB_CONN_H */ |