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