1 | /* $Id: VRDPServerImpl.h 22183 2009-08-11 17:00:33Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | *
|
---|
19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
20 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
21 | * additional information or have any questions.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef ____H_VRDPSERVER
|
---|
25 | #define ____H_VRDPSERVER
|
---|
26 |
|
---|
27 | #include "VirtualBoxBase.h"
|
---|
28 |
|
---|
29 | #include <VBox/VRDPAuth.h>
|
---|
30 |
|
---|
31 | class Machine;
|
---|
32 |
|
---|
33 | namespace settings
|
---|
34 | {
|
---|
35 | struct VRDPSettings;
|
---|
36 | }
|
---|
37 |
|
---|
38 | class ATL_NO_VTABLE VRDPServer :
|
---|
39 | public VirtualBoxBase,
|
---|
40 | public VirtualBoxSupportErrorInfoImpl<VRDPServer, IVRDPServer>,
|
---|
41 | public VirtualBoxSupportTranslation<VRDPServer>,
|
---|
42 | VBOX_SCRIPTABLE_IMPL(IVRDPServer)
|
---|
43 | {
|
---|
44 | public:
|
---|
45 |
|
---|
46 | struct Data
|
---|
47 | {
|
---|
48 | bool operator== (const Data &that) const
|
---|
49 | {
|
---|
50 | return this == &that ||
|
---|
51 | (mEnabled == that.mEnabled &&
|
---|
52 | mVRDPPort == that.mVRDPPort &&
|
---|
53 | mVRDPAddress == that.mVRDPAddress &&
|
---|
54 | mAuthType == that.mAuthType &&
|
---|
55 | mAuthTimeout == that.mAuthTimeout &&
|
---|
56 | mAllowMultiConnection == that.mAllowMultiConnection &&
|
---|
57 | mReuseSingleConnection == that.mReuseSingleConnection);
|
---|
58 | }
|
---|
59 |
|
---|
60 | BOOL mEnabled;
|
---|
61 | ULONG mVRDPPort;
|
---|
62 | Bstr mVRDPAddress;
|
---|
63 | VRDPAuthType_T mAuthType;
|
---|
64 | ULONG mAuthTimeout;
|
---|
65 | BOOL mAllowMultiConnection;
|
---|
66 | BOOL mReuseSingleConnection;
|
---|
67 | };
|
---|
68 |
|
---|
69 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VRDPServer)
|
---|
70 |
|
---|
71 | DECLARE_NOT_AGGREGATABLE(VRDPServer)
|
---|
72 |
|
---|
73 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
74 |
|
---|
75 | BEGIN_COM_MAP(VRDPServer)
|
---|
76 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
77 | COM_INTERFACE_ENTRY (IVRDPServer)
|
---|
78 | COM_INTERFACE_ENTRY2 (IDispatch, IVRDPServer)
|
---|
79 | END_COM_MAP()
|
---|
80 |
|
---|
81 | NS_DECL_ISUPPORTS
|
---|
82 |
|
---|
83 | DECLARE_EMPTY_CTOR_DTOR (VRDPServer)
|
---|
84 |
|
---|
85 | HRESULT FinalConstruct();
|
---|
86 | void FinalRelease();
|
---|
87 |
|
---|
88 | // public initializer/uninitializer for internal purposes only
|
---|
89 | HRESULT init(Machine *aParent);
|
---|
90 | HRESULT init(Machine *aParent, VRDPServer *aThat);
|
---|
91 | HRESULT initCopy (Machine *aParent, VRDPServer *aThat);
|
---|
92 | void uninit();
|
---|
93 |
|
---|
94 | // IVRDPServer properties
|
---|
95 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
96 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnable);
|
---|
97 | STDMETHOD(COMGETTER(Port)) (ULONG *aPort);
|
---|
98 | STDMETHOD(COMSETTER(Port)) (ULONG aPort);
|
---|
99 | STDMETHOD(COMGETTER(NetAddress)) (BSTR *aAddress);
|
---|
100 | STDMETHOD(COMSETTER(NetAddress)) (IN_BSTR aAddress);
|
---|
101 | STDMETHOD(COMGETTER(AuthType)) (VRDPAuthType_T *aType);
|
---|
102 | STDMETHOD(COMSETTER(AuthType)) (VRDPAuthType_T aType);
|
---|
103 | STDMETHOD(COMGETTER(AuthTimeout)) (ULONG *aTimeout);
|
---|
104 | STDMETHOD(COMSETTER(AuthTimeout)) (ULONG aTimeout);
|
---|
105 | STDMETHOD(COMGETTER(AllowMultiConnection)) (BOOL *aAllowMultiConnection);
|
---|
106 | STDMETHOD(COMSETTER(AllowMultiConnection)) (BOOL aAllowMultiConnection);
|
---|
107 | STDMETHOD(COMGETTER(ReuseSingleConnection)) (BOOL *aReuseSingleConnection);
|
---|
108 | STDMETHOD(COMSETTER(ReuseSingleConnection)) (BOOL aReuseSingleConnection);
|
---|
109 |
|
---|
110 | // IVRDPServer methods
|
---|
111 |
|
---|
112 | // public methods only for internal purposes
|
---|
113 |
|
---|
114 | HRESULT loadSettings(const settings::VRDPSettings &data);
|
---|
115 | HRESULT saveSettings(settings::VRDPSettings &data);
|
---|
116 |
|
---|
117 | bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
|
---|
118 | bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
|
---|
119 | bool rollback();
|
---|
120 | void commit();
|
---|
121 | void copyFrom (VRDPServer *aThat);
|
---|
122 |
|
---|
123 | // public methods for internal purposes only
|
---|
124 | // (ensure there is a caller and a read lock before calling them!)
|
---|
125 |
|
---|
126 | const Backupable <Data> &data() const { return mData; }
|
---|
127 |
|
---|
128 | // for VirtualBoxSupportErrorInfoImpl
|
---|
129 | static const wchar_t *getComponentName() { return L"VRDPServer"; }
|
---|
130 |
|
---|
131 | private:
|
---|
132 |
|
---|
133 | const ComObjPtr<Machine, ComWeakRef> mParent;
|
---|
134 | const ComObjPtr<VRDPServer> mPeer;
|
---|
135 |
|
---|
136 | Backupable <Data> mData;
|
---|
137 | };
|
---|
138 |
|
---|
139 | #endif // ____H_VRDPSERVER
|
---|
140 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|