VirtualBox

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

Last change on this file since 30396 was 28864, checked in by vboxsync, 15 years ago

Main/Nat: fixed uninitialized variable

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/* $Id: NATEngineImpl.h 28864 2010-04-28 12:59:54Z 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 public VirtualBoxSupportErrorInfoImpl<NATEngine, INATEngine>,
35 public VirtualBoxSupportTranslation<NATEngine>,
36 VBOX_SCRIPTABLE_IMPL(INATEngine)
37{
38 public:
39 typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
40 struct Data
41 {
42 Data() : mMtu(0),
43 mSockRcv(0),
44 mSockSnd(0),
45 mTcpRcv(0),
46 mTcpSnd(0),
47 mDnsPassDomain(TRUE),
48 mDnsProxy(FALSE),
49 mDnsUseHostResolver(FALSE),
50 mAliasMode(0)
51 {}
52
53 com::Utf8Str mNetwork;
54 com::Utf8Str mBindIP;
55 uint32_t mMtu;
56 uint32_t mSockRcv;
57 uint32_t mSockSnd;
58 uint32_t mTcpRcv;
59 uint32_t mTcpSnd;
60 /* TFTP service */
61 Utf8Str mTftpPrefix;
62 Utf8Str mTftpBootFile;
63 Utf8Str mTftpNextServer;
64 /* DNS service */
65 BOOL mDnsPassDomain;
66 BOOL mDnsProxy;
67 BOOL mDnsUseHostResolver;
68 /* Alias service */
69 ULONG mAliasMode;
70 };
71 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (NATEngine)
72
73 DECLARE_NOT_AGGREGATABLE(NATEngine)
74
75 DECLARE_PROTECT_FINAL_CONSTRUCT()
76
77 BEGIN_COM_MAP(NATEngine)
78 COM_INTERFACE_ENTRY (ISupportErrorInfo)
79 COM_INTERFACE_ENTRY (INATEngine)
80 COM_INTERFACE_ENTRY2 (IDispatch, INATEngine)
81 END_COM_MAP()
82
83 DECLARE_EMPTY_CTOR_DTOR (NATEngine)
84
85 HRESULT FinalConstruct();
86 HRESULT init(Machine *aParent);
87 HRESULT init(Machine *aParent, NATEngine *aThat);
88 HRESULT initCopy(Machine *aParent, NATEngine *aThat);
89 bool isModified();
90 bool isReallyModified();
91 bool rollback();
92 void commit();
93 void uninit();
94 void FinalRelease();
95
96 HRESULT loadSettings(const settings::NAT &data);
97 HRESULT saveSettings(settings::NAT &data);
98
99 STDMETHOD(COMSETTER(Network)) (IN_BSTR aNetwork);
100 STDMETHOD(COMGETTER(Network)) (BSTR *aNetwork);
101 STDMETHOD(COMSETTER(HostIP)) (IN_BSTR aBindIP);
102 STDMETHOD(COMGETTER(HostIP)) (BSTR *aBindIP);
103 /* TFTP attributes */
104 STDMETHOD(COMSETTER(TftpPrefix)) (IN_BSTR aTftpPrefix);
105 STDMETHOD(COMGETTER(TftpPrefix)) (BSTR *aTftpPrefix);
106 STDMETHOD(COMSETTER(TftpBootFile)) (IN_BSTR aTftpBootFile);
107 STDMETHOD(COMGETTER(TftpBootFile)) (BSTR *aTftpBootFile);
108 STDMETHOD(COMSETTER(TftpNextServer)) (IN_BSTR aTftpNextServer);
109 STDMETHOD(COMGETTER(TftpNextServer)) (BSTR *aTftpNextServer);
110 /* Alias attributes */
111 STDMETHOD(COMSETTER(AliasMode)) (ULONG aAliasLog);
112 STDMETHOD(COMGETTER(AliasMode)) (ULONG *aAliasLog);
113 /* DNS attributes */
114 STDMETHOD(COMSETTER(DnsPassDomain)) (BOOL aDnsPassDomain);
115 STDMETHOD(COMGETTER(DnsPassDomain)) (BOOL *aDnsPassDomain);
116 STDMETHOD(COMSETTER(DnsProxy)) (BOOL aDnsProxy);
117 STDMETHOD(COMGETTER(DnsProxy)) (BOOL *aDnsProxy);
118 STDMETHOD(COMGETTER(DnsUseHostResolver)) (BOOL *aDnsUseHostResolver);
119 STDMETHOD(COMSETTER(DnsUseHostResolver)) (BOOL aDnsUseHostResolver);
120
121 STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
122 STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
123
124 STDMETHOD(COMGETTER(Redirects)) (ComSafeArrayOut (BSTR, aNatRules));
125 STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
126 STDMETHOD(RemoveRedirect)(IN_BSTR aName);
127
128 static const wchar_t *getComponentName() { return L"NATEngine"; }
129private:
130 Backupable<Data> mData;
131 bool m_fModified;
132 const ComObjPtr<NATEngine> mPeer;
133 Machine * const mParent;
134 NATRuleMap mNATRules;
135};
136#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