1/* 2 * Copyright (c) 2009 - 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef _SMBCLIENT_INTERNAL_H_ 25#define _SMBCLIENT_INTERNAL_H_ 26 27/* 28 * This is private to SMB Client Project code and is not for external use. 29 */ 30 31#ifdef __cplusplus 32extern "C" { 33#endif 34 35/* Optional smbfs mount flags */ 36#define SMBFS_MNT_SOFT 0x0001 37#define SMBFS_MNT_NOTIFY_OFF 0x0002 38#define SMBFS_MNT_STREAMS_ON 0x0004 39#define SMBFS_MNT_DEBUG_ACL_ON 0x0008 40#define SMBFS_MNT_DFS_SHARE 0x0010 41#define SMBFS_MNT_COMPOUND_ON 0x0020 42#define SMBFS_MNT_TIME_MACHINE 0x0040 43#define SMBFS_MNT_READDIRATTR_OFF 0x0080 44#define SMBFS_MNT_KERBEROS_OFF 0x0100 /* tmp until <12991970> is fixed */ 45#define SMBFS_MNT_FILE_IDS_OFF 0x0200 46#define SMBFS_MNT_AAPL_OFF 0x0400 47 48#ifndef KERNEL 49#include <asl.h> 50#include <sys/mount.h> 51#include <CoreFoundation/CoreFoundation.h> 52 53/* Once we add more we may want to make this an enum, also may want to make public */ 54#define kHasNtwrkSID 0x01 55#define kLanmanOn 0x02 56 57/* These must match the values in dfs.h */ 58#define kReferralList CFSTR("ReferralList") 59#define kRequestFileName CFSTR("RequestFileName") 60#define kDFSPath CFSTR("DFSPath") 61#define kServerType CFSTR("ServerType") 62#define kNetworkAddress CFSTR("NetworkAddress") 63#define kNewReferral CFSTR("NewReferral") 64#define kDfsServerArray CFSTR("DfsServerArray") 65#define kDfsADServerArray CFSTR("DfsADServerArray") 66#define kDfsReferralArray CFSTR("DfsReferralArray") 67#define kSpecialName CFSTR("SpecialName") 68#define kNumberOfExpandedNames CFSTR("NumberOfExpandedNames") 69#define kExpandedNameArray CFSTR("ExpandedNameArray") 70 71/*! 72 * @function SMBLogInfo 73 * @abstract Helper routine for logging information the same as the framework. 74 * @printf style routine 75 */ 76SMBCLIENT_EXPORT 77void 78SMBLogInfo( const char *, int,...) __printflike(1, 3) 79__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 80; 81 82 83/*! 84 * @function SMBMountShare 85 * @abstract Mount a SMB share 86 * @param inConnection A SMBHANDLE created by SMBOpenServer. 87 * @param targetShare A UTF-8 encoded share name, may be null. 88 * @param mountPoint A UTF-8 encoded mount point that must exist. 89 * @param mountFlags See man mount. 90 * @param mountOptions Set of options that support the alternative mount flags 91 * @param fileMode Specify permissions that should be assigned to files. The 92 * value must be specified as octal numbers. To use the default value set to 93 * zero. 94 * @param dirMode Specify permissions that should be assigned to directories. 95 * The value must be specified as octal numbers. To use the default value set to 96 * zero. 97 * @result Returns an NTSTATUS error code. 98 */ 99SMBCLIENT_EXPORT 100NTSTATUS 101SMBMountShareEx( 102 SMBHANDLE inConnection, 103 const char *targetShare, 104 const char *mountPoint, 105 unsigned mountFlags, 106 uint64_t mountOptions, 107 mode_t fileMode, 108 mode_t dirMode, 109 void (*)(void *, void *), 110 void *args) 111__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 112; 113 114/*! 115 * @function SMBAllocateAndSetContext 116 * @abstract Creates a SMBHANDLE that contains the smb library internal session 117 * context passed into it. The handle can be used to access other SMBClient 118 * Framework routines. 119 * @param session - A smb library internal session context 120 * @result Returns an SMBHANDLE that can be used to access the session or NULL 121 */ 122SMBCLIENT_EXPORT 123SMBHANDLE 124SMBAllocateAndSetContext( 125 void * session) 126__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 127; 128 129/*! 130 * @function SMBCheckForAlreadyMountedShare 131 * @abstract Private routine for getting information about a list of shares 132 * @inConnection - A handle to the connection 133 * @shareRef - the share in question 134 * @mdictRef - a dictionary to add the share to 135 * @fs - List of file systems 136 * @fs_cnt - Number of file systems 137 * @result Returns an errno on failure and zero on success 138 */ 139SMBCLIENT_EXPORT 140int 141SMBCheckForAlreadyMountedShare( 142 SMBHANDLE inConnection, 143 CFStringRef shareRef, 144 CFMutableDictionaryRef mdictRef, 145 struct statfs *fs, 146 int fs_cnt) 147__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 148; 149 150/*! 151 * @function SMBSetNetworkIdentity 152 * @abstract Private routine for getting identity information of a users 153 * connection. 154 * @inConnection - A handle to the users connection 155 * @network_sid - On success the users network sid 156 * @account - On success the users account name 157 * @domain - On success the domain the user belongs to 158 * @result Returns an errno on failure and zero on success 159 */ 160SMBCLIENT_EXPORT 161int 162SMBSetNetworkIdentity( 163 SMBHANDLE inConnection, 164 void *network_sid, 165 char *account, 166 char *domain) 167__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 168; 169 170/*! 171 * @function SMBRemountServer 172 * @abstract Private routine for remouting Dfs 173 * @param inputBuffer Internal only should never be looked at. 174 * @param inputBufferLen Size of the inputBuffer. 175 */ 176SMBCLIENT_EXPORT 177void 178SMBRemountServer( 179 const void *inputBuffer, 180 size_t inputBufferLen) 181__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) 182; 183 184SMBCLIENT_EXPORT 185int SMBGetDfsReferral( 186 const char * url, 187 CFMutableDictionaryRef dfsReferralDict); 188 189#endif // KERNEL 190 191 192#ifdef __cplusplus 193} // extern "C" 194#endif 195 196#endif // _SMBCLIENT_INTERNAL_H_ 197