1 | /* $Id: shflhandle.h 77243 2019-02-10 22:44:00Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Shared Folders Host Service - Handles helper functions header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h
|
---|
19 | #define VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "shfl.h"
|
---|
25 | #include <VBox/shflsvc.h>
|
---|
26 | #include <iprt/dir.h>
|
---|
27 |
|
---|
28 | #define SHFL_HF_TYPE_MASK (0x000000FF)
|
---|
29 | #define SHFL_HF_TYPE_DIR (0x00000001)
|
---|
30 | #define SHFL_HF_TYPE_FILE (0x00000002)
|
---|
31 | #define SHFL_HF_TYPE_VOLUME (0x00000004)
|
---|
32 | #define SHFL_HF_TYPE_DONTUSE (0x00000080)
|
---|
33 |
|
---|
34 | #define SHFL_HF_VALID (0x80000000)
|
---|
35 |
|
---|
36 | #define SHFLHANDLE_MAX (4096)
|
---|
37 |
|
---|
38 | typedef struct _SHFLHANDLEHDR
|
---|
39 | {
|
---|
40 | uint32_t u32Flags;
|
---|
41 | } SHFLHANDLEHDR;
|
---|
42 |
|
---|
43 | #define ShflHandleType(__Handle) BIT_FLAG(((SHFLHANDLEHDR *)(__Handle))->u32Flags, SHFL_HF_TYPE_MASK)
|
---|
44 |
|
---|
45 | typedef struct _SHFLFILEHANDLE
|
---|
46 | {
|
---|
47 | SHFLHANDLEHDR Header;
|
---|
48 | SHFLROOT root; /* Where the handle has been opened. */
|
---|
49 | union
|
---|
50 | {
|
---|
51 | struct
|
---|
52 | {
|
---|
53 | RTFILE Handle;
|
---|
54 | uint64_t fOpenFlags; /**< RTFILE_O_XXX. */
|
---|
55 | } file;
|
---|
56 | struct
|
---|
57 | {
|
---|
58 | RTDIR Handle;
|
---|
59 | RTDIR SearchHandle;
|
---|
60 | PRTDIRENTRYEX pLastValidEntry; /**< last found file in a directory search */
|
---|
61 | } dir;
|
---|
62 | };
|
---|
63 | } SHFLFILEHANDLE;
|
---|
64 |
|
---|
65 |
|
---|
66 | SHFLHANDLE vbsfAllocDirHandle(PSHFLCLIENTDATA pClient);
|
---|
67 | SHFLHANDLE vbsfAllocFileHandle(PSHFLCLIENTDATA pClient);
|
---|
68 | void vbsfFreeFileHandle (PSHFLCLIENTDATA pClient, SHFLHANDLE hHandle);
|
---|
69 |
|
---|
70 |
|
---|
71 | int vbsfInitHandleTable();
|
---|
72 | int vbsfFreeHandleTable();
|
---|
73 | SHFLHANDLE vbsfAllocHandle(PSHFLCLIENTDATA pClient, uint32_t uType,
|
---|
74 | uintptr_t pvUserData);
|
---|
75 | SHFLFILEHANDLE *vbsfQueryFileHandle(PSHFLCLIENTDATA pClient,
|
---|
76 | SHFLHANDLE handle);
|
---|
77 | SHFLFILEHANDLE *vbsfQueryDirHandle(PSHFLCLIENTDATA pClient, SHFLHANDLE handle);
|
---|
78 | uint32_t vbsfQueryHandleType(PSHFLCLIENTDATA pClient,
|
---|
79 | SHFLHANDLE handle);
|
---|
80 |
|
---|
81 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h */
|
---|