xref: /titanic_51/usr/src/uts/common/netsmb/smb_dev.h (revision 430b4c467020edf2445feb0c21db01c88b86243a)
14bff34e3Sthurlow /*
24bff34e3Sthurlow  * Copyright (c) 2000-2001 Boris Popov
34bff34e3Sthurlow  * All rights reserved.
44bff34e3Sthurlow  *
54bff34e3Sthurlow  * Redistribution and use in source and binary forms, with or without
64bff34e3Sthurlow  * modification, are permitted provided that the following conditions
74bff34e3Sthurlow  * are met:
84bff34e3Sthurlow  * 1. Redistributions of source code must retain the above copyright
94bff34e3Sthurlow  *    notice, this list of conditions and the following disclaimer.
104bff34e3Sthurlow  * 2. Redistributions in binary form must reproduce the above copyright
114bff34e3Sthurlow  *    notice, this list of conditions and the following disclaimer in the
124bff34e3Sthurlow  *    documentation and/or other materials provided with the distribution.
134bff34e3Sthurlow  * 3. All advertising materials mentioning features or use of this software
144bff34e3Sthurlow  *    must display the following acknowledgement:
154bff34e3Sthurlow  *    This product includes software developed by Boris Popov.
164bff34e3Sthurlow  * 4. Neither the name of the author nor the names of any co-contributors
174bff34e3Sthurlow  *    may be used to endorse or promote products derived from this software
184bff34e3Sthurlow  *    without specific prior written permission.
194bff34e3Sthurlow  *
204bff34e3Sthurlow  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
214bff34e3Sthurlow  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224bff34e3Sthurlow  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234bff34e3Sthurlow  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
244bff34e3Sthurlow  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254bff34e3Sthurlow  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264bff34e3Sthurlow  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274bff34e3Sthurlow  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284bff34e3Sthurlow  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294bff34e3Sthurlow  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304bff34e3Sthurlow  * SUCH DAMAGE.
314bff34e3Sthurlow  *
324bff34e3Sthurlow  * $Id: smb_dev.h,v 1.10.178.1 2005/05/27 02:35:29 lindak Exp $
334bff34e3Sthurlow  */
344bff34e3Sthurlow 
354bff34e3Sthurlow /*
36*430b4c46SGordon Ross  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
37613a2f6bSGordon Ross  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
384bff34e3Sthurlow  * Use is subject to license terms.
394bff34e3Sthurlow  */
404bff34e3Sthurlow 
414bff34e3Sthurlow #ifndef _NETSMB_DEV_H_
424bff34e3Sthurlow #define	_NETSMB_DEV_H_
434bff34e3Sthurlow 
444bff34e3Sthurlow /*
454bff34e3Sthurlow  * This file defines an internal ABI for the "nsmb" driver,
464bff34e3Sthurlow  * particularly the various data structures passed to ioctl.
474bff34e3Sthurlow  * In order to avoid some messy 32-bit to 64-bit conversions
484bff34e3Sthurlow  * in the driver, we take pains to define all data structures
494bff34e3Sthurlow  * that pass across the user/kernel boundary in a way that
504bff34e3Sthurlow  * makes them invariant across 32-bit and 64-bit ABIs.
514bff34e3Sthurlow  * This invariance is checked during the driver build
524bff34e3Sthurlow  * using a mechanism similar to genassym.h builds.
534bff34e3Sthurlow  *
544bff34e3Sthurlow  * If you change any of the ioctl data structures in
554bff34e3Sthurlow  * this file, YOU MUST ALSO edit this file:
564bff34e3Sthurlow  *   uts/common/fs/smbclnt/netsmb/offsets.in
574bff34e3Sthurlow  * and then verify the invariance describe above.
584bff34e3Sthurlow  *
594bff34e3Sthurlow  * Also, remember to "bump" NSMB_VER below when
604bff34e3Sthurlow  * any part of this user/kernel I/F changes.
614bff34e3Sthurlow  */
624bff34e3Sthurlow 
634bff34e3Sthurlow #include <sys/types.h>
644bff34e3Sthurlow #include <sys/socket_impl.h>
65613a2f6bSGordon Ross #include <netinet/in.h>
664bff34e3Sthurlow 
674bff34e3Sthurlow #define	NSMB_NAME		"nsmb"
684bff34e3Sthurlow 
694bff34e3Sthurlow /*
704bff34e3Sthurlow  * Update NSMB_VER* if any of the ioctl codes and/or
714bff34e3Sthurlow  * associated structures change in ways that would
724bff34e3Sthurlow  * make them incompatible with an old driver.
734bff34e3Sthurlow  */
744bff34e3Sthurlow #define	NSMB_VERMAJ	1
75*430b4c46SGordon Ross #define	NSMB_VERMIN	4000
764bff34e3Sthurlow #define	NSMB_VERSION	(NSMB_VERMAJ * 100000 + NSMB_VERMIN)
774bff34e3Sthurlow 
784bff34e3Sthurlow /*
79613a2f6bSGordon Ross  * Some errno values we need to expose to the library.
80613a2f6bSGordon Ross  * NB: these are also defined in the library smbfs_api.h
81613a2f6bSGordon Ross  * to avoid exposing all of this stuff in that API.
82613a2f6bSGordon Ross  *
834bff34e3Sthurlow  * EBADRPC is used for message decoding errors.
844bff34e3Sthurlow  * EAUTH is used for CIFS authentication errors.
854bff34e3Sthurlow  */
864bff34e3Sthurlow #ifndef EBADRPC
87613a2f6bSGordon Ross #define	EBADRPC 	113
884bff34e3Sthurlow #endif
894bff34e3Sthurlow #ifndef EAUTH
90613a2f6bSGordon Ross #define	EAUTH		114
914bff34e3Sthurlow #endif
924bff34e3Sthurlow 
934bff34e3Sthurlow /*
944bff34e3Sthurlow  * Upper/lower case options
954bff34e3Sthurlow  */
964bff34e3Sthurlow #define	SMB_CS_NONE	0x0000
974bff34e3Sthurlow #define	SMB_CS_UPPER	0x0001	/* convert passed string to upper case */
984bff34e3Sthurlow #define	SMB_CS_LOWER	0x0002	/* convert passed string to lower case */
994bff34e3Sthurlow 
1004bff34e3Sthurlow /*
1014bff34e3Sthurlow  * access mode stuff (see also smb_lib.h)
1024bff34e3Sthurlow  */
1034bff34e3Sthurlow #define	SMBM_ANY_OWNER		((uid_t)-1)
1044bff34e3Sthurlow #define	SMBM_ANY_GROUP		((gid_t)-1)
1054bff34e3Sthurlow 
1064bff34e3Sthurlow /*
1074bff34e3Sthurlow  * Option flags in smbioc_ossn.ioc_opt
1084bff34e3Sthurlow  * and vcspec.optflags
1094bff34e3Sthurlow  */
1104bff34e3Sthurlow #define	SMBVOPT_CREATE		0x0001	/* create object if necessary */
1114bff34e3Sthurlow #define	SMBVOPT_PRIVATE		0x0002	/* connection should be private */
1124bff34e3Sthurlow #define	SMBVOPT_SINGLESHARE	0x0004	/* keep only one share at this VC */
1134bff34e3Sthurlow #define	SMBVOPT_PERMANENT	0x0010	/* object will keep last reference */
1144bff34e3Sthurlow #define	SMBVOPT_EXT_SEC		0x0020	/* extended security negotiation */
1154bff34e3Sthurlow #define	SMBVOPT_USE_KEYCHAIN	0x0040	/* get p/w from keychain */
1164bff34e3Sthurlow #define	SMBVOPT_KC_DOMAIN	0x0080	/* keychain lookup uses domain */
1179c9af259SGordon Ross 
1189c9af259SGordon Ross #define	SMBVOPT_SIGNING_ENABLED		0x0100	/* sign if server agrees */
1199c9af259SGordon Ross #define	SMBVOPT_SIGNING_REQUIRED	0x0200	/* signing required */
1209c9af259SGordon Ross #define	SMBVOPT_SIGNING_MASK		0x0300	/* all signing bits */
1219c9af259SGordon Ross 
1224bff34e3Sthurlow /*
1234bff34e3Sthurlow  * Option flags in smbioc_oshare.ioc_opt
1244bff34e3Sthurlow  * and sharespec.optflags
1254bff34e3Sthurlow  */
1264bff34e3Sthurlow #define	SMBSOPT_CREATE		SMBVOPT_CREATE
1274bff34e3Sthurlow #define	SMBSOPT_PERMANENT	SMBVOPT_PERMANENT
1284bff34e3Sthurlow 
129613a2f6bSGordon Ross /* All user and machine names. */
130613a2f6bSGordon Ross #define	SMBIOC_MAX_NAME		256
131613a2f6bSGordon Ross 
132613a2f6bSGordon Ross /*
133613a2f6bSGordon Ross  * Size of storage for p/w hashes.
134613a2f6bSGordon Ross  * Also for SMBIOC_GETSSNKEY.
135613a2f6bSGordon Ross  */
136613a2f6bSGordon Ross #define	SMBIOC_HASH_SZ	16
137613a2f6bSGordon Ross 
138613a2f6bSGordon Ross /*
139613a2f6bSGordon Ross  * network IO daemon states
140613a2f6bSGordon Ross  * really connection states.
141613a2f6bSGordon Ross  */
142613a2f6bSGordon Ross enum smbiod_state {
143613a2f6bSGordon Ross 	SMBIOD_ST_IDLE = 0,	/* no user requests enqueued yet */
144613a2f6bSGordon Ross 	SMBIOD_ST_RECONNECT,	/* a [re]connect attempt is in progress */
145613a2f6bSGordon Ross 	SMBIOD_ST_RCFAILED,	/* a reconnect attempt has failed */
146613a2f6bSGordon Ross 	SMBIOD_ST_VCACTIVE,	/* session established */
147613a2f6bSGordon Ross 	SMBIOD_ST_DEAD		/* connection gone, no IOD */
148613a2f6bSGordon Ross };
149613a2f6bSGordon Ross 
1504bff34e3Sthurlow 
1514bff34e3Sthurlow /*
1524bff34e3Sthurlow  * We're now using structures that are invariant
1534bff34e3Sthurlow  * across 32-bit vs 64-bit compilers for all
1544bff34e3Sthurlow  * member sizes and offsets.  Scalar members
1554bff34e3Sthurlow  * simply have to use fixed-size types.
1564bff34e3Sthurlow  * Pointers are a little harder...
1574bff34e3Sthurlow  * We use this union for all pointers that
1584bff34e3Sthurlow  * must pass between user and kernel.
1594bff34e3Sthurlow  */
1604bff34e3Sthurlow typedef union lptr {
1614bff34e3Sthurlow 	uint64_t lp_ll;
1624bff34e3Sthurlow #ifdef _LP64
1634bff34e3Sthurlow 	void	*lp_ptr;
1644bff34e3Sthurlow #endif
1654bff34e3Sthurlow #ifdef _ILP32
1664bff34e3Sthurlow 	void	*_lp_p2[2];
1674bff34e3Sthurlow #ifdef _LITTLE_ENDIAN
1684bff34e3Sthurlow #define	lp_ptr	_lp_p2[0]
1694bff34e3Sthurlow #define	lp_pad	_lp_p2[1]
1704bff34e3Sthurlow #else /* _ENDIAN */
1714bff34e3Sthurlow #define	lp_pad	_lp_p2[0]
1724bff34e3Sthurlow #define	lp_ptr	_lp_p2[1]
1734bff34e3Sthurlow #endif /* _ENDIAN */
1744bff34e3Sthurlow #endif /* _ILP32 */
1754bff34e3Sthurlow } lptr_t;
1764bff34e3Sthurlow 
1774bff34e3Sthurlow /*
1784bff34e3Sthurlow  * Handy union of sockaddr types we use.
1794bff34e3Sthurlow  * Type discriminator is sa_family
1804bff34e3Sthurlow  */
181613a2f6bSGordon Ross union smbioc_sockaddr {
182613a2f6bSGordon Ross 	struct sockaddr sa;	/* generic */
183613a2f6bSGordon Ross 	struct sockaddr_in sin;
184613a2f6bSGordon Ross 	struct sockaddr_in6 sin6;
1854bff34e3Sthurlow };
186613a2f6bSGordon Ross typedef union smbioc_sockaddr smbioc_sockaddr_t;
1874bff34e3Sthurlow 
1884bff34e3Sthurlow /*
189613a2f6bSGordon Ross  * This is what identifies a session.
190613a2f6bSGordon Ross  */
191613a2f6bSGordon Ross struct smbioc_ssn_ident {
192613a2f6bSGordon Ross 	smbioc_sockaddr_t id_srvaddr;
193613a2f6bSGordon Ross 	char		id_domain[SMBIOC_MAX_NAME];
194613a2f6bSGordon Ross 	char		id_user[SMBIOC_MAX_NAME];
195613a2f6bSGordon Ross };
196613a2f6bSGordon Ross typedef struct smbioc_ssn_ident smbioc_ssn_ident_t;
197613a2f6bSGordon Ross 
198613a2f6bSGordon Ross /*
199613a2f6bSGordon Ross  * Flags for smbioc_ossn.ssn_opt
2004bff34e3Sthurlow  */
2014bff34e3Sthurlow #define	SMBLK_CREATE		SMBVOPT_CREATE
2024bff34e3Sthurlow 
203613a2f6bSGordon Ross /*
204613a2f6bSGordon Ross  * Structure used with SMBIOC_SSN_FIND, _CREATE
205613a2f6bSGordon Ross  */
2064bff34e3Sthurlow struct smbioc_ossn {
207613a2f6bSGordon Ross 	uint32_t		ssn_vopt;	/* i.e. SMBVOPT_CREATE */
208613a2f6bSGordon Ross 	uint32_t		ssn_owner;	/* Unix owner (UID) */
209613a2f6bSGordon Ross 	smbioc_ssn_ident_t	ssn_id;
210613a2f6bSGordon Ross 	char			ssn_srvname[SMBIOC_MAX_NAME];
2114bff34e3Sthurlow };
2124bff34e3Sthurlow typedef struct smbioc_ossn smbioc_ossn_t;
213613a2f6bSGordon Ross /* Convenience names for members under ssn_id */
214613a2f6bSGordon Ross #define	ssn_srvaddr	ssn_id.id_srvaddr
215613a2f6bSGordon Ross #define	ssn_domain	ssn_id.id_domain
216613a2f6bSGordon Ross #define	ssn_user	ssn_id.id_user
2174bff34e3Sthurlow 
2184bff34e3Sthurlow /*
219613a2f6bSGordon Ross  * Structure used with SMBIOC_TREE_FIND, _CONNECT
2204bff34e3Sthurlow  */
221613a2f6bSGordon Ross struct smbioc_oshare {
222*430b4c46SGordon Ross 	uint32_t	sh_use;		/* requested */
223*430b4c46SGordon Ross 	uint32_t	sh_type;	/* returned */
224613a2f6bSGordon Ross 	char		sh_name[SMBIOC_MAX_NAME];
225613a2f6bSGordon Ross 	char		sh_pass[SMBIOC_MAX_NAME];
2264bff34e3Sthurlow };
2274bff34e3Sthurlow typedef struct smbioc_oshare smbioc_oshare_t;
2284bff34e3Sthurlow 
229613a2f6bSGordon Ross typedef struct smbioc_tcon {
230613a2f6bSGordon Ross 	int32_t		tc_flags;
231613a2f6bSGordon Ross 	int32_t		tc_opt;
232613a2f6bSGordon Ross 	smbioc_oshare_t	tc_sh;
233613a2f6bSGordon Ross } smbioc_tcon_t;
234613a2f6bSGordon Ross 
235613a2f6bSGordon Ross 
236613a2f6bSGordon Ross /*
237613a2f6bSGordon Ross  * Negotiated protocol parameters
238613a2f6bSGordon Ross  */
239613a2f6bSGordon Ross struct smb_sopt {
240613a2f6bSGordon Ross 	int16_t		sv_proto;	/* protocol dialect */
241613a2f6bSGordon Ross 	uchar_t		sv_sm;		/* security mode */
242613a2f6bSGordon Ross 	int16_t		sv_tz;		/* offset in min relative to UTC */
243613a2f6bSGordon Ross 	uint16_t	sv_maxmux;	/* max number of outstanding rq's */
244613a2f6bSGordon Ross 	uint16_t 	sv_maxvcs;	/* max number of VCs */
245613a2f6bSGordon Ross 	uint16_t	sv_rawmode;
246613a2f6bSGordon Ross 	uint32_t	sv_maxtx;	/* maximum transmit buf size */
247613a2f6bSGordon Ross 	uint32_t	sv_maxraw;	/* maximum raw-buffer size */
248613a2f6bSGordon Ross 	uint32_t	sv_skey;	/* session key */
249613a2f6bSGordon Ross 	uint32_t	sv_caps;	/* capabilites SMB_CAP_ */
250613a2f6bSGordon Ross };
251613a2f6bSGordon Ross typedef struct smb_sopt smb_sopt_t;
252613a2f6bSGordon Ross 
253613a2f6bSGordon Ross /*
254613a2f6bSGordon Ross  * State carried in/out of the driver by the IOD thread.
255613a2f6bSGordon Ross  * Inside the driver, these are members of the "VC" object.
256613a2f6bSGordon Ross  */
257613a2f6bSGordon Ross struct smb_iods {
258613a2f6bSGordon Ross 	int32_t		is_tran_fd;	/* transport FD */
259613a2f6bSGordon Ross 	uint32_t	is_vcflags;	/* SMBV_... */
260613a2f6bSGordon Ross 	uint8_t 	is_hflags;	/* SMB header flags */
261613a2f6bSGordon Ross 	uint16_t	is_hflags2;	/* SMB header flags2 */
262613a2f6bSGordon Ross 	uint16_t	is_smbuid;	/* SMB header UID */
263613a2f6bSGordon Ross 	uint16_t	is_next_mid;	/* SMB header MID */
264613a2f6bSGordon Ross 	uint32_t	is_txmax;	/* max tx/rx packet size */
265613a2f6bSGordon Ross 	uint32_t	is_rwmax;	/* max read/write data size */
266613a2f6bSGordon Ross 	uint32_t	is_rxmax;	/* max readx data size */
267613a2f6bSGordon Ross 	uint32_t	is_wxmax;	/* max writex data size */
268613a2f6bSGordon Ross 	uint8_t		is_ssn_key[SMBIOC_HASH_SZ]; /* session key */
269613a2f6bSGordon Ross 	/* Signing state */
270613a2f6bSGordon Ross 	uint32_t	is_next_seq;	/* my next sequence number */
271613a2f6bSGordon Ross 	uint32_t	is_u_maclen;	/* MAC key length */
272613a2f6bSGordon Ross 	lptr_t		is_u_mackey;	/* user-space ptr! */
273613a2f6bSGordon Ross };
274613a2f6bSGordon Ross typedef struct smb_iods smb_iods_t;
275613a2f6bSGordon Ross 
276613a2f6bSGordon Ross /*
277613a2f6bSGordon Ross  * This is the operational state information passed
278613a2f6bSGordon Ross  * in and out of the driver for SMBIOC_SSN_WORK
279613a2f6bSGordon Ross  */
280613a2f6bSGordon Ross struct smbioc_ssn_work {
281613a2f6bSGordon Ross 	smb_iods_t	wk_iods;
282613a2f6bSGordon Ross 	smb_sopt_t	wk_sopt;
283613a2f6bSGordon Ross 	int		wk_out_state;
284613a2f6bSGordon Ross };
285613a2f6bSGordon Ross typedef struct smbioc_ssn_work smbioc_ssn_work_t;
286613a2f6bSGordon Ross 
287613a2f6bSGordon Ross /*
288613a2f6bSGordon Ross  * User-level SMB requests
289613a2f6bSGordon Ross  */
290613a2f6bSGordon Ross 
291613a2f6bSGordon Ross /*
292613a2f6bSGordon Ross  * SMBIOC_REQUEST (simple SMB request)
293613a2f6bSGordon Ross  */
2944bff34e3Sthurlow typedef struct smbioc_rq {
2954bff34e3Sthurlow 	uchar_t		ioc_cmd;
2964bff34e3Sthurlow 	uint8_t 	ioc_errclass;
2974bff34e3Sthurlow 	uint16_t	ioc_serror;
2984bff34e3Sthurlow 	uint32_t	ioc_error;
299613a2f6bSGordon Ross 	uint32_t	ioc_tbufsz;	/* transmit */
300613a2f6bSGordon Ross 	uint32_t	ioc_rbufsz;	/* receive */
301613a2f6bSGordon Ross 	lptr_t		_ioc_tbuf;
302613a2f6bSGordon Ross 	lptr_t		_ioc_rbuf;
3034bff34e3Sthurlow } smbioc_rq_t;
304613a2f6bSGordon Ross #define	ioc_tbuf	_ioc_tbuf.lp_ptr
305613a2f6bSGordon Ross #define	ioc_rbuf	_ioc_rbuf.lp_ptr
3064bff34e3Sthurlow 
3074bff34e3Sthurlow 
308613a2f6bSGordon Ross #define	SMBIOC_T2RQ_MAXSETUP	4
3099c9af259SGordon Ross #define	SMBIOC_T2RQ_MAXNAME	128
3109c9af259SGordon Ross 
3114bff34e3Sthurlow typedef struct smbioc_t2rq {
312613a2f6bSGordon Ross 	uint16_t	ioc_setup[SMBIOC_T2RQ_MAXSETUP];
3134bff34e3Sthurlow 	int32_t		ioc_setupcnt;
3149c9af259SGordon Ross 	char		ioc_name[SMBIOC_T2RQ_MAXNAME];
3154bff34e3Sthurlow 	ushort_t	ioc_tparamcnt;
3164bff34e3Sthurlow 	ushort_t	ioc_tdatacnt;
3174bff34e3Sthurlow 	ushort_t	ioc_rparamcnt;
3184bff34e3Sthurlow 	ushort_t	ioc_rdatacnt;
3194bff34e3Sthurlow 	uint8_t 	ioc__pad1;
3204bff34e3Sthurlow 	uint8_t 	ioc_errclass;
3214bff34e3Sthurlow 	uint16_t	ioc_serror;
3224bff34e3Sthurlow 	uint32_t	ioc_error;
3234bff34e3Sthurlow 	uint16_t	ioc_rpflags2;
3244bff34e3Sthurlow 	uint16_t	ioc__pad2;
3254bff34e3Sthurlow 	lptr_t		_ioc_tparam;
3264bff34e3Sthurlow 	lptr_t		_ioc_tdata;
3274bff34e3Sthurlow 	lptr_t		_ioc_rparam;
3284bff34e3Sthurlow 	lptr_t		_ioc_rdata;
3294bff34e3Sthurlow } smbioc_t2rq_t;
3304bff34e3Sthurlow #define	ioc_tparam	_ioc_tparam.lp_ptr
3314bff34e3Sthurlow #define	ioc_tdata	_ioc_tdata.lp_ptr
3324bff34e3Sthurlow #define	ioc_rparam	_ioc_rparam.lp_ptr
3334bff34e3Sthurlow #define	ioc_rdata	_ioc_rdata.lp_ptr
3344bff34e3Sthurlow 
3354bff34e3Sthurlow 
3364bff34e3Sthurlow typedef struct smbioc_flags {
3374bff34e3Sthurlow 	int32_t		ioc_level;	/* 0 - session, 1 - share */
3384bff34e3Sthurlow 	int32_t		ioc_flags;
339613a2f6bSGordon Ross 	int32_t		ioc_mask;
3404bff34e3Sthurlow } smbioc_flags_t;
3414bff34e3Sthurlow 
3424bff34e3Sthurlow typedef struct smbioc_rw {
343*430b4c46SGordon Ross 	int32_t		ioc_fh;
3444bff34e3Sthurlow 	uint32_t	ioc_cnt;
3454bff34e3Sthurlow 	lloff_t	_ioc_offset;
3464bff34e3Sthurlow 	lptr_t	_ioc_base;
3474bff34e3Sthurlow } smbioc_rw_t;
3484bff34e3Sthurlow #define	ioc_offset	_ioc_offset._f
3494bff34e3Sthurlow #define	ioc_base	_ioc_base.lp_ptr
3504bff34e3Sthurlow 
351*430b4c46SGordon Ross typedef struct smbioc_ntcreate {
352*430b4c46SGordon Ross 	uint32_t	ioc_req_acc;
353*430b4c46SGordon Ross 	uint32_t	ioc_efattr;
354*430b4c46SGordon Ross 	uint32_t	ioc_share_acc;
355*430b4c46SGordon Ross 	uint32_t	ioc_open_disp;
356*430b4c46SGordon Ross 	uint32_t	ioc_creat_opts;
357*430b4c46SGordon Ross 	char		ioc_name[SMBIOC_MAX_NAME];
358*430b4c46SGordon Ross } smbioc_ntcreate_t;
359*430b4c46SGordon Ross 
360*430b4c46SGordon Ross typedef struct smbioc_printjob {
361*430b4c46SGordon Ross 	uint16_t	ioc_setuplen;
362*430b4c46SGordon Ross 	uint16_t	ioc_prmode;
363*430b4c46SGordon Ross 	char		ioc_title[SMBIOC_MAX_NAME];
364*430b4c46SGordon Ross } smbioc_printjob_t;
365*430b4c46SGordon Ross 
3664bff34e3Sthurlow /* Password Keychain (PK) support. */
3674bff34e3Sthurlow typedef struct smbioc_pk {
3684bff34e3Sthurlow 	uid_t	pk_uid;				/* UID for PAM use */
369613a2f6bSGordon Ross 	char pk_dom[SMBIOC_MAX_NAME];		/* CIFS domain name */
370613a2f6bSGordon Ross 	char pk_usr[SMBIOC_MAX_NAME];		/* CIFS user name */
371613a2f6bSGordon Ross 	uchar_t pk_lmhash[SMBIOC_HASH_SZ];	/* LanMan p/w hash */
372613a2f6bSGordon Ross 	uchar_t pk_nthash[SMBIOC_HASH_SZ];	/* NTLM p/w hash */
3734bff34e3Sthurlow } smbioc_pk_t;
3744bff34e3Sthurlow 
3754bff34e3Sthurlow 
3764bff34e3Sthurlow /*
3774bff34e3Sthurlow  * Device IOCTLs
3784bff34e3Sthurlow  *
3794bff34e3Sthurlow  * Define ioctl codes the way ZFS does.
3804bff34e3Sthurlow  * The "base" value is arbitrary, and can
3814bff34e3Sthurlow  * occupy the high word if we like, because
3824bff34e3Sthurlow  * our driver does its own copyin/copyout.
3834bff34e3Sthurlow  * Keep GETVERS first and use it to verify
3844bff34e3Sthurlow  * driver compatibility with the library.
3854bff34e3Sthurlow  */
3864bff34e3Sthurlow #define	SMBIOC_BASE 	((('n' << 8) | 's') << 8)
3874bff34e3Sthurlow typedef enum nsmb_ioc {
388613a2f6bSGordon Ross 	SMBIOC_GETVERS = SMBIOC_BASE,	/* keep first */
389613a2f6bSGordon Ross 	SMBIOC_FLAGS2,		/* get hflags2 */
390613a2f6bSGordon Ross 	SMBIOC_GETSSNKEY,	/* get SMB session key */
391*430b4c46SGordon Ross 	SMBIOC_DUP_DEV,		/* duplicate dev handle */
392613a2f6bSGordon Ross 
393613a2f6bSGordon Ross 	SMBIOC_REQUEST,		/* simple request */
394613a2f6bSGordon Ross 	SMBIOC_T2RQ,		/* trans2 request */
395*430b4c46SGordon Ross 
396613a2f6bSGordon Ross 	SMBIOC_READ,		/* read (pipe) */
397613a2f6bSGordon Ross 	SMBIOC_WRITE,		/* write (pipe) */
398*430b4c46SGordon Ross 	SMBIOC_NTCREATE,	/* open or create */
399*430b4c46SGordon Ross 	SMBIOC_PRINTJOB,	/* open print job */
400*430b4c46SGordon Ross 	SMBIOC_CLOSEFH,		/* from ntcreate or printjob */
401613a2f6bSGordon Ross 
402613a2f6bSGordon Ross 	SMBIOC_SSN_CREATE,
403613a2f6bSGordon Ross 	SMBIOC_SSN_FIND,
404613a2f6bSGordon Ross 	SMBIOC_SSN_KILL,	/* force disconnect */
405613a2f6bSGordon Ross 	SMBIOC_SSN_RELE,	/* drop our reference */
406613a2f6bSGordon Ross 
407613a2f6bSGordon Ross 	SMBIOC_TREE_CONNECT,	/* create and connect */
408613a2f6bSGordon Ross 	SMBIOC_TREE_FIND,
409613a2f6bSGordon Ross 	SMBIOC_TREE_KILL,
410613a2f6bSGordon Ross 	SMBIOC_TREE_RELE,
411613a2f6bSGordon Ross 
412613a2f6bSGordon Ross 	SMBIOC_IOD_WORK,	/* work on session requests */
413613a2f6bSGordon Ross 	SMBIOC_IOD_IDLE,	/* wait for requests on this session */
414613a2f6bSGordon Ross 	SMBIOC_IOD_RCFAIL,	/* notify that reconnect failed */
415613a2f6bSGordon Ross 
4164bff34e3Sthurlow 	/* Password Keychain (PK) support. */
4174bff34e3Sthurlow 	SMBIOC_PK_ADD,    /* Add/Modify a password entry */
4184bff34e3Sthurlow 	SMBIOC_PK_CHK,    /* Check for a password entry */
4194bff34e3Sthurlow 	SMBIOC_PK_DEL,    /* Delete specified password entry */
4204bff34e3Sthurlow 	SMBIOC_PK_DEL_OWNER,	/* all owned by the caller */
4214bff34e3Sthurlow 	SMBIOC_PK_DEL_EVERYONE	/* all owned by everyone */
4224bff34e3Sthurlow } nsmb_ioc_t;
4234bff34e3Sthurlow 
4244bff34e3Sthurlow #endif /* _NETSMB_DEV_H_ */
425