1 |
|
---|
2 | /* $Id: GuestSessionImpl.h 42094 2012-07-10 12:47:49Z 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 |
|
---|
29 | /**
|
---|
30 | * TODO
|
---|
31 | */
|
---|
32 | class ATL_NO_VTABLE GuestSession :
|
---|
33 | public VirtualBoxBase,
|
---|
34 | VBOX_SCRIPTABLE_IMPL(IGuestSession)
|
---|
35 | {
|
---|
36 | public:
|
---|
37 | /** @name COM and internal init/term/mapping cruft.
|
---|
38 | * @{ */
|
---|
39 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestSession, IGuestSession)
|
---|
40 | DECLARE_NOT_AGGREGATABLE(GuestSession)
|
---|
41 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
42 | BEGIN_COM_MAP(GuestSession)
|
---|
43 | VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestSession)
|
---|
44 | END_COM_MAP()
|
---|
45 | DECLARE_EMPTY_CTOR_DTOR(GuestSession)
|
---|
46 |
|
---|
47 | HRESULT init(const ComPtr<IGuest> pGuest, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
|
---|
48 | void uninit(void);
|
---|
49 | HRESULT FinalConstruct(void);
|
---|
50 | void FinalRelease(void);
|
---|
51 | /** @} */
|
---|
52 |
|
---|
53 | /** @name IGuestSession properties.
|
---|
54 | * @{ */
|
---|
55 | STDMETHOD(COMGETTER(User))(BSTR *aName);
|
---|
56 | STDMETHOD(COMGETTER(Domain))(BSTR *aDomain);
|
---|
57 | STDMETHOD(COMGETTER(Name))(BSTR *aName);
|
---|
58 | STDMETHOD(COMGETTER(Id))(ULONG *aId);
|
---|
59 | STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
|
---|
60 | STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
|
---|
61 | STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
|
---|
62 | STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
|
---|
63 | STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
|
---|
64 | /** @} */
|
---|
65 |
|
---|
66 | /** @name IGuestSession methods.
|
---|
67 | * @{ */
|
---|
68 | STDMETHOD(Close)(void);
|
---|
69 | STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
|
---|
70 | STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
|
---|
71 | STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aDirectory);
|
---|
72 | STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory);
|
---|
73 | STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
|
---|
74 | STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory);
|
---|
75 | STDMETHOD(DirectoryQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
|
---|
76 | STDMETHOD(DirectoryRemove)(IN_BSTR aPath);
|
---|
77 | STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
|
---|
78 | STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
|
---|
79 | STDMETHOD(DirectorySetACL)(IN_BSTR aPath, IN_BSTR aACL);
|
---|
80 | STDMETHOD(EnvironmentClear)(void);
|
---|
81 | STDMETHOD(EnvironmentSet)(IN_BSTR aName, IN_BSTR aValue);
|
---|
82 | STDMETHOD(EnvironmentSetArray)(ComSafeArrayIn(IN_BSTR, aValues));
|
---|
83 | STDMETHOD(EnvironmentUnset)(IN_BSTR aName);
|
---|
84 | STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile);
|
---|
85 | STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
|
---|
86 | STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
|
---|
87 | STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
|
---|
88 | STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
|
---|
89 | STDMETHOD(FileRemove)(IN_BSTR aPath);
|
---|
90 | STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
|
---|
91 | STDMETHOD(FileSetACL)(IN_BSTR aPath, IN_BSTR aACL);
|
---|
92 | STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
|
---|
93 | ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **IGuestProcess);
|
---|
94 | STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
|
---|
95 | ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
|
---|
96 | ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
|
---|
97 | IGuestProcess **IGuestProcess);
|
---|
98 | STDMETHOD(ProcessGet)(ULONG aPID, IGuestProcess **IGuestProcess);
|
---|
99 | STDMETHOD(SetTimeout)(ULONG aTimeoutMS);
|
---|
100 | STDMETHOD(SymlinkCreate)(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType);
|
---|
101 | STDMETHOD(SymlinkExists)(IN_BSTR aSymlink, BOOL *aExists);
|
---|
102 | STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
|
---|
103 | STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
|
---|
104 | STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
|
---|
105 | /** @} */
|
---|
106 |
|
---|
107 | public:
|
---|
108 | /** @name Public internal methods.
|
---|
109 | * @{ */
|
---|
110 | /** @} */
|
---|
111 |
|
---|
112 | private:
|
---|
113 |
|
---|
114 | typedef std::map <Utf8Str, Utf8Str> SessionEnvironment;
|
---|
115 | typedef std::list <ComObjPtr<GuestProcess> > SessionProcesses;
|
---|
116 | typedef std::list <ComObjPtr<GuestDirectory> > SessionDirectories;
|
---|
117 | typedef std::list <ComObjPtr<GuestFile> > SessionFiles;
|
---|
118 |
|
---|
119 | struct Data
|
---|
120 | {
|
---|
121 | ComPtr<IGuest> mParent;
|
---|
122 | Utf8Str mUser;
|
---|
123 | Utf8Str mDomain;
|
---|
124 | Utf8Str mPassword;
|
---|
125 | Utf8Str mName;
|
---|
126 | ULONG mId;
|
---|
127 | ULONG mTimeout;
|
---|
128 | SessionEnvironment mEnvironment;
|
---|
129 | SessionProcesses mProcesses;
|
---|
130 | SessionDirectories mDirectories;
|
---|
131 | SessionFiles mFiles;
|
---|
132 | } mData;
|
---|
133 | };
|
---|
134 |
|
---|
135 | #endif /* !____H_GUESTSESSIONIMPL */
|
---|
136 |
|
---|