OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright (c) 2008 Secure Endpoints, Inc. 00003 * Copyright (c) 2009-2011 Your File System, Inc. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * - Neither the name of Secure Endpoints Inc. nor the names of its contributors 00015 * may be used to endorse or promote products derived from this software without 00016 * specific prior written permission from Secure Endpoints, Inc. and 00017 * Your File System, Inc. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00021 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00022 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00023 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00024 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00025 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 #include <ntsecapi.h> 00037 00038 // The following are forward declarations of structures 00039 // which are referenced in the RDR code only by pointer. 00040 typedef struct cm_user cm_user_t; 00041 typedef struct cm_req cm_req_t; 00042 typedef struct cm_fid cm_fid_t; 00043 typedef struct cm_scache cm_scache_t; 00044 00045 // Function Declarations 00046 #include <../common/AFSUserPrototypes.h> 00047 00048 void 00049 RDR_InitReq( IN OUT cm_req_t *reqp ); 00050 00051 DWORD 00052 RDR_SetInitParams( OUT AFSRedirectorInitInfo **ppRedirInitInfo, 00053 OUT DWORD * pRedirInitInfoLen ); 00054 00055 DWORD 00056 WINAPI 00057 RDR_RequestWorkerThread( LPVOID lpParameter); 00058 00059 DWORD 00060 RDR_ProcessWorkerThreads( IN DWORD); 00061 00062 void 00063 RDR_ProcessRequest( AFSCommRequest *RequestBuffer); 00064 00065 void 00066 RDR_EnumerateDirectory( IN cm_user_t *userp, 00067 IN AFSFileID ParentID, 00068 IN AFSDirQueryCB *QueryCB, 00069 IN BOOL bWow64, 00070 IN BOOL bQueryStatus, 00071 IN DWORD ResultBufferLength, 00072 IN OUT AFSCommResult **ResultCB); 00073 00074 void 00075 RDR_EvaluateNodeByName( IN cm_user_t *userp, 00076 IN AFSFileID ParentID, 00077 IN WCHAR *Name, 00078 IN DWORD NameLength, 00079 IN BOOL CaseSensitive, 00080 IN BOOL bWow64, 00081 IN BOOL bQueryStatus, 00082 IN BOOL bHoldFid, 00083 IN DWORD ResultBufferLength, 00084 IN OUT AFSCommResult **ResultCB); 00085 00086 void 00087 RDR_EvaluateNodeByID( IN cm_user_t *userp, 00088 IN AFSFileID ParentID, 00089 IN AFSFileID SourceID, 00090 IN BOOL bWow64, 00091 IN BOOL bQueryStatus, 00092 IN BOOL bHoldFid, 00093 IN DWORD ResultBufferLength, 00094 IN OUT AFSCommResult **ResultCB); 00095 00096 void 00097 RDR_CreateFileEntry( IN cm_user_t *userp, 00098 IN WCHAR *FileName, 00099 IN DWORD FileNameLength, 00100 IN AFSFileCreateCB *CreateCB, 00101 IN BOOL bWow64, 00102 IN BOOL bHoldFid, 00103 IN DWORD ResultBufferLength, 00104 IN OUT AFSCommResult **ResultCB); 00105 00106 void 00107 RDR_UpdateFileEntry( IN cm_user_t *userp, 00108 IN AFSFileID FileId, 00109 IN AFSFileUpdateCB *UpdateCB, 00110 IN BOOL bWow64, 00111 IN DWORD ResultBufferLength, 00112 IN OUT AFSCommResult **ResultCB); 00113 00114 void 00115 RDR_DeleteFileEntry( IN cm_user_t *userp, 00116 IN AFSFileID ParentId, 00117 IN ULONGLONG ProcessId, 00118 IN WCHAR *FileName, 00119 IN DWORD FileNameLength, 00120 IN BOOL bWow64, 00121 IN BOOL bCheckOnly, 00122 IN DWORD ResultBufferLength, 00123 IN OUT AFSCommResult **ResultCB); 00124 00125 void 00126 RDR_RenameFileEntry( IN cm_user_t *userp, 00127 IN WCHAR *SourceFileName, 00128 IN DWORD SourceFileNameLength, 00129 IN AFSFileID SourceFileId, 00130 IN AFSFileRenameCB *RenameCB, 00131 IN BOOL bWow64, 00132 IN DWORD ResultBufferLength, 00133 IN OUT AFSCommResult **ResultCB); 00134 00135 void 00136 RDR_FlushFileEntry( IN cm_user_t *userp, 00137 IN AFSFileID FileId, 00138 IN BOOL bWow64, 00139 IN DWORD ResultBufferLength, 00140 IN OUT AFSCommResult **ResultCB); 00141 00142 void 00143 RDR_OpenFileEntry( IN cm_user_t *userp, 00144 IN AFSFileID FileId, 00145 IN AFSFileOpenCB *OpenCB, 00146 IN BOOL bWow64, 00147 IN BOOL bHoldFid, 00148 IN DWORD ResultBufferLength, 00149 IN OUT AFSCommResult **ResultCB); 00150 00151 void 00152 RDR_ReleaseFileAccess( IN cm_user_t *userp, 00153 IN AFSFileID FileId, 00154 IN AFSFileAccessReleaseCB *ReleaseFileCB, 00155 IN BOOL bWow64, 00156 IN DWORD ResultBufferLength, 00157 IN OUT AFSCommResult **ResultCB); 00158 00159 void 00160 RDR_CleanupFileEntry( IN cm_user_t *userp, 00161 IN AFSFileID FileId, 00162 IN WCHAR *FileName, 00163 IN DWORD FileNameLength, 00164 IN AFSFileCleanupCB *CleanupCB, 00165 IN BOOL bWow64, 00166 IN BOOL bFlushFile, 00167 IN BOOL bDeleteFile, 00168 IN BOOL bUnlockFile, 00169 IN DWORD ResultBufferLength, 00170 IN OUT AFSCommResult **ResultCB); 00171 00172 BOOL 00173 RDR_RequestFileExtentsAsync( IN cm_user_t *userp, 00174 IN AFSFileID FileId, 00175 IN AFSRequestExtentsCB *RequestExtentsCB, 00176 IN BOOL bWow64, 00177 IN OUT DWORD * ResultBufferLength, 00178 IN OUT AFSSetFileExtentsCB **ResultCB); 00179 00180 void 00181 RDR_ReleaseFileExtents( IN cm_user_t *userp, 00182 IN AFSFileID FileId, 00183 IN AFSReleaseExtentsCB *ReleaseExtentsCB, 00184 IN BOOL bWow64, 00185 IN DWORD ResultBufferLength, 00186 IN OUT AFSCommResult **ResultCB); 00187 00188 DWORD 00189 RDR_RequestExtentRelease( IN cm_fid_t *fidp, 00190 IN LARGE_INTEGER numOfHeldExtents, 00191 IN DWORD numOfExtents, 00192 IN AFSFileExtentCB *extentList); 00193 00194 DWORD 00195 RDR_ProcessReleaseFileExtentsResult( IN AFSReleaseFileExtentsResultCB *ReleaseFileExtentsResultCB, 00196 IN DWORD ResultBufferLength); 00197 00198 DWORD 00199 RDR_ReleaseFailedSetFileExtents( IN cm_user_t *userp, 00200 IN AFSSetFileExtentsCB *SetFileExtentsResultCB, 00201 IN DWORD ResultBufferLength); 00202 00203 DWORD 00204 RDR_SetFileExtents( IN AFSSetFileExtentsCB *pSetFileExtentsResultCB, 00205 IN DWORD dwResultBufferLength); 00206 void 00207 RDR_PioctlOpen( IN cm_user_t *userp, 00208 IN AFSFileID ParentId, 00209 IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB, 00210 IN BOOL bWow64, 00211 IN DWORD ResultBufferLength, 00212 IN OUT AFSCommResult **ResultCB); 00213 00214 void 00215 RDR_PioctlClose( IN cm_user_t *userp, 00216 IN AFSFileID ParentId, 00217 IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB, 00218 IN BOOL bWow64, 00219 IN DWORD ResultBufferLength, 00220 IN OUT AFSCommResult **ResultCB); 00221 00222 void 00223 RDR_PioctlWrite( IN cm_user_t *userp, 00224 IN AFSFileID ParentId, 00225 IN AFSPIOCtlIORequestCB *pPioctlCB, 00226 IN BOOL bWow64, 00227 IN DWORD ResultBufferLength, 00228 IN OUT AFSCommResult **ResultCB); 00229 00230 void 00231 RDR_PioctlRead( IN cm_user_t *userp, 00232 IN AFSFileID ParentId, 00233 IN AFSPIOCtlIORequestCB *pPioctlCB, 00234 IN BOOL bWow64, 00235 IN BOOL bIsLocalSystem, 00236 IN DWORD ResultBufferLength, 00237 IN OUT AFSCommResult **ResultCB); 00238 00239 void 00240 RDR_ByteRangeLockSync( IN cm_user_t *userp, 00241 IN AFSFileID FileId, 00242 IN AFSByteRangeLockRequestCB *pBRLRequestCB, 00243 IN BOOL bWow64, 00244 IN DWORD ResultBufferLength, 00245 IN OUT AFSCommResult **ResultCB); 00246 00247 void 00248 RDR_ByteRangeUnlock( IN cm_user_t *userp, 00249 IN AFSFileID FileId, 00250 IN AFSByteRangeUnlockRequestCB *pBRURequestCB, 00251 IN BOOL bWow64, 00252 IN DWORD ResultBufferLength, 00253 IN OUT AFSCommResult **ResultCB); 00254 00255 void 00256 RDR_ByteRangeUnlockAll( IN cm_user_t *userp, 00257 IN AFSFileID FileId, 00258 IN AFSByteRangeUnlockRequestCB *pBRURequestCB, 00259 IN BOOL bWow64, 00260 IN DWORD ResultBufferLength, 00261 IN OUT AFSCommResult **ResultCB); 00262 00263 void 00264 RDR_GetVolumeInfo( IN cm_user_t *userp, 00265 IN AFSFileID FileId, 00266 IN BOOL bWow64, 00267 IN DWORD ResultBufferLength, 00268 IN OUT AFSCommResult **ResultCB); 00269 00270 void 00271 RDR_GetVolumeSizeInfo( IN cm_user_t *userp, 00272 IN AFSFileID FileId, 00273 IN BOOL bWow64, 00274 IN DWORD ResultBufferLength, 00275 IN OUT AFSCommResult **ResultCB); 00276 00277 void 00278 RDR_HoldFid( IN cm_user_t *userp, 00279 IN AFSHoldFidRequestCB * pHoldFidCB, 00280 IN BOOL bFast, 00281 IN DWORD ResultBufferLength, 00282 IN OUT AFSCommResult **ResultCB); 00283 00284 void 00285 RDR_ReleaseFid( IN cm_user_t *userp, 00286 IN AFSReleaseFidRequestCB * pReleaseFidCB, 00287 IN BOOL bFast, 00288 IN DWORD ResultBufferLength, 00289 IN OUT AFSCommResult **ResultCB); 00290 00291 void 00292 RDR_InitPipe(void); 00293 00294 void 00295 RDR_ShutdownPipe(void); 00296 00297 void 00298 RDR_PipeOpen( IN cm_user_t *userp, 00299 IN AFSFileID ParentId, 00300 IN WCHAR *Name, 00301 IN DWORD NameLength, 00302 IN AFSPipeOpenCloseRequestCB *pPipeCB, 00303 IN BOOL bWow64, 00304 IN DWORD ResultBufferLength, 00305 IN OUT AFSCommResult **ResultCB); 00306 00307 void 00308 RDR_PipeClose( IN cm_user_t *userp, 00309 IN AFSFileID ParentId, 00310 IN AFSPipeOpenCloseRequestCB *pPipeCB, 00311 IN BOOL bWow64, 00312 IN DWORD ResultBufferLength, 00313 IN OUT AFSCommResult **ResultCB); 00314 00315 void 00316 RDR_PipeWrite( IN cm_user_t *userp, 00317 IN AFSFileID ParentId, 00318 IN AFSPipeIORequestCB *pPipeCB, 00319 IN BYTE *pPipeData, 00320 IN BOOL bWow64, 00321 IN DWORD ResultBufferLength, 00322 IN OUT AFSCommResult **ResultCB); 00323 00324 void 00325 RDR_PipeRead( IN cm_user_t *userp, 00326 IN AFSFileID ParentId, 00327 IN AFSPipeIORequestCB *pPipeCB, 00328 IN BOOL bWow64, 00329 IN DWORD ResultBufferLength, 00330 IN OUT AFSCommResult **ResultCB); 00331 00332 void 00333 RDR_PipeSetInfo( IN cm_user_t *userp, 00334 IN AFSFileID ParentId, 00335 IN AFSPipeInfoRequestCB *pPipeCB, 00336 IN BYTE *pPipeData, 00337 IN BOOL bWow64, 00338 IN DWORD ResultBufferLength, 00339 IN OUT AFSCommResult **ResultCB); 00340 00341 void 00342 RDR_PipeQueryInfo( IN cm_user_t *userp, 00343 IN AFSFileID ParentId, 00344 IN AFSPipeInfoRequestCB *pPipeCB, 00345 IN BOOL bWow64, 00346 IN DWORD ResultBufferLength, 00347 IN OUT AFSCommResult **ResultCB); 00348 00349 void 00350 RDR_PipeTransceive( IN cm_user_t *userp, 00351 IN AFSFileID ParentId, 00352 IN AFSPipeIORequestCB *pPipeCB, 00353 IN BYTE *pPipeData, 00354 IN BOOL bWow64, 00355 IN DWORD ResultBufferLength, 00356 IN OUT AFSCommResult **ResultCB); 00357 00358 cm_user_t * 00359 RDR_UserFromCommRequest( IN AFSCommRequest * pRequest); 00360 00361 cm_user_t * 00362 RDR_UserFromAuthGroup( IN GUID *pGuid); 00363 00364 void 00365 RDR_ReleaseUser( IN cm_user_t *userp); 00366 00367 void 00368 RDR_fid2FID( IN cm_fid_t *fid, 00369 IN AFSFileID *FileId); 00370 00371 void 00372 RDR_FID2fid( IN AFSFileID *FileId, 00373 IN cm_fid_t *fid); 00374 00375 void 00376 RDR_InitIoctl(void); 00377 00378 void 00379 RDR_ShutdownIoctl(void); 00380 00381 #ifdef __cplusplus 00382 } 00383 #endif 00384