Windows: Add Hard Link support to Service
[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      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_HardLinkFileEntry( IN cm_user_t *userp,
137                        IN WCHAR    *SourceFileName,
138                        IN DWORD     SourceFileNameLength,
139                        IN AFSFileID SourceFileId,
140                        IN AFSFileHardLinkCB *HardLinkCB,
141                        IN BOOL bWow64,
142                        IN DWORD ResultBufferLength,
143                        IN OUT AFSCommResult **ResultCB);
144
145 void
146 RDR_FlushFileEntry( IN cm_user_t *userp,
147                     IN AFSFileID FileId,
148                     IN BOOL bWow64,
149                     IN DWORD ResultBufferLength,
150                     IN OUT AFSCommResult **ResultCB);
151
152 void
153 RDR_OpenFileEntry( IN cm_user_t *userp,
154                    IN AFSFileID FileId,
155                    IN AFSFileOpenCB *OpenCB,
156                    IN BOOL bWow64,
157                    IN BOOL bHoldFid,
158                    IN DWORD ResultBufferLength,
159                    IN OUT AFSCommResult **ResultCB);
160
161 void
162 RDR_ReleaseFileAccess( IN cm_user_t *userp,
163                        IN AFSFileID FileId,
164                        IN AFSFileAccessReleaseCB *ReleaseFileCB,
165                        IN BOOL bWow64,
166                        IN DWORD ResultBufferLength,
167                        IN OUT AFSCommResult **ResultCB);
168
169 void
170 RDR_CleanupFileEntry( IN cm_user_t *userp,
171                       IN AFSFileID FileId,
172                       IN WCHAR *FileName,
173                       IN DWORD FileNameLength,
174                       IN AFSFileCleanupCB *CleanupCB,
175                       IN BOOL bWow64,
176                       IN BOOL bFlushFile,
177                       IN BOOL bDeleteFile,
178                       IN BOOL bUnlockFile,
179                       IN DWORD ResultBufferLength,
180                       IN OUT AFSCommResult **ResultCB);
181
182 BOOL
183 RDR_RequestFileExtentsAsync( IN cm_user_t *userp,
184                              IN AFSFileID FileId,
185                              IN AFSRequestExtentsCB *RequestExtentsCB,
186                              IN BOOL bWow64,
187                              IN OUT DWORD * ResultBufferLength,
188                              IN OUT AFSSetFileExtentsCB **ResultCB);
189
190 void
191 RDR_ReleaseFileExtents( IN cm_user_t *userp,
192                         IN AFSFileID FileId,
193                         IN AFSReleaseExtentsCB *ReleaseExtentsCB,
194                         IN BOOL bWow64,
195                         IN DWORD ResultBufferLength,
196                         IN OUT AFSCommResult **ResultCB);
197
198 DWORD
199 RDR_RequestExtentRelease( IN cm_fid_t *fidp,
200                           IN LARGE_INTEGER numOfHeldExtents,
201                           IN DWORD numOfExtents,
202                           IN AFSFileExtentCB *extentList);
203
204 DWORD
205 RDR_ProcessReleaseFileExtentsResult( IN AFSReleaseFileExtentsResultCB *ReleaseFileExtentsResultCB,
206                                      IN DWORD ResultBufferLength);
207
208 DWORD
209 RDR_ReleaseFailedSetFileExtents( IN cm_user_t *userp,
210                                  IN AFSSetFileExtentsCB *SetFileExtentsResultCB,
211                                  IN DWORD ResultBufferLength);
212
213 DWORD
214 RDR_SetFileExtents( IN AFSSetFileExtentsCB *pSetFileExtentsResultCB,
215                     IN DWORD dwResultBufferLength);
216 void
217 RDR_PioctlOpen( IN cm_user_t *userp,
218                 IN AFSFileID  ParentId,
219                 IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
220                 IN BOOL bWow64,
221                 IN DWORD ResultBufferLength,
222                 IN OUT AFSCommResult **ResultCB);
223
224 void
225 RDR_PioctlClose( IN cm_user_t *userp,
226                  IN AFSFileID  ParentId,
227                  IN AFSPIOCtlOpenCloseRequestCB *pPioctlCB,
228                  IN BOOL bWow64,
229                  IN DWORD ResultBufferLength,
230                  IN OUT AFSCommResult **ResultCB);
231
232 void
233 RDR_PioctlWrite( IN cm_user_t *userp,
234                  IN AFSFileID  ParentId,
235                  IN AFSPIOCtlIORequestCB *pPioctlCB,
236                  IN BOOL bWow64,
237                  IN DWORD ResultBufferLength,
238                  IN OUT AFSCommResult **ResultCB);
239
240 void
241 RDR_PioctlRead( IN cm_user_t *userp,
242                 IN AFSFileID  ParentId,
243                 IN AFSPIOCtlIORequestCB *pPioctlCB,
244                 IN BOOL bWow64,
245                 IN BOOL bIsLocalSystem,
246                 IN DWORD ResultBufferLength,
247                 IN OUT AFSCommResult **ResultCB);
248
249 void
250 RDR_ByteRangeLockSync( IN cm_user_t     *userp,
251                        IN AFSFileID     FileId,
252                        IN AFSByteRangeLockRequestCB *pBRLRequestCB,
253                        IN BOOL bWow64,
254                        IN DWORD ResultBufferLength,
255                        IN OUT AFSCommResult **ResultCB);
256
257 void
258 RDR_ByteRangeUnlock( IN cm_user_t     *userp,
259                      IN AFSFileID     FileId,
260                      IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
261                      IN BOOL bWow64,
262                      IN DWORD ResultBufferLength,
263                      IN OUT AFSCommResult **ResultCB);
264
265 void
266 RDR_ByteRangeUnlockAll( IN cm_user_t     *userp,
267                         IN AFSFileID     FileId,
268                         IN AFSByteRangeUnlockRequestCB *pBRURequestCB,
269                         IN BOOL bWow64,
270                         IN DWORD ResultBufferLength,
271                         IN OUT AFSCommResult **ResultCB);
272
273 void
274 RDR_GetVolumeInfo( IN cm_user_t     *userp,
275                    IN AFSFileID     FileId,
276                    IN BOOL bWow64,
277                    IN DWORD ResultBufferLength,
278                    IN OUT AFSCommResult **ResultCB);
279
280 void
281 RDR_GetVolumeSizeInfo( IN cm_user_t     *userp,
282                        IN AFSFileID     FileId,
283                        IN BOOL bWow64,
284                        IN DWORD ResultBufferLength,
285                        IN OUT AFSCommResult **ResultCB);
286
287 void
288 RDR_HoldFid( IN cm_user_t     *userp,
289              IN AFSHoldFidRequestCB * pHoldFidCB,
290              IN BOOL bFast,
291              IN DWORD ResultBufferLength,
292              IN OUT AFSCommResult **ResultCB);
293
294 void
295 RDR_ReleaseFid( IN cm_user_t     *userp,
296                 IN AFSReleaseFidRequestCB * pReleaseFidCB,
297                 IN BOOL bFast,
298                 IN DWORD ResultBufferLength,
299                 IN OUT AFSCommResult **ResultCB);
300
301 void
302 RDR_InitPipe(void);
303
304 void
305 RDR_ShutdownPipe(void);
306
307 void
308 RDR_PipeOpen( IN cm_user_t *userp,
309               IN AFSFileID  ParentId,
310               IN WCHAR     *Name,
311               IN DWORD      NameLength,
312               IN AFSPipeOpenCloseRequestCB *pPipeCB,
313               IN BOOL bWow64,
314               IN DWORD ResultBufferLength,
315               IN OUT AFSCommResult **ResultCB);
316
317 void
318 RDR_PipeClose( IN cm_user_t *userp,
319                IN AFSFileID  ParentId,
320                IN AFSPipeOpenCloseRequestCB *pPipeCB,
321                IN BOOL bWow64,
322                IN DWORD ResultBufferLength,
323                IN OUT AFSCommResult **ResultCB);
324
325 void
326 RDR_PipeWrite( IN cm_user_t *userp,
327                IN AFSFileID  ParentId,
328                IN AFSPipeIORequestCB *pPipeCB,
329                IN BYTE *pPipeData,
330                IN BOOL bWow64,
331                IN DWORD ResultBufferLength,
332                IN OUT AFSCommResult **ResultCB);
333
334 void
335 RDR_PipeRead( IN cm_user_t *userp,
336               IN AFSFileID  ParentId,
337               IN AFSPipeIORequestCB *pPipeCB,
338               IN BOOL bWow64,
339               IN DWORD ResultBufferLength,
340               IN OUT AFSCommResult **ResultCB);
341
342 void
343 RDR_PipeSetInfo( IN cm_user_t *userp,
344                  IN AFSFileID  ParentId,
345                  IN AFSPipeInfoRequestCB *pPipeCB,
346                  IN BYTE *pPipeData,
347                  IN BOOL bWow64,
348                  IN DWORD ResultBufferLength,
349                  IN OUT AFSCommResult **ResultCB);
350
351 void
352 RDR_PipeQueryInfo( IN cm_user_t *userp,
353                    IN AFSFileID  ParentId,
354                    IN AFSPipeInfoRequestCB *pPipeCB,
355                    IN BOOL bWow64,
356                    IN DWORD ResultBufferLength,
357                    IN OUT AFSCommResult **ResultCB);
358
359 void
360 RDR_PipeTransceive( IN cm_user_t     *userp,
361                     IN AFSFileID  ParentId,
362                     IN AFSPipeIORequestCB *pPipeCB,
363                     IN BYTE *pPipeData,
364                     IN BOOL bWow64,
365                     IN DWORD          ResultBufferLength,
366                     IN OUT AFSCommResult **ResultCB);
367
368 cm_user_t *
369 RDR_UserFromCommRequest( IN AFSCommRequest * pRequest);
370
371 cm_user_t *
372 RDR_UserFromAuthGroup( IN GUID *pGuid);
373
374 void
375 RDR_ReleaseUser( IN cm_user_t *userp);
376
377 void
378 RDR_fid2FID( IN cm_fid_t *fid,
379              IN AFSFileID *FileId);
380
381 void
382 RDR_FID2fid( IN AFSFileID *FileId,
383              IN cm_fid_t *fid);
384
385 void
386 RDR_InitIoctl(void);
387
388 void
389 RDR_ShutdownIoctl(void);
390
391 #ifdef __cplusplus
392 }
393 #endif
394