1 | /* $Id: VRDPServerImpl.h 8155 2008-04-18 15:16:47Z 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 | class ATL_NO_VTABLE VRDPServer :
|
---|
34 | public VirtualBoxBaseNEXT,
|
---|
35 | public VirtualBoxSupportErrorInfoImpl <VRDPServer, IVRDPServer>,
|
---|
36 | public VirtualBoxSupportTranslation <VRDPServer>,
|
---|
37 | public IVRDPServer
|
---|
38 | {
|
---|
39 | public:
|
---|
40 |
|
---|
41 | struct Data
|
---|
42 | {
|
---|
43 | bool operator== (const Data &that) const
|
---|
44 | {
|
---|
45 | return this == &that ||
|
---|
46 | (mEnabled == that.mEnabled &&
|
---|
47 | mVRDPPort == that.mVRDPPort &&
|
---|
48 | mVRDPAddress == that.mVRDPAddress &&
|
---|
49 | mAuthType == that.mAuthType &&
|
---|
50 | mAuthTimeout == that.mAuthTimeout &&
|
---|
51 | mAllowMultiConnection == that.mAllowMultiConnection);
|
---|
52 | }
|
---|
53 |
|
---|
54 | BOOL mEnabled;
|
---|
55 | ULONG mVRDPPort;
|
---|
56 | Bstr mVRDPAddress;
|
---|
57 | VRDPAuthType_T mAuthType;
|
---|
58 | ULONG mAuthTimeout;
|
---|
59 | BOOL mAllowMultiConnection;
|
---|
60 | };
|
---|
61 |
|
---|
62 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VRDPServer)
|
---|
63 |
|
---|
64 | DECLARE_NOT_AGGREGATABLE(VRDPServer)
|
---|
65 |
|
---|
66 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
67 |
|
---|
68 | BEGIN_COM_MAP(VRDPServer)
|
---|
69 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
70 | COM_INTERFACE_ENTRY(IVRDPServer)
|
---|
71 | END_COM_MAP()
|
---|
72 |
|
---|
73 | NS_DECL_ISUPPORTS
|
---|
74 |
|
---|
75 | DECLARE_EMPTY_CTOR_DTOR (VRDPServer)
|
---|
76 |
|
---|
77 | HRESULT FinalConstruct();
|
---|
78 | void FinalRelease();
|
---|
79 |
|
---|
80 | // public initializer/uninitializer for internal purposes only
|
---|
81 | HRESULT init(Machine *aParent);
|
---|
82 | HRESULT init(Machine *aParent, VRDPServer *aThat);
|
---|
83 | HRESULT initCopy (Machine *aParent, VRDPServer *aThat);
|
---|
84 | void uninit();
|
---|
85 |
|
---|
86 | // IVRDPServer properties
|
---|
87 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
88 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnable);
|
---|
89 | STDMETHOD(COMGETTER(Port)) (ULONG *aPort);
|
---|
90 | STDMETHOD(COMSETTER(Port)) (ULONG aPort);
|
---|
91 | STDMETHOD(COMGETTER(NetAddress)) (BSTR *aAddress);
|
---|
92 | STDMETHOD(COMSETTER(NetAddress)) (INPTR BSTR aAddress);
|
---|
93 | STDMETHOD(COMGETTER(AuthType)) (VRDPAuthType_T *aType);
|
---|
94 | STDMETHOD(COMSETTER(AuthType)) (VRDPAuthType_T aType);
|
---|
95 | STDMETHOD(COMGETTER(AuthTimeout)) (ULONG *aTimeout);
|
---|
96 | STDMETHOD(COMSETTER(AuthTimeout)) (ULONG aTimeout);
|
---|
97 | STDMETHOD(COMGETTER(AllowMultiConnection)) (BOOL *aAllowMultiConnection);
|
---|
98 | STDMETHOD(COMSETTER(AllowMultiConnection)) (BOOL aAllowMultiConnection);
|
---|
99 |
|
---|
100 | // IVRDPServer methods
|
---|
101 |
|
---|
102 | // public methods only for internal purposes
|
---|
103 |
|
---|
104 | HRESULT loadSettings (const settings::Key &aMachineNode);
|
---|
105 | HRESULT saveSettings (settings::Key &aMachineNode);
|
---|
106 |
|
---|
107 | bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
|
---|
108 | bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
|
---|
109 | bool rollback();
|
---|
110 | void commit();
|
---|
111 | void copyFrom (VRDPServer *aThat);
|
---|
112 |
|
---|
113 | // public methods for internal purposes only
|
---|
114 | // (ensure there is a caller and a read lock before calling them!)
|
---|
115 |
|
---|
116 | const Backupable <Data> &data() const { return mData; }
|
---|
117 |
|
---|
118 | // for VirtualBoxSupportErrorInfoImpl
|
---|
119 | static const wchar_t *getComponentName() { return L"VRDPServer"; }
|
---|
120 |
|
---|
121 | private:
|
---|
122 |
|
---|
123 | const ComObjPtr <Machine, ComWeakRef> mParent;
|
---|
124 | const ComObjPtr <VRDPServer> mPeer;
|
---|
125 |
|
---|
126 | Backupable <Data> mData;
|
---|
127 | };
|
---|
128 |
|
---|
129 | #endif // ____H_VRDPSERVER
|
---|