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 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 | 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 | DECLARE_NOT_AGGREGATABLE(VRDPServer)
|
---|
62 |
|
---|
63 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
64 |
|
---|
65 | BEGIN_COM_MAP(VRDPServer)
|
---|
66 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
67 | COM_INTERFACE_ENTRY(IVRDPServer)
|
---|
68 | END_COM_MAP()
|
---|
69 |
|
---|
70 | NS_DECL_ISUPPORTS
|
---|
71 |
|
---|
72 | HRESULT FinalConstruct();
|
---|
73 | void FinalRelease();
|
---|
74 |
|
---|
75 | // public initializer/uninitializer for internal purposes only
|
---|
76 | HRESULT init(Machine *parent);
|
---|
77 | HRESULT init(Machine *parent, VRDPServer *that);
|
---|
78 | HRESULT initCopy (Machine *parent, VRDPServer *that);
|
---|
79 | void uninit();
|
---|
80 |
|
---|
81 | // IVRDPServer properties
|
---|
82 | STDMETHOD(COMGETTER(Enabled))(BOOL *enabled);
|
---|
83 | STDMETHOD(COMSETTER(Enabled))(BOOL enable);
|
---|
84 | STDMETHOD(COMGETTER(Port))(ULONG *port);
|
---|
85 | STDMETHOD(COMSETTER(Port))(ULONG port);
|
---|
86 | STDMETHOD(COMGETTER(NetAddress))(BSTR *address);
|
---|
87 | STDMETHOD(COMSETTER(NetAddress))(INPTR BSTR address);
|
---|
88 | STDMETHOD(COMGETTER(AuthType))(VRDPAuthType_T *type);
|
---|
89 | STDMETHOD(COMSETTER(AuthType))(VRDPAuthType_T type);
|
---|
90 | STDMETHOD(COMGETTER(AuthTimeout))(ULONG *timeout);
|
---|
91 | STDMETHOD(COMSETTER(AuthTimeout))(ULONG timeout);
|
---|
92 | STDMETHOD(COMGETTER(AllowMultiConnection))(BOOL *enabled);
|
---|
93 | STDMETHOD(COMSETTER(AllowMultiConnection))(BOOL enable);
|
---|
94 |
|
---|
95 | // IVRDPServer methods
|
---|
96 |
|
---|
97 | // public methods only for internal purposes
|
---|
98 |
|
---|
99 | void loadConfig (CFGNODE node);
|
---|
100 | void saveConfig (CFGNODE node);
|
---|
101 |
|
---|
102 | const Backupable <Data> &data() const { return mData; }
|
---|
103 |
|
---|
104 | bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
|
---|
105 | bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
|
---|
106 | bool rollback();
|
---|
107 | void commit();
|
---|
108 | void copyFrom (VRDPServer *aThat);
|
---|
109 |
|
---|
110 | // for VirtualBoxSupportErrorInfoImpl
|
---|
111 | static const wchar_t *getComponentName() { return L"VRDPServer"; }
|
---|
112 |
|
---|
113 | private:
|
---|
114 |
|
---|
115 | ComObjPtr <Machine, ComWeakRef> mParent;
|
---|
116 | ComObjPtr <VRDPServer> mPeer;
|
---|
117 | Backupable <Data> mData;
|
---|
118 | };
|
---|
119 |
|
---|
120 | #endif // ____H_VRDPSERVER
|
---|