a29d9b51642a59a1871695a3df60681c71fb3e6d
[openafs.git] / src / WINNT / afsrdr / user / RDRPrototypes.h
1 /*
2  * Copyright (c) 2008 Secure Endpoints, Inc.
3  * Copyright (c) 2009-2011 Your File System, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice,
10  *   this list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  *   this list of conditions and the following disclaimer in the documentation
13  *   and/or other materials provided with the distribution.
14  * - Neither the name of Secure Endpoints Inc. nor the names of its contributors
15  *   may be used to endorse or promote products derived from this software without
16  *   specific prior written permission from Secure Endpoints, Inc. and
17  *   Your File System, Inc.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #include <ntsecapi.h>
37
38 // The following are forward declarations of structures
39 // which are referenced in the RDR code only by pointer.
40 typedef struct cm_user cm_user_t;
41 typedef struct cm_req cm_req_t;
42 typedef struct cm_fid cm_fid_t;
43 typedef struct cm_scache cm_scache_t;
44
45 // Function Declarations
46 #include <../common/AFSUserPrototypes.h>
47
48 void
49 RDR_InitReq( IN OUT cm_req_t *reqp, BOOL bWow64);
50
51 DWORD
52 RDR_SetInitParams( OUT AFSRedirectorInitInfo **ppRedirInitInfo,
53                    OUT DWORD * pRedirInitInfoLen );
54
55 DWORD
56 WINAPI
57 RDR_RequestWorkerThread( LPVOID lpParameter);
58
59 DWORD
60 RDR_ProcessWorkerThreads( IN DWORD);
61
62 void
63 RDR_ProcessRequest( AFSCommRequest *RequestBuffer);
64
65 void
66 RDR_EnumerateDirectory( IN cm_user_t *userp,
67                         IN AFSFileID ParentID,
68                         IN AFSDirQueryCB *QueryCB,
69                         IN BOOL bWow64,
70                         IN BOOL bQueryStatus,
71                         IN DWORD ResultBufferLength,
72                         IN OUT AFSCommResult **ResultCB);
73
74 void
75 RDR_EvaluateNodeByName( IN cm_user_t *userp,
76                         IN AFSFileID ParentID,
77                         IN WCHAR     *Name,
78                         IN DWORD     NameLength,
79                         IN BOOL      CaseSensitive,
80                         IN BOOL      LastComponent,
81                         IN BOOL      bWow64,
82                         IN BOOL      bQueryStatus,
83                         IN BOOL      bHoldFid,
84                         IN DWORD     ResultBufferLength,
85                         IN OUT AFSCommResult **ResultCB);
86
87 void
88 RDR_EvaluateNodeByID( IN cm_user_t *userp,
89                       IN AFSFileID ParentID,
90                       IN AFSFileID SourceID,
91                       IN BOOL bWow64,
92                       IN BOOL bQueryStatus,
93                       IN BOOL      bHoldFid,
94                       IN DWORD    ResultBufferLength,
95                       IN OUT AFSCommResult **ResultCB);
96
97 void
98 RDR_CreateFileEntry( IN cm_user_t *userp,
99                      IN WCHAR *FileName,
100                      IN DWORD FileNameLength,
101                      IN AFSFileCreateCB *CreateCB,
102                      IN BOOL bWow64,
103                      IN BOOL bHoldFid,
104                      IN DWORD ResultBufferLength,
105                      IN OUT AFSCommResult **ResultCB);
106
107 void
108 RDR_UpdateFileEntry( IN cm_user_t *userp,
109                      IN AFSFileID FileId,
110                      IN AFSFileUpdateCB *UpdateCB,
111                      IN BOOL bWow64,
112                      IN DWORD ResultBufferLength,
113                      IN OUT AFSCommResult **ResultCB);
114
115 void
116 RDR_DeleteFileEntry( IN cm_user_t *userp,
117                      IN AFSFileID ParentId,
118                      IN ULONGLONG ProcessId,
119                      IN WCHAR *FileName,
120                      IN DWORD FileNameLength,
121                      IN BOOL bWow64,
122                      IN BOOL bCheckOnly,
123                      IN DWORD ResultBufferLength,
124                      IN OUT AFSCommResult **ResultCB);
125
126 void
127 RDR_RenameFileEntry( IN cm_user_t *userp,
128                      IN WCHAR    *SourceFileName,
129                      IN DWORD     SourceFileNameLength,
130                      IN AFSFileID SourceFileId,
131                      IN AFSFileRenameCB *RenameCB,
132                      IN BOOL bWow64,
133                      IN DWORD ResultBufferLength,
134                      IN OUT AFSCommResult **ResultCB);
135
136 void
137 RDR_HardLinkFileEntry( IN cm_user_t *userp,
138                        IN WCHAR    *SourceFileName,
139                        IN DWORD     SourceFileNameLength,
140                        IN AFSFileID SourceFileId,
141                        IN AFSFileHardLinkCB *HardLinkCB,
142                        IN BOOL bWow64,
143                        IN DWORD ResultBufferLength,
144                        IN OUT AFSCommResult **ResultCB);
145
146 void
147 RDR_FlushFileEntry( IN cm_user_t *userp,
148                     IN AFSFileID FileId,
149                     IN BOOL bWow64,
150                     IN DWORD ResultBufferLength,
151                     IN OUT AFSCommResult **ResultCB);
152
153 void
154 RDR_OpenFileEntry( IN cm_user_t *userp,
155                    IN AFSFileID FileId,
156                    IN AFSFileOpenCB *OpenCB,
157                    IN BOOL bWow64,
158                    IN BOOL bHoldFid,
159                    IN DWORD ResultBufferLength,
160                    IN OUT AFSCommResult **ResultCB);
161
162 void
163 RDR_ReleaseFileAccess( IN cm_user_t *userp,
164                        IN AFSFileID FileId,
165                        IN AFSFileAccessReleaseCB *ReleaseFileCB,
166                        IN BOOL bWow64,
167                        IN DWORD ResultBufferLength,
168                        IN OUT AFSCommResult **ResultCB);
169
170 void
171 RDR_CleanupFileEntry( IN cm_user_t *userp,
172                       IN AFSFileID FileId,
173                       IN WCHAR *FileName,
174                       IN DWORD FileNameLength,
175                       IN AFSFileCleanupCB *CleanupCB,
176                       IN BOOL bWow64,
177                       IN BOOL bFlushFile,
178                       IN BOOL bDeleteFile,
179                       IN BOOL bUnlockFile,
180                       IN DWORD ResultBufferLength,
181                       IN OUT AFSCommResult **ResultCB);
182
183 BOOL
184 RDR_RequestFileExtentsAsync( IN cm_user_t *userp,
185                              IN AFSFileID FileId,
186                              IN AFSRequestExtentsCB *RequestExtentsCB,
187                              IN BOOL bWow64,
188                              IN OUT DWORD * ResultBufferLength,
189                              IN OUT AFSSetFileExtentsCB **ResultCB);
190
191 void
192 RDR_ReleaseFileExtents( IN cm_user_t *userp,
193                         IN AFSFileID FileId,
194                         IN AFSReleaseExtentsCB *ReleaseExtentsCB,
195                         IN BOOL bWow64,
196                         IN DWORD ResultBufferLength,
197                         IN OUT AFSCommResult **ResultCB);
198
199 DWORD
200 RDR_RequestExtentRelease( IN cm_fid_t *fidp,
201                           IN LARGE_INTEGER numOfHeldExtents,
202                           IN DWORD numOfExtents,
203                           IN AFSFileExtentCB *extentList);
204
205 DWORD
206 RDR_ProcessReleaseFileExtentsResult( IN AFSReleaseFileExtentsResultCB *ReleaseFileExtentsResultCB,
207                                      IN DWORD ResultBufferLength);
208
209 DWORD
210 RDR_ReleaseFailedSetFileExtents( IN cm_user_t *userp,
211                                  IN AFSSetFileExtentsCB *SetFileExtentsResultCB,
212                                  IN DWORD ResultBufferLength);
213
214 DWORD
215 RDR_SetFileExtents( IN AFSSetFileExtentsCB *pSetFileExtentsResultCB,
216                     IN DWORD dwResultBufferLength);
217 void
218 RDR_PioctlOpen( IN cm_user_t *userp,
219                 IN AFSFileID  ParentId,
220                 IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
221                 IN BOOL bWow64,
222                 IN DWORD ResultBufferLength,
223                 IN OUT AFSCommResult **ResultCB);
224
225 void
226 RDR_PioctlClose( IN cm_user_t *userp,
227                  IN AFSFileID  ParentId,
228                  IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
229                  IN BOOL bWow64,
230                  IN DWORD ResultBufferLength,
231                  IN OUT AFSCommResult **ResultCB);
232
233 void
234 RDR_PioctlWrite( IN cm_user_t *userp,
235                  IN AFSFileID  ParentId,
236                  IN AFSPIOCtlIORequestCB *pPioctlCB,
237                  IN BOOL bWow64,
238                  IN DWORD ResultBufferLength,
239                  IN OUT AFSCommResult **ResultCB);
240
241 void
242 RDR_PioctlRead( IN cm_user_t *userp,
243                 IN AFSFileID  ParentId,
244                 IN AFSPIOCtlIORequestCB *pPioctlCB,
245                 IN BOOL bWow64,
246                 IN BOOL bIsLocalSystem,
247                 IN DWORD ResultBufferLength,
248                 IN OUT AFSCommResult **ResultCB);
249
250 void
251 RDR_ByteRangeLockSync( IN cm_user_t     *userp,
252                        IN AFSFileID     FileId,
253                        IN AFSByteRangeLockRequestCB *pBRLRequestCB,
254                        IN BOOL bWow64,
255                        IN DWORD ResultBufferLength,
256                        IN OUT AFSCommResult **ResultCB);
257
258 void
259 RDR_ByteRangeUnlock( IN cm_user_t     *userp,
260                      IN AFSFileID     FileId,
261                      IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
262                      IN BOOL bWow64,
263                      IN DWORD ResultBufferLength,
264                      IN OUT AFSCommResult **ResultCB);
265
266 void
267 RDR_ByteRangeUnlockAll( IN cm_user_t     *userp,
268                         IN AFSFileID     FileId,
269                         IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
270                         IN BOOL bWow64,
271                         IN DWORD ResultBufferLength,
272                         IN OUT AFSCommResult **ResultCB);
273
274 void
275 RDR_GetVolumeInfo( IN cm_user_t     *userp,
276                    IN AFSFileID     FileId,
277                    IN BOOL bWow64,
278                    IN DWORD ResultBufferLength,
279                    IN OUT AFSCommResult **ResultCB);
280
281 void
282 RDR_GetVolumeSizeInfo( IN cm_user_t     *userp,
283                        IN AFSFileID     FileId,
284                        IN BOOL bWow64,
285                        IN DWORD ResultBufferLength,
286                        IN OUT AFSCommResult **ResultCB);
287
288 void
289 RDR_HoldFid( IN cm_user_t     *userp,
290              IN AFSHoldFidRequestCB * pHoldFidCB,
291              IN BOOL bFast,
292              IN DWORD ResultBufferLength,
293              IN OUT AFSCommResult **ResultCB);
294
295 void
296 RDR_ReleaseFid( IN cm_user_t     *userp,
297                 IN AFSReleaseFidRequestCB * pReleaseFidCB,
298                 IN BOOL bFast,
299                 IN DWORD ResultBufferLength,
300                 IN OUT AFSCommResult **ResultCB);
301
302 void
303 RDR_InitPipe(void);
304
305 void
306 RDR_ShutdownPipe(void);
307
308 void
309 RDR_PipeOpen( IN cm_user_t *userp,
310               IN AFSFileID  ParentId,
311               IN WCHAR     *Name,
312               IN DWORD      NameLength,
313               IN AFSPipeOpenCloseRequestCB *pPipeCB,
314               IN BOOL bWow64,
315               IN DWORD ResultBufferLength,
316               IN OUT AFSCommResult **ResultCB);
317
318 void
319 RDR_PipeClose( IN cm_user_t *userp,
320                IN AFSFileID  ParentId,
321                IN AFSPipeOpenCloseRequestCB *pPipeCB,
322                IN BOOL bWow64,
323                IN DWORD ResultBufferLength,
324                IN OUT AFSCommResult **ResultCB);
325
326 void
327 RDR_PipeWrite( IN cm_user_t *userp,
328                IN AFSFileID  ParentId,
329                IN AFSPipeIORequestCB *pPipeCB,
330                IN BYTE *pPipeData,
331                IN BOOL bWow64,
332                IN DWORD ResultBufferLength,
333                IN OUT AFSCommResult **ResultCB);
334
335 void
336 RDR_PipeRead( IN cm_user_t *userp,
337               IN AFSFileID  ParentId,
338               IN AFSPipeIORequestCB *pPipeCB,
339               IN BOOL bWow64,
340               IN DWORD ResultBufferLength,
341               IN OUT AFSCommResult **ResultCB);
342
343 void
344 RDR_PipeSetInfo( IN cm_user_t *userp,
345                  IN AFSFileID  ParentId,
346                  IN AFSPipeInfoRequestCB *pPipeCB,
347                  IN BYTE *pPipeData,
348                  IN BOOL bWow64,
349                  IN DWORD ResultBufferLength,
350                  IN OUT AFSCommResult **ResultCB);
351
352 void
353 RDR_PipeQueryInfo( IN cm_user_t *userp,
354                    IN AFSFileID  ParentId,
355                    IN AFSPipeInfoRequestCB *pPipeCB,
356                    IN BOOL bWow64,
357                    IN DWORD ResultBufferLength,
358                    IN OUT AFSCommResult **ResultCB);
359
360 void
361 RDR_PipeTransceive( IN cm_user_t     *userp,
362                     IN AFSFileID  ParentId,
363                     IN AFSPipeIORequestCB *pPipeCB,
364                     IN BYTE *pPipeData,
365                     IN BOOL bWow64,
366                     IN DWORD          ResultBufferLength,
367                     IN OUT AFSCommResult **ResultCB);
368
369 void
370 RDR_ReadFile( IN cm_user_t     *userp,
371               IN AFSFileID      FileID,
372               IN LARGE_INTEGER *Offset,
373               IN ULONG          Length,
374               IN PVOID          Buffer,
375               IN BOOL           bWow64,
376               IN BOOL           bCacheBypass,
377               IN DWORD          ResultBufferLength,
378               IN OUT AFSCommResult **ResultCB);
379
380 void
381 RDR_WriteFile( IN cm_user_t     *userp,
382                IN AFSFileID      FileID,
383                IN AFSFileIOCB   *FileIOCB,
384                IN LARGE_INTEGER *Offset,
385                IN ULONG          Length,
386                IN PVOID          Buffer,
387                IN BOOL           bWow64,
388                IN BOOL           bCacheBypass,
389                IN DWORD          ResultBufferLength,
390                IN OUT AFSCommResult **ResultCB);
391
392 cm_user_t *
393 RDR_UserFromCommRequest( IN AFSCommRequest * pRequest);
394
395 cm_user_t *
396 RDR_UserFromAuthGroup( IN GUID *pGuid);
397
398 void
399 RDR_ReleaseUser( IN cm_user_t *userp);
400
401 void
402 RDR_fid2FID( IN cm_fid_t *fid,
403              IN AFSFileID *FileId);
404
405 void
406 RDR_FID2fid( IN AFSFileID *FileId,
407              IN cm_fid_t *fid);
408
409 void
410 RDR_InitIoctl(void);
411
412 void
413 RDR_ShutdownIoctl(void);
414
415 #ifdef __cplusplus
416 }
417 #endif
418