VirtualBox

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

Last change on this file since 35356 was 33825, checked in by vboxsync, 14 years ago

Main,NAT: Managing port-forwarding at runtime. (xTracker/#4835).

  • 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 33825 2010-11-08 10:16:25Z 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 COM_INTERFACE_ENTRY (ISupportErrorInfo)
77 COM_INTERFACE_ENTRY (INATEngine)
78 COM_INTERFACE_ENTRY2 (IDispatch, INATEngine)
79 END_COM_MAP()
80
81 DECLARE_EMPTY_CTOR_DTOR (NATEngine)
82
83 HRESULT FinalConstruct();
84 HRESULT init(Machine *aParent, INetworkAdapter *aAdapter);
85 HRESULT init(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
86 HRESULT initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
87 bool isModified();
88 bool isReallyModified();
89 bool rollback();
90 void commit();
91 void uninit();
92 void FinalRelease();
93
94 HRESULT loadSettings(const settings::NAT &data);
95 HRESULT saveSettings(settings::NAT &data);
96
97 STDMETHOD(COMSETTER(Network)) (IN_BSTR aNetwork);
98 STDMETHOD(COMGETTER(Network)) (BSTR *aNetwork);
99 STDMETHOD(COMSETTER(HostIP)) (IN_BSTR aBindIP);
100 STDMETHOD(COMGETTER(HostIP)) (BSTR *aBindIP);
101 /* TFTP attributes */
102 STDMETHOD(COMSETTER(TftpPrefix)) (IN_BSTR aTftpPrefix);
103 STDMETHOD(COMGETTER(TftpPrefix)) (BSTR *aTftpPrefix);
104 STDMETHOD(COMSETTER(TftpBootFile)) (IN_BSTR aTftpBootFile);
105 STDMETHOD(COMGETTER(TftpBootFile)) (BSTR *aTftpBootFile);
106 STDMETHOD(COMSETTER(TftpNextServer)) (IN_BSTR aTftpNextServer);
107 STDMETHOD(COMGETTER(TftpNextServer)) (BSTR *aTftpNextServer);
108 /* Alias attributes */
109 STDMETHOD(COMSETTER(AliasMode)) (ULONG aAliasLog);
110 STDMETHOD(COMGETTER(AliasMode)) (ULONG *aAliasLog);
111 /* DNS attributes */
112 STDMETHOD(COMSETTER(DnsPassDomain)) (BOOL aDnsPassDomain);
113 STDMETHOD(COMGETTER(DnsPassDomain)) (BOOL *aDnsPassDomain);
114 STDMETHOD(COMSETTER(DnsProxy)) (BOOL aDnsProxy);
115 STDMETHOD(COMGETTER(DnsProxy)) (BOOL *aDnsProxy);
116 STDMETHOD(COMGETTER(DnsUseHostResolver)) (BOOL *aDnsUseHostResolver);
117 STDMETHOD(COMSETTER(DnsUseHostResolver)) (BOOL aDnsUseHostResolver);
118
119 STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
120 STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
121
122 STDMETHOD(COMGETTER(Redirects)) (ComSafeArrayOut (BSTR, aNatRules));
123 STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
124 STDMETHOD(RemoveRedirect)(IN_BSTR aName);
125
126private:
127 Backupable<Data> mData;
128 bool m_fModified;
129 const ComObjPtr<NATEngine> mPeer;
130 Machine * const mParent;
131 NATRuleMap mNATRules;
132 INetworkAdapter * const mAdapter;
133};
134#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