1 | /* $Id: SessionImpl.h 84411 2020-05-20 14:31:23Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Client Session COM Class definition
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 | #if defined(RT_OS_WINDOWS) && !RT_MSC_PREREQ(RT_MSC_VER_VC140)
|
---|
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(const Guid &aMachineId, const com::Utf8Str& aControllerName);
|
---|
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 onClipboardFileTransferModeChange(BOOL aEnabled);
|
---|
104 | HRESULT onDnDModeChange(DnDMode_T aDndMode);
|
---|
105 | HRESULT onCPUChange(ULONG aCpu,
|
---|
106 | BOOL aAdd);
|
---|
107 | HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
|
---|
108 | HRESULT onVRDEServerChange(BOOL aRestart);
|
---|
109 | HRESULT onRecordingChange(BOOL aEnable);
|
---|
110 | HRESULT onUSBControllerChange();
|
---|
111 | HRESULT onSharedFolderChange(BOOL aGlobal);
|
---|
112 | HRESULT onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice,
|
---|
113 | const ComPtr<IVirtualBoxErrorInfo> &aError,
|
---|
114 | ULONG aMaskedInterfaces,
|
---|
115 | const com::Utf8Str &aCaptureFilename);
|
---|
116 | HRESULT onUSBDeviceDetach(const com::Guid &aId,
|
---|
117 | const ComPtr<IVirtualBoxErrorInfo> &aError);
|
---|
118 | HRESULT onShowWindow(BOOL aCheck,
|
---|
119 | BOOL *aCanShow,
|
---|
120 | LONG64 *aWinId);
|
---|
121 | HRESULT onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
122 | HRESULT accessGuestProperty(const com::Utf8Str &aName,
|
---|
123 | const com::Utf8Str &aValue,
|
---|
124 | const com::Utf8Str &aFlags,
|
---|
125 | ULONG aAccessMode,
|
---|
126 | com::Utf8Str &aRetValue,
|
---|
127 | LONG64 *aRetTimestamp,
|
---|
128 | com::Utf8Str &aRetFlags);
|
---|
129 | HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
|
---|
130 | std::vector<com::Utf8Str> &aKeys,
|
---|
131 | std::vector<com::Utf8Str> &aValues,
|
---|
132 | std::vector<LONG64> &aTimestamps,
|
---|
133 | std::vector<com::Utf8Str> &aFlags);
|
---|
134 | HRESULT onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment,
|
---|
135 | ULONG aSourceIdx,
|
---|
136 | ULONG aTargetIdx,
|
---|
137 | const ComPtr<IProgress> &aProgress);
|
---|
138 | HRESULT reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments);
|
---|
139 | HRESULT enableVMMStatistics(BOOL aEnable);
|
---|
140 | HRESULT pauseWithReason(Reason_T aReason);
|
---|
141 | HRESULT resumeWithReason(Reason_T aReason);
|
---|
142 | HRESULT saveStateWithReason(Reason_T aReason,
|
---|
143 | const ComPtr<IProgress> &aProgress,
|
---|
144 | const ComPtr<ISnapshot> &aSnapshot,
|
---|
145 | const Utf8Str &aStateFilePath,
|
---|
146 | BOOL aPauseVM,
|
---|
147 | BOOL *aLeftPaused);
|
---|
148 | HRESULT cancelSaveStateWithReason();
|
---|
149 |
|
---|
150 |
|
---|
151 | HRESULT i_unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock &aLockW);
|
---|
152 |
|
---|
153 | SessionState_T mState;
|
---|
154 | SessionType_T mType;
|
---|
155 | Utf8Str mName;
|
---|
156 |
|
---|
157 | ComPtr<IInternalMachineControl> mControl;
|
---|
158 |
|
---|
159 | #ifndef VBOX_COM_INPROC_API_CLIENT
|
---|
160 | ComObjPtr<Console> mConsole;
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | ComPtr<IMachine> mRemoteMachine;
|
---|
164 | ComPtr<IConsole> mRemoteConsole;
|
---|
165 |
|
---|
166 | ComPtr<IVirtualBox> mVirtualBox;
|
---|
167 |
|
---|
168 | class ClientTokenHolder;
|
---|
169 |
|
---|
170 | ClientTokenHolder *mClientTokenHolder;
|
---|
171 | };
|
---|
172 |
|
---|
173 | #endif /* !MAIN_INCLUDED_SessionImpl_h */
|
---|
174 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|