VirtualBox

source: vbox/trunk/src/VBox/Main/include/GuestSessionImpl.h@ 106903

Last change on this file since 106903 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.1 KB
Line 
1/* $Id: GuestSessionImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Guest session handling.
4 */
5
6/*
7 * Copyright (C) 2012-2024 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_GuestSessionImpl_h
29#define MAIN_INCLUDED_GuestSessionImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "GuestSessionWrap.h"
35#include "EventImpl.h"
36
37#include "GuestCtrlImplPrivate.h"
38#include "GuestProcessImpl.h"
39#include "GuestDirectoryImpl.h"
40#include "GuestFileImpl.h"
41#include "GuestFsObjInfoImpl.h"
42#include "GuestSessionImplTasks.h"
43
44#include <iprt/asm.h> /** @todo r=bird: Needed for ASMBitSet() in GuestSession::Data constructor. Removed when
45 * that is moved into the class implementation file as it should be. */
46#include <deque>
47
48class GuestSessionTaskInternalStart; /* Needed for i_startSessionThreadTask(). */
49
50/**
51 * Guest session implementation.
52 */
53class ATL_NO_VTABLE GuestSession
54 : public GuestSessionWrap
55 , public GuestBase
56{
57public:
58 /** @name COM and internal init/term/mapping cruft.
59 * @{ */
60 DECLARE_COMMON_CLASS_METHODS(GuestSession)
61
62 int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
63 void uninit(void);
64 HRESULT FinalConstruct(void);
65 void FinalRelease(void);
66 /** @} */
67
68private:
69
70 /** Wrapped @name IGuestSession properties.
71 * @{ */
72 HRESULT getUser(com::Utf8Str &aUser);
73 HRESULT getDomain(com::Utf8Str &aDomain);
74 HRESULT getName(com::Utf8Str &aName);
75 HRESULT getId(ULONG *aId);
76 HRESULT getTimeout(ULONG *aTimeout);
77 HRESULT setTimeout(ULONG aTimeout);
78 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
79 HRESULT getStatus(GuestSessionStatus_T *aStatus);
80 HRESULT getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges);
81 HRESULT setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges);
82 HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase);
83 HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
84 HRESULT getPathStyle(PathStyle_T *aPathStyle);
85 HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
86 HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
87 HRESULT getUserDocuments(com::Utf8Str &aUserDocuments);
88 HRESULT getUserHome(com::Utf8Str &aUserHome);
89 HRESULT getMountPoints(std::vector<com::Utf8Str> &aMountPoints);
90 HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
91 HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
92 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
93 /** @} */
94
95 /** Wrapped @name IGuestSession methods.
96 * @{ */
97 HRESULT close();
98
99 HRESULT copyFromGuest(const std::vector<com::Utf8Str> &aSources,
100 const std::vector<com::Utf8Str> &aFilters,
101 const std::vector<com::Utf8Str> &aFlags,
102 const com::Utf8Str &aDestination,
103 ComPtr<IProgress> &aProgress);
104 HRESULT copyToGuest(const std::vector<com::Utf8Str> &aSources,
105 const std::vector<com::Utf8Str> &aFilters,
106 const std::vector<com::Utf8Str> &aFlags,
107 const com::Utf8Str &aDestination,
108 ComPtr<IProgress> &aProgress);
109
110 HRESULT directoryCopy(const com::Utf8Str &aSource,
111 const com::Utf8Str &aDestination,
112 const std::vector<DirectoryCopyFlag_T> &aFlags,
113 ComPtr<IProgress> &aProgress);
114 HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource,
115 const com::Utf8Str &aDestination,
116 const std::vector<DirectoryCopyFlag_T> &aFlags,
117 ComPtr<IProgress> &aProgress);
118 HRESULT directoryCopyToGuest(const com::Utf8Str &aSource,
119 const com::Utf8Str &aDestination,
120 const std::vector<DirectoryCopyFlag_T> &aFlags,
121 ComPtr<IProgress> &aProgress);
122 HRESULT directoryCreate(const com::Utf8Str &aPath,
123 ULONG aMode,
124 const std::vector<DirectoryCreateFlag_T> &aFlags);
125 HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
126 ULONG aMode,
127 const com::Utf8Str &aPath,
128 BOOL aSecure,
129 com::Utf8Str &aDirectory);
130 HRESULT directoryExists(const com::Utf8Str &aPath,
131 BOOL aFollowSymlinks,
132 BOOL *aExists);
133 HRESULT directoryOpen(const com::Utf8Str &aPath,
134 const com::Utf8Str &aFilter,
135 const std::vector<DirectoryOpenFlag_T> &aFlags,
136 ComPtr<IGuestDirectory> &aDirectory);
137 HRESULT directoryRemove(const com::Utf8Str &aPath);
138 HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
139 const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
140 ComPtr<IProgress> &aProgress);
141 HRESULT environmentScheduleSet(const com::Utf8Str &aName,
142 const com::Utf8Str &aValue);
143 HRESULT environmentScheduleUnset(const com::Utf8Str &aName);
144 HRESULT environmentGetBaseVariable(const com::Utf8Str &aName,
145 com::Utf8Str &aValue);
146 HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
147 BOOL *aExists);
148
149 HRESULT fileCopy(const com::Utf8Str &aSource,
150 const com::Utf8Str &aDestination,
151 const std::vector<FileCopyFlag_T> &aFlags,
152 ComPtr<IProgress> &aProgress);
153 HRESULT fileCopyToGuest(const com::Utf8Str &aSource,
154 const com::Utf8Str &aDestination,
155 const std::vector<FileCopyFlag_T> &aFlags,
156 ComPtr<IProgress> &aProgress);
157 HRESULT fileCopyFromGuest(const com::Utf8Str &aSource,
158 const com::Utf8Str &aDestination,
159 const std::vector<FileCopyFlag_T> &aFlags,
160 ComPtr<IProgress> &aProgress);
161 HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
162 ULONG aMode,
163 const com::Utf8Str &aPath,
164 BOOL aSecure,
165 ComPtr<IGuestFile> &aFile);
166 HRESULT fileExists(const com::Utf8Str &aPath,
167 BOOL aFollowSymlinks,
168 BOOL *aExists);
169 HRESULT fileOpen(const com::Utf8Str &aPath,
170 FileAccessMode_T aAccessMode,
171 FileOpenAction_T aOpenAction,
172 ULONG aCreationMode,
173 ComPtr<IGuestFile> &aFile);
174 HRESULT fileOpenEx(const com::Utf8Str &aPath,
175 FileAccessMode_T aAccessMode,
176 FileOpenAction_T aOpenAction,
177 FileSharingMode_T aSharingMode,
178 ULONG aCreationMode,
179 const std::vector<FileOpenExFlag_T> &aFlags,
180 ComPtr<IGuestFile> &aFile);
181 HRESULT fileQuerySize(const com::Utf8Str &aPath,
182 BOOL aFollowSymlinks,
183 LONG64 *aSize);
184 HRESULT fsQueryFreeSpace(const com::Utf8Str &aPath, LONG64 *aFreeSpace);
185 HRESULT fsQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsInfo> &aInfo);
186 HRESULT fsObjExists(const com::Utf8Str &aPath,
187 BOOL aFollowSymlinks,
188 BOOL *pfExists);
189 HRESULT fsObjQueryInfo(const com::Utf8Str &aPath,
190 BOOL aFollowSymlinks,
191 ComPtr<IGuestFsObjInfo> &aInfo);
192 HRESULT fsObjRemove(const com::Utf8Str &aPath);
193 HRESULT fsObjRemoveArray(const std::vector<com::Utf8Str> &aPaths,
194 ComPtr<IProgress> &aProgress);
195 HRESULT fsObjRename(const com::Utf8Str &aOldPath,
196 const com::Utf8Str &aNewPath,
197 const std::vector<FsObjRenameFlag_T> &aFlags);
198 HRESULT fsObjMove(const com::Utf8Str &aSource,
199 const com::Utf8Str &aDestination,
200 const std::vector<FsObjMoveFlag_T> &aFlags,
201 ComPtr<IProgress> &aProgress);
202 HRESULT fsObjMoveArray(const std::vector<com::Utf8Str> &aSource,
203 const com::Utf8Str &aDestination,
204 const std::vector<FsObjMoveFlag_T> &aFlags,
205 ComPtr<IProgress> &aProgress);
206 HRESULT fsObjCopyArray(const std::vector<com::Utf8Str> &aSource,
207 const com::Utf8Str &aDestination,
208 const std::vector<FileCopyFlag_T> &aFlags,
209 ComPtr<IProgress> &aProgress);
210 HRESULT fsObjSetACL(const com::Utf8Str &aPath,
211 BOOL aFollowSymlinks,
212 const com::Utf8Str &aAcl,
213 ULONG aMode);
214 HRESULT processCreate(const com::Utf8Str &aCommand,
215 const std::vector<com::Utf8Str> &aArguments,
216 const com::Utf8Str &aCwd,
217 const std::vector<com::Utf8Str> &aEnvironment,
218 const std::vector<ProcessCreateFlag_T> &aFlags,
219 ULONG aTimeoutMS,
220 ComPtr<IGuestProcess> &aGuestProcess);
221 HRESULT processCreateEx(const com::Utf8Str &aCommand,
222 const std::vector<com::Utf8Str> &aArguments,
223 const com::Utf8Str &aCwd,
224 const std::vector<com::Utf8Str> &aEnvironment,
225 const std::vector<ProcessCreateFlag_T> &aFlags,
226 ULONG aTimeoutMS,
227 ProcessPriority_T aPriority,
228 const std::vector<LONG> &aAffinity,
229 ComPtr<IGuestProcess> &aGuestProcess);
230 HRESULT processGet(ULONG aPid,
231 ComPtr<IGuestProcess> &aGuestProcess);
232 HRESULT symlinkCreate(const com::Utf8Str &aSource,
233 const com::Utf8Str &aTarget,
234 SymlinkType_T aType);
235 HRESULT symlinkExists(const com::Utf8Str &aSymlink,
236 BOOL *aExists);
237 HRESULT symlinkRead(const com::Utf8Str &aSymlink,
238 const std::vector<SymlinkReadFlag_T> &aFlags,
239 com::Utf8Str &aTarget);
240 HRESULT waitFor(ULONG aWaitFor,
241 ULONG aTimeoutMS,
242 GuestSessionWaitResult_T *aReason);
243 HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
244 ULONG aTimeoutMS,
245 GuestSessionWaitResult_T *aReason);
246 /** @} */
247
248 /** Map of guest directories. The key specifies the internal directory ID. */
249 typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
250 /** Map of guest files. The key specifies the internal file ID. */
251 typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
252 /** Map of guest processes. The key specifies the internal process number.
253 * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
254 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
255
256 /** Guest session object type enumeration. */
257 enum SESSIONOBJECTTYPE
258 {
259 /** Invalid session object type. */
260 SESSIONOBJECTTYPE_INVALID = 0,
261 /** Session object. */
262 SESSIONOBJECTTYPE_SESSION = 1,
263 /** Directory object. */
264 SESSIONOBJECTTYPE_DIRECTORY = 2,
265 /** File object. */
266 SESSIONOBJECTTYPE_FILE = 3,
267 /** Process object. */
268 SESSIONOBJECTTYPE_PROCESS = 4
269 };
270
271 struct SessionObject
272 {
273 /** Creation timestamp (in ms).
274 * @note not used by anyone at the moment. */
275 uint64_t msBirth;
276 /** The object type. */
277 SESSIONOBJECTTYPE enmType;
278 /** Weak pointer to the object itself.
279 * Is NULL for SESSIONOBJECTTYPE_SESSION because GuestSession doesn't
280 * inherit from GuestObject. */
281 GuestObject *pObject;
282 };
283
284 /** Map containing all objects bound to a guest session.
285 * The key specifies the (global) context ID. */
286 typedef std::map<uint32_t, SessionObject> SessionObjects;
287
288public:
289 /** @name Public internal methods.
290 * @todo r=bird: Most of these are public for no real reason...
291 * @{ */
292 HRESULT i_copyFromGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
293 ComPtr<IProgress> &pProgress);
294 HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
295 ComPtr<IProgress> &pProgress);
296 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest);
297 HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags);
298 bool i_directoryExists(const Utf8Str &strPath);
299 inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
300 int i_directoryUnregister(GuestDirectory *pDirectory);
301 int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest);
302 int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
303 int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
304 ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest);
305 int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
306 int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
307 int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
308 HRESULT i_fileCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, FileCopyFlag_T *pfFlags);
309 inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
310 int i_fileUnregister(GuestFile *pFile);
311 int i_fileRemove(const Utf8Str &strPath, int *pvrcGuest);
312 int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
313 FileSharingMode_T aSharingMode, ULONG aCreationMode,
314 const std::vector<FileOpenExFlag_T> &aFlags,
315 ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
316 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
317 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
318 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest);
319 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
320 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest);
321 int i_fsQueryInfo(const Utf8Str &strPath, PGSTCTLFSINFO pFsInfo, int *pvrcGuest);
322 int i_fsObjQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
323 const GuestCredentials &i_getCredentials(void);
324 EventSource *i_getEventSource(void) { return mEventSource; }
325 Utf8Str i_getName(void);
326 ULONG i_getId(void) { return mData.mSession.mID; }
327 bool i_isStarted(void) const;
328 HRESULT i_isStartedExternal(void);
329 bool i_isReady(void);
330 bool i_isTerminated(void) const;
331 int i_onRemove(void);
332#ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
333 int i_onFsNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
334#endif
335 int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
336 PathStyle_T i_getGuestPathStyle(void);
337 static PathStyle_T i_getHostPathStyle(void);
338 int i_startSession(int *pvrcGuest);
339 int i_startSessionAsync(void);
340 Guest *i_getParent(void) { return mParent; }
341 uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
342 int i_objectRegister(GuestObject *pObject, SESSIONOBJECTTYPE enmType, uint32_t *pidObject);
343 int i_objectUnregister(uint32_t uObjectID);
344 int i_objectsUnregister(void);
345 int i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus);
346 int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest);
347 int i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest);
348 int i_getMountPoints(std::vector<com::Utf8Str> &vecMountPoints, int *pvrcGuest);
349 int i_pathUserHome(Utf8Str &strPath, int *pvrcGuest);
350 int i_processUnregister(GuestProcess *pProcess);
351 int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
352 inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
353 inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
354 int i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms,
355 uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION);
356 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession);
357 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */);
358 int i_shutdown(uint32_t fFlags, int *pvrcGuest);
359 int i_determineProtocolVersion(void);
360 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest);
361 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
362 GuestSessionStatus_T *pSessionStatus, int *pvrcGuest);
363 /** @} */
364
365#ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT
366 /** @name Public internal methods for supporting older Guest Additions via
367 * VBoxService' built-in toolbox (< 7.1). Deprecated, do not use anymore.
368 * @{ */
369 int i_directoryCreateViaToolbox(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
370 int i_fileRemoveViaToolbox(const Utf8Str &strPath, int *pvrcGuest);
371 int i_fsCreateTempViaToolbox(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName,
372 uint32_t fMode, bool fSecure, int *pvrcGuest);
373 int i_fsObjQueryInfoViaToolbox(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
374 /** @} */
375#endif /* VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT */
376
377public:
378
379 /** @name Static helper methods.
380 * @{ */
381 static Utf8Str i_guestErrorToString(int guestRc);
382 static bool i_isTerminated(GuestSessionStatus_T enmStatus);
383 static int i_startSessionThreadTask(GuestSessionTaskInternalStart *pTask);
384 /** @} */
385
386private:
387
388 /* Console object. */
389 ComObjPtr<Console> mConsole;
390 /* Guest object. */
391 ComObjPtr<Guest> mParent;
392 /**
393 * The session's event source. This source is used for
394 * serving the internal listener as well as all other
395 * external listeners that may register to it.
396 *
397 * Note: This can safely be used without holding any locks.
398 * An AutoCaller suffices to prevent it being destroy while in use and
399 * internally there is a lock providing the necessary serialization.
400 */
401 const ComObjPtr<EventSource> mEventSource;
402
403 /** @todo r=bird: One of the core points of the DATA sub-structures in Main is
404 * hinding implementation details and stuff that requires including iprt/asm.h.
405 * The way it's used here totally defeats that purpose. You need to make it
406 * a pointer to a anynmous Data struct and define that structure in
407 * GuestSessionImpl.cpp and allocate it in the Init() function.
408 */
409 struct Data
410 {
411 /** The session credentials. */
412 GuestCredentials mCredentials;
413 /** The session's startup info. */
414 GuestSessionStartupInfo mSession;
415 /** The session's object ID.
416 * Needed for registering wait events which are bound directly to this session. */
417 uint32_t mObjectID;
418 /** The session's current status. */
419 GuestSessionStatus_T mStatus;
420 /** The set of environment changes for the session for use when
421 * creating new guest processes. */
422 GuestEnvironmentChanges mEnvironmentChanges;
423 /** Pointer to the immutable base environment for the session.
424 * @note This is not allocated until the guest reports it to the host. It is
425 * also shared with child processes.
426 * @todo This is actually not yet implemented, see
427 * GuestSession::i_onSessionStatusChange. */
428 GuestEnvironment const *mpBaseEnvironment;
429 /** Directory objects bound to this session. */
430 SessionDirectories mDirectories;
431 /** File objects bound to this session. */
432 SessionFiles mFiles;
433 /** Process objects bound to this session. */
434 SessionProcesses mProcesses;
435 /** Map of registered session objects (files, directories, ...). */
436 SessionObjects mObjects;
437 /** Guest control protocol version to be used.
438 * Guest Additions < VBox 4.3 have version 1, any newer version will have version 2.
439 * Set to 0 if a valid Guest Additions version was not found (yet). */
440 uint32_t mProtocolVersion;
441 /** Session timeout (in ms). */
442 uint32_t mTimeout;
443 /** The last returned session VBox status status returned from the guest side. */
444 int mVrc;
445 /** Object ID allocation bitmap; clear bits are free, set bits are busy. */
446 uint64_t bmObjectIds[VBOX_GUESTCTRL_MAX_OBJECTS / sizeof(uint64_t) / 8];
447
448 Data(void)
449 : mpBaseEnvironment(NULL)
450 {
451 RT_ZERO(bmObjectIds);
452 ASMBitSet(&bmObjectIds, VBOX_GUESTCTRL_MAX_OBJECTS - 1); /* Reserved for the session itself? */
453 ASMBitSet(&bmObjectIds, 0); /* Let's reserve this too. */
454 }
455 Data(const Data &rThat)
456 : mCredentials(rThat.mCredentials)
457 , mSession(rThat.mSession)
458 , mStatus(rThat.mStatus)
459 , mEnvironmentChanges(rThat.mEnvironmentChanges)
460 , mpBaseEnvironment(NULL)
461 , mDirectories(rThat.mDirectories)
462 , mFiles(rThat.mFiles)
463 , mProcesses(rThat.mProcesses)
464 , mObjects(rThat.mObjects)
465 , mProtocolVersion(rThat.mProtocolVersion)
466 , mTimeout(rThat.mTimeout)
467 , mVrc(rThat.mVrc)
468 {
469 memcpy(&bmObjectIds, &rThat.bmObjectIds, sizeof(bmObjectIds));
470 }
471 ~Data(void)
472 {
473 if (mpBaseEnvironment)
474 {
475 mpBaseEnvironment->releaseConst();
476 mpBaseEnvironment = NULL;
477 }
478 }
479 } mData;
480};
481
482#endif /* !MAIN_INCLUDED_GuestSessionImpl_h */
483
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