1 | /* $Id: SessionImpl.h 77910 2019-03-27 11:33:01Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Client Session COM Class definition
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 MAIN_INCLUDED_SessionImpl_h
|
---|
19 | #define MAIN_INCLUDED_SessionImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "SessionWrap.h"
|
---|
25 | #include "ConsoleImpl.h"
|
---|
26 |
|
---|
27 | #ifdef RT_OS_WINDOWS
|
---|
28 | # include "win/resource.h"
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifdef RT_OS_WINDOWS
|
---|
32 | [threading(free)]
|
---|
33 | #endif
|
---|
34 | class ATL_NO_VTABLE Session :
|
---|
35 | public SessionWrap
|
---|
36 | #ifdef RT_OS_WINDOWS
|
---|
37 | , public ATL::CComCoClass<Session, &CLSID_Session>
|
---|
38 | #endif
|
---|
39 | {
|
---|
40 | public:
|
---|
41 |
|
---|
42 | DECLARE_CLASSFACTORY()
|
---|
43 |
|
---|
44 | // Do not use any ATL registry support.
|
---|
45 | //DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
|
---|
46 |
|
---|
47 | DECLARE_NOT_AGGREGATABLE(Session)
|
---|
48 |
|
---|
49 | DECLARE_EMPTY_CTOR_DTOR(Session)
|
---|
50 |
|
---|
51 | HRESULT FinalConstruct();
|
---|
52 | void FinalRelease();
|
---|
53 |
|
---|
54 | // public initializers/uninitializers only for internal purposes
|
---|
55 | HRESULT init();
|
---|
56 | void uninit();
|
---|
57 |
|
---|
58 | private:
|
---|
59 |
|
---|
60 | // Wrapped ISession properties
|
---|
61 | HRESULT getState(SessionState_T *aState);
|
---|
62 | HRESULT getType(SessionType_T *aType);
|
---|
63 | HRESULT getName(com::Utf8Str &aName);
|
---|
64 | HRESULT setName(const com::Utf8Str &aName);
|
---|
65 | HRESULT getMachine(ComPtr<IMachine> &aMachine);
|
---|
66 | HRESULT getConsole(ComPtr<IConsole> &aConsole);
|
---|
67 |
|
---|
68 | // Wrapped ISession methods
|
---|
69 | HRESULT unlockMachine();
|
---|
70 |
|
---|
71 | // Wrapped IInternalSessionControl properties
|
---|
72 | HRESULT getPID(ULONG *aPid);
|
---|
73 | HRESULT getRemoteConsole(ComPtr<IConsole> &aRemoteConsole);
|
---|
74 | HRESULT getNominalState(MachineState_T *aNominalState);
|
---|
75 |
|
---|
76 | // Wrapped IInternalSessionControl methods
|
---|
77 | #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
|
---|
78 | HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
|
---|
79 | LockType_T aLockType,
|
---|
80 | const com::Utf8Str &aTokenId);
|
---|
81 | #else
|
---|
82 | HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
|
---|
83 | LockType_T aLockType,
|
---|
84 | const ComPtr<IToken> &aToken);
|
---|
85 | #endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
|
---|
86 | HRESULT assignRemoteMachine(const ComPtr<IMachine> &aMachine,
|
---|
87 | const ComPtr<IConsole> &aConsole);
|
---|
88 | HRESULT updateMachineState(MachineState_T aMachineState);
|
---|
89 | HRESULT uninitialize();
|
---|
90 | HRESULT onNetworkAdapterChange(const ComPtr<INetworkAdapter> &aNetworkAdapter,
|
---|
91 | BOOL aChangeAdapter);
|
---|
92 | HRESULT onAudioAdapterChange(const ComPtr<IAudioAdapter> &aAudioAdapter);
|
---|
93 | HRESULT onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort);
|
---|
94 | HRESULT onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort);
|
---|
95 | HRESULT onStorageControllerChange();
|
---|
96 | HRESULT onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
|
---|
97 | BOOL aForce);
|
---|
98 | HRESULT onStorageDeviceChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
|
---|
99 | BOOL aRemove,
|
---|
100 | BOOL aSilent);
|
---|
101 | HRESULT onVMProcessPriorityChange(VMProcPriority_T priority);
|
---|
102 | HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
|
---|
103 | HRESULT onDnDModeChange(DnDMode_T aDndMode);
|
---|
104 | HRESULT onCPUChange(ULONG aCpu,
|
---|
105 | BOOL aAdd);
|
---|
106 | HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
|
---|
107 | HRESULT onVRDEServerChange(BOOL aRestart);
|
---|
108 | HRESULT onRecordingChange(BOOL aEnable);
|
---|
109 | HRESULT onUSBControllerChange();
|
---|
110 | HRESULT onSharedFolderChange(BOOL aGlobal);
|
---|
111 | HRESULT onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice,
|
---|
112 | const ComPtr<IVirtualBoxErrorInfo> &aError,
|
---|
113 | ULONG aMaskedInterfaces,
|
---|
114 | const com::Utf8Str &aCaptureFilename);
|
---|
115 | HRESULT onUSBDeviceDetach(const com::Guid &aId,
|
---|
116 | const ComPtr<IVirtualBoxErrorInfo> &aError);
|
---|
117 | HRESULT onShowWindow(BOOL aCheck,
|
---|
118 | BOOL *aCanShow,
|
---|
119 | LONG64 *aWinId);
|
---|
120 | HRESULT onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
121 | HRESULT accessGuestProperty(const com::Utf8Str &aName,
|
---|
122 | const com::Utf8Str &aValue,
|
---|
123 | const com::Utf8Str &aFlags,
|
---|
124 | ULONG aAccessMode,
|
---|
125 | com::Utf8Str &aRetValue,
|
---|
126 | LONG64 *aRetTimestamp,
|
---|
127 | com::Utf8Str &aRetFlags);
|
---|
128 | HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
|
---|
129 | std::vector<com::Utf8Str> &aKeys,
|
---|
130 | std::vector<com::Utf8Str> &aValues,
|
---|
131 | std::vector<LONG64> &aTimestamps,
|
---|
132 | std::vector<com::Utf8Str> &aFlags);
|
---|
133 | HRESULT onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment,
|
---|
134 | ULONG aSourceIdx,
|
---|
135 | ULONG aTargetIdx,
|
---|
136 | const ComPtr<IProgress> &aProgress);
|
---|
137 | HRESULT reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments);
|
---|
138 | HRESULT enableVMMStatistics(BOOL aEnable);
|
---|
139 | HRESULT pauseWithReason(Reason_T aReason);
|
---|
140 | HRESULT resumeWithReason(Reason_T aReason);
|
---|
141 | HRESULT saveStateWithReason(Reason_T aReason,
|
---|
142 | const ComPtr<IProgress> &aProgress,
|
---|
143 | const ComPtr<ISnapshot> &aSnapshot,
|
---|
144 | const Utf8Str &aStateFilePath,
|
---|
145 | BOOL aPauseVM,
|
---|
146 | BOOL *aLeftPaused);
|
---|
147 | HRESULT cancelSaveStateWithReason();
|
---|
148 |
|
---|
149 |
|
---|
150 | HRESULT i_unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock &aLockW);
|
---|
151 |
|
---|
152 | SessionState_T mState;
|
---|
153 | SessionType_T mType;
|
---|
154 | Utf8Str mName;
|
---|
155 |
|
---|
156 | ComPtr<IInternalMachineControl> mControl;
|
---|
157 |
|
---|
158 | #ifndef VBOX_COM_INPROC_API_CLIENT
|
---|
159 | ComObjPtr<Console> mConsole;
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | ComPtr<IMachine> mRemoteMachine;
|
---|
163 | ComPtr<IConsole> mRemoteConsole;
|
---|
164 |
|
---|
165 | ComPtr<IVirtualBox> mVirtualBox;
|
---|
166 |
|
---|
167 | class ClientTokenHolder;
|
---|
168 |
|
---|
169 | ClientTokenHolder *mClientTokenHolder;
|
---|
170 | };
|
---|
171 |
|
---|
172 | #endif /* !MAIN_INCLUDED_SessionImpl_h */
|
---|
173 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|