xref: /titanic_41/usr/src/uts/common/smbsrv/smb_ioctl.h (revision aa2aa9a662539940ddbc8610da5a3a874ebd7503)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMB_IOCTL_H_
27 #define	_SMB_IOCTL_H_
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #include <smbsrv/smbinfo.h>
36 
37 #define	SMB_IOC_VERSION		0x534D4201	/* SMB1 */
38 
39 #define	SMB_IOC_BASE		(('S' << 16) | ('B' << 8))
40 
41 #define	SMB_IOC_CONFIG		_IOW(SMB_IOC_BASE, 1, int)
42 #define	SMB_IOC_START		_IOW(SMB_IOC_BASE, 2, int)
43 #define	SMB_IOC_NBT_LISTEN	_IOW(SMB_IOC_BASE, 3, int)
44 #define	SMB_IOC_TCP_LISTEN	_IOW(SMB_IOC_BASE, 4, int)
45 #define	SMB_IOC_NBT_RECEIVE	_IOW(SMB_IOC_BASE, 5, int)
46 #define	SMB_IOC_TCP_RECEIVE	_IOW(SMB_IOC_BASE, 6, int)
47 #define	SMB_IOC_GMTOFF		_IOW(SMB_IOC_BASE, 7, int)
48 #define	SMB_IOC_SHARE		_IOW(SMB_IOC_BASE, 8, int)
49 #define	SMB_IOC_UNSHARE		_IOW(SMB_IOC_BASE, 9, int)
50 #define	SMB_IOC_USER_NUMBER	_IOW(SMB_IOC_BASE, 10, int)
51 #define	SMB_IOC_USER_LIST	_IOW(SMB_IOC_BASE, 11, int)
52 
53 typedef struct smb_ioc_header {
54 	uint32_t	version;
55 	uint32_t	crc;
56 	uint32_t	len;
57 	int		cmd;
58 } smb_ioc_header_t;
59 
60 typedef	struct {
61 	smb_ioc_header_t hdr;
62 	int32_t 	offset;
63 } smb_ioc_gmt_t;
64 
65 typedef struct smb_ioc_share {
66 	smb_ioc_header_t hdr;
67 	char		path[MAXPATHLEN];
68 	char		name[MAXNAMELEN];
69 } smb_ioc_share_t;
70 
71 typedef	struct smb_ioc_listen {
72 	smb_ioc_header_t hdr;
73 	int		error;
74 } smb_ioc_listen_t;
75 
76 typedef	struct smb_ioc_start {
77 	smb_ioc_header_t hdr;
78 	int		opipe;
79 	int		lmshrd;
80 	int		udoor;
81 } smb_ioc_start_t;
82 
83 typedef	struct smb_ioc_usernum {
84 	smb_ioc_header_t hdr;
85 	uint32_t	num;
86 } smb_ioc_usernum_t;
87 
88 typedef	struct smb_ioc_ulist {
89 	smb_ioc_header_t hdr;
90 	uint32_t	cookie;
91 	uint32_t	num;
92 	uint32_t	data_len;
93 	uint8_t		data[1];
94 } smb_ioc_ulist_t;
95 
96 typedef struct smb_ioc_cfg {
97 	smb_ioc_header_t hdr;
98 	uint32_t	maxworkers;
99 	uint32_t	maxconnections;
100 	uint32_t	keepalive;
101 	int32_t		restrict_anon;
102 	int32_t		signing_enable;
103 	int32_t		signing_required;
104 	int32_t		oplock_enable;
105 	int32_t		sync_enable;
106 	int32_t		secmode;
107 	int32_t		ipv6_enable;
108 	char		nbdomain[NETBIOS_NAME_SZ];
109 	char		fqdn[SMB_PI_MAX_DOMAIN];
110 	char		hostname[SMB_PI_MAX_HOST];
111 	char		system_comment[SMB_PI_MAX_COMMENT];
112 } smb_ioc_cfg_t;
113 
114 typedef union smb_ioc {
115 	smb_ioc_header_t	ioc_hdr;
116 	smb_ioc_gmt_t		ioc_gmt;
117 	smb_ioc_cfg_t		ioc_cfg;
118 	smb_ioc_start_t		ioc_start;
119 	smb_ioc_listen_t	ioc_listen;
120 	smb_ioc_usernum_t	ioc_unum;
121 	smb_ioc_ulist_t		ioc_ulist;
122 	smb_ioc_share_t		ioc_share;
123 } smb_ioc_t;
124 
125 uint32_t smb_crc_gen(uint8_t *, size_t);
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* _SMB_IOCTL_H_ */
132