1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung 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 VirtualBoxSupportErrorInfoImpl <VRDPServer, IVRDPServer>,
|
---|
34 | public VirtualBoxSupportTranslation <VRDPServer>,
|
---|
35 | public VirtualBoxBase,
|
---|
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 | mAuthType == that.mAuthType &&
|
---|
48 | mAuthTimeout == that.mAuthTimeout);
|
---|
49 | }
|
---|
50 |
|
---|
51 | BOOL mEnabled;
|
---|
52 | ULONG mVRDPPort;
|
---|
53 | VRDPAuthType_T mAuthType;
|
---|
54 | ULONG mAuthTimeout;
|
---|
55 | };
|
---|
56 |
|
---|
57 | DECLARE_NOT_AGGREGATABLE(VRDPServer)
|
---|
58 |
|
---|
59 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
60 |
|
---|
61 | BEGIN_COM_MAP(VRDPServer)
|
---|
62 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
63 | COM_INTERFACE_ENTRY(IVRDPServer)
|
---|
64 | END_COM_MAP()
|
---|
65 |
|
---|
66 | NS_DECL_ISUPPORTS
|
---|
67 |
|
---|
68 | HRESULT FinalConstruct();
|
---|
69 | void FinalRelease();
|
---|
70 |
|
---|
71 | // public initializer/uninitializer for internal purposes only
|
---|
72 | HRESULT init(Machine *parent);
|
---|
73 | HRESULT init(Machine *parent, VRDPServer *that);
|
---|
74 | HRESULT initCopy (Machine *parent, VRDPServer *that);
|
---|
75 | void uninit();
|
---|
76 |
|
---|
77 | // IVRDPServer properties
|
---|
78 | STDMETHOD(COMGETTER(Enabled))(BOOL *enabled);
|
---|
79 | STDMETHOD(COMSETTER(Enabled))(BOOL enable);
|
---|
80 | STDMETHOD(COMGETTER(Port))(ULONG *port);
|
---|
81 | STDMETHOD(COMSETTER(Port))(ULONG port);
|
---|
82 | STDMETHOD(COMGETTER(AuthType))(VRDPAuthType_T *type);
|
---|
83 | STDMETHOD(COMSETTER(AuthType))(VRDPAuthType_T type);
|
---|
84 | STDMETHOD(COMGETTER(AuthTimeout))(ULONG *timeout);
|
---|
85 | STDMETHOD(COMSETTER(AuthTimeout))(ULONG timeout);
|
---|
86 |
|
---|
87 | // IVRDPServer methods
|
---|
88 |
|
---|
89 | // public methods only for internal purposes
|
---|
90 |
|
---|
91 | void loadConfig (CFGNODE node);
|
---|
92 | void saveConfig (CFGNODE node);
|
---|
93 |
|
---|
94 | const Backupable <Data> &data() const { return mData; }
|
---|
95 |
|
---|
96 | bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
|
---|
97 | bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
|
---|
98 | bool rollback();
|
---|
99 | void commit();
|
---|
100 | void copyFrom (VRDPServer *aThat);
|
---|
101 |
|
---|
102 | // for VirtualBoxSupportErrorInfoImpl
|
---|
103 | static const wchar_t *getComponentName() { return L"VRDPServer"; }
|
---|
104 |
|
---|
105 | private:
|
---|
106 |
|
---|
107 | ComObjPtr <Machine, ComWeakRef> mParent;
|
---|
108 | ComObjPtr <VRDPServer> mPeer;
|
---|
109 | Backupable <Data> mData;
|
---|
110 | };
|
---|
111 |
|
---|
112 | #endif // ____H_VRDPSERVER
|
---|