[55401] | 1 | /* $Id: SharedFolderImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
| 3 | * VirtualBox COM class implementation
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
[1] | 8 | *
|
---|
[96407] | 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
|
---|
[1] | 26 | */
|
---|
| 27 |
|
---|
[76562] | 28 | #ifndef MAIN_INCLUDED_SharedFolderImpl_h
|
---|
| 29 | #define MAIN_INCLUDED_SharedFolderImpl_h
|
---|
[76487] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[1] | 33 |
|
---|
[50919] | 34 | #include "SharedFolderWrap.h"
|
---|
[1] | 35 | #include <VBox/shflsvc.h>
|
---|
| 36 |
|
---|
[30764] | 37 | class Console;
|
---|
| 38 |
|
---|
[1] | 39 | class ATL_NO_VTABLE SharedFolder :
|
---|
[50919] | 40 | public SharedFolderWrap
|
---|
[1] | 41 | {
|
---|
| 42 | public:
|
---|
| 43 |
|
---|
[90828] | 44 | DECLARE_COMMON_CLASS_METHODS (SharedFolder)
|
---|
[4040] | 45 |
|
---|
[1] | 46 | HRESULT FinalConstruct();
|
---|
| 47 | void FinalRelease();
|
---|
| 48 |
|
---|
| 49 | // public initializer/uninitializer for internal purposes only
|
---|
[75380] | 50 | HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
|
---|
[105087] | 51 | bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError,
|
---|
| 52 | SymlinkPolicy_T enmSymlinkPolicy);
|
---|
[26044] | 53 | HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
|
---|
[98341] | 54 | // HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
|
---|
| 55 | // bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
|
---|
[75380] | 56 | // HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath,
|
---|
| 57 | // bool aWritable, const com::Utf8Str &aAutoMountPoint, bool aAutoMount, bool fFailOnError);
|
---|
[1] | 58 | void uninit();
|
---|
| 59 |
|
---|
| 60 | // public methods for internal purposes only
|
---|
[4040] | 61 | // (ensure there is a caller and a read lock before calling them!)
|
---|
[1] | 62 |
|
---|
[35755] | 63 | /**
|
---|
| 64 | * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
|
---|
| 65 | * @return
|
---|
| 66 | */
|
---|
[75380] | 67 | const Utf8Str &i_getName() const;
|
---|
[1] | 68 |
|
---|
[35755] | 69 | /**
|
---|
| 70 | * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
|
---|
| 71 | * @return
|
---|
| 72 | */
|
---|
[75380] | 73 | const Utf8Str &i_getHostPath() const;
|
---|
[4040] | 74 |
|
---|
[35755] | 75 | /**
|
---|
| 76 | * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
|
---|
| 77 | * @return
|
---|
| 78 | */
|
---|
[50919] | 79 | bool i_isWritable() const;
|
---|
[35755] | 80 |
|
---|
| 81 | /**
|
---|
| 82 | * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
|
---|
| 83 | * @return
|
---|
| 84 | */
|
---|
[50919] | 85 | bool i_isAutoMounted() const;
|
---|
[35755] | 86 |
|
---|
[75380] | 87 | /**
|
---|
| 88 | * Public internal method for getting the auto mount point.
|
---|
| 89 | */
|
---|
| 90 | const Utf8Str &i_getAutoMountPoint() const;
|
---|
| 91 |
|
---|
[105087] | 92 | /**
|
---|
| 93 | * Public internal method for getting the symlink policy.
|
---|
| 94 | */
|
---|
[105089] | 95 | SymlinkPolicy_T i_getSymlinkPolicy() const;
|
---|
[105087] | 96 |
|
---|
[1] | 97 | protected:
|
---|
| 98 |
|
---|
[50919] | 99 | HRESULT i_protectedInit(VirtualBoxBase *aParent,
|
---|
| 100 | const Utf8Str &aName,
|
---|
| 101 | const Utf8Str &aHostPath,
|
---|
| 102 | bool aWritable,
|
---|
| 103 | bool aAutoMount,
|
---|
[75380] | 104 | const com::Utf8Str &aAutoMountPoint,
|
---|
[105087] | 105 | bool fFailOnError,
|
---|
| 106 | SymlinkPolicy_T enmSymlinkPolicy);
|
---|
[1] | 107 | private:
|
---|
| 108 |
|
---|
[105087] | 109 | // wrapped ISharedFolder properties.
|
---|
[50919] | 110 | HRESULT getName(com::Utf8Str &aName);
|
---|
| 111 | HRESULT getHostPath(com::Utf8Str &aHostPath);
|
---|
| 112 | HRESULT getAccessible(BOOL *aAccessible);
|
---|
| 113 | HRESULT getWritable(BOOL *aWritable);
|
---|
[75458] | 114 | HRESULT setWritable(BOOL aWritable);
|
---|
[50919] | 115 | HRESULT getAutoMount(BOOL *aAutoMount);
|
---|
[75458] | 116 | HRESULT setAutoMount(BOOL aAutoMount);
|
---|
[75380] | 117 | HRESULT getAutoMountPoint(com::Utf8Str &aAutoMountPoint);
|
---|
[75458] | 118 | HRESULT setAutoMountPoint(com::Utf8Str const &aAutoMountPoint);
|
---|
[50919] | 119 | HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
|
---|
[105087] | 120 | HRESULT getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy);
|
---|
| 121 | HRESULT setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy);
|
---|
[50919] | 122 |
|
---|
[50174] | 123 | VirtualBoxBase * const mParent;
|
---|
[1] | 124 |
|
---|
| 125 | /* weak parents (only one of them is not null) */
|
---|
[50174] | 126 | Machine * const mMachine;
|
---|
| 127 | VirtualBox * const mVirtualBox;
|
---|
[1] | 128 |
|
---|
[98341] | 129 | struct Data; // opaque data struct, defined in MachineSharedFolderImpl.cpp
|
---|
[35755] | 130 | Data *m;
|
---|
[1] | 131 | };
|
---|
| 132 |
|
---|
[76562] | 133 | #endif /* !MAIN_INCLUDED_SharedFolderImpl_h */
|
---|
[14949] | 134 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|