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