VirtualBox

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

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

back out Main/Session+Console hack introducing full/reduced console

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 *
3 * VBox Client Session COM Class definition
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ____H_SESSIONIMPL
23#define ____H_SESSIONIMPL
24
25#include "VirtualBoxBase.h"
26#include "ConsoleImpl.h"
27
28#ifdef RT_OS_WINDOWS
29# include "win/resource.h"
30#endif
31
32/** @def VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
33 * Use SYS V IPC for watching a session.
34 * This is defined in the Makefile since it's also used by MachineImpl.h/cpp.
35 *
36 * @todo Dmitry, feel free to completely change this (and/or write a better description).
37 * (The same goes for the other darwin changes.)
38 */
39#ifdef DOXYGEN_RUNNING
40# define VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
41#endif
42
43class ATL_NO_VTABLE Session :
44 public VirtualBoxBase,
45 public VirtualBoxSupportErrorInfoImpl<Session, ISession>,
46 public VirtualBoxSupportTranslation<Session>,
47 VBOX_SCRIPTABLE_IMPL(ISession),
48 VBOX_SCRIPTABLE_IMPL(IInternalSessionControl)
49#ifdef RT_OS_WINDOWS
50 , public CComCoClass<Session, &CLSID_Session>
51#endif
52{
53public:
54
55 DECLARE_CLASSFACTORY()
56
57 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
58 DECLARE_NOT_AGGREGATABLE(Session)
59
60 DECLARE_PROTECT_FINAL_CONSTRUCT()
61
62 BEGIN_COM_MAP(Session)
63 COM_INTERFACE_ENTRY2(IDispatch, ISession)
64 COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl)
65 COM_INTERFACE_ENTRY(IInternalSessionControl)
66 COM_INTERFACE_ENTRY(ISupportErrorInfo)
67 COM_INTERFACE_ENTRY(ISession)
68 END_COM_MAP()
69
70 HRESULT FinalConstruct();
71 void FinalRelease();
72
73 // public initializers/uninitializers only for internal purposes
74 HRESULT init();
75 void uninit (bool aFinalRelease);
76
77 // ISession properties
78 STDMETHOD(COMGETTER(State)) (SessionState_T *aState);
79 STDMETHOD(COMGETTER(Type)) (SessionType_T *aType);
80 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
81 STDMETHOD(COMGETTER(Console)) (IConsole **aConsole);
82
83 // ISession methods
84 STDMETHOD(Close)();
85
86 // IInternalSessionControl methods
87 STDMETHOD(GetPID) (ULONG *aPid);
88 STDMETHOD(GetRemoteConsole) (IConsole **aConsole);
89 STDMETHOD(AssignMachine) (IMachine *aMachine);
90 STDMETHOD(AssignRemoteMachine) (IMachine *aMachine, IConsole *aConsole);
91 STDMETHOD(UpdateMachineState) (MachineState_T aMachineState);
92 STDMETHOD(Uninitialize)();
93 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter, BOOL changeAdapter);
94 STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort);
95 STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
96 STDMETHOD(OnStorageControllerChange)();
97 STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
98 STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
99 STDMETHOD(OnVRDPServerChange)();
100 STDMETHOD(OnUSBControllerChange)();
101 STDMETHOD(OnSharedFolderChange) (BOOL aGlobal);
102 STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
103 STDMETHOD(OnUSBDeviceDetach) (IN_BSTR aId, IVirtualBoxErrorInfo *aError);
104 STDMETHOD(OnShowWindow) (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
105 STDMETHOD(AccessGuestProperty) (IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
106 BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags);
107 STDMETHOD(EnumerateGuestProperties) (IN_BSTR aPatterns,
108 ComSafeArrayOut(BSTR, aNames),
109 ComSafeArrayOut(BSTR, aValues),
110 ComSafeArrayOut(ULONG64, aTimestamps),
111 ComSafeArrayOut(BSTR, aFlags));
112
113 // for VirtualBoxSupportErrorInfoImpl
114 static const wchar_t *getComponentName() { return L"Session"; }
115
116private:
117
118 HRESULT close (bool aFinalRelease, bool aFromServer);
119 HRESULT grabIPCSemaphore();
120 void releaseIPCSemaphore();
121
122 SessionState_T mState;
123 SessionType_T mType;
124
125 ComPtr<IInternalMachineControl> mControl;
126
127 ComObjPtr<Console> mConsole;
128
129 ComPtr<IMachine> mRemoteMachine;
130 ComPtr<IConsole> mRemoteConsole;
131
132 ComPtr<IVirtualBox> mVirtualBox;
133
134 /* interprocess semaphore handle (id) for the opened machine */
135#if defined(RT_OS_WINDOWS)
136 HANDLE mIPCSem;
137 HANDLE mIPCThreadSem;
138#elif defined(RT_OS_OS2)
139 RTTHREAD mIPCThread;
140 RTSEMEVENT mIPCThreadSem;
141#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
142 int mIPCSem;
143#else
144# error "Port me!"
145#endif
146};
147
148#endif // ____H_SESSIONIMPL
149/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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