1 | /* $Id: shflhandle.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Shared Folders Host Service - Handles helper functions header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h
|
---|
29 | #define VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "shfl.h"
|
---|
35 | #include <VBox/shflsvc.h>
|
---|
36 | #include <iprt/dir.h>
|
---|
37 |
|
---|
38 | #define SHFL_HF_TYPE_MASK (0x000000FF)
|
---|
39 | #define SHFL_HF_TYPE_DIR (0x00000001)
|
---|
40 | #define SHFL_HF_TYPE_FILE (0x00000002)
|
---|
41 | #define SHFL_HF_TYPE_VOLUME (0x00000004)
|
---|
42 | #define SHFL_HF_TYPE_DONTUSE (0x00000080)
|
---|
43 |
|
---|
44 | #define SHFL_HF_VALID (0x80000000)
|
---|
45 |
|
---|
46 | #define SHFLHANDLE_MAX (4096)
|
---|
47 |
|
---|
48 | typedef struct _SHFLHANDLEHDR
|
---|
49 | {
|
---|
50 | uint32_t u32Flags;
|
---|
51 | } SHFLHANDLEHDR;
|
---|
52 |
|
---|
53 | #define ShflHandleType(__Handle) BIT_FLAG(((SHFLHANDLEHDR *)(__Handle))->u32Flags, SHFL_HF_TYPE_MASK)
|
---|
54 |
|
---|
55 | typedef struct _SHFLFILEHANDLE
|
---|
56 | {
|
---|
57 | SHFLHANDLEHDR Header;
|
---|
58 | SHFLROOT root; /* Where the handle has been opened. */
|
---|
59 | union
|
---|
60 | {
|
---|
61 | struct
|
---|
62 | {
|
---|
63 | RTFILE Handle;
|
---|
64 | uint64_t fOpenFlags; /**< RTFILE_O_XXX. */
|
---|
65 | } file;
|
---|
66 | struct
|
---|
67 | {
|
---|
68 | RTDIR Handle;
|
---|
69 | RTDIR SearchHandle;
|
---|
70 | PRTDIRENTRYEX pLastValidEntry; /**< last found file in a directory search */
|
---|
71 | } dir;
|
---|
72 | };
|
---|
73 | } SHFLFILEHANDLE;
|
---|
74 |
|
---|
75 |
|
---|
76 | SHFLHANDLE vbsfAllocDirHandle(PSHFLCLIENTDATA pClient);
|
---|
77 | SHFLHANDLE vbsfAllocFileHandle(PSHFLCLIENTDATA pClient);
|
---|
78 | void vbsfFreeFileHandle (PSHFLCLIENTDATA pClient, SHFLHANDLE hHandle);
|
---|
79 |
|
---|
80 |
|
---|
81 | int vbsfInitHandleTable();
|
---|
82 | int vbsfFreeHandleTable();
|
---|
83 | SHFLHANDLE vbsfAllocHandle(PSHFLCLIENTDATA pClient, uint32_t uType,
|
---|
84 | uintptr_t pvUserData);
|
---|
85 | SHFLFILEHANDLE *vbsfQueryFileHandle(PSHFLCLIENTDATA pClient,
|
---|
86 | SHFLHANDLE handle);
|
---|
87 | SHFLFILEHANDLE *vbsfQueryDirHandle(PSHFLCLIENTDATA pClient, SHFLHANDLE handle);
|
---|
88 | uint32_t vbsfQueryHandleType(PSHFLCLIENTDATA pClient,
|
---|
89 | SHFLHANDLE handle);
|
---|
90 |
|
---|
91 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_shflhandle_h */
|
---|