VirtualBox

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

Last change on this file since 27908 was 27875, checked in by vboxsync, 15 years ago

Main: win build fix.

  • 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 27875 2010-03-31 10:16:46Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_NATDRIVER
25#define ____H_NATDRIVER
26
27
28#include "VirtualBoxBase.h"
29#include <VBox/settings.h>
30
31namespace settings
32{
33 struct NAT;
34}
35
36class ATL_NO_VTABLE NATEngine :
37 public VirtualBoxBase,
38 public VirtualBoxSupportErrorInfoImpl<NATEngine, INATEngine>,
39 public VirtualBoxSupportTranslation<NATEngine>,
40 VBOX_SCRIPTABLE_IMPL(INATEngine)
41{
42 public:
43 typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
44 struct Data
45 {
46 Data(): mMtu(0),
47 mSockRcv(0),
48 mSockSnd(0),
49 mTcpRcv(0),
50 mTcpSnd(0),
51 mDnsPassDomain(TRUE),
52 mDnsProxy(FALSE),
53 mDnsUseHostResolver(FALSE) {}
54
55 com::Utf8Str mNetwork;
56 com::Utf8Str mBindIP;
57 uint32_t mMtu;
58 uint32_t mSockRcv;
59 uint32_t mSockSnd;
60 uint32_t mTcpRcv;
61 uint32_t mTcpSnd;
62 /* TFTP service */
63 Utf8Str mTftpPrefix;
64 Utf8Str mTftpBootFile;
65 Utf8Str mTftpNextServer;
66 /* DNS service */
67 BOOL mDnsPassDomain;
68 BOOL mDnsProxy;
69 BOOL mDnsUseHostResolver;
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 /* DNS attributes */
111 STDMETHOD(COMSETTER(DnsPassDomain)) (BOOL aDnsPassDomain);
112 STDMETHOD(COMGETTER(DnsPassDomain)) (BOOL *aDnsPassDomain);
113 STDMETHOD(COMSETTER(DnsProxy)) (BOOL aDnsProxy);
114 STDMETHOD(COMGETTER(DnsProxy)) (BOOL *aDnsProxy);
115 STDMETHOD(COMGETTER(DnsUseHostResolver)) (BOOL *aDnsUseHostResolver);
116 STDMETHOD(COMSETTER(DnsUseHostResolver)) (BOOL aDnsUseHostResolver);
117
118 STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
119 STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
120
121 STDMETHOD(COMGETTER(Redirects)) (ComSafeArrayOut (BSTR, aNatRules));
122 STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
123 STDMETHOD(RemoveRedirect)(IN_BSTR aName);
124
125 static const wchar_t *getComponentName() { return L"NATEngine"; }
126private:
127 Backupable<Data> mData;
128 bool m_fModified;
129 const ComObjPtr<NATEngine> mPeer;
130 Machine * const mParent;
131 NATRuleMap mNATRules;
132};
133#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