VirtualBox

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

Last change on this file since 42354 was 42354, checked in by vboxsync, 12 years ago

Guest Control 2.0: Update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1
2/* $Id: GuestSessionImpl.h 42354 2012-07-24 12:13:00Z vboxsync $ */
3/** @file
4 * VirtualBox Main - XXX.
5 */
6
7/*
8 * Copyright (C) 2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef ____H_GUESTSESSIONIMPL
20#define ____H_GUESTSESSIONIMPL
21
22#include "VirtualBoxBase.h"
23
24#include "GuestCtrlImplPrivate.h"
25#include "GuestProcessImpl.h"
26#include "GuestDirectoryImpl.h"
27#include "GuestFileImpl.h"
28#include "GuestFsObjInfoImpl.h"
29
30class Guest;
31
32/**
33 * TODO
34 */
35class ATL_NO_VTABLE GuestSession :
36 public VirtualBoxBase,
37 VBOX_SCRIPTABLE_IMPL(IGuestSession)
38{
39public:
40 /** @name COM and internal init/term/mapping cruft.
41 * @{ */
42 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestSession, IGuestSession)
43 DECLARE_NOT_AGGREGATABLE(GuestSession)
44 DECLARE_PROTECT_FINAL_CONSTRUCT()
45 BEGIN_COM_MAP(GuestSession)
46 VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestSession)
47 END_COM_MAP()
48 DECLARE_EMPTY_CTOR_DTOR(GuestSession)
49
50 int init(Guest *aGuest, ULONG aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
51 void uninit(void);
52 HRESULT FinalConstruct(void);
53 void FinalRelease(void);
54 /** @} */
55
56 /** @name IGuestSession properties.
57 * @{ */
58 STDMETHOD(COMGETTER(User))(BSTR *aName);
59 STDMETHOD(COMGETTER(Domain))(BSTR *aDomain);
60 STDMETHOD(COMGETTER(Name))(BSTR *aName);
61 STDMETHOD(COMGETTER(Id))(ULONG *aId);
62 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
63 STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
64 STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
65 STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
66 STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
67 /** @} */
68
69 /** @name IGuestSession methods.
70 * @{ */
71 STDMETHOD(Close)(void);
72 STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
73 STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
74 STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aDirectory);
75 STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory);
76 STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
77 STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory);
78 STDMETHOD(DirectoryQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
79 STDMETHOD(DirectoryRemove)(IN_BSTR aPath);
80 STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
81 STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
82 STDMETHOD(DirectorySetACL)(IN_BSTR aPath, IN_BSTR aACL);
83 STDMETHOD(EnvironmentClear)(void);
84 STDMETHOD(EnvironmentGet)(IN_BSTR aName, BSTR *aValue);
85 STDMETHOD(EnvironmentSet)(IN_BSTR aName, IN_BSTR aValue);
86 STDMETHOD(EnvironmentSetArray)(ComSafeArrayIn(IN_BSTR, aValues));
87 STDMETHOD(EnvironmentUnset)(IN_BSTR aName);
88 STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile);
89 STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
90 STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
91 STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
92 STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
93 STDMETHOD(FileRemove)(IN_BSTR aPath);
94 STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
95 STDMETHOD(FileSetACL)(IN_BSTR aPath, IN_BSTR aACL);
96 STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
97 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess);
98 STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
99 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
100 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
101 IGuestProcess **aProcess);
102 STDMETHOD(ProcessGet)(ULONG aPID, IGuestProcess **aProcess);
103 STDMETHOD(SetTimeout)(ULONG aTimeoutMS);
104 STDMETHOD(SymlinkCreate)(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType);
105 STDMETHOD(SymlinkExists)(IN_BSTR aSymlink, BOOL *aExists);
106 STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
107 STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
108 STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
109 /** @} */
110
111private:
112
113 typedef std::vector <ComObjPtr<GuestDirectory> > SessionDirectories;
114 typedef std::vector <ComObjPtr<GuestFile> > SessionFiles;
115 /** Map of guest processes. The key specifies the internal process number.
116 * To retrieve the process' guest PID use the Id() method of the IProgress interface. */
117 typedef std::map <ULONG, ComObjPtr<GuestProcess> > SessionProcesses;
118
119public:
120 /** @name Public internal methods.
121 * @{ */
122 int directoryClose(ComObjPtr<GuestDirectory> pDirectory);
123 int dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
124 int fileClose(ComObjPtr<GuestFile> pFile);
125 const GuestCredentials &getCredentials(void);
126 const GuestEnvironment &getEnvironment(void);
127 int processClose(ComObjPtr<GuestProcess> pProcess);
128 int processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
129 inline bool processExists(ULONG uProcessID, ComObjPtr<GuestProcess> *pProcess);
130 inline int processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
131 /** @} */
132
133private:
134
135 struct Data
136 {
137 /** Flag indicating if this is an internal session
138 * or not. Internal session are not accessible by clients. */
139 bool fInternal;
140 /** Pointer to the parent (Guest). */
141 Guest *mParent;
142 /** The session credentials. */
143 GuestCredentials mCredentials;
144 /** The (optional) session name. */
145 Utf8Str mName;
146 /** The session ID. */
147 ULONG mId;
148 /** The session timeout. Default is 30s. */
149 ULONG mTimeout;
150 GuestEnvironment mEnvironment;
151 SessionDirectories mDirectories;
152 SessionFiles mFiles;
153 SessionProcesses mProcesses;
154 } mData;
155};
156
157#endif /* !____H_GUESTSESSIONIMPL */
158
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