1 | /* $Id: GuestDirectoryImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Guest directory handling implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-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 MAIN_INCLUDED_GuestDirectoryImpl_h
|
---|
29 | #define MAIN_INCLUDED_GuestDirectoryImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "GuestDirectoryWrap.h"
|
---|
35 | #include "GuestFsObjInfoImpl.h"
|
---|
36 | #include "GuestProcessImpl.h"
|
---|
37 |
|
---|
38 | class GuestSession;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * TODO
|
---|
42 | */
|
---|
43 | class ATL_NO_VTABLE GuestDirectory :
|
---|
44 | public GuestDirectoryWrap,
|
---|
45 | public GuestObject
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | /** @name COM and internal init/term/mapping cruft.
|
---|
49 | * @{ */
|
---|
50 | DECLARE_COMMON_CLASS_METHODS(GuestDirectory)
|
---|
51 |
|
---|
52 | int init(Console *pConsole, GuestSession *pSession, ULONG aObjectID, const GuestDirectoryOpenInfo &openInfo);
|
---|
53 | void uninit(void);
|
---|
54 |
|
---|
55 | HRESULT FinalConstruct(void);
|
---|
56 | void FinalRelease(void);
|
---|
57 | /** @} */
|
---|
58 |
|
---|
59 | public:
|
---|
60 | /** @name Implemented virtual methods from GuestObject.
|
---|
61 | * @{ */
|
---|
62 | int i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
|
---|
63 | int i_onUnregister(void);
|
---|
64 | int i_onSessionStatusChange(GuestSessionStatus_T enmSessionStatus);
|
---|
65 | /** @} */
|
---|
66 |
|
---|
67 | public:
|
---|
68 | /** @name Public internal methods.
|
---|
69 | * @{ */
|
---|
70 | int i_closeInternal(int *pGuestRc);
|
---|
71 | int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pGuestRc);
|
---|
72 | int i_readInternal(GuestFsObjData &objData, int *prcGuest);
|
---|
73 | /** @} */
|
---|
74 |
|
---|
75 | public:
|
---|
76 | /** @name Public static internal methods.
|
---|
77 | * @{ */
|
---|
78 | static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);
|
---|
79 | /** @} */
|
---|
80 |
|
---|
81 | private:
|
---|
82 |
|
---|
83 | /** Wrapped @name IGuestDirectory properties
|
---|
84 | * @{ */
|
---|
85 | HRESULT getDirectoryName(com::Utf8Str &aDirectoryName);
|
---|
86 | HRESULT getFilter(com::Utf8Str &aFilter);
|
---|
87 | /** @} */
|
---|
88 |
|
---|
89 | /** Wrapped @name IGuestDirectory methods.
|
---|
90 | * @{ */
|
---|
91 | HRESULT close();
|
---|
92 | HRESULT read(ComPtr<IFsObjInfo> &aObjInfo);
|
---|
93 | /** @} */
|
---|
94 |
|
---|
95 | struct Data
|
---|
96 | {
|
---|
97 | /** The directory's open info. */
|
---|
98 | GuestDirectoryOpenInfo mOpenInfo;
|
---|
99 | /** The process tool instance to use. */
|
---|
100 | GuestProcessTool mProcessTool;
|
---|
101 | /** Object data cache.
|
---|
102 | * Its mName attribute acts as a beacon if the cache is valid or not. */
|
---|
103 | GuestFsObjData mObjData;
|
---|
104 | } mData;
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif /* !MAIN_INCLUDED_GuestDirectoryImpl_h */
|
---|
108 |
|
---|