VirtualBox

source: vbox/trunk/src/VBox/Main/include/NATNetworkImpl.h@ 46284

Last change on this file since 46284 was 45559, checked in by vboxsync, 12 years ago

NAT/Lwip-service: Main client now, dynamic port-forward + managment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: NATNetworkImpl.h 45559 2013-04-16 06:11:59Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2011 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_H_NATNETWORKIMPL
21#define ____H_H_NATNETWORKIMPL
22
23#include "VirtualBoxBase.h"
24
25#ifdef VBOX_WITH_HOSTNETIF_API
26struct NETIFINFO;
27#endif
28
29#ifdef VBOX_WITH_NAT_SERVICE
30# define NAT_XML_SERIALIZATION 1
31#endif
32
33namespace settings
34{
35 struct NATNetwork;
36 struct NATRule;
37}
38
39
40class ATL_NO_VTABLE NATNetwork :
41 public VirtualBoxBase,
42 VBOX_SCRIPTABLE_IMPL(INATNetwork)
43{
44public:
45
46 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATNetwork, INATNetwork)
47
48 DECLARE_NOT_AGGREGATABLE (NATNetwork)
49
50 DECLARE_PROTECT_FINAL_CONSTRUCT()
51
52 BEGIN_COM_MAP (NATNetwork)
53 VBOX_DEFAULT_INTERFACE_ENTRIES(INATNetwork)
54 END_COM_MAP()
55
56 DECLARE_EMPTY_CTOR_DTOR (NATNetwork)
57
58 HRESULT FinalConstruct();
59 void FinalRelease();
60
61 HRESULT init(VirtualBox *aVirtualBox,
62 IN_BSTR aName);
63
64
65 HRESULT init(VirtualBox *aVirtualBox,
66 const settings::NATNetwork &data);
67#ifdef NAT_XML_SERIALIZATION
68 HRESULT saveSettings(settings::NATNetwork &data);
69#endif
70 void uninit();
71 // INATNetwork::EventSource
72 STDMETHOD(COMGETTER(EventSource))(IEventSource **IEventSource);
73 // INATNetwork properties
74 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
75 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
76
77 STDMETHOD(COMGETTER(NetworkName))(BSTR *aName);
78 STDMETHOD(COMSETTER(NetworkName))(IN_BSTR aName);
79
80 STDMETHOD(COMGETTER(Gateway))(BSTR *aIPGateway);
81
82 STDMETHOD(COMGETTER(Network))(BSTR *aIPNetwork);
83 STDMETHOD(COMSETTER(Network))(IN_BSTR aIPNetwork);
84
85 STDMETHOD(COMGETTER(IPv6Enabled))(BOOL *aEnabled);
86 STDMETHOD(COMSETTER(IPv6Enabled))(BOOL aEnabled);
87
88 STDMETHOD(COMGETTER(IPv6Prefix))(BSTR *aName);
89 STDMETHOD(COMSETTER(IPv6Prefix))(IN_BSTR aName);
90
91 STDMETHOD(COMGETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL *aEnabled);
92 STDMETHOD(COMSETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL aEnabled);
93
94 STDMETHOD(COMGETTER(NeedDhcpServer))(BOOL *aEnabled);
95 STDMETHOD(COMSETTER(NeedDhcpServer))(BOOL aEnabled);
96
97 STDMETHOD(COMGETTER(PortForwardRules4))(ComSafeArrayOut(BSTR, aPortForwardRules4));
98 STDMETHOD(COMGETTER(PortForwardRules6))(ComSafeArrayOut(BSTR, aPortForwardRules6));
99
100 STDMETHOD(AddPortForwardRule)(BOOL aIsIpv6,
101 IN_BSTR aPortForwardRuleName,
102 NATProtocol_T aProto,
103 IN_BSTR aHostIp,
104 USHORT aHostPort,
105 IN_BSTR aGuestIp,
106 USHORT aGuestPort);
107 STDMETHOD(RemovePortForwardRule)(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName);
108
109 STDMETHOD(Start)(IN_BSTR aTrunkType);
110 STDMETHOD(Stop)();
111
112private:
113 int RecalculateIpv4AddressAssignments();
114
115 typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
116 typedef NATRuleMap::const_iterator constNATRuleMapIterator;
117
118 void GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules);
119 /** weak VirtualBox parent */
120 VirtualBox * const mVirtualBox;
121
122 const Bstr mName;
123 struct Data;
124 struct Data *m;
125
126};
127
128#endif // ____H_H_NATNETWORKIMPL
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