1 | /* $Id: GuestSessionImpl.h 74734 2018-10-10 11:47:54Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Guest session handling.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2018 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ____H_GUESTSESSIONIMPL
|
---|
19 | #define ____H_GUESTSESSIONIMPL
|
---|
20 |
|
---|
21 | #include "GuestSessionWrap.h"
|
---|
22 | #include "EventImpl.h"
|
---|
23 |
|
---|
24 | #include "GuestCtrlImplPrivate.h"
|
---|
25 | #include "GuestProcessImpl.h"
|
---|
26 | #include "GuestDirectoryImpl.h"
|
---|
27 | #include "GuestFileImpl.h"
|
---|
28 | #include "GuestFsObjInfoImpl.h"
|
---|
29 | #include "GuestSessionImplTasks.h"
|
---|
30 |
|
---|
31 | #include <deque>
|
---|
32 |
|
---|
33 | class GuestSessionTaskInternalOpen; /* Needed for i_startSessionThreadTask(). */
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Guest session implementation.
|
---|
37 | */
|
---|
38 | class ATL_NO_VTABLE GuestSession :
|
---|
39 | public GuestSessionWrap,
|
---|
40 | public GuestBase
|
---|
41 | {
|
---|
42 | public:
|
---|
43 | /** @name COM and internal init/term/mapping cruft.
|
---|
44 | * @{ */
|
---|
45 | DECLARE_EMPTY_CTOR_DTOR(GuestSession)
|
---|
46 |
|
---|
47 | int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
|
---|
48 | void uninit(void);
|
---|
49 | HRESULT FinalConstruct(void);
|
---|
50 | void FinalRelease(void);
|
---|
51 | /** @} */
|
---|
52 |
|
---|
53 | private:
|
---|
54 |
|
---|
55 | /** Wrapped @name IGuestSession properties.
|
---|
56 | * @{ */
|
---|
57 | HRESULT getUser(com::Utf8Str &aUser);
|
---|
58 | HRESULT getDomain(com::Utf8Str &aDomain);
|
---|
59 | HRESULT getName(com::Utf8Str &aName);
|
---|
60 | HRESULT getId(ULONG *aId);
|
---|
61 | HRESULT getTimeout(ULONG *aTimeout);
|
---|
62 | HRESULT setTimeout(ULONG aTimeout);
|
---|
63 | HRESULT getProtocolVersion(ULONG *aProtocolVersion);
|
---|
64 | HRESULT getStatus(GuestSessionStatus_T *aStatus);
|
---|
65 | HRESULT getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges);
|
---|
66 | HRESULT setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges);
|
---|
67 | HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase);
|
---|
68 | HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
|
---|
69 | HRESULT getPathStyle(PathStyle_T *aPathStyle);
|
---|
70 | HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
|
---|
71 | HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
|
---|
72 | HRESULT getUserDocuments(com::Utf8Str &aUserDocuments);
|
---|
73 | HRESULT getUserHome(com::Utf8Str &aUserHome);
|
---|
74 | HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
|
---|
75 | HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
|
---|
76 | HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
|
---|
77 | /** @} */
|
---|
78 |
|
---|
79 | /** Wrapped @name IGuestSession methods.
|
---|
80 | * @{ */
|
---|
81 | HRESULT close();
|
---|
82 |
|
---|
83 | HRESULT copyFromGuest(const std::vector<com::Utf8Str> &aSources,
|
---|
84 | const std::vector<com::Utf8Str> &aFilters,
|
---|
85 | const std::vector<com::Utf8Str> &aFlags,
|
---|
86 | const com::Utf8Str &aDestination,
|
---|
87 | ComPtr<IProgress> &aProgress);
|
---|
88 | HRESULT copyToGuest(const std::vector<com::Utf8Str> &aSources,
|
---|
89 | const std::vector<com::Utf8Str> &aFilters,
|
---|
90 | const std::vector<com::Utf8Str> &aFlags,
|
---|
91 | const com::Utf8Str &aDestination,
|
---|
92 | ComPtr<IProgress> &aProgress);
|
---|
93 |
|
---|
94 | HRESULT directoryCopy(const com::Utf8Str &aSource,
|
---|
95 | const com::Utf8Str &aDestination,
|
---|
96 | const std::vector<DirectoryCopyFlag_T> &aFlags,
|
---|
97 | ComPtr<IProgress> &aProgress);
|
---|
98 | HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource,
|
---|
99 | const com::Utf8Str &aDestination,
|
---|
100 | const std::vector<DirectoryCopyFlag_T> &aFlags,
|
---|
101 | ComPtr<IProgress> &aProgress);
|
---|
102 | HRESULT directoryCopyToGuest(const com::Utf8Str &aSource,
|
---|
103 | const com::Utf8Str &aDestination,
|
---|
104 | const std::vector<DirectoryCopyFlag_T> &aFlags,
|
---|
105 | ComPtr<IProgress> &aProgress);
|
---|
106 | HRESULT directoryCreate(const com::Utf8Str &aPath,
|
---|
107 | ULONG aMode,
|
---|
108 | const std::vector<DirectoryCreateFlag_T> &aFlags);
|
---|
109 | HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
|
---|
110 | ULONG aMode,
|
---|
111 | const com::Utf8Str &aPath,
|
---|
112 | BOOL aSecure,
|
---|
113 | com::Utf8Str &aDirectory);
|
---|
114 | HRESULT directoryExists(const com::Utf8Str &aPath,
|
---|
115 | BOOL aFollowSymlinks,
|
---|
116 | BOOL *aExists);
|
---|
117 | HRESULT directoryOpen(const com::Utf8Str &aPath,
|
---|
118 | const com::Utf8Str &aFilter,
|
---|
119 | const std::vector<DirectoryOpenFlag_T> &aFlags,
|
---|
120 | ComPtr<IGuestDirectory> &aDirectory);
|
---|
121 | HRESULT directoryRemove(const com::Utf8Str &aPath);
|
---|
122 | HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
|
---|
123 | const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
|
---|
124 | ComPtr<IProgress> &aProgress);
|
---|
125 | HRESULT environmentScheduleSet(const com::Utf8Str &aName,
|
---|
126 | const com::Utf8Str &aValue);
|
---|
127 | HRESULT environmentScheduleUnset(const com::Utf8Str &aName);
|
---|
128 | HRESULT environmentGetBaseVariable(const com::Utf8Str &aName,
|
---|
129 | com::Utf8Str &aValue);
|
---|
130 | HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
|
---|
131 | BOOL *aExists);
|
---|
132 |
|
---|
133 | HRESULT fileCopy(const com::Utf8Str &aSource,
|
---|
134 | const com::Utf8Str &aDestination,
|
---|
135 | const std::vector<FileCopyFlag_T> &aFlags,
|
---|
136 | ComPtr<IProgress> &aProgress);
|
---|
137 | HRESULT fileCopyToGuest(const com::Utf8Str &aSource,
|
---|
138 | const com::Utf8Str &aDestination,
|
---|
139 | const std::vector<FileCopyFlag_T> &aFlags,
|
---|
140 | ComPtr<IProgress> &aProgress);
|
---|
141 | HRESULT fileCopyFromGuest(const com::Utf8Str &aSource,
|
---|
142 | const com::Utf8Str &aDestination,
|
---|
143 | const std::vector<FileCopyFlag_T> &aFlags,
|
---|
144 | ComPtr<IProgress> &aProgress);
|
---|
145 | HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
|
---|
146 | ULONG aMode,
|
---|
147 | const com::Utf8Str &aPath,
|
---|
148 | BOOL aSecure,
|
---|
149 | ComPtr<IGuestFile> &aFile);
|
---|
150 | HRESULT fileExists(const com::Utf8Str &aPath,
|
---|
151 | BOOL aFollowSymlinks,
|
---|
152 | BOOL *aExists);
|
---|
153 | HRESULT fileOpen(const com::Utf8Str &aPath,
|
---|
154 | FileAccessMode_T aAccessMode,
|
---|
155 | FileOpenAction_T aOpenAction,
|
---|
156 | ULONG aCreationMode,
|
---|
157 | ComPtr<IGuestFile> &aFile);
|
---|
158 | HRESULT fileOpenEx(const com::Utf8Str &aPath,
|
---|
159 | FileAccessMode_T aAccessMode,
|
---|
160 | FileOpenAction_T aOpenAction,
|
---|
161 | FileSharingMode_T aSharingMode,
|
---|
162 | ULONG aCreationMode,
|
---|
163 | const std::vector<FileOpenExFlag_T> &aFlags,
|
---|
164 | ComPtr<IGuestFile> &aFile);
|
---|
165 | HRESULT fileQuerySize(const com::Utf8Str &aPath,
|
---|
166 | BOOL aFollowSymlinks,
|
---|
167 | LONG64 *aSize);
|
---|
168 | HRESULT fsObjExists(const com::Utf8Str &aPath,
|
---|
169 | BOOL aFollowSymlinks,
|
---|
170 | BOOL *pfExists);
|
---|
171 | HRESULT fsObjQueryInfo(const com::Utf8Str &aPath,
|
---|
172 | BOOL aFollowSymlinks,
|
---|
173 | ComPtr<IGuestFsObjInfo> &aInfo);
|
---|
174 | HRESULT fsObjRemove(const com::Utf8Str &aPath);
|
---|
175 | HRESULT fsObjRename(const com::Utf8Str &aOldPath,
|
---|
176 | const com::Utf8Str &aNewPath,
|
---|
177 | const std::vector<FsObjRenameFlag_T> &aFlags);
|
---|
178 | HRESULT fsObjMove(const com::Utf8Str &aSource,
|
---|
179 | const com::Utf8Str &aDestination,
|
---|
180 | const std::vector<FsObjMoveFlag_T> &aFlags,
|
---|
181 | ComPtr<IProgress> &aProgress);
|
---|
182 | HRESULT fsObjSetACL(const com::Utf8Str &aPath,
|
---|
183 | BOOL aFollowSymlinks,
|
---|
184 | const com::Utf8Str &aAcl,
|
---|
185 | ULONG aMode);
|
---|
186 | HRESULT processCreate(const com::Utf8Str &aCommand,
|
---|
187 | const std::vector<com::Utf8Str> &aArguments,
|
---|
188 | const std::vector<com::Utf8Str> &aEnvironment,
|
---|
189 | const std::vector<ProcessCreateFlag_T> &aFlags,
|
---|
190 | ULONG aTimeoutMS,
|
---|
191 | ComPtr<IGuestProcess> &aGuestProcess);
|
---|
192 | HRESULT processCreateEx(const com::Utf8Str &aCommand,
|
---|
193 | const std::vector<com::Utf8Str> &aArguments,
|
---|
194 | const std::vector<com::Utf8Str> &aEnvironment,
|
---|
195 | const std::vector<ProcessCreateFlag_T> &aFlags,
|
---|
196 | ULONG aTimeoutMS,
|
---|
197 | ProcessPriority_T aPriority,
|
---|
198 | const std::vector<LONG> &aAffinity,
|
---|
199 | ComPtr<IGuestProcess> &aGuestProcess);
|
---|
200 | HRESULT processGet(ULONG aPid,
|
---|
201 | ComPtr<IGuestProcess> &aGuestProcess);
|
---|
202 | HRESULT symlinkCreate(const com::Utf8Str &aSource,
|
---|
203 | const com::Utf8Str &aTarget,
|
---|
204 | SymlinkType_T aType);
|
---|
205 | HRESULT symlinkExists(const com::Utf8Str &aSymlink,
|
---|
206 | BOOL *aExists);
|
---|
207 | HRESULT symlinkRead(const com::Utf8Str &aSymlink,
|
---|
208 | const std::vector<SymlinkReadFlag_T> &aFlags,
|
---|
209 | com::Utf8Str &aTarget);
|
---|
210 | HRESULT waitFor(ULONG aWaitFor,
|
---|
211 | ULONG aTimeoutMS,
|
---|
212 | GuestSessionWaitResult_T *aReason);
|
---|
213 | HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
|
---|
214 | ULONG aTimeoutMS,
|
---|
215 | GuestSessionWaitResult_T *aReason);
|
---|
216 | /** @} */
|
---|
217 |
|
---|
218 | /** Map of guest directories. The key specifies the internal directory ID. */
|
---|
219 | typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
|
---|
220 | /** Map of guest files. The key specifies the internal file ID. */
|
---|
221 | typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
|
---|
222 | /** Map of guest processes. The key specifies the internal process number.
|
---|
223 | * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
|
---|
224 | typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
|
---|
225 |
|
---|
226 | /** Guest session object type enumeration. */
|
---|
227 | enum SESSIONOBJECTTYPE
|
---|
228 | {
|
---|
229 | /** Anonymous object. */
|
---|
230 | SESSIONOBJECTTYPE_ANONYMOUS = 0,
|
---|
231 | /** Session object. */
|
---|
232 | SESSIONOBJECTTYPE_SESSION = 1,
|
---|
233 | /** Directory object. */
|
---|
234 | SESSIONOBJECTTYPE_DIRECTORY = 2,
|
---|
235 | /** File object. */
|
---|
236 | SESSIONOBJECTTYPE_FILE = 3,
|
---|
237 | /** Process object. */
|
---|
238 | SESSIONOBJECTTYPE_PROCESS = 4,
|
---|
239 | /** The usual 32-bit hack. */
|
---|
240 | SESSIONOBJECTTYPE_32BIT_HACK = 0x7fffffff
|
---|
241 | };
|
---|
242 |
|
---|
243 | struct SessionObject
|
---|
244 | {
|
---|
245 | /** Creation timestamp (in ms). */
|
---|
246 | uint64_t tsCreatedMs;
|
---|
247 | /** The object type. */
|
---|
248 | SESSIONOBJECTTYPE enmType;
|
---|
249 | };
|
---|
250 |
|
---|
251 | /** Map containing all objects bound to a guest session.
|
---|
252 | * The key specifies the (global) context ID. */
|
---|
253 | typedef std::map <uint32_t, SessionObject> SessionObjects;
|
---|
254 | /** Queue containing context IDs which are no longer in use.
|
---|
255 | * Useful for quickly retrieving a new, unused context ID. */
|
---|
256 | typedef std::deque <uint32_t> SessionObjectsFree;
|
---|
257 |
|
---|
258 | public:
|
---|
259 | /** @name Public internal methods.
|
---|
260 | * @todo r=bird: Most of these are public for no real reason...
|
---|
261 | * @{ */
|
---|
262 | HRESULT i_copyFromGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
|
---|
263 | ComPtr<IProgress> &pProgress);
|
---|
264 | HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
|
---|
265 | ComPtr<IProgress> &pProgress);
|
---|
266 | int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
|
---|
267 | HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, DirectoryCopyFlag_T *pfFlags);
|
---|
268 | inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
|
---|
269 | int i_directoryUnregister(GuestDirectory *pDirectory);
|
---|
270 | int i_directoryRemove(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
|
---|
271 | int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
|
---|
272 | int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
|
---|
273 | ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
|
---|
274 | int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
|
---|
275 | int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
|
---|
276 | int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
|
---|
277 | HRESULT i_fileCopyFlagFromStr(const com::Utf8Str &strFlags, FileCopyFlag_T *pfFlags);
|
---|
278 | inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
|
---|
279 | int i_fileUnregister(GuestFile *pFile);
|
---|
280 | int i_fileRemove(const Utf8Str &strPath, int *pGuestRc);
|
---|
281 | int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
|
---|
282 | FileSharingMode_T aSharingMode, ULONG aCreationMode,
|
---|
283 | const std::vector<FileOpenExFlag_T> &aFlags,
|
---|
284 | ComObjPtr<GuestFile> &pFile, int *prcGuest);
|
---|
285 | int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
|
---|
286 | int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
|
---|
287 | int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc);
|
---|
288 | int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
|
---|
289 | Utf8Str &strName, int *pGuestRc);
|
---|
290 | int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
|
---|
291 | const GuestCredentials &i_getCredentials(void);
|
---|
292 | EventSource *i_getEventSource(void) { return mEventSource; }
|
---|
293 | Utf8Str i_getName(void);
|
---|
294 | ULONG i_getId(void) { return mData.mSession.mID; }
|
---|
295 | static Utf8Str i_guestErrorToString(int guestRc);
|
---|
296 | HRESULT i_isReadyExternal(void);
|
---|
297 | int i_onRemove(void);
|
---|
298 | int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
|
---|
299 | PathStyle_T i_getPathStyle(void);
|
---|
300 | int i_startSession(int *pGuestRc);
|
---|
301 | int i_startSessionAsync(void);
|
---|
302 | static void i_startSessionThreadTask(GuestSessionTaskInternalOpen *pTask);
|
---|
303 | Guest *i_getParent(void) { return mParent; }
|
---|
304 | uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
|
---|
305 | int i_objectRegister(SESSIONOBJECTTYPE enmType, uint32_t *puObjectID);
|
---|
306 | int i_objectRegisterEx(SESSIONOBJECTTYPE enmType, uint32_t fFlags, uint32_t *puObjectID);
|
---|
307 | int i_objectUnregister(uint32_t uObjectID);
|
---|
308 | int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pGuestRc);
|
---|
309 | int i_pathUserDocuments(Utf8Str &strPath, int *prcGuest);
|
---|
310 | int i_pathUserHome(Utf8Str &strPath, int *prcGuest);
|
---|
311 | int i_processUnregister(GuestProcess *pProcess);
|
---|
312 | int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
|
---|
313 | inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
|
---|
314 | inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
|
---|
315 | int i_sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
|
---|
316 | static HRESULT i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
|
---|
317 | int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
|
---|
318 | int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
|
---|
319 | int i_determineProtocolVersion(void);
|
---|
320 | int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
|
---|
321 | int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
|
---|
322 | GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
|
---|
323 | /** @} */
|
---|
324 |
|
---|
325 | private:
|
---|
326 |
|
---|
327 | /** Pointer to the parent (Guest). */
|
---|
328 | Guest *mParent;
|
---|
329 | /**
|
---|
330 | * The session's event source. This source is used for
|
---|
331 | * serving the internal listener as well as all other
|
---|
332 | * external listeners that may register to it.
|
---|
333 | *
|
---|
334 | * Note: This can safely be used without holding any locks.
|
---|
335 | * An AutoCaller suffices to prevent it being destroy while in use and
|
---|
336 | * internally there is a lock providing the necessary serialization.
|
---|
337 | */
|
---|
338 | const ComObjPtr<EventSource> mEventSource;
|
---|
339 |
|
---|
340 | struct Data
|
---|
341 | {
|
---|
342 | /** The session credentials. */
|
---|
343 | GuestCredentials mCredentials;
|
---|
344 | /** The session's startup info. */
|
---|
345 | GuestSessionStartupInfo mSession;
|
---|
346 | /** The session's object ID.
|
---|
347 | * Needed for registering wait events which are bound directly to this session. */
|
---|
348 | uint32_t mObjectID;
|
---|
349 | /** The session's current status. */
|
---|
350 | GuestSessionStatus_T mStatus;
|
---|
351 | /** The set of environment changes for the session for use when
|
---|
352 | * creating new guest processes. */
|
---|
353 | GuestEnvironmentChanges mEnvironmentChanges;
|
---|
354 | /** Pointer to the immutable base environment for the session.
|
---|
355 | * @note This is not allocated until the guest reports it to the host. It is
|
---|
356 | * also shared with child processes. */
|
---|
357 | GuestEnvironment const *mpBaseEnvironment;
|
---|
358 | /** Directory objects bound to this session. */
|
---|
359 | SessionDirectories mDirectories;
|
---|
360 | /** File objects bound to this session. */
|
---|
361 | SessionFiles mFiles;
|
---|
362 | /** Process objects bound to this session. */
|
---|
363 | SessionProcesses mProcesses;
|
---|
364 | /** Map of registered session objects (files, directories, ...). */
|
---|
365 | SessionObjects mObjects;
|
---|
366 | /** Queue of object IDs which are not used anymore (free list).
|
---|
367 | * Acts as a "free list" for the mObjects map. */
|
---|
368 | SessionObjectsFree mObjectsFree;
|
---|
369 | /** Guest control protocol version to be used.
|
---|
370 | * Guest Additions < VBox 4.3 have version 1,
|
---|
371 | * any newer version will have version 2. */
|
---|
372 | uint32_t mProtocolVersion;
|
---|
373 | /** Session timeout (in ms). */
|
---|
374 | uint32_t mTimeout;
|
---|
375 | /** The last returned session status
|
---|
376 | * returned from the guest side. */
|
---|
377 | int mRC;
|
---|
378 |
|
---|
379 | Data(void)
|
---|
380 | : mpBaseEnvironment(NULL)
|
---|
381 | { }
|
---|
382 | Data(const Data &rThat)
|
---|
383 | : mCredentials(rThat.mCredentials)
|
---|
384 | , mSession(rThat.mSession)
|
---|
385 | , mStatus(rThat.mStatus)
|
---|
386 | , mEnvironmentChanges(rThat.mEnvironmentChanges)
|
---|
387 | , mpBaseEnvironment(NULL)
|
---|
388 | , mDirectories(rThat.mDirectories)
|
---|
389 | , mFiles(rThat.mFiles)
|
---|
390 | , mProcesses(rThat.mProcesses)
|
---|
391 | , mObjects(rThat.mObjects)
|
---|
392 | , mObjectsFree(rThat.mObjectsFree)
|
---|
393 | , mProtocolVersion(rThat.mProtocolVersion)
|
---|
394 | , mTimeout(rThat.mTimeout)
|
---|
395 | , mRC(rThat.mRC)
|
---|
396 | { }
|
---|
397 | ~Data(void)
|
---|
398 | {
|
---|
399 | if (mpBaseEnvironment)
|
---|
400 | {
|
---|
401 | mpBaseEnvironment->releaseConst();
|
---|
402 | mpBaseEnvironment = NULL;
|
---|
403 | }
|
---|
404 | }
|
---|
405 | } mData;
|
---|
406 | };
|
---|
407 |
|
---|
408 | #endif /* !____H_GUESTSESSIONIMPL */
|
---|
409 |
|
---|