VirtualBox

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

Last change on this file since 98694 was 98526, checked in by vboxsync, 23 months ago

Guest Control: Initial commit (work in progress, disabled by default). bugref:9783

IGuestDirectory:

Added new attributes id + status + an own event source. Also added for rewind support via rewind().

New event types for guest directory [un]registration, state changes and entry reads.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/* $Id: GuestDirectoryImpl.h 98526 2023-02-10 15:10:50Z 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 /** @} */
79
80#ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT
81 int i_openViaToolbox(int *pvrcGuest);
82 int i_closeViaToolbox(int *pvrcGuest);
83 int i_readInternalViaToolbox(GuestFsObjData &objData, int *pvrcGuest);
84#endif /* VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT */
85
86public:
87 /** @name Public static internal methods.
88 * @{ */
89 static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat);
90 /** @} */
91
92private:
93
94 /** Wrapped @name IGuestDirectory properties
95 * @{ */
96 HRESULT getDirectoryName(com::Utf8Str &aDirectoryName);
97 HRESULT getFilter(com::Utf8Str &aFilter);
98 /** @} */
99
100 /** Wrapped @name IGuestDirectory methods.
101 * @{ */
102 HRESULT close();
103 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
104 HRESULT getId(ULONG *aId);
105 HRESULT getStatus(DirectoryStatus_T *aStatus);
106 HRESULT read(ComPtr<IFsObjInfo> &aObjInfo);
107 HRESULT rewind(void);
108 /** @} */
109
110 /** This can safely be used without holding any locks.
111 * An AutoCaller suffices to prevent it being destroy while in use and
112 * internally there is a lock providing the necessary serialization. */
113 const ComObjPtr<EventSource> mEventSource;
114
115 struct Data
116 {
117 /** The directory's open info. */
118 GuestDirectoryOpenInfo mOpenInfo;
119 /** The current directory status. */
120 DirectoryStatus_T mStatus;
121 /** The last returned directory error returned from the guest side. */
122 int mLastError;
123# ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT
124 /** The process tool instance to use. */
125 GuestProcessToolbox mProcessTool;
126# endif
127 /** Object data cache.
128 * Its mName attribute acts as a beacon if the cache is valid or not. */
129 GuestFsObjData mObjData;
130 } mData;
131};
132
133#endif /* !MAIN_INCLUDED_GuestDirectoryImpl_h */
134
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