VirtualBox

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

Last change on this file since 19169 was 19134, checked in by vboxsync, 16 years ago

Main: make VBox interfaces scriptable (that is, callable from Python and VisualBasic)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 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__
40# define VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
41#endif
42
43class ATL_NO_VTABLE Session :
44 public VirtualBoxBaseNEXT,
45 public VirtualBoxSupportErrorInfoImpl <Session, ISession>,
46 public VirtualBoxSupportTranslation <Session>,
47#ifdef RT_OS_WINDOWS
48 public IDispatchImpl<ISession, &IID_ISession, &LIBID_VirtualBox,
49 kTypeLibraryMajorVersion, kTypeLibraryMinorVersion>,
50 public IDispatchImpl<IInternalSessionControl, &IID_IInternalSessionControl, &LIBID_VirtualBox,
51 kTypeLibraryMajorVersion, kTypeLibraryMinorVersion>,
52 public CComCoClass<Session, &CLSID_Session>
53#else
54 public ISession,
55 public IInternalSessionControl
56#endif
57{
58public:
59
60 DECLARE_CLASSFACTORY()
61
62 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
63 DECLARE_NOT_AGGREGATABLE(Session)
64
65 DECLARE_PROTECT_FINAL_CONSTRUCT()
66
67 BEGIN_COM_MAP(Session)
68 //COM_INTERFACE_ENTRY(IDispatch)
69 COM_INTERFACE_ENTRY(IInternalSessionControl)
70 COM_INTERFACE_ENTRY(ISupportErrorInfo)
71 COM_INTERFACE_ENTRY(ISession)
72 END_COM_MAP()
73
74 NS_DECL_ISUPPORTS
75
76 HRESULT FinalConstruct();
77 void FinalRelease();
78
79 // public initializers/uninitializers only for internal purposes
80 HRESULT init();
81 void uninit (bool aFinalRelease);
82
83 // ISession properties
84 STDMETHOD(COMGETTER(State)) (SessionState_T *aState);
85 STDMETHOD(COMGETTER(Type)) (SessionType_T *aType);
86 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
87 STDMETHOD(COMGETTER(Console)) (IConsole **aConsole);
88
89 // ISession methods
90 STDMETHOD(Close)();
91
92 // IInternalSessionControl methods
93 STDMETHOD(GetPID) (ULONG *aPid);
94 STDMETHOD(GetRemoteConsole) (IConsole **aConsole);
95 STDMETHOD(AssignMachine) (IMachine *aMachine);
96 STDMETHOD(AssignRemoteMachine) (IMachine *aMachine, IConsole *aConsole);
97 STDMETHOD(UpdateMachineState) (MachineState_T aMachineState);
98 STDMETHOD(Uninitialize)();
99 STDMETHOD(OnDVDDriveChange)();
100 STDMETHOD(OnFloppyDriveChange)();
101 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter);
102 STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort);
103 STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
104 STDMETHOD(OnStorageControllerChange)();
105 STDMETHOD(OnVRDPServerChange)();
106 STDMETHOD(OnUSBControllerChange)();
107 STDMETHOD(OnSharedFolderChange) (BOOL aGlobal);
108 STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
109 STDMETHOD(OnUSBDeviceDetach) (IN_GUID aId, IVirtualBoxErrorInfo *aError);
110 STDMETHOD(OnShowWindow) (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
111 STDMETHOD(AccessGuestProperty) (IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
112 BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags);
113 STDMETHOD(EnumerateGuestProperties) (IN_BSTR aPatterns,
114 ComSafeArrayOut(BSTR, aNames),
115 ComSafeArrayOut(BSTR, aValues),
116 ComSafeArrayOut(ULONG64, aTimestamps),
117 ComSafeArrayOut(BSTR, aFlags));
118
119 // for VirtualBoxSupportErrorInfoImpl
120 static const wchar_t *getComponentName() { return L"Session"; }
121
122private:
123
124 HRESULT close (bool aFinalRelease, bool aFromServer);
125 HRESULT grabIPCSemaphore();
126 void releaseIPCSemaphore();
127
128 SessionState_T mState;
129 SessionType_T mType;
130
131 ComPtr <IInternalMachineControl> mControl;
132
133 ComObjPtr <Console> mConsole;
134
135 ComPtr <IMachine> mRemoteMachine;
136 ComPtr <IConsole> mRemoteConsole;
137
138 ComPtr <IVirtualBox> mVirtualBox;
139
140 /* interprocess semaphore handle (id) for the opened machine */
141#if defined(RT_OS_WINDOWS)
142 HANDLE mIPCSem;
143 HANDLE mIPCThreadSem;
144#elif defined(RT_OS_OS2)
145 RTTHREAD mIPCThread;
146 RTSEMEVENT mIPCThreadSem;
147#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
148 int mIPCSem;
149#else
150# error "Port me!"
151#endif
152};
153
154#endif // ____H_SESSIONIMPL
155/* 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