VirtualBox

source: vbox/trunk/src/VBox/Main/include/SessionImpl.h@ 30760

Last change on this file since 30760 was 30760, checked in by vboxsync, 15 years ago

Main: separate internal machine data structs into MachineImplPrivate.h to significantly speed up compilation and for better interface separation; remove obsolete ConsoleEvents.h file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/** @file
2 *
3 * VBox Client Session COM Class definition
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. 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 ____H_SESSIONIMPL
19#define ____H_SESSIONIMPL
20
21#include "VirtualBoxBase.h"
22
23#ifdef RT_OS_WINDOWS
24# include "win/resource.h"
25#endif
26
27/** @def VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
28 * Use SYS V IPC for watching a session.
29 * This is defined in the Makefile since it's also used by MachineImpl.h/cpp.
30 */
31#ifdef DOXYGEN_RUNNING
32# define VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
33#endif
34
35class ATL_NO_VTABLE Session :
36 public VirtualBoxBase,
37 VBOX_SCRIPTABLE_IMPL(ISession),
38 VBOX_SCRIPTABLE_IMPL(IInternalSessionControl)
39#ifdef RT_OS_WINDOWS
40 , public CComCoClass<Session, &CLSID_Session>
41#endif
42{
43public:
44
45 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Session, ISession)
46
47 DECLARE_CLASSFACTORY()
48
49 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
50 DECLARE_NOT_AGGREGATABLE(Session)
51
52 DECLARE_PROTECT_FINAL_CONSTRUCT()
53
54 BEGIN_COM_MAP(Session)
55 COM_INTERFACE_ENTRY2(IDispatch, ISession)
56 COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl)
57 COM_INTERFACE_ENTRY(IInternalSessionControl)
58 COM_INTERFACE_ENTRY(ISupportErrorInfo)
59 COM_INTERFACE_ENTRY(ISession)
60 END_COM_MAP()
61
62 HRESULT FinalConstruct();
63 void FinalRelease();
64
65 // public initializers/uninitializers only for internal purposes
66 HRESULT init();
67 void uninit(bool aFinalRelease);
68
69 // ISession properties
70 STDMETHOD(COMGETTER(State))(SessionState_T *aState);
71 STDMETHOD(COMGETTER(Type))(SessionType_T *aType);
72 STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
73 STDMETHOD(COMGETTER(Console))(IConsole **aConsole);
74
75 // ISession methods
76 STDMETHOD(Close)();
77
78 // IInternalSessionControl methods
79 STDMETHOD(GetPID)(ULONG *aPid);
80 STDMETHOD(GetRemoteConsole)(IConsole **aConsole);
81 STDMETHOD(AssignMachine)(IMachine *aMachine);
82 STDMETHOD(AssignRemoteMachine)(IMachine *aMachine, IConsole *aConsole);
83 STDMETHOD(UpdateMachineState)(MachineState_T aMachineState);
84 STDMETHOD(Uninitialize)();
85 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter, BOOL changeAdapter);
86 STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort);
87 STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
88 STDMETHOD(OnStorageControllerChange)();
89 STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
90 STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
91 STDMETHOD(OnVRDPServerChange)(BOOL aRestart);
92 STDMETHOD(OnUSBControllerChange)();
93 STDMETHOD(OnSharedFolderChange)(BOOL aGlobal);
94 STDMETHOD(OnUSBDeviceAttach)(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
95 STDMETHOD(OnUSBDeviceDetach)(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
96 STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
97 STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
98 BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags);
99 STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPatterns,
100 ComSafeArrayOut(BSTR, aNames),
101 ComSafeArrayOut(BSTR, aValues),
102 ComSafeArrayOut(ULONG64, aTimestamps),
103 ComSafeArrayOut(BSTR, aFlags));
104 STDMETHOD(OnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
105 ULONG aSourceIdx, ULONG aTargetIdx,
106 IMedium *aSource, IMedium *aTarget,
107 BOOL aMergeForward, IMedium *aParentForTarget,
108 ComSafeArrayIn(IMedium *, aChildrenToReparent),
109 IProgress *aProgress);
110
111private:
112
113 HRESULT close(bool aFinalRelease, bool aFromServer);
114 HRESULT grabIPCSemaphore();
115 void releaseIPCSemaphore();
116
117 SessionState_T mState;
118 SessionType_T mType;
119
120 ComPtr<IInternalMachineControl> mControl;
121
122 ComObjPtr<Console> mConsole;
123
124 ComPtr<IMachine> mRemoteMachine;
125 ComPtr<IConsole> mRemoteConsole;
126
127 ComPtr<IVirtualBox> mVirtualBox;
128
129 /* interprocess semaphore handle (id) for the opened machine */
130#if defined(RT_OS_WINDOWS)
131 HANDLE mIPCSem;
132 HANDLE mIPCThreadSem;
133#elif defined(RT_OS_OS2)
134 RTTHREAD mIPCThread;
135 RTSEMEVENT mIPCThreadSem;
136#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
137 int mIPCSem;
138#else
139# error "Port me!"
140#endif
141};
142
143#endif // ____H_SESSIONIMPL
144/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette