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.
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.
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]
22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #include <smbsrv/smbinfo.h>
37 #define SMB_IOC_VERSION 0x534D4201 /* SMB1 */
39 #define SMB_IOC_BASE (('S' << 16) | ('B' << 8))
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_GMTOFF _IOW(SMB_IOC_BASE, 3, int)
44 #define SMB_IOC_SHARE _IOW(SMB_IOC_BASE, 4, int)
45 #define SMB_IOC_UNSHARE _IOW(SMB_IOC_BASE, 5, int)
46 #define SMB_IOC_NUMOPEN _IOW(SMB_IOC_BASE, 6, int)
47 #define SMB_IOC_SVCENUM _IOW(SMB_IOC_BASE, 7, int)
48 #define SMB_IOC_FILE_CLOSE _IOW(SMB_IOC_BASE, 8, int)
49 #define SMB_IOC_SESSION_CLOSE _IOW(SMB_IOC_BASE, 9, int)
50 #define SMB_IOC_STOP _IOW(SMB_IOC_BASE, 10, int)
51 #define SMB_IOC_EVENT _IOW(SMB_IOC_BASE, 11, int)
52 #define SMB_IOC_SHAREINFO _IOW(SMB_IOC_BASE, 12, int)
53 #define SMB_IOC_SPOOLDOC _IOW(SMB_IOC_BASE, 13, int)
55 typedef struct smb_ioc_header
{
62 typedef struct smb_ioc_spooldoc
{
66 char username
[MAXNAMELEN
];
67 char path
[MAXPATHLEN
];
75 typedef struct smb_ioc_share
{
81 typedef struct smb_ioc_shareinfo
{
83 char shrname
[MAXNAMELEN
];
85 } smb_ioc_shareinfo_t
;
87 typedef struct smb_ioc_start
{
92 /* These are used only by libfksmbsrv */
98 typedef struct smb_ioc_event
{
103 typedef struct smb_ioc_opennum
{
104 smb_ioc_header_t hdr
;
109 char qualifier
[MAXNAMELEN
];
113 * For enumeration, user and session are synonymous, as are
114 * connection and tree.
116 #define SMB_SVCENUM_TYPE_USER 0x55534552 /* 'USER' */
117 #define SMB_SVCENUM_TYPE_TREE 0x54524545 /* 'TREE' */
118 #define SMB_SVCENUM_TYPE_FILE 0x46494C45 /* 'FILE' */
119 #define SMB_SVCENUM_TYPE_SHARE 0x53484152 /* 'SHAR' */
121 typedef struct smb_svcenum
{
122 uint32_t se_type
; /* object type to enumerate */
123 uint32_t se_level
; /* level of detail being requested */
124 uint32_t se_prefmaxlen
; /* client max size buffer preference */
125 uint32_t se_resume
; /* client resume handle */
126 uint32_t se_bavail
; /* remaining buffer space in bytes */
127 uint32_t se_bused
; /* consumed buffer space in bytes */
128 uint32_t se_ntotal
; /* total number of objects */
129 uint32_t se_nlimit
; /* max number of objects to return */
130 uint32_t se_nitems
; /* number of objects in buf */
131 uint32_t se_nskip
; /* number of objects to skip */
132 uint32_t se_status
; /* enumeration status */
133 uint32_t se_buflen
; /* length of the buffer in bytes */
134 uint8_t se_buf
[1]; /* buffer to hold enumeration data */
137 typedef struct smb_ioc_svcenum
{
138 smb_ioc_header_t hdr
;
139 smb_svcenum_t svcenum
;
142 typedef struct smb_ioc_session
{
143 smb_ioc_header_t hdr
;
144 char client
[MAXNAMELEN
];
145 char username
[MAXNAMELEN
];
148 typedef struct smb_ioc_fileid
{
149 smb_ioc_header_t hdr
;
153 /* See also: smb_kmod_cfg_t */
154 typedef struct smb_ioc_cfg
{
155 smb_ioc_header_t hdr
;
157 uint32_t maxconnections
;
159 int32_t restrict_anon
;
160 int32_t signing_enable
;
161 int32_t signing_required
;
162 int32_t oplock_enable
;
165 int32_t netbios_enable
;
167 int32_t print_enable
;
168 int32_t traverse_mounts
;
169 uint32_t max_protocol
;
172 smb_version_t version
;
173 uint16_t initial_credits
;
174 uint16_t maximum_credits
;
175 /* SMB negotiate protocol response. */
177 uchar_t negtok
[SMB_PI_MAX_NEGTOK
];
178 char native_os
[SMB_PI_MAX_NATIVE_OS
];
179 char native_lm
[SMB_PI_MAX_LANMAN
];
180 char nbdomain
[NETBIOS_NAME_SZ
];
181 char fqdn
[SMB_PI_MAX_DOMAIN
];
182 char hostname
[SMB_PI_MAX_HOST
];
183 char system_comment
[SMB_PI_MAX_COMMENT
];
186 typedef union smb_ioc
{
187 smb_ioc_header_t ioc_hdr
;
188 smb_ioc_gmt_t ioc_gmt
;
189 smb_ioc_cfg_t ioc_cfg
;
190 smb_ioc_start_t ioc_start
;
191 smb_ioc_event_t ioc_event
;
192 smb_ioc_opennum_t ioc_opennum
;
193 smb_ioc_svcenum_t ioc_svcenum
;
194 smb_ioc_session_t ioc_session
;
195 smb_ioc_fileid_t ioc_fileid
;
196 smb_ioc_share_t ioc_share
;
197 smb_ioc_shareinfo_t ioc_shareinfo
;
198 smb_ioc_spooldoc_t ioc_spooldoc
;
201 uint32_t smb_crc_gen(uint8_t *, size_t);
203 /* fksmbd (init,open,close,ioctl) calls into libfksmbsrv */
204 int fksmbsrv_drv_open(void);
205 int fksmbsrv_drv_close(void);
206 int fksmbsrv_drv_ioctl(int cmd
, void *arg
);
207 void fksmbsrv_drv_load(void);
213 #endif /* _SMB_IOCTL_H_ */