Changeset 27857 in vbox for trunk/src/VBox/Main
- Timestamp:
- Mar 31, 2010 9:02:32 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59541
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r27853 r27857 2531 2531 case NetworkAttachmentType_NAT: 2532 2532 { 2533 ComPtr<INATEngine> natDriver; 2534 hrc = aNetworkAdapter->COMGETTER(NatDriver)(natDriver.asOutParam()); H(); 2533 2535 if (fSniffer) 2534 2536 { … … 2553 2555 STR_FREE(); 2554 2556 2555 hrc = aNetworkAdapter->COMGETTER(NATNetwork)(&str); H(); 2556 if (str && *str) 2557 { 2557 hrc = natDriver->COMGETTER(Network)(&str); H(); 2558 if (str) 2558 2559 rc = CFGMR3InsertStringW(pCfg, "Network", str); RC_CHECK(); 2559 /* NAT uses its own DHCP implementation */2560 //networkName = Bstr(psz);2561 }2562 2560 STR_FREE(); 2561 hrc = natDriver->COMGETTER(HostIP)(&str); H(); 2562 if (str) 2563 { 2564 rc = CFGMR3InsertStringW(pCfg, "BindIP", str); RC_CHECK(); 2565 } 2566 STR_FREE(); 2567 uint32_t mtu = 0; 2568 uint32_t sockSnd = 0; 2569 uint32_t sockRcv = 0; 2570 uint32_t tcpSnd = 0; 2571 uint32_t tcpRcv = 0; 2572 hrc = natDriver->GetNetworkSettings(&mtu, &sockSnd, &sockRcv, &tcpSnd, &tcpRcv); H(); 2573 if (mtu) 2574 { 2575 rc = CFGMR3InsertInteger(pCfg, "SlirpMTU", mtu); RC_CHECK(); 2576 } 2577 if (sockRcv) 2578 { 2579 rc = CFGMR3InsertInteger(pCfg, "SockRcv", sockRcv); RC_CHECK(); 2580 } 2581 if (sockSnd) 2582 { 2583 rc = CFGMR3InsertInteger(pCfg, "SockSnd", sockSnd); RC_CHECK(); 2584 } 2585 if (tcpRcv) 2586 { 2587 rc = CFGMR3InsertInteger(pCfg, "TcpRcv", tcpRcv); RC_CHECK(); 2588 } 2589 if (tcpSnd) 2590 { 2591 rc = CFGMR3InsertInteger(pCfg, "TcpSnd", tcpSnd); RC_CHECK(); 2592 } 2593 STR_FREE(); 2594 hrc = natDriver->COMGETTER(TftpPrefix)(&str); H(); 2595 if (str) 2596 { 2597 rc = CFGMR3RemoveValue(pCfg, "TFTPPrefix"); RC_CHECK(); 2598 rc = CFGMR3InsertStringW(pCfg, "TFTPPrefix", str); RC_CHECK(); 2599 } 2600 STR_FREE(); 2601 hrc = natDriver->COMGETTER(TftpBootFile)(&str); H(); 2602 if (str) 2603 { 2604 rc = CFGMR3RemoveValue(pCfg, "BootFile"); RC_CHECK(); 2605 rc = CFGMR3InsertStringW(pCfg, "BootFile", str); RC_CHECK(); 2606 } 2607 STR_FREE(); 2608 hrc = natDriver->COMGETTER(TftpNextServer)(&str); H(); 2609 if (str) 2610 { 2611 rc = CFGMR3InsertStringW(pCfg, "NextServer", str); RC_CHECK(); 2612 } 2613 BOOL fDnsFlag; 2614 hrc = natDriver->COMGETTER(DnsPassDomain)(&fDnsFlag); H(); 2615 rc = CFGMR3InsertInteger(pCfg, "PassDomain", fDnsFlag); RC_CHECK(); 2616 hrc = natDriver->COMGETTER(DnsProxy)(&fDnsFlag); H(); 2617 rc = CFGMR3InsertInteger(pCfg, "DNSProxy", fDnsFlag); RC_CHECK(); 2618 hrc = natDriver->COMGETTER(DnsUseHostResolver)(&fDnsFlag); H(); 2619 rc = CFGMR3InsertInteger(pCfg, "UseHostResolver", fDnsFlag); RC_CHECK(); 2620 /* port-forwarding */ 2621 SafeArray<BSTR> pfs; 2622 hrc = natDriver->COMGETTER(Redirects)(ComSafeArrayAsOutParam(pfs)); H(); 2623 PCFGMNODE pPF = NULL; /* /Devices/Dev/.../Config/PF#0/ */ 2624 for(unsigned int i = 0; i < pfs.size(); ++i) 2625 { 2626 uint16_t port = 0; 2627 BSTR r = pfs[i]; 2628 Utf8Str utf = Utf8Str(r); 2629 Utf8Str strName; 2630 Utf8Str strProto; 2631 Utf8Str strHostPort; 2632 Utf8Str strHostIP; 2633 Utf8Str strGuestPort; 2634 Utf8Str strGuestIP; 2635 size_t pos, ppos; 2636 pos = ppos = 0; 2637 #define ITERATE_TO_NEXT_TERM(res, str, pos, ppos) \ 2638 do { \ 2639 pos = str.find(",", ppos); \ 2640 if (pos == Utf8Str::npos) \ 2641 { \ 2642 Log(( #res " extracting from %s is failed\n", str.raw())); \ 2643 continue; \ 2644 } \ 2645 res = str.substr(ppos, pos - ppos); \ 2646 Log2((#res " %s pos:%d, ppos:%d\n", res.raw(), pos, ppos)); \ 2647 ppos = pos + 1; \ 2648 }while (0) 2649 ITERATE_TO_NEXT_TERM(strName, utf, pos, ppos); 2650 ITERATE_TO_NEXT_TERM(strProto, utf, pos, ppos); 2651 ITERATE_TO_NEXT_TERM(strHostIP, utf, pos, ppos); 2652 ITERATE_TO_NEXT_TERM(strHostPort, utf, pos, ppos); 2653 ITERATE_TO_NEXT_TERM(strGuestIP, utf, pos, ppos); 2654 strGuestPort = utf.substr(ppos, utf.length() - ppos); 2655 #undef ITERATE_TO_NEXT_TERM 2656 2657 uint32_t proto = strProto.toUInt32(); 2658 bool fValid = true; 2659 switch(proto) 2660 { 2661 case NATProtocol_UDP: 2662 strProto = "UDP"; 2663 break; 2664 case NATProtocol_TCP: 2665 strProto = "TCP"; 2666 break; 2667 default: 2668 fValid = false; 2669 } 2670 /* continue with next rule if no valid proto was passed */ 2671 if (!fValid) 2672 continue; 2673 2674 rc = CFGMR3InsertNode(pCfg, strName.raw(), &pPF); RC_CHECK(); 2675 rc = CFGMR3InsertString(pPF, "Protocol", strProto.raw()); RC_CHECK(); 2676 2677 if (!strHostIP.isEmpty()) 2678 { 2679 rc = CFGMR3InsertString(pPF, "BindIP", strHostIP.raw()); RC_CHECK(); 2680 } 2681 2682 if (!strGuestIP.isEmpty()) 2683 { 2684 rc = CFGMR3InsertString(pPF, "GuestIP", strGuestIP.raw()); RC_CHECK(); 2685 } 2686 2687 port = RTStrToUInt16(strHostPort.raw()); 2688 if (port) 2689 { 2690 rc = CFGMR3InsertInteger(pPF, "HostPort", port); RC_CHECK(); 2691 } 2692 2693 port = RTStrToUInt16(strGuestPort.raw()); 2694 if (port) 2695 { 2696 rc = CFGMR3InsertInteger(pPF, "GuestPort", port); RC_CHECK(); 2697 } 2698 } 2563 2699 break; 2564 2700 } -
trunk/src/VBox/Main/Makefile.kmk
r27829 r27857 305 305 DHCPServerRunner.cpp \ 306 306 GuestOSTypeImpl.cpp \ 307 NATEngineImpl.cpp \ 307 308 NetworkAdapterImpl.cpp \ 308 309 SerialPortImpl.cpp \ -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r27607 r27857 21 21 22 22 #include "NetworkAdapterImpl.h" 23 #include "NATEngineImpl.h" 23 24 #include "AutoCaller.h" 24 25 #include "Logging.h" … … 48 49 HRESULT NetworkAdapter::FinalConstruct() 49 50 { 51 50 52 return S_OK; 51 53 } … … 76 78 77 79 unconst(mParent) = aParent; 80 unconst(mNATEngine).createObject(); 81 mNATEngine->init(aParent); 78 82 /* mPeer is left null */ 79 83 … … 121 125 unconst(mParent) = aParent; 122 126 unconst(mPeer) = aThat; 127 mNATEngine.createObject(); 128 mNATEngine->init(aParent, aThat->mNATEngine); 123 129 124 130 AutoCaller thatCaller (aThat); … … 154 160 /* mPeer is left null */ 155 161 162 unconst(mNATEngine).createObject(); 163 mNATEngine->initCopy(aParent, aThat->mNATEngine); 164 156 165 AutoCaller thatCaller (aThat); 157 166 AssertComRCReturnRC(thatCaller.rc()); … … 181 190 mData.free(); 182 191 192 unconst(mNATEngine).setNull(); 183 193 unconst(mPeer) = NULL; 184 194 unconst(mParent) = NULL; … … 779 789 } 780 790 791 STDMETHODIMP NetworkAdapter::COMGETTER(NatDriver) (INATEngine **aNatDriver) 792 { 793 CheckComArgOutPointerValid(aNatDriver); 794 795 AutoCaller autoCaller(this); 796 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 797 798 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 799 800 mNATEngine.queryInterfaceTo(aNatDriver); 801 802 return S_OK; 803 } 804 781 805 // INetworkAdapter methods 782 806 //////////////////////////////////////////////////////////////////////////////// … … 1056 1080 { 1057 1081 case NetworkAttachmentType_NAT: 1058 m Data->mNATNetwork = data.strName;1082 mNATEngine->loadSettings(data.nat); 1059 1083 rc = AttachToNAT(); 1060 1084 if (FAILED(rc)) return rc; … … 1132 1156 1133 1157 case NetworkAttachmentType_NAT: 1134 data.strName = mData->mNATNetwork; 1158 mNATEngine->commit(); 1159 mNATEngine->saveSettings(data.nat); 1135 1160 break; 1136 1161 … … 1158 1183 * @return 1159 1184 */ 1160 bool NetworkAdapter::isModified() 1161 { 1162 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1163 return m_fModified; 1185 bool NetworkAdapter::isModified() { 1186 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1187 bool fChanged = m_fModified; 1188 fChanged |= (mData->mAdapterType == NetworkAttachmentType_NAT? mNATEngine->isModified() : false); 1189 return fChanged; 1164 1190 } 1165 1191 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r27822 r27857 11598 11598 </attribute> 11599 11599 11600 <attribute name="natDriver" type="INATEngine" readonly="yes"> 11601 <desc> 11602 Instance of INATEngine allowing NAT network configuration. Active only when 11603 attach to NAT is happend. 11604 </desc> 11605 </attribute> 11606 11600 11607 <method name="attachToNAT"> 11601 11608 <desc> … … 13959 13966 </interface> 13960 13967 13968 <enum 13969 name="NATProtocol" 13970 uuid="e90164be-eb03-11de-94af-fff9b1c1b19f" 13971 > 13972 <desc>Protocols definitions are used for registering port-forward rules.</desc> 13973 <const name="UDP" value="0"> 13974 <desc>port-forwarding uses UDP protocol.</desc> 13975 </const> 13976 <const name="TCP" value="1"> 13977 <desc>port-forwarding uses TCP protocol.</desc> 13978 </const> 13979 </enum> 13980 13981 <interface 13982 name="INATEngine" extends="$unknown" 13983 uuid="4b286616-eb03-11de-b0fb-1701eca42246" 13984 wsmap="managed" 13985 > 13986 <desc>Interface for managing NAT engine: changing attributes and port-forwarding rules.</desc> 13987 <attribute name="network" type="wstring"> 13988 <desc>Defines network attribute of NAT engine (the same value used with built-in dhcp server to fill corresponding fields of DHCP leases).</desc> 13989 </attribute> 13990 <attribute name="hostIP" type="wstring"> 13991 <desc>IP of host interface where to bind all opened sockets 13992 <note> 13993 Note: it doesn't change binding of port forwarding. 13994 </note> 13995 </desc> 13996 </attribute> 13997 <attribute name="tftpPrefix" type="wstring"> 13998 <desc>TFTP prefix attribute which used with built-in DHCP server to fill corresponding fields of DHCP leases.</desc> 13999 </attribute> 14000 <attribute name="tftpBootFile" type="wstring"> 14001 <desc>TFTP boot file attribute which used with built-in DHCP server to fill corresponding fields of DHCP leases.</desc> 14002 </attribute> 14003 <attribute name="tftpNextServer" type="wstring"> 14004 <desc>TFTP server attribute which used with built-in DHCP server to fill corresponding fields of DHCP leases. 14005 <note> 14006 Note: prefered form is IPv4 address. 14007 </note> 14008 </desc> 14009 </attribute> 14010 <attribute name="dnsPassDomain" type="boolean"> 14011 <desc>Attribute controls DHCP server behavior to pass or not DNS domain used by host.</desc> 14012 </attribute> 14013 <attribute name="dnsProxy" type="boolean"> 14014 <desc>Attribute controls DHCP server behavior and handling DNS traffic by NAT: to pass or not address of DNS proxy and process traffic using 14015 DNS servers registerd on host.</desc> 14016 </attribute> 14017 <attribute name="dnsUseHostResolver" type="boolean"> 14018 <desc>Attribute controls DHCP server behavior and handling DNS traffic by NAT: to pass or not address of DNS proxy and process traffic using 14019 host resolver mechanism.</desc> 14020 </attribute> 14021 <attribute name="redirects" type="wstring" readonly="yes" safearray="yes"> 14022 <desc>Array of port-forwarding rules in string representaion of following format: "name,protocol id,host ip,host port,guest ip,guest port".</desc> 14023 </attribute> 14024 <method name="setNetworkSettings"> 14025 <desc>Sets network configuration of NAT engine.</desc> 14026 <param name="mtu" type="unsigned long" dir="in"> 14027 <desc>Sets MTU of NAT engine.</desc> 14028 </param> 14029 <param name="sockSnd" type="unsigned long" dir="in"> 14030 <desc>Sets capacity of send buffer of socket used while creating new socket.</desc> 14031 </param> 14032 <param name="sockRcv" type="unsigned long" dir="in"> 14033 <desc>Sets capacity of receive buffer of socket used while creating new socket.</desc> 14034 </param> 14035 <param name="TcpWndSnd" type="unsigned long" dir="in"> 14036 <desc>Sets initial size of sending tcp window used with NAT engine while establishing new TCP connection.</desc> 14037 </param> 14038 <param name="TcpWndRcv" type="unsigned long" dir="in"> 14039 <desc>Sets initial size of receiving tcp window used with NAT engine while establishing new TCP connection.</desc> 14040 </param> 14041 </method> 14042 <method name="getNetworkSettings"> 14043 <desc>Returns network configuration of NAT engine.</desc> 14044 <param name="mtu" type="unsigned long" dir="out"> 14045 <desc>Returns MTU of NAT engine.</desc> 14046 </param> 14047 <param name="sockSnd" type="unsigned long" dir="out"> 14048 <desc>Returns capacity of send buffer of socket used while creating new socket.</desc> 14049 </param> 14050 <param name="sockRcv" type="unsigned long" dir="out"> 14051 <desc>Returns capacity of receive buffer of socket used while creating new socket.</desc> 14052 </param> 14053 <param name="TcpWndSnd" type="unsigned long" dir="out"> 14054 <desc>Returns initial size of sending tcp window used with NAT engine while establishing new TCP connection.</desc> 14055 </param> 14056 <param name="TcpWndRcv" type="unsigned long" dir="out"> 14057 <desc>Returns initial size of receiving tcp window used with NAT engine while establishing new TCP connection.</desc> 14058 </param> 14059 </method> 14060 <method name="addRedirect"> 14061 <desc>Adds port-forwarding rule.</desc> 14062 <param name="name" type="wstring" dir="in"> 14063 <desc>Name of the rule. 14064 <note>Empty name is acceptable. In case of empty name NAT engine generates new name using rest of parameters.</note> 14065 </desc> 14066 </param> 14067 <param name="proto" type="NATProtocol" dir="in"> 14068 <desc>Protocol handled with rule.</desc> 14069 </param> 14070 <param name="hostIp" type="wstring" dir="in"> 14071 <desc>IP of host interface which handled handled with rule. 14072 <note> 14073 Empty ip address is acceptable. In case of empty address NAT engine binds handling socket to any interface. 14074 </note> 14075 </desc> 14076 </param> 14077 <param name="hostPort" type="unsigned short" dir="in"> 14078 <desc>Port number to listen on.</desc> 14079 </param> 14080 <param name="guestIp" type="wstring" dir="in"> 14081 <desc>IP address of the guest where NAT engine will forward packets which have met rule requirement. 14082 <note> 14083 Empty IP address is acceptable. In case of empty IP NAT engine will forward packets to the first DHCP lease (x.x.x.15). 14084 </note> 14085 </desc> 14086 </param> 14087 <param name="guestPort" type="unsigned short" dir="in"> 14088 <desc>Port number to forward.</desc> 14089 </param> 14090 </method> 14091 <method name="removeRedirect"> 14092 <desc>Removes registered port forwarding.</desc> 14093 <param name="name" type="wstring" dir="in"> 14094 <desc>Name of the rule to delete.</desc> 14095 </param> 14096 </method> 14097 </interface> 14098 13961 14099 <module name="VBoxSVC" context="LocalServer"> 13962 14100 <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F" -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r27607 r27857 26 26 27 27 #include "VirtualBoxBase.h" 28 #include "NATEngineImpl.h" 28 29 29 30 class GuestOSType; … … 111 112 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile); 112 113 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile); 114 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver); 113 115 114 116 // INetworkAdapter methods … … 140 142 Machine * const mParent; 141 143 const ComObjPtr<NetworkAdapter> mPeer; 144 const ComObjPtr<NATEngine> mNATEngine; 142 145 143 146 bool m_fModified; -
trunk/src/VBox/Main/xml/Settings.cpp
r27835 r27857 1811 1811 { 1812 1812 nic.mode = NetworkAttachmentType_NAT; 1813 pelmAdapterChild->getAttributeValue("network", nic.strName); // optional network name 1813 pelmAdapterChild->getAttributeValue("network", nic.nat.strNetwork); // optional network name 1814 pelmAdapterChild->getAttributeValue("hostip", nic.nat.strBindIP); 1815 pelmAdapterChild->getAttributeValue("mtu", nic.nat.u32Mtu); 1816 pelmAdapterChild->getAttributeValue("sockrcv", nic.nat.u32SockRcv); 1817 pelmAdapterChild->getAttributeValue("socksnd", nic.nat.u32SockSnd); 1818 pelmAdapterChild->getAttributeValue("tcprcv", nic.nat.u32TcpRcv); 1819 pelmAdapterChild->getAttributeValue("tcpsnd", nic.nat.u32TcpSnd); 1820 const xml::ElementNode *pelmDNS; 1821 if ((pelmDNS = pelmAdapterChild->findChildElement("DNS"))) 1822 { 1823 pelmDNS->getAttributeValue("pass-domain", nic.nat.fDnsPassDomain); 1824 pelmDNS->getAttributeValue("use-proxy", nic.nat.fDnsProxy); 1825 pelmDNS->getAttributeValue("use-host-resolver", nic.nat.fDnsUseHostResolver); 1826 } 1827 const xml::ElementNode *pelmTFTP; 1828 if ((pelmTFTP = pelmAdapterChild->findChildElement("TFTP"))) 1829 { 1830 pelmTFTP->getAttributeValue("prefix", nic.nat.strTftpPrefix); 1831 pelmTFTP->getAttributeValue("boot-file", nic.nat.strTftpBootFile); 1832 pelmTFTP->getAttributeValue("next-server", nic.nat.strTftpNextServer); 1833 } 1834 xml::ElementNodesList plstNatPF; 1835 pelmAdapterChild->getChildElements(plstNatPF, "Forwarding"); 1836 for(xml::ElementNodesList::iterator pf = plstNatPF.begin(); pf != plstNatPF.end(); ++pf) 1837 { 1838 NATRule rule; 1839 uint32_t port = 0; 1840 (*pf)->getAttributeValue("name", rule.strName); 1841 (*pf)->getAttributeValue("proto", rule.u32Proto); 1842 (*pf)->getAttributeValue("hostip", rule.strHostIP); 1843 (*pf)->getAttributeValue("hostport", port); 1844 rule.u16HostPort = port; 1845 (*pf)->getAttributeValue("guestip", rule.strGuestIP); 1846 (*pf)->getAttributeValue("guestport", port); 1847 rule.u16GuestPort = port; 1848 nic.nat.llRules.push_back(rule); 1849 } 1814 1850 } 1815 1851 else if ( ((pelmAdapterChild = pelmAdapter->findChildElement("HostInterface"))) … … 3261 3297 case NetworkAttachmentType_NAT: 3262 3298 pelmNAT = pelmAdapter->createChild("NAT"); 3263 if (nic.strName.length()) 3264 pelmNAT->setAttribute("network", nic.strName); 3299 if (nic.nat.strNetwork.length()) 3300 pelmNAT->setAttribute("network", nic.nat.strNetwork); 3301 if (m->sv >= SettingsVersion_v1_10) 3302 { 3303 if (nic.nat.strBindIP.length()) 3304 pelmNAT->setAttribute("hostip", nic.nat.strBindIP); 3305 if (nic.nat.u32Mtu) 3306 pelmNAT->setAttribute("mtu", nic.nat.u32Mtu); 3307 if (nic.nat.u32SockRcv) 3308 pelmNAT->setAttribute("sockrcv", nic.nat.u32SockRcv); 3309 if (nic.nat.u32SockSnd) 3310 pelmNAT->setAttribute("socksnd", nic.nat.u32SockSnd); 3311 if (nic.nat.u32TcpRcv) 3312 pelmNAT->setAttribute("tcprcv", nic.nat.u32TcpRcv); 3313 if (nic.nat.u32TcpSnd) 3314 pelmNAT->setAttribute("tcpsnd", nic.nat.u32TcpSnd); 3315 xml::ElementNode *pelmDNS; 3316 pelmDNS = pelmNAT->createChild("DNS"); 3317 pelmDNS->setAttribute("pass-domain", nic.nat.fDnsPassDomain); 3318 pelmDNS->setAttribute("use-proxy", nic.nat.fDnsProxy); 3319 pelmDNS->setAttribute("use-host-resolver", nic.nat.fDnsUseHostResolver); 3320 if ( nic.nat.strTftpPrefix.length() 3321 || nic.nat.strTftpBootFile.length() 3322 || nic.nat.strTftpNextServer.length()) 3323 { 3324 xml::ElementNode *pelmTFTP; 3325 pelmTFTP = pelmNAT->createChild("TFTP"); 3326 if (nic.nat.strTftpPrefix.length()) 3327 pelmTFTP->setAttribute("prefix", nic.nat.strTftpPrefix); 3328 if (nic.nat.strTftpBootFile.length()) 3329 pelmTFTP->setAttribute("boot-file", nic.nat.strTftpBootFile); 3330 if (nic.nat.strTftpNextServer.length()) 3331 pelmTFTP->setAttribute("next-server", nic.nat.strTftpNextServer); 3332 } 3333 for(NATRuleList::const_iterator rule = nic.nat.llRules.begin(); 3334 rule != nic.nat.llRules.end(); ++rule) 3335 { 3336 xml::ElementNode *pelmPF; 3337 pelmPF = pelmNAT->createChild("Forwarding"); 3338 if ((*rule).strName.length()) 3339 pelmPF->setAttribute("name", (*rule).strName); 3340 pelmPF->setAttribute("proto", (*rule).u32Proto); 3341 if ((*rule).strHostIP.length()) 3342 pelmPF->setAttribute("hostip", (*rule).strHostIP); 3343 if ((*rule).u16HostPort) 3344 pelmPF->setAttribute("hostport", (*rule).u16HostPort); 3345 if ((*rule).strGuestIP.length()) 3346 pelmPF->setAttribute("guestip", (*rule).strGuestIP); 3347 if ((*rule).u16GuestPort) 3348 pelmPF->setAttribute("guestport", (*rule).u16GuestPort); 3349 } 3350 } 3265 3351 break; 3266 3352 … … 3738 3824 ) 3739 3825 m->sv = SettingsVersion_v1_10; 3740 3826 // VirtualBox 3.2 adds NAT Main 3827 if (m->sv < SettingsVersion_v1_10) 3828 { 3829 NetworkAdaptersList::const_iterator netit; 3830 for (netit = hardwareMachine.llNetworkAdapters.begin(); 3831 netit != hardwareMachine.llNetworkAdapters.end(); ++netit) 3832 if ( netit->fEnabled 3833 && netit->mode == NetworkAttachmentType_NAT 3834 && ( netit->nat.u32Mtu != 0 3835 || netit->nat.u32SockRcv != 0 3836 || netit->nat.u32SockSnd != 0 3837 || netit->nat.u32TcpRcv != 0 3838 || netit->nat.u32TcpSnd != 0 3839 || !netit->nat.fDnsPassDomain 3840 || netit->nat.fDnsProxy 3841 || netit->nat.fDnsUseHostResolver 3842 || netit->nat.strTftpPrefix.length() 3843 || netit->nat.strTftpBootFile.length() 3844 || netit->nat.strTftpNextServer.length() 3845 || netit->nat.llRules.size()) 3846 ) 3847 { 3848 m->sv = SettingsVersion_v1_10; 3849 break; 3850 } 3851 } 3741 3852 // Check for non default I/O settings and bump the settings version. 3742 3853 if (m->sv < SettingsVersion_v1_10) -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r27820 r27857 687 687 <xsd:attribute name="network" type="xsd:string"/> 688 688 </xsd:complexType> 689 <xsd:complexType> 690 <xsd:attribute name="hostip" type="xsd:string"/> 691 </xsd:complexType> 692 <xsd:complexType> 693 <xsd:attribute name="mtu" type="xsd:unsignedInt"/> 694 </xsd:complexType> 695 <xsd:complexType> 696 <xsd:attribute name="sockrcv" type="xsd:unsignedInt"/> 697 </xsd:complexType> 698 <xsd:complexType> 699 <xsd:attribute name="socksnd" type="xsd:unsignedInt"/> 700 </xsd:complexType> 701 <xsd:complexType> 702 <xsd:attribute name="tcprcv" type="xsd:unsignedInt"/> 703 </xsd:complexType> 704 <xsd:complexType> 705 <xsd:attribute name="tcpsnd" type="xsd:unsignedInt"/> 706 </xsd:complexType> 707 <xsd:element name="DNS"> 708 <xsd:complexType> 709 <xsd:attribute name="pass-domain" type="xsd:boolean"/> 710 </xsd:complexType> 711 <xsd:complexType> 712 <xsd:attribute name="use-proxy" type="xsd:boolean"/> 713 </xsd:complexType> 714 <xsd:complexType> 715 <xsd:attribute name="use-host-resolver" type="xsd:boolean"/> 716 </xsd:complexType> 717 </xsd:element> 718 <xsd:element name="TFTP"> 719 <xsd:complexType> 720 <xsd:attribute name="prefix" type="xsd:string"/> 721 </xsd:complexType> 722 <xsd:complexType> 723 <xsd:attribute name="boot-file" type="xsd:string"/> 724 </xsd:complexType> 725 <xsd:complexType> 726 <xsd:attribute name="next-server" type="xsd:string"/> 727 </xsd:complexType> 728 </xsd:element> 729 <xsd:element name="Forwarding"> 730 <xsd:complexType> 731 <xsd:attribute name="name" type="xsd:string"/> 732 </xsd:complexType> 733 <xsd:complexType> 734 <xsd:attribute name="proto" type="xsd:unsignedInt"/> 735 </xsd:complexType> 736 <xsd:complexType> 737 <xsd:attribute name="hostip" type="xsd:string"/> 738 </xsd:complexType> 739 <xsd:complexType> 740 <xsd:attribute name="hostport" type="xsd:unsignedInt"/> 741 </xsd:complexType> 742 <xsd:complexType> 743 <xsd:attribute name="guestip" type="xsd:string"/> 744 </xsd:complexType> 745 <xsd:complexType> 746 <xsd:attribute name="guestport" type="xsd:unsignedInt"/> 747 </xsd:complexType> 748 </xsd:element> 689 749 </xsd:element> 690 750 <xsd:element name="HostInterface"> -
trunk/src/VBox/Main/xpcom/module.cpp
r25860 r27857 44 44 #include "ProgressImpl.h" 45 45 #include "NetworkAdapterImpl.h" 46 #include "NATEngineImpl.h" 46 47 47 48 #include "SessionImpl.h" -
trunk/src/VBox/Main/xpcom/server.cpp
r26517 r27857 77 77 #include <GuestOSTypeImpl.h> 78 78 #include <NetworkAdapterImpl.h> 79 #include <NATEngineImpl.h> 79 80 #include <SerialPortImpl.h> 80 81 #include <ParallelPortImpl.h> … … 153 154 NS_DECL_CLASSINFO(NetworkAdapter) 154 155 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NetworkAdapter, INetworkAdapter) 156 157 NS_DECL_CLASSINFO(NATEngine) 158 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATEngine, INATEngine) 159 155 160 156 161 NS_DECL_CLASSINFO(SerialPort)
Note:
See TracChangeset
for help on using the changeset viewer.