VirtualBox

source: vbox/trunk/src/VBox/Main/include/GuestDirectoryImpl.h@ 98709

Last change on this file since 98709 was 98709, checked in by vboxsync, 22 months ago

Guest Control: Implemented directory handling / walking as non-toolbox variants. bugref:9783

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: GuestDirectoryImpl.h 98709 2023-02-24 08:49:40Z 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
38class GuestSession;
39
40/**
41 * TODO
42 */
43class ATL_NO_VTABLE GuestDirectory :
44 public GuestDirectoryWrap,
45 public GuestObject
46{
47public:
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
59public:
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
67public:
68 /** @name Public internal methods.
69 * @{ */
70 int i_open(int *pvrcGuest);
71 int i_close(int *pvrcGuest);
72 EventSource *i_getEventSource(void) { return mEventSource; }
73 int i_onDirNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
74 int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pvrcGuest);
75 int i_readInternal(GuestFsObjData &objData, int *pvrcGuest);
76 int i_rewind(uint32_t uTimeoutMS, int *pvrcGuest);
77 int i_setStatus(DirectoryStatus_T enmStatus, int vrcDir);
78 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, DirectoryStatus_T *penmStatus, int *prcGuest);
79 /** @} */
80
81#ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT
82 int i_openViaToolbox(int *pvrcGuest);
83 int i_closeViaToolbox(int *pvrcGuest);
84 int i_readInternalViaToolbox(GuestFsObjData &objData, int *pvrcGuest);
85#endif /* VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT */
86
87public:
88 /** @name Public static internal methods.
89 * @{ */
90 static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat);
91 /** @} */
92
93private:
94
95 /** Wrapped @name IGuestDirectory properties
96 * @{ */
97 HRESULT getDirectoryName(com::Utf8Str &aDirectoryName);
98 HRESULT getFilter(com::Utf8Str &aFilter);
99 /** @} */
100
101 /** Wrapped @name IGuestDirectory methods.
102 * @{ */
103 HRESULT close();
104 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
105 HRESULT getId(ULONG *aId);
106 HRESULT getStatus(DirectoryStatus_T *aStatus);
107 HRESULT read(ComPtr<IFsObjInfo> &aObjInfo);
108 HRESULT rewind(void);
109 /** @} */
110
111 /** This can safely be used without holding any locks.
112 * An AutoCaller suffices to prevent it being destroy while in use and
113 * internally there is a lock providing the necessary serialization. */
114 const ComObjPtr<EventSource> mEventSource;
115
116 struct Data
117 {
118 /** The directory's open info. */
119 GuestDirectoryOpenInfo mOpenInfo;
120 /** The current directory status. */
121 DirectoryStatus_T mStatus;
122 /** The last returned directory error returned from the guest side. */
123 int mLastError;
124# ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT
125 /** The process tool instance to use. */
126 GuestProcessToolbox mProcessTool;
127# endif
128 /** Object data cache.
129 * Its mName attribute acts as a beacon if the cache is valid or not. */
130 GuestFsObjData mObjData;
131 } mData;
132};
133
134#endif /* !MAIN_INCLUDED_GuestDirectoryImpl_h */
135
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette