VirtualBox

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

Last change on this file since 47167 was 42551, checked in by vboxsync, 12 years ago

Main: big API naming cleanup, use all caps acronyms everywhere, including SDK docs
Frontends/VBoxManage: implement guestcontrol execute for new API, disabled by default

  • 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 42551 2012-08-02 16:44:39Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2012 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_NATENGINE
21#define ____H_NATENGINE
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