VirtualBox

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

Last change on this file since 42105 was 42105, checked in by vboxsync, 13 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: 6.8 KB
Line 
1
2/* $Id: GuestSessionImpl.h 42105 2012-07-11 11:53:22Z 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 "GuestProcessImpl.h"
25#include "GuestDirectoryImpl.h"
26#include "GuestFileImpl.h"
27#include "GuestFsObjInfoImpl.h"
28
29class Guest;
30
31/**
32 * TODO
33 */
34class ATL_NO_VTABLE GuestSession :
35 public VirtualBoxBase,
36 VBOX_SCRIPTABLE_IMPL(IGuestSession)
37{
38public:
39 /** @name COM and internal init/term/mapping cruft.
40 * @{ */
41 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestSession, IGuestSession)
42 DECLARE_NOT_AGGREGATABLE(GuestSession)
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44 BEGIN_COM_MAP(GuestSession)
45 VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestSession)
46 END_COM_MAP()
47 DECLARE_EMPTY_CTOR_DTOR(GuestSession)
48
49 int init(Guest *aGuest, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
50 void uninit(void);
51 HRESULT FinalConstruct(void);
52 void FinalRelease(void);
53 /** @} */
54
55 /** @name IGuestSession properties.
56 * @{ */
57 STDMETHOD(COMGETTER(User))(BSTR *aName);
58 STDMETHOD(COMGETTER(Domain))(BSTR *aDomain);
59 STDMETHOD(COMGETTER(Name))(BSTR *aName);
60 STDMETHOD(COMGETTER(Id))(ULONG *aId);
61 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
62 STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
63 STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
64 STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
65 STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
66 /** @} */
67
68 /** @name IGuestSession methods.
69 * @{ */
70 STDMETHOD(Close)(void);
71 STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
72 STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
73 STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aDirectory);
74 STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory);
75 STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
76 STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory);
77 STDMETHOD(DirectoryQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
78 STDMETHOD(DirectoryRemove)(IN_BSTR aPath);
79 STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
80 STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
81 STDMETHOD(DirectorySetACL)(IN_BSTR aPath, IN_BSTR aACL);
82 STDMETHOD(EnvironmentClear)(void);
83 STDMETHOD(EnvironmentSet)(IN_BSTR aName, IN_BSTR aValue);
84 STDMETHOD(EnvironmentSetArray)(ComSafeArrayIn(IN_BSTR, aValues));
85 STDMETHOD(EnvironmentUnset)(IN_BSTR aName);
86 STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile);
87 STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
88 STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
89 STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
90 STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
91 STDMETHOD(FileRemove)(IN_BSTR aPath);
92 STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
93 STDMETHOD(FileSetACL)(IN_BSTR aPath, IN_BSTR aACL);
94 STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
95 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess);
96 STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
97 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
98 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
99 IGuestProcess **aProcess);
100 STDMETHOD(ProcessGet)(ULONG aPID, IGuestProcess **aProcess);
101 STDMETHOD(SetTimeout)(ULONG aTimeoutMS);
102 STDMETHOD(SymlinkCreate)(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType);
103 STDMETHOD(SymlinkExists)(IN_BSTR aSymlink, BOOL *aExists);
104 STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
105 STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
106 STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
107 /** @} */
108
109public:
110 /** @name Public internal methods.
111 * @{ */
112 int directoryClose(ComObjPtr<GuestDirectory> pDirectory);
113 int fileClose(ComObjPtr<GuestFile> pFile);
114 int processClose(ComObjPtr<GuestProcess> pProcess);
115 int processCreateExInteral(const Utf8Str &aCommand, ComSafeArrayIn(Utf8Str, aArguments), ComSafeArrayIn(Utf8Str, aEnvironment),
116 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
117 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
118 IGuestProcess **aProcess);
119 /** @} */
120
121private:
122
123 typedef std::map <Utf8Str, Utf8Str> SessionEnvironment;
124
125 typedef std::list <ComObjPtr<GuestDirectory> > SessionDirectories;
126 typedef std::list <ComObjPtr<GuestFile> > SessionFiles;
127 typedef std::list <ComObjPtr<GuestProcess> > SessionProcesses;
128
129 struct Data
130 {
131 /** Flag indicating if this is an internal session
132 * or not. Internal session are not accessible by clients. */
133 bool fInternal;
134 /** Pointer to the parent (IGuest). */
135 Guest *mParent;
136 /** The session credentials. */
137 Utf8Str mUser;
138 Utf8Str mPassword;
139 Utf8Str mDomain;
140 /** The (optional) session name. */
141 Utf8Str mName;
142 /** The session ID. */
143 ULONG mId;
144 /** The session timeout. Default is 30s. */
145 ULONG mTimeout;
146 SessionEnvironment mEnvironment;
147 SessionDirectories mDirectories;
148 SessionFiles mFiles;
149 SessionProcesses mProcesses;
150 } mData;
151};
152
153#endif /* !____H_GUESTSESSIONIMPL */
154
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