VirtualBox

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

Last change on this file since 317 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 *
3 * VBox Client Session COM Class definition
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_SESSIONIMPL
23#define ____H_SESSIONIMPL
24
25#include "VirtualBoxBase.h"
26#include "ConsoleImpl.h"
27
28#ifdef __WIN__
29#include "win32/resource.h"
30#endif
31
32class ATL_NO_VTABLE Session :
33 public VirtualBoxBaseNEXT,
34 public VirtualBoxSupportErrorInfoImpl <Session, ISession>,
35 public VirtualBoxSupportTranslation <Session>,
36#ifdef __WIN__
37 public IDispatchImpl<ISession, &IID_ISession, &LIBID_VirtualBox,
38 kTypeLibraryMajorVersion, kTypeLibraryMinorVersion>,
39 public CComCoClass<Session, &CLSID_Session>,
40#else
41 public ISession,
42#endif
43 public IInternalSessionControl
44{
45public:
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_ENTRY(IDispatch)
56 COM_INTERFACE_ENTRY(IInternalSessionControl)
57 COM_INTERFACE_ENTRY(ISupportErrorInfo)
58 COM_INTERFACE_ENTRY(ISession)
59 END_COM_MAP()
60
61 NS_DECL_ISUPPORTS
62
63 HRESULT FinalConstruct();
64 void FinalRelease();
65
66 // public initializers/uninitializers only for internal purposes
67 HRESULT init();
68 void uninit (bool aFinalRelease);
69
70 // ISession properties
71 STDMETHOD(COMGETTER(State)) (SessionState_T *aState);
72 STDMETHOD(COMGETTER(Type)) (SessionType_T *aType);
73 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
74 STDMETHOD(COMGETTER(Console)) (IConsole **aConsole);
75
76 // ISession methods
77 STDMETHOD(Close)();
78
79 // IInternalSessionControl methods
80 STDMETHOD(GetPID) (ULONG *aPid);
81 STDMETHOD(GetRemoteConsole) (IConsole **aConsole);
82 STDMETHOD(AssignMachine) (IMachine *aMachine);
83 STDMETHOD(AssignRemoteMachine) (IMachine *aMachine, IConsole *aConsole);
84 STDMETHOD(UpdateMachineState) (MachineState_T aMachineState);
85 STDMETHOD(Uninitialize)();
86 STDMETHOD(OnDVDDriveChange)();
87 STDMETHOD(OnFloppyDriveChange)();
88 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter);
89 STDMETHOD(OnVRDPServerChange)();
90 STDMETHOD(OnUSBControllerChange)();
91 STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice);
92 STDMETHOD(OnUSBDeviceDetach) (INPTR GUIDPARAM aId);
93
94 // for VirtualBoxSupportErrorInfoImpl
95 static const wchar_t *getComponentName() { return L"Session"; }
96
97private:
98
99 HRESULT close (bool aFinalRelease, bool aFromServer);
100 HRESULT grabIPCSemaphore();
101 void releaseIPCSemaphore();
102
103 SessionState_T mState;
104 SessionType_T mType;
105
106 ComPtr <IInternalMachineControl> mControl;
107
108 ComObjPtr <Console> mConsole;
109
110 ComPtr <IMachine> mRemoteMachine;
111 ComPtr <IConsole> mRemoteConsole;
112
113 ComPtr <IVirtualBox> mVirtualBox;
114
115 // the interprocess semaphore handle (id) for the opened machine
116#if defined(__WIN__)
117 HANDLE mIPCSem;
118 HANDLE mIPCThreadSem;
119#elif defined(__LINUX__)
120 int mIPCSem;
121#endif
122};
123
124#endif // ____H_SESSIONIMPL
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