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