VirtualBox

source: vbox/trunk/src/VBox/Main/include/NATEngineImpl.h@ 40532

Last change on this file since 40532 was 35638, checked in by vboxsync, 14 years ago

Main. QT/FE: fix long standing COM issue

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: NATEngineImpl.h 35638 2011-01-19 19:10:49Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2009 Oracle Corporation
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
20#ifndef ____H_NATDRIVER
21#define ____H_NATDRIVER
22
23
24#include "VirtualBoxBase.h"
25#include <VBox/settings.h>
26
27namespace settings
28{
29 struct NAT;
30}
31
32class ATL_NO_VTABLE NATEngine :
33 public VirtualBoxBase,
34 VBOX_SCRIPTABLE_IMPL(INATEngine)
35{
36 public:
37 typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
38 struct Data
39 {
40 Data() : mMtu(0),
41 mSockRcv(0),
42 mSockSnd(0),
43 mTcpRcv(0),
44 mTcpSnd(0),
45 mDnsPassDomain(TRUE),
46 mDnsProxy(FALSE),
47 mDnsUseHostResolver(FALSE),
48 mAliasMode(0)
49 {}
50
51 com::Utf8Str mNetwork;
52 com::Utf8Str mBindIP;
53 uint32_t mMtu;
54 uint32_t mSockRcv;
55 uint32_t mSockSnd;
56 uint32_t mTcpRcv;
57 uint32_t mTcpSnd;
58 /* TFTP service */
59 Utf8Str mTftpPrefix;
60 Utf8Str mTftpBootFile;
61 Utf8Str mTftpNextServer;
62 /* DNS service */
63 BOOL mDnsPassDomain;
64 BOOL mDnsProxy;
65 BOOL mDnsUseHostResolver;
66 /* Alias service */
67 ULONG mAliasMode;
68 };
69 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATEngine, INATEngine)
70
71 DECLARE_NOT_AGGREGATABLE(NATEngine)
72
73 DECLARE_PROTECT_FINAL_CONSTRUCT()
74
75 BEGIN_COM_MAP(NATEngine)
76 VBOX_DEFAULT_INTERFACE_ENTRIES (INATEngine)
77 END_COM_MAP()
78
79 DECLARE_EMPTY_CTOR_DTOR (NATEngine)
80
81 HRESULT FinalConstruct();
82 HRESULT init(Machine *aParent, INetworkAdapter *aAdapter);
83 HRESULT init(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
84 HRESULT initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
85 bool isModified();
86 bool isReallyModified();
87 bool rollback();
88 void commit();
89 void uninit();
90 void FinalRelease();
91
92 HRESULT loadSettings(const settings::NAT &data);
93 HRESULT saveSettings(settings::NAT &data);
94
95 STDMETHOD(COMSETTER(Network)) (IN_BSTR aNetwork);
96 STDMETHOD(COMGETTER(Network)) (BSTR *aNetwork);
97 STDMETHOD(COMSETTER(HostIP)) (IN_BSTR aBindIP);
98 STDMETHOD(COMGETTER(HostIP)) (BSTR *aBindIP);
99 /* TFTP attributes */
100 STDMETHOD(COMSETTER(TftpPrefix)) (IN_BSTR aTftpPrefix);
101 STDMETHOD(COMGETTER(TftpPrefix)) (BSTR *aTftpPrefix);
102 STDMETHOD(COMSETTER(TftpBootFile)) (IN_BSTR aTftpBootFile);
103 STDMETHOD(COMGETTER(TftpBootFile)) (BSTR *aTftpBootFile);
104 STDMETHOD(COMSETTER(TftpNextServer)) (IN_BSTR aTftpNextServer);
105 STDMETHOD(COMGETTER(TftpNextServer)) (BSTR *aTftpNextServer);
106 /* Alias attributes */
107 STDMETHOD(COMSETTER(AliasMode)) (ULONG aAliasLog);
108 STDMETHOD(COMGETTER(AliasMode)) (ULONG *aAliasLog);
109 /* DNS attributes */
110 STDMETHOD(COMSETTER(DnsPassDomain)) (BOOL aDnsPassDomain);
111 STDMETHOD(COMGETTER(DnsPassDomain)) (BOOL *aDnsPassDomain);
112 STDMETHOD(COMSETTER(DnsProxy)) (BOOL aDnsProxy);
113 STDMETHOD(COMGETTER(DnsProxy)) (BOOL *aDnsProxy);
114 STDMETHOD(COMGETTER(DnsUseHostResolver)) (BOOL *aDnsUseHostResolver);
115 STDMETHOD(COMSETTER(DnsUseHostResolver)) (BOOL aDnsUseHostResolver);
116
117 STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
118 STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
119
120 STDMETHOD(COMGETTER(Redirects)) (ComSafeArrayOut (BSTR, aNatRules));
121 STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
122 STDMETHOD(RemoveRedirect)(IN_BSTR aName);
123
124private:
125 Backupable<Data> mData;
126 bool m_fModified;
127 const ComObjPtr<NATEngine> mPeer;
128 Machine * const mParent;
129 NATRuleMap mNATRules;
130 INetworkAdapter * const mAdapter;
131};
132#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette