VirtualBox

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

最後變更 在這個檔案從28787是 28787,由 vboxsync 提交於 15 年 前

NAT: introduces management routines of NAT libalias core. (see xTracker/#4843 for details)

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.6 KB
 
1/* $Id: NATEngineImpl.h 28787 2010-04-27 06:36:48Z 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.alldomusa.eu.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 /* Alias service */
71 ULONG mAliasMode;
72 };
73 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (NATEngine)
74
75 DECLARE_NOT_AGGREGATABLE(NATEngine)
76
77 DECLARE_PROTECT_FINAL_CONSTRUCT()
78
79 BEGIN_COM_MAP(NATEngine)
80 COM_INTERFACE_ENTRY (ISupportErrorInfo)
81 COM_INTERFACE_ENTRY (INATEngine)
82 COM_INTERFACE_ENTRY2 (IDispatch, INATEngine)
83 END_COM_MAP()
84
85 DECLARE_EMPTY_CTOR_DTOR (NATEngine)
86
87 HRESULT FinalConstruct();
88 HRESULT init(Machine *aParent);
89 HRESULT init(Machine *aParent, NATEngine *aThat);
90 HRESULT initCopy(Machine *aParent, NATEngine *aThat);
91 bool isModified();
92 bool isReallyModified();
93 bool rollback();
94 void commit();
95 void uninit();
96 void FinalRelease();
97
98 HRESULT loadSettings(const settings::NAT &data);
99 HRESULT saveSettings(settings::NAT &data);
100
101 STDMETHOD(COMSETTER(Network)) (IN_BSTR aNetwork);
102 STDMETHOD(COMGETTER(Network)) (BSTR *aNetwork);
103 STDMETHOD(COMSETTER(HostIP)) (IN_BSTR aBindIP);
104 STDMETHOD(COMGETTER(HostIP)) (BSTR *aBindIP);
105 /* TFTP attributes */
106 STDMETHOD(COMSETTER(TftpPrefix)) (IN_BSTR aTftpPrefix);
107 STDMETHOD(COMGETTER(TftpPrefix)) (BSTR *aTftpPrefix);
108 STDMETHOD(COMSETTER(TftpBootFile)) (IN_BSTR aTftpBootFile);
109 STDMETHOD(COMGETTER(TftpBootFile)) (BSTR *aTftpBootFile);
110 STDMETHOD(COMSETTER(TftpNextServer)) (IN_BSTR aTftpNextServer);
111 STDMETHOD(COMGETTER(TftpNextServer)) (BSTR *aTftpNextServer);
112 /* Alias attributes */
113 STDMETHOD(COMSETTER(AliasMode)) (ULONG aAliasLog);
114 STDMETHOD(COMGETTER(AliasMode)) (ULONG *aAliasLog);
115 /* DNS attributes */
116 STDMETHOD(COMSETTER(DnsPassDomain)) (BOOL aDnsPassDomain);
117 STDMETHOD(COMGETTER(DnsPassDomain)) (BOOL *aDnsPassDomain);
118 STDMETHOD(COMSETTER(DnsProxy)) (BOOL aDnsProxy);
119 STDMETHOD(COMGETTER(DnsProxy)) (BOOL *aDnsProxy);
120 STDMETHOD(COMGETTER(DnsUseHostResolver)) (BOOL *aDnsUseHostResolver);
121 STDMETHOD(COMSETTER(DnsUseHostResolver)) (BOOL aDnsUseHostResolver);
122
123 STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
124 STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
125
126 STDMETHOD(COMGETTER(Redirects)) (ComSafeArrayOut (BSTR, aNatRules));
127 STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
128 STDMETHOD(RemoveRedirect)(IN_BSTR aName);
129
130 static const wchar_t *getComponentName() { return L"NATEngine"; }
131private:
132 Backupable<Data> mData;
133 bool m_fModified;
134 const ComObjPtr<NATEngine> mPeer;
135 Machine * const mParent;
136 NATRuleMap mNATRules;
137};
138#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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