a32368911429abb448f41e14ff628d5883dbc1d8
[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 );
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      bWow64,
81                         IN BOOL      bQueryStatus,
82                         IN BOOL      bHoldFid,
83                         IN DWORD     ResultBufferLength,
84                         IN OUT AFSCommResult **ResultCB);
85
86 void
87 RDR_EvaluateNodeByID( IN cm_user_t *userp,
88                       IN AFSFileID ParentID,
89                       IN AFSFileID SourceID,
90                       IN BOOL bWow64,
91                       IN BOOL bQueryStatus,
92                       IN BOOL      bHoldFid,
93                       IN DWORD    ResultBufferLength,
94                       IN OUT AFSCommResult **ResultCB);
95
96 void
97 RDR_CreateFileEntry( IN cm_user_t *userp,
98                      IN WCHAR *FileName,
99                      IN DWORD FileNameLength,
100                      IN AFSFileCreateCB *CreateCB,
101                      IN BOOL bWow64,
102                      IN BOOL bHoldFid,
103                      IN DWORD ResultBufferLength,
104                      IN OUT AFSCommResult **ResultCB);
105
106 void
107 RDR_UpdateFileEntry( IN cm_user_t *userp,
108                      IN AFSFileID FileId,
109                      IN AFSFileUpdateCB *UpdateCB,
110                      IN BOOL bWow64,
111                      IN DWORD ResultBufferLength,
112                      IN OUT AFSCommResult **ResultCB);
113
114 void
115 RDR_DeleteFileEntry( IN cm_user_t *userp,
116                      IN AFSFileID ParentId,
117                      IN ULONGLONG ProcessId,
118                      IN WCHAR *FileName,
119                      IN DWORD FileNameLength,
120                      IN BOOL bWow64,
121                      IN BOOL bCheckOnly,
122                      IN DWORD ResultBufferLength,
123                      IN OUT AFSCommResult **ResultCB);
124
125 void
126 RDR_RenameFileEntry( IN cm_user_t *userp,
127                      IN WCHAR    *SourceFileName,
128                      IN DWORD     SourceFileNameLength,
129                      IN AFSFileID SourceFileId,
130                      IN AFSFileRenameCB *RenameCB,
131                      IN BOOL bWow64,
132                      IN DWORD ResultBufferLength,
133                      IN OUT AFSCommResult **ResultCB);
134
135 void
136 RDR_FlushFileEntry( IN cm_user_t *userp,
137                     IN AFSFileID FileId,
138                     IN BOOL bWow64,
139                     IN DWORD ResultBufferLength,
140                     IN OUT AFSCommResult **ResultCB);
141
142 void
143 RDR_OpenFileEntry( IN cm_user_t *userp,
144                    IN AFSFileID FileId,
145                    IN AFSFileOpenCB *OpenCB,
146                    IN BOOL bWow64,
147                    IN BOOL bHoldFid,
148                    IN DWORD ResultBufferLength,
149                    IN OUT AFSCommResult **ResultCB);
150
151 void
152 RDR_CleanupFileEntry( IN cm_user_t *userp,
153                       IN AFSFileID FileId,
154                       IN WCHAR *FileName,
155                       IN DWORD FileNameLength,
156                       IN AFSFileCleanupCB *CleanupCB,
157                       IN BOOL bWow64,
158                       IN BOOL bFlushFile,
159                       IN BOOL bDeleteFile,
160                       IN BOOL bUnlockFile,
161                       IN DWORD ResultBufferLength,
162                       IN OUT AFSCommResult **ResultCB);
163
164 BOOL
165 RDR_RequestFileExtentsAsync( IN cm_user_t *userp,
166                              IN AFSFileID FileId,
167                              IN AFSRequestExtentsCB *RequestExtentsCB,
168                              IN BOOL bWow64,
169                              IN OUT DWORD * ResultBufferLength,
170                              IN OUT AFSSetFileExtentsCB **ResultCB);
171
172 void
173 RDR_ReleaseFileExtents( IN cm_user_t *userp,
174                         IN AFSFileID FileId,
175                         IN AFSReleaseExtentsCB *ReleaseExtentsCB,
176                         IN BOOL bWow64,
177                         IN DWORD ResultBufferLength,
178                         IN OUT AFSCommResult **ResultCB);
179
180 DWORD
181 RDR_RequestExtentRelease( IN cm_fid_t *fidp,
182                           IN LARGE_INTEGER numOfHeldExtents,
183                           IN DWORD numOfExtents,
184                           IN AFSFileExtentCB *extentList);
185
186 DWORD
187 RDR_ProcessReleaseFileExtentsResult( IN AFSReleaseFileExtentsResultCB *ReleaseFileExtentsResultCB,
188                                      IN DWORD ResultBufferLength);
189
190 DWORD
191 RDR_ReleaseFailedSetFileExtents( IN cm_user_t *userp,
192                                  IN AFSSetFileExtentsCB *SetFileExtentsResultCB,
193                                  IN DWORD ResultBufferLength);
194
195 DWORD
196 RDR_SetFileExtents( IN AFSSetFileExtentsCB *pSetFileExtentsResultCB,
197                     IN DWORD dwResultBufferLength);
198 void
199 RDR_PioctlOpen( IN cm_user_t *userp,
200                 IN AFSFileID  ParentId,
201                 IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
202                 IN BOOL bWow64,
203                 IN DWORD ResultBufferLength,
204                 IN OUT AFSCommResult **ResultCB);
205
206 void
207 RDR_PioctlClose( IN cm_user_t *userp,
208                  IN AFSFileID  ParentId,
209                  IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
210                  IN BOOL bWow64,
211                  IN DWORD ResultBufferLength,
212                  IN OUT AFSCommResult **ResultCB);
213
214 void
215 RDR_PioctlWrite( IN cm_user_t *userp,
216                  IN AFSFileID  ParentId,
217                  IN AFSPIOCtlIORequestCB *pPioctlCB,
218                  IN BOOL bWow64,
219                  IN DWORD ResultBufferLength,
220                  IN OUT AFSCommResult **ResultCB);
221
222 void
223 RDR_PioctlRead( IN cm_user_t *userp,
224                 IN AFSFileID  ParentId,
225                 IN AFSPIOCtlIORequestCB *pPioctlCB,
226                 IN BOOL bWow64,
227                 IN BOOL bIsLocalSystem,
228                 IN DWORD ResultBufferLength,
229                 IN OUT AFSCommResult **ResultCB);
230
231 void
232 RDR_ByteRangeLockSync( IN cm_user_t     *userp,
233                        IN AFSFileID     FileId,
234                        IN AFSByteRangeLockRequestCB *pBRLRequestCB,
235                        IN BOOL bWow64,
236                        IN DWORD ResultBufferLength,
237                        IN OUT AFSCommResult **ResultCB);
238
239 void
240 RDR_ByteRangeUnlock( IN cm_user_t     *userp,
241                      IN AFSFileID     FileId,
242                      IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
243                      IN BOOL bWow64,
244                      IN DWORD ResultBufferLength,
245                      IN OUT AFSCommResult **ResultCB);
246
247 void
248 RDR_ByteRangeUnlockAll( IN cm_user_t     *userp,
249                         IN AFSFileID     FileId,
250                         IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
251                         IN BOOL bWow64,
252                         IN DWORD ResultBufferLength,
253                         IN OUT AFSCommResult **ResultCB);
254
255 void
256 RDR_GetVolumeInfo( IN cm_user_t     *userp,
257                    IN AFSFileID     FileId,
258                    IN BOOL bWow64,
259                    IN DWORD ResultBufferLength,
260                    IN OUT AFSCommResult **ResultCB);
261
262 void
263 RDR_HoldFid( IN cm_user_t     *userp,
264              IN AFSHoldFidRequestCB * pHoldFidCB,
265              IN BOOL bFast,
266              IN DWORD ResultBufferLength,
267              IN OUT AFSCommResult **ResultCB);
268
269 void
270 RDR_ReleaseFid( IN cm_user_t     *userp,
271                 IN AFSReleaseFidRequestCB * pReleaseFidCB,
272                 IN BOOL bFast,
273                 IN DWORD ResultBufferLength,
274                 IN OUT AFSCommResult **ResultCB);
275
276 void
277 RDR_PipeOpen( IN cm_user_t *userp,
278               IN AFSFileID  ParentId,
279               IN WCHAR     *Name,
280               IN DWORD      NameLength,
281               IN AFSPipeOpenCloseRequestCB *pPipeCB,
282               IN BOOL bWow64,
283               IN DWORD ResultBufferLength,
284               IN OUT AFSCommResult **ResultCB);
285
286 void
287 RDR_PipeClose( IN cm_user_t *userp,
288                IN AFSFileID  ParentId,
289                IN AFSPipeOpenCloseRequestCB *pPipeCB,
290                IN BOOL bWow64,
291                IN DWORD ResultBufferLength,
292                IN OUT AFSCommResult **ResultCB);
293
294 void
295 RDR_PipeWrite( IN cm_user_t *userp,
296                IN AFSFileID  ParentId,
297                IN AFSPipeIORequestCB *pPipeCB,
298                IN BYTE *pPipeData,
299                IN BOOL bWow64,
300                IN DWORD ResultBufferLength,
301                IN OUT AFSCommResult **ResultCB);
302
303 void
304 RDR_PipeRead( IN cm_user_t *userp,
305               IN AFSFileID  ParentId,
306               IN AFSPipeIORequestCB *pPipeCB,
307               IN BOOL bWow64,
308               IN DWORD ResultBufferLength,
309               IN OUT AFSCommResult **ResultCB);
310
311 void
312 RDR_PipeSetInfo( IN cm_user_t *userp,
313                  IN AFSFileID  ParentId,
314                  IN AFSPipeInfoRequestCB *pPipeCB,
315                  IN BYTE *pPipeData,
316                  IN BOOL bWow64,
317                  IN DWORD ResultBufferLength,
318                  IN OUT AFSCommResult **ResultCB);
319
320 void
321 RDR_PipeQueryInfo( IN cm_user_t *userp,
322                    IN AFSFileID  ParentId,
323                    IN AFSPipeInfoRequestCB *pPipeCB,
324                    IN BOOL bWow64,
325                    IN DWORD ResultBufferLength,
326                    IN OUT AFSCommResult **ResultCB);
327
328 void
329 RDR_PipeTransceive( IN cm_user_t     *userp,
330                     IN AFSFileID  ParentId,
331                     IN AFSPipeIORequestCB *pPipeCB,
332                     IN BYTE *pPipeData,
333                     IN BOOL bWow64,
334                     IN DWORD          ResultBufferLength,
335                     IN OUT AFSCommResult **ResultCB);
336
337 cm_user_t *
338 RDR_UserFromCommRequest( IN AFSCommRequest * pRequest);
339
340 cm_user_t *
341 RDR_UserFromAuthGroup( IN GUID *pGuid);
342
343 void
344 RDR_ReleaseUser( IN cm_user_t *userp);
345
346 void
347 RDR_fid2FID( IN cm_fid_t *fid,
348              IN AFSFileID *FileId);
349
350 void
351 RDR_FID2fid( IN AFSFileID *FileId,
352              IN cm_fid_t *fid);
353
354 void
355 RDR_InitIoctl(void);
356
357 #ifdef __cplusplus
358 }
359 #endif
360