1da6c28aaSamw /* 2da6c28aaSamw * CDDL HEADER START 3da6c28aaSamw * 4da6c28aaSamw * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 7da6c28aaSamw * 8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da6c28aaSamw * or http://www.opensolaris.org/os/licensing. 10da6c28aaSamw * See the License for the specific language governing permissions 11da6c28aaSamw * and limitations under the License. 12da6c28aaSamw * 13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each 14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the 16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying 17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner] 18da6c28aaSamw * 19da6c28aaSamw * CDDL HEADER END 20da6c28aaSamw */ 21da6c28aaSamw /* 22148c5f43SAlan Wright * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 234c0e320cSGordon Ross * Copyright 2013 Nexenta Systems, Inc. All rights reserved. 24da6c28aaSamw */ 25da6c28aaSamw 26da6c28aaSamw #ifndef _SMB_IOCTL_H_ 27da6c28aaSamw #define _SMB_IOCTL_H_ 28da6c28aaSamw 29da6c28aaSamw #ifdef __cplusplus 30da6c28aaSamw extern "C" { 31da6c28aaSamw #endif 32da6c28aaSamw 33da6c28aaSamw #include <sys/types.h> 3429bd2886SAlan Wright #include <sys/param.h> 35faa1795aSjb150015 #include <smbsrv/smbinfo.h> 36faa1795aSjb150015 3794fff790SAlan Wright #define SMB_IOC_VERSION 0x534D4201 /* SMB1 */ 38da6c28aaSamw 39da6c28aaSamw #define SMB_IOC_BASE (('S' << 16) | ('B' << 8)) 40faa1795aSjb150015 41faa1795aSjb150015 #define SMB_IOC_CONFIG _IOW(SMB_IOC_BASE, 1, int) 42faa1795aSjb150015 #define SMB_IOC_START _IOW(SMB_IOC_BASE, 2, int) 434163af6aSjose borrego #define SMB_IOC_GMTOFF _IOW(SMB_IOC_BASE, 3, int) 444163af6aSjose borrego #define SMB_IOC_SHARE _IOW(SMB_IOC_BASE, 4, int) 454163af6aSjose borrego #define SMB_IOC_UNSHARE _IOW(SMB_IOC_BASE, 5, int) 464163af6aSjose borrego #define SMB_IOC_NUMOPEN _IOW(SMB_IOC_BASE, 6, int) 474163af6aSjose borrego #define SMB_IOC_SVCENUM _IOW(SMB_IOC_BASE, 7, int) 484163af6aSjose borrego #define SMB_IOC_FILE_CLOSE _IOW(SMB_IOC_BASE, 8, int) 494163af6aSjose borrego #define SMB_IOC_SESSION_CLOSE _IOW(SMB_IOC_BASE, 9, int) 504163af6aSjose borrego #define SMB_IOC_STOP _IOW(SMB_IOC_BASE, 10, int) 514163af6aSjose borrego #define SMB_IOC_EVENT _IOW(SMB_IOC_BASE, 11, int) 524163af6aSjose borrego #define SMB_IOC_SHAREINFO _IOW(SMB_IOC_BASE, 12, int) 534163af6aSjose borrego #define SMB_IOC_SPOOLDOC _IOW(SMB_IOC_BASE, 13, int) 54faa1795aSjb150015 5529bd2886SAlan Wright typedef struct smb_ioc_header { 5629bd2886SAlan Wright uint32_t version; 5729bd2886SAlan Wright uint32_t crc; 5829bd2886SAlan Wright uint32_t len; 5929bd2886SAlan Wright int cmd; 6029bd2886SAlan Wright } smb_ioc_header_t; 61faa1795aSjb150015 62cb174861Sjoyce mcintosh typedef struct smb_ioc_spooldoc { 63cb174861Sjoyce mcintosh smb_ioc_header_t hdr; 64cb174861Sjoyce mcintosh smb_inaddr_t ipaddr; 65cb174861Sjoyce mcintosh uint32_t spool_num; 66cb174861Sjoyce mcintosh char username[MAXNAMELEN]; 67cb174861Sjoyce mcintosh char path[MAXPATHLEN]; 68cb174861Sjoyce mcintosh } smb_ioc_spooldoc_t; 69cb174861Sjoyce mcintosh 70faa1795aSjb150015 typedef struct { 7129bd2886SAlan Wright smb_ioc_header_t hdr; 7229bd2886SAlan Wright int32_t offset; 7329bd2886SAlan Wright } smb_ioc_gmt_t; 7494fff790SAlan Wright 7529bd2886SAlan Wright typedef struct smb_ioc_share { 7629bd2886SAlan Wright smb_ioc_header_t hdr; 77148c5f43SAlan Wright uint32_t shrlen; 78148c5f43SAlan Wright char shr[1]; 7929bd2886SAlan Wright } smb_ioc_share_t; 8029bd2886SAlan Wright 81cb174861Sjoyce mcintosh typedef struct smb_ioc_shareinfo { 82cb174861Sjoyce mcintosh smb_ioc_header_t hdr; 83cb174861Sjoyce mcintosh char shrname[MAXNAMELEN]; 84cb174861Sjoyce mcintosh uint32_t shortnames; 85cb174861Sjoyce mcintosh } smb_ioc_shareinfo_t; 86cb174861Sjoyce mcintosh 8729bd2886SAlan Wright typedef struct smb_ioc_start { 8829bd2886SAlan Wright smb_ioc_header_t hdr; 893db3f65cSamw int opipe; 90faa1795aSjb150015 int lmshrd; 91faa1795aSjb150015 int udoor; 92*7206bf49SGordon Ross /* These are used only by libfksmbsrv */ 93*7206bf49SGordon Ross void *opipe_func; 94*7206bf49SGordon Ross void *lmshr_func; 95*7206bf49SGordon Ross void *udoor_func; 9629bd2886SAlan Wright } smb_ioc_start_t; 97faa1795aSjb150015 989fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct smb_ioc_event { 999fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_ioc_header_t hdr; 1009fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t txid; 1019fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } smb_ioc_event_t; 1029fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1031fcced4cSJordan Brown typedef struct smb_ioc_opennum { 10429bd2886SAlan Wright smb_ioc_header_t hdr; 1051fcced4cSJordan Brown uint32_t open_users; 1061fcced4cSJordan Brown uint32_t open_trees; 1071fcced4cSJordan Brown uint32_t open_files; 1081fcced4cSJordan Brown uint32_t qualtype; 1091fcced4cSJordan Brown char qualifier[MAXNAMELEN]; 1101fcced4cSJordan Brown } smb_ioc_opennum_t; 11129bd2886SAlan Wright 1121fcced4cSJordan Brown /* 1131fcced4cSJordan Brown * For enumeration, user and session are synonymous, as are 1141fcced4cSJordan Brown * connection and tree. 1151fcced4cSJordan Brown */ 1161fcced4cSJordan Brown #define SMB_SVCENUM_TYPE_USER 0x55534552 /* 'USER' */ 1171fcced4cSJordan Brown #define SMB_SVCENUM_TYPE_TREE 0x54524545 /* 'TREE' */ 1181fcced4cSJordan Brown #define SMB_SVCENUM_TYPE_FILE 0x46494C45 /* 'FILE' */ 1191fcced4cSJordan Brown #define SMB_SVCENUM_TYPE_SHARE 0x53484152 /* 'SHAR' */ 1201fcced4cSJordan Brown 1211fcced4cSJordan Brown typedef struct smb_svcenum { 1221fcced4cSJordan Brown uint32_t se_type; /* object type to enumerate */ 1231fcced4cSJordan Brown uint32_t se_level; /* level of detail being requested */ 1241fcced4cSJordan Brown uint32_t se_prefmaxlen; /* client max size buffer preference */ 1251fcced4cSJordan Brown uint32_t se_resume; /* client resume handle */ 1261fcced4cSJordan Brown uint32_t se_bavail; /* remaining buffer space in bytes */ 1271fcced4cSJordan Brown uint32_t se_bused; /* consumed buffer space in bytes */ 1281fcced4cSJordan Brown uint32_t se_ntotal; /* total number of objects */ 1291fcced4cSJordan Brown uint32_t se_nlimit; /* max number of objects to return */ 1301fcced4cSJordan Brown uint32_t se_nitems; /* number of objects in buf */ 1311fcced4cSJordan Brown uint32_t se_nskip; /* number of objects to skip */ 1321fcced4cSJordan Brown uint32_t se_status; /* enumeration status */ 1331fcced4cSJordan Brown uint32_t se_buflen; /* length of the buffer in bytes */ 1341fcced4cSJordan Brown uint8_t se_buf[1]; /* buffer to hold enumeration data */ 1351fcced4cSJordan Brown } smb_svcenum_t; 1361fcced4cSJordan Brown 1371fcced4cSJordan Brown typedef struct smb_ioc_svcenum { 13829bd2886SAlan Wright smb_ioc_header_t hdr; 1391fcced4cSJordan Brown smb_svcenum_t svcenum; 1401fcced4cSJordan Brown } smb_ioc_svcenum_t; 1411fcced4cSJordan Brown 1421fcced4cSJordan Brown typedef struct smb_ioc_session { 1431fcced4cSJordan Brown smb_ioc_header_t hdr; 1441fcced4cSJordan Brown char client[MAXNAMELEN]; 1451fcced4cSJordan Brown char username[MAXNAMELEN]; 1461fcced4cSJordan Brown } smb_ioc_session_t; 1471fcced4cSJordan Brown 1481fcced4cSJordan Brown typedef struct smb_ioc_fileid { 1491fcced4cSJordan Brown smb_ioc_header_t hdr; 1501fcced4cSJordan Brown uint32_t uniqid; 1511fcced4cSJordan Brown } smb_ioc_fileid_t; 15229bd2886SAlan Wright 15329bd2886SAlan Wright typedef struct smb_ioc_cfg { 15429bd2886SAlan Wright smb_ioc_header_t hdr; 15529bd2886SAlan Wright uint32_t maxworkers; 15629bd2886SAlan Wright uint32_t maxconnections; 15729bd2886SAlan Wright uint32_t keepalive; 15829bd2886SAlan Wright int32_t restrict_anon; 15929bd2886SAlan Wright int32_t signing_enable; 16029bd2886SAlan Wright int32_t signing_required; 16129bd2886SAlan Wright int32_t oplock_enable; 16229bd2886SAlan Wright int32_t sync_enable; 16329bd2886SAlan Wright int32_t secmode; 16429bd2886SAlan Wright int32_t ipv6_enable; 165cb174861Sjoyce mcintosh int32_t print_enable; 1665f1ef25cSAram Hăvărneanu int32_t traverse_mounts; 1674c0e320cSGordon Ross int32_t netbios_enable; 168148c5f43SAlan Wright uint32_t exec_flags; 169148c5f43SAlan Wright smb_version_t version; 17029bd2886SAlan Wright char nbdomain[NETBIOS_NAME_SZ]; 17129bd2886SAlan Wright char fqdn[SMB_PI_MAX_DOMAIN]; 17229bd2886SAlan Wright char hostname[SMB_PI_MAX_HOST]; 17329bd2886SAlan Wright char system_comment[SMB_PI_MAX_COMMENT]; 17429bd2886SAlan Wright } smb_ioc_cfg_t; 17529bd2886SAlan Wright 17629bd2886SAlan Wright typedef union smb_ioc { 17729bd2886SAlan Wright smb_ioc_header_t ioc_hdr; 17829bd2886SAlan Wright smb_ioc_gmt_t ioc_gmt; 17929bd2886SAlan Wright smb_ioc_cfg_t ioc_cfg; 18029bd2886SAlan Wright smb_ioc_start_t ioc_start; 1819fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_ioc_event_t ioc_event; 1821fcced4cSJordan Brown smb_ioc_opennum_t ioc_opennum; 1831fcced4cSJordan Brown smb_ioc_svcenum_t ioc_svcenum; 1841fcced4cSJordan Brown smb_ioc_session_t ioc_session; 1851fcced4cSJordan Brown smb_ioc_fileid_t ioc_fileid; 18629bd2886SAlan Wright smb_ioc_share_t ioc_share; 187cb174861Sjoyce mcintosh smb_ioc_shareinfo_t ioc_shareinfo; 188cb174861Sjoyce mcintosh smb_ioc_spooldoc_t ioc_spooldoc; 18929bd2886SAlan Wright } smb_ioc_t; 190da6c28aaSamw 19194fff790SAlan Wright uint32_t smb_crc_gen(uint8_t *, size_t); 19294fff790SAlan Wright 193*7206bf49SGordon Ross /* fksmbd (init,open,close,ioctl) calls into libfksmbsrv */ 194*7206bf49SGordon Ross int fksmbsrv_drv_open(void); 195*7206bf49SGordon Ross int fksmbsrv_drv_close(void); 196*7206bf49SGordon Ross int fksmbsrv_drv_ioctl(int cmd, void *arg); 197*7206bf49SGordon Ross void fksmbsrv_drv_load(void); 198*7206bf49SGordon Ross 199da6c28aaSamw #ifdef __cplusplus 200da6c28aaSamw } 201da6c28aaSamw #endif 202da6c28aaSamw 203da6c28aaSamw #endif /* _SMB_IOCTL_H_ */ 204