Changeset 48538 in vbox
- Timestamp:
- Sep 19, 2013 3:17:43 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89083
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r48406 r48538 202 202 return (strLoopbackHostAddress == strAddr); 203 203 } 204 204 205 205 bool operator == (uint32_t off) 206 206 { … … 595 595 com::Utf8Str strGenericDriver; 596 596 StringsMap genericProperties; 597 com::Utf8Str strNATNetworkName; 597 598 uint32_t ulBootPriority; 598 599 com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r48406 r48538 761 761 CHECK_ERROR_RET(adapter, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic), 1); 762 762 } 763 else if (!strcmp(a->argv[2], "natnetwork")) 764 { 765 if (a->argc <= 3) 766 { 767 errorArgument("Missing argument to '%s'", a->argv[2]); 768 rc = E_FAIL; 769 break; 770 } 771 CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1); 772 CHECK_ERROR_RET(adapter, COMSETTER(NATNetwork)(Bstr(a->argv[3]).raw()), 1); 773 CHECK_ERROR_RET(adapter, COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork), 1); 774 } 763 775 /** @todo obsolete, remove eventually */ 764 776 else if (!strcmp(a->argv[2], "vde")) … … 1458 1470 break; 1459 1471 } 1460 1472 1461 1473 } 1462 1474 else -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r48429 r48538 123 123 "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n" 124 124 #if defined(VBOX_WITH_NETFLT) 125 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"125 " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n" 126 126 #else 127 " bridgedifs|dhcpservers|hostinfo|\n"128 #endif 129 " host cpuids|hddbackends|hdds|dvds|floppies|\n"127 " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n" 128 #endif 129 " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n" 130 130 " usbhost|usbfilters|systemproperties|extpacks|\n" 131 131 " groups\n" … … 217 217 #endif 218 218 "|\n" 219 " generic "219 " generic|natnetwork" 220 220 "]\n" 221 221 " [--nictype<1-N> Am79C970A|Am79C973" … … 240 240 #endif 241 241 " [--intnet<1-N> <network name>]\n" 242 " [--nat-network<1-N> <network name>]\n" 243 " [--nicgenericdrv<1-N> <driver>\n" 242 244 " [--natnet<1-N> <network>|default]\n" 243 " [--nicgenericdrv<1-N> <driver>\n"244 245 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n" 245 246 " [<sockrcv>],[<tcpsnd>],\n" … … 440 441 " setlinkstate<1-N> on|off |\n" 441 442 #if defined(VBOX_WITH_NETFLT) 442 " nic<1-N> null|nat|bridged|intnet|hostonly|generic" 443 "\n" 444 " [<devicename>] |\n" 443 " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n" 444 " natnetwork [<devicename>] |\n" 445 445 #else /* !VBOX_WITH_NETFLT */ 446 " nic<1-N> null|nat|bridged|intnet|generic \n"446 " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n" 447 447 " [<devicename>] |\n" 448 448 #endif /* !VBOX_WITH_NETFLT */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r47991 r48538 1073 1073 break; 1074 1074 } 1075 1075 1076 case NetworkAttachmentType_Generic: 1076 1077 { … … 1103 1104 break; 1104 1105 } 1106 1107 case NetworkAttachmentType_NATNetwork: 1108 { 1109 Bstr strNetwork; 1110 nic->COMGETTER(NATNetwork)(strNetwork.asOutParam()); 1111 if (details == VMINFO_MACHINEREADABLE) 1112 { 1113 RTPrintf("nat-network%d=\"%ls\"\n", currentNIC + 1, strNetwork.raw()); 1114 strAttachment = "natnetwork"; 1115 } 1116 else 1117 strAttachment = Utf8StrFmt("NAT Network '%s'", Utf8Str(strNetwork).c_str()); 1118 break; 1119 } 1120 1105 1121 default: 1106 1122 strAttachment = "unknown"; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r48097 r48538 76 76 77 77 /** 78 * List internal networks. 79 * 80 * @returns See produceList. 81 * @param pVirtualBox Reference to the IVirtualBox smart pointer. 82 */ 83 static HRESULT listInternalNetworks(const ComPtr<IVirtualBox> pVirtualBox) 84 { 85 HRESULT rc; 86 com::SafeArray<BSTR> internalNetworks; 87 CHECK_ERROR(pVirtualBox, COMGETTER(InternalNetworks)(ComSafeArrayAsOutParam(internalNetworks))); 88 for (size_t i = 0; i < internalNetworks.size(); ++i) 89 { 90 RTPrintf("Name: %ls\n", internalNetworks[i]); 91 } 92 return rc; 93 } 94 95 96 /** 78 97 * List network interfaces information (bridged/host only). 79 98 * 80 99 * @returns See produceList. 81 100 * @param pVirtualBox Reference to the IVirtualBox smart pointer. 101 * @param fIsBridged Selects between listing host interfaces (for 102 * use with bridging) or host only interfaces. 82 103 */ 83 104 static HRESULT listNetworkInterfaces(const ComPtr<IVirtualBox> pVirtualBox, … … 283 304 284 305 /* File extensions */ 285 com::SafeArray 286 com::SafeArray 306 com::SafeArray<BSTR> fileExtensions; 307 com::SafeArray<DeviceType_T> deviceTypes; 287 308 CHECK_ERROR(mediumFormats[i], 288 309 DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes))); … … 296 317 297 318 /* Configuration keys */ 298 com::SafeArray 299 com::SafeArray 300 com::SafeArray 301 com::SafeArray 302 com::SafeArray 319 com::SafeArray<BSTR> propertyNames; 320 com::SafeArray<BSTR> propertyDescriptions; 321 com::SafeArray<DataType_T> propertyTypes; 322 com::SafeArray<ULONG> propertyFlags; 323 com::SafeArray<BSTR> propertyDefaults; 303 324 CHECK_ERROR(mediumFormats[i], 304 325 DescribeProperties(ComSafeArrayAsOutParam(propertyNames), … … 722 743 kListHostDvds, 723 744 kListHostFloppies, 745 kListInternalNetworks, 724 746 kListBridgedInterfaces, 725 747 #if defined(VBOX_WITH_NETFLT) … … 894 916 } 895 917 918 case kListInternalNetworks: 919 rc = listInternalNetworks(pVirtualBox); 920 break; 921 896 922 case kListBridgedInterfaces: 897 923 #if defined(VBOX_WITH_NETFLT) … … 1038 1064 net->COMGETTER(Enabled)(&fEnabled); 1039 1065 RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No"); 1040 1066 1041 1067 #define PRINT_STRING_ARRAY(title) \ 1042 1068 if (strs.size() > 0) \ … … 1046 1072 for (;j < strs.size(); ++j) \ 1047 1073 RTPrintf(" %s\n", Utf8Str(strs[j]).c_str()); \ 1048 } 1074 } 1049 1075 1050 1076 com::SafeArray<BSTR> strs; … … 1096 1122 { "hostdvds", kListHostDvds, RTGETOPT_REQ_NOTHING }, 1097 1123 { "hostfloppies", kListHostFloppies, RTGETOPT_REQ_NOTHING }, 1124 { "intnets", kListInternalNetworks, RTGETOPT_REQ_NOTHING }, 1098 1125 { "hostifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, /* backward compatibility */ 1099 1126 { "bridgedifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, … … 1101 1128 { "hostonlyifs", kListHostOnlyInterfaces, RTGETOPT_REQ_NOTHING }, 1102 1129 #endif 1130 { "natnetworks", kListNatNetworks, RTGETOPT_REQ_NOTHING }, 1131 { "natnets", kListNatNetworks, RTGETOPT_REQ_NOTHING }, 1103 1132 { "hostinfo", kListHostInfo, RTGETOPT_REQ_NOTHING }, 1104 1133 { "hostcpuids", kListHostCpuIDs, RTGETOPT_REQ_NOTHING }, … … 1113 1142 { "extpacks", kListExtPacks, RTGETOPT_REQ_NOTHING }, 1114 1143 { "groups", kListGroups, RTGETOPT_REQ_NOTHING }, 1115 { "natnetworks", kListNatNetworks, RTGETOPT_REQ_NOTHING },1116 1144 }; 1117 1145 … … 1141 1169 case kListHostDvds: 1142 1170 case kListHostFloppies: 1171 case kListInternalNetworks: 1143 1172 case kListBridgedInterfaces: 1144 1173 #if defined(VBOX_WITH_NETFLT) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r48406 r48538 113 113 MODIFYVM_HOSTONLYADAPTER, 114 114 MODIFYVM_INTNET, 115 MODIFYVM_GENERICDRV, 116 MODIFYVM_NATNETWORKNAME, 115 117 MODIFYVM_NATNET, 116 MODIFYVM_GENERICDRV,117 118 MODIFYVM_NATBINDIP, 118 119 MODIFYVM_NATSETTINGS, … … 273 274 { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 274 275 { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 276 { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 277 { "--nat-network", MODIFYVM_NATNETWORKNAME, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 278 { "--natnetwork", MODIFYVM_NATNETWORKNAME, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 275 279 { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 276 { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },277 280 { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 278 281 { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, … … 1409 1412 CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic)); 1410 1413 } 1414 else if (!RTStrICmp(ValueUnion.psz, "natnetwork")) 1415 { 1416 1417 CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE)); 1418 CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork)); 1419 } 1411 1420 else 1412 1421 { … … 1493 1502 1494 1503 CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw())); 1504 break; 1505 } 1506 1507 case MODIFYVM_NATNETWORKNAME: 1508 { 1509 ComPtr<INetworkAdapter> nic; 1510 1511 CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam())); 1512 ASSERT(nic); 1513 1514 CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz).raw())); 1495 1515 break; 1496 1516 } -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
r48537 r48538 7 7 8 8 /* 9 * Copyright (C) 2012 Oracle Corporation9 * Copyright (C) 2012-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 290 290 case KNetworkAttachmentType_HostOnly: return QApplication::translate("VBoxGlobal", "Host-only Adapter", "NetworkAttachmentType"); 291 291 case KNetworkAttachmentType_Generic: return QApplication::translate("VBoxGlobal", "Generic Driver", "NetworkAttachmentType"); 292 case KNetworkAttachmentType_NATNetwork: return QApplication::translate("VBoxGlobal", "NAT Network", "NetworkAttachmentType"); 292 293 default: AssertMsgFailed(("No text for %d", type)); break; 293 294 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r48534 r48538 1397 1397 attType = attType.arg (tr ("Generic, '%1'", 1398 1398 "details report (network)").arg (adapter.GetGenericDriver())); 1399 else if (type == KNetworkAttachmentType_NATNetwork) 1400 attType = attType.arg (tr ("NAT network, '%1'", 1401 "details report (network)").arg (adapter.GetNATNetwork())); 1399 1402 else 1400 1403 attType = attType.arg (gpConverter->toString (type)); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r48314 r48538 677 677 break; 678 678 } 679 case KNetworkAttachmentType_NATNetwork: 680 { 681 strAttachmentType = strAttachmentType.arg(QApplication::translate("UIGDetails", "NAT Network, '%1'", "details (network)") 682 .arg(adapter.GetNATNetwork())); 683 break; 684 } 679 685 default: 680 686 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r47944 r48538 7 7 8 8 /* 9 * Copyright (C) 2008-201 2Oracle Corporation9 * Copyright (C) 2008-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 #include "CNATEngine.h" 31 31 #include "CHostNetworkInterface.h" 32 #include "CNATNetwork.h" 32 33 33 34 /* Other VBox includes: */ … … 142 143 adapterData.m_strGenericProperties = m_pGenericPropertiesTextEdit->toPlainText(); 143 144 break; 145 case KNetworkAttachmentType_NATNetwork: 146 adapterData.m_strNATNetworkName = alternativeName(); 147 break; 144 148 default: 145 149 break; … … 211 215 { 212 216 message.second << tr("No generic driver is currently selected."); 217 fPass = false; 218 } 219 break; 220 } 221 case KNetworkAttachmentType_NATNetwork: 222 { 223 if (alternativeName().isNull()) 224 { 225 message.second << tr("No NAT network name is currently specified."); 213 226 fPass = false; 214 227 } … … 289 302 case KNetworkAttachmentType_Generic: 290 303 strResult = m_strGenericDriverName; 304 break; 305 case KNetworkAttachmentType_NATNetwork: 306 strResult = m_strNATNetworkName; 291 307 break; 292 308 default: … … 420 436 break; 421 437 } 438 case KNetworkAttachmentType_NATNetwork: 439 { 440 m_pAdapterNameCombo->setWhatsThis(tr("Enter the name of the NAT network that this network card " 441 "will be connected to. You can create and remove adapters " 442 "using the global network settings in the virtual machine " 443 "manager window.")); 444 m_pAdapterNameCombo->setEditable(true); 445 break; 446 } 422 447 default: 423 448 { … … 480 505 emit sigTabUpdated(); 481 506 } 507 break; 508 } 509 case KNetworkAttachmentType_NATNetwork: 510 { 511 QString newName(m_pAdapterNameCombo->itemData(m_pAdapterNameCombo->currentIndex()).toString() == QString(pEmptyItemCode) || 512 m_pAdapterNameCombo->currentText().isEmpty() ? QString() : m_pAdapterNameCombo->currentText()); 513 if (m_strNATNetworkName != newName) 514 m_strNATNetworkName = newName; 482 515 break; 483 516 } … … 560 593 m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Generic)); 561 594 m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Generic); 595 m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole); 596 ++iAttachmentTypeIndex; 597 m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_NATNetwork)); 598 m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_NATNetwork); 562 599 m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole); 563 600 ++iAttachmentTypeIndex; … … 659 696 m_pAdapterNameCombo->insertItems(0, m_pParent->genericDriverList()); 660 697 break; 698 case KNetworkAttachmentType_NATNetwork: 699 m_pAdapterNameCombo->insertItems(0, m_pParent->natNetworkList()); 700 break; 661 701 default: 662 702 break; … … 670 710 case KNetworkAttachmentType_Bridged: 671 711 case KNetworkAttachmentType_HostOnly: 712 case KNetworkAttachmentType_NATNetwork: 672 713 { 673 714 /* If adapter list is empty => add 'Not selected' item: */ … … 706 747 case KNetworkAttachmentType_HostOnly: 707 748 case KNetworkAttachmentType_Generic: 749 case KNetworkAttachmentType_NATNetwork: 708 750 { 709 751 m_pAdapterNameCombo->setCurrentIndex(position(m_pAdapterNameCombo, alternativeName())); … … 770 812 refreshHostInterfaceList(); 771 813 refreshGenericDriverList(true); 814 refreshNATNetworkList(); 772 815 773 816 /* For each network adapter: */ … … 917 960 updateGenericProperties(adapter, adapterData.m_strGenericProperties); 918 961 break; 962 case KNetworkAttachmentType_NATNetwork: 963 adapter.SetNATNetwork(adapterData.m_strNATNetworkName); 964 break; 919 965 default: 920 966 break; … … 1091 1137 } 1092 1138 1139 void UIMachineSettingsNetworkPage::refreshNATNetworkList() 1140 { 1141 /* Reload NAT network list: */ 1142 m_natNetworkList.clear(); 1143 const CNATNetworkVector &nws = vboxGlobal().virtualBox().GetNATNetworks(); 1144 for (int i = 0; i < nws.size(); ++i) 1145 { 1146 const CNATNetwork &nw = nws[i]; 1147 m_natNetworkList << nw.GetNetworkName(); 1148 } 1149 } 1150 1093 1151 /* static */ 1094 1152 QStringList UIMachineSettingsNetworkPage::otherInternalNetworkList() -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r47944 r48538 6 6 7 7 /* 8 * Copyright (C) 2008-201 2Oracle Corporation8 * Copyright (C) 2008-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 , m_strGenericDriverName(QString()) 45 45 , m_strGenericProperties(QString()) 46 , m_strNATNetworkName(QString()) 46 47 , m_strMACAddress(QString()) 47 48 , m_fCableConnected(false) … … 60 61 (m_strGenericDriverName == other.m_strGenericDriverName) && 61 62 (m_strGenericProperties == other.m_strGenericProperties) && 63 (m_strNATNetworkName == other.m_strNATNetworkName) && 62 64 (m_strMACAddress == other.m_strMACAddress) && 63 65 (m_fCableConnected == other.m_fCableConnected) && … … 78 80 QString m_strGenericDriverName; 79 81 QString m_strGenericProperties; 82 QString m_strNATNetworkName; 80 83 QString m_strMACAddress; 81 84 bool m_fCableConnected; … … 165 168 QString m_strHostInterfaceName; 166 169 QString m_strGenericDriverName; 170 QString m_strNATNetworkName; 167 171 UIPortForwardingDataList m_portForwardingRules; 168 172 }; … … 186 190 /* Generic driver list: */ 187 191 const QStringList& genericDriverList() const { return m_genericDriverList; } 192 /* NAT network list: */ 193 const QStringList& natNetworkList() const { return m_natNetworkList; } 188 194 189 195 protected: … … 225 231 void refreshHostInterfaceList(); 226 232 void refreshGenericDriverList(bool fFullRefresh = false); 233 void refreshNATNetworkList(); 227 234 228 235 /* Various static stuff: */ … … 240 247 QStringList m_hostInterfaceList; 241 248 QStringList m_genericDriverList; 249 QStringList m_natNetworkList; 242 250 243 251 /* Cache: */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r48505 r48538 1383 1383 ///////////////////////////////////////////////////////////////////////// 1384 1384 --> 1385 <!-- This is experimental interface to LWIP based NAT server --> 1385 1386 1386 <interface name="INATNetwork" extends="$unknown" 1387 1387 uuid="a63c75da-4c99-4e9d-8351-eb73651c18cc" … … 2586 2586 <!-- Here we create a record in NAT network array with name 2587 2587 and gateway/network parameters this information should 2588 be enough for VBoxNet [Lwip]NAT and VBoxNetDHCP for2588 be enough for VBoxNetNAT and VBoxNetDHCP for 2589 2589 servicing the guests. 2590 2590 --> … … 4122 4122 <interface 4123 4123 name="IMachine" extends="$unknown" 4124 uuid=" 8c931034-83f6-46b8-97f0-31e70d30402e"4124 uuid="7108c7c7-2c0a-47ee-9c69-022fe2a466bf" 4125 4125 wsmap="managed" 4126 4126 > … … 4548 4548 </attribute> 4549 4549 4550 <attribute name="settingsFilePath" type="wstring" >4550 <attribute name="settingsFilePath" type="wstring" readonly="yes"> 4551 4551 <desc> 4552 4552 Full name of the file containing machine settings data. 4553 4554 Currently, it is an error to change this property on any machine.4555 Later this will allow setting a new path for the settings file, with4556 automatic relocation of all files (including snapshots and disk images)4557 which are inside the base directory.4558 4559 <note>4560 Setting this property to @c null or to an empty string is forbidden.4561 </note>4562 <note>4563 When setting this property, the specified path must be absolute. When4564 reading this property, an absolute (full) path is always returned.4565 </note>4566 <note>4567 The specified path may not exist, it will be created when necessary.4568 </note>4569 4553 </desc> 4570 4554 </attribute> … … 6313 6297 New property value. 6314 6298 </desc> 6299 </param> 6300 </method> 6301 6302 <method name="setSettingsFilePath"> 6303 <desc> 6304 Currently, it is an error to change this property on any machine. 6305 Later this will allow setting a new path for the settings file, with 6306 automatic relocation of all files (including snapshots and disk images) 6307 which are inside the base directory. This operation is only allowed 6308 when there are no pending unsaved settings. 6309 6310 <note> 6311 Setting this property to @c null or to an empty string is forbidden. 6312 When setting this property, the specified path must be absolute. 6313 The specified path may not exist, it will be created when necessary. 6314 </note> 6315 6316 <result name="E_NOTIMPL"> 6317 The operation is not implemented yet. 6318 </result> 6319 </desc> 6320 6321 <param name="settingsFilePath" type="wstring" dir="in"> 6322 <desc>New settings file path, will be used to determine the new 6323 location for the attached media if it is in the same directory or 6324 below as the original settings file.</desc> 6325 </param> 6326 <param name="progress" type="IProgress" dir="return"> 6327 <desc>Progress object to track the operation completion.</desc> 6315 6328 </param> 6316 6329 </method> … … 13045 13058 <interface 13046 13059 name="IMedium" extends="$unknown" 13047 uuid=" 8df5fc17-503a-4171-85bc-039b6f24d86b"13060 uuid="05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac" 13048 13061 wsmap="managed" 13049 13062 > … … 13259 13272 </attribute> 13260 13273 13261 <attribute name="location" type="wstring" >13274 <attribute name="location" type="wstring" readonly="yes"> 13262 13275 <desc> 13263 13276 Location of the storage unit holding medium data. … … 13266 13279 types using regular files in a host's file system, the location 13267 13280 string is the full file name. 13268 13269 Some medium types may support changing the storage unit location by13270 simply changing the value of this property. If this operation is not13271 supported, the implementation will return E_NOTIMPL in attempt to set13272 this attribute's value.13273 13274 When setting a value of the location attribute which is a regular file13275 in the host's file system, the given file name may be either relative to13276 the <link to="IVirtualBox::homeFolder">VirtualBox home folder</link> or13277 absolute. Note that if the given location specification does not contain13278 the file extension part then a proper default extension will be13279 automatically appended by the implementation depending on the medium type.13280 13281 </desc> 13281 13282 </attribute> … … 14186 14187 <!-- other methods --> 14187 14188 14189 <method name="setLocation"> 14190 <desc> 14191 Changes the location of this medium. Some medium types may support 14192 changing the storage unit location by simply changing the value of the 14193 associated property. In this case the operation is performed 14194 immediately, and @a progress is returning a @c null reference. 14195 Otherwise on success there is a progress object returned, which 14196 signals progress and completion of the operation. This distinction is 14197 necessary because for some formats the operation is very fast, while 14198 for others it can be very slow (moving the image file by copying all 14199 data), and in the former case it'd be a waste of resources to create 14200 a progress object which will immediately signal completion. 14201 14202 When setting a location for a medium which corresponds to a/several 14203 regular file(s) in the host's file system, the given file name may be 14204 either relative to the <link to="IVirtualBox::homeFolder">VirtualBox 14205 home folder</link> or absolute. Note that if the given location 14206 specification does not contain the file extension part then a proper 14207 default extension will be automatically appended by the implementation 14208 depending on the medium type. 14209 14210 <result name="E_NOTIMPL"> 14211 The operation is not implemented yet. 14212 </result> 14213 <result name="VBOX_E_NOT_SUPPORTED"> 14214 Medium format does not support changing the location. 14215 </result> 14216 </desc> 14217 <param name="location" type="wstring" dir="in"> 14218 <desc>New location.</desc> 14219 </param> 14220 <param name="progress" type="IProgress" dir="return"> 14221 <desc>Progress object to track the operation completion.</desc> 14222 </param> 14223 </method> 14224 14188 14225 <method name="compact"> 14189 14226 <desc> … … 15651 15688 <enum 15652 15689 name="NetworkAttachmentType" 15653 uuid=" 2ac4bc71-6b82-417a-acd1-f7426d2570d6"15690 uuid="524a8f9d-4b86-4b51-877d-1aa27c4ebeac" 15654 15691 > 15655 15692 <desc> … … 15665 15702 <const name="HostOnly" value="4"/> 15666 15703 <const name="Generic" value="5"/> 15704 <const name="NATNetwork" value="6"/> 15667 15705 </enum> 15668 15706 -
trunk/src/VBox/Main/include/MachineImpl.h
r48505 r48538 457 457 STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters); 458 458 STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath); 459 STDMETHOD(COMSETTER(SettingsFilePath))(IN_BSTR aFilePath);460 459 STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified); 461 460 STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState); … … 568 567 STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal); 569 568 STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal); 569 STDMETHOD(SetSettingsFilePath)(IN_BSTR aFilePath, IProgress **aProgress); 570 570 STDMETHOD(SaveSettings)(); 571 571 STDMETHOD(DiscardSettings)(); -
trunk/src/VBox/Main/include/MediumImpl.h
r48297 r48538 106 106 STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant)); 107 107 STDMETHOD(COMGETTER(Location))(BSTR *aLocation); 108 STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);109 108 STDMETHOD(COMGETTER(Name))(BSTR *aName); 110 109 STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType); … … 154 153 STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant), 155 154 IProgress **aProgress); 155 STDMETHOD(SetLocation)(IN_BSTR aLocation, IProgress **aProgress); 156 156 STDMETHOD(Compact)(IProgress **aProgress); 157 157 STDMETHOD(Resize)(LONG64 aLogicalSize, IProgress **aProgress); -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r48528 r48538 4857 4857 } 4858 4858 4859 case NetworkAttachmentType_NATNetwork: 4860 { 4861 hrc = aNetworkAdapter->COMGETTER(NATNetwork)(bstr.asOutParam()); H(); 4862 if (!bstr.isEmpty()) 4863 { 4864 /** @todo add intnet prefix to separate namespaces, and add trunk if dealing with vboxnatX */ 4865 InsertConfigString(pLunL0, "Driver", "IntNet"); 4866 InsertConfigNode(pLunL0, "Config", &pCfg); 4867 InsertConfigString(pCfg, "Network", bstr); 4868 InsertConfigInteger(pCfg, "TrunkType", kIntNetTrunkType_WhateverNone); 4869 InsertConfigString(pCfg, "IfPolicyPromisc", pszPromiscuousGuestPolicy); 4870 networkName = bstr; 4871 trunkType = Bstr(TRUNKTYPE_WHATEVER); 4872 } 4873 break; 4874 } 4875 4859 4876 default: 4860 4877 AssertMsgFailed(("should not get here!\n")); … … 4875 4892 case NetworkAttachmentType_NAT: 4876 4893 case NetworkAttachmentType_Generic: 4894 case NetworkAttachmentType_NATNetwork: 4877 4895 { 4878 4896 if (SUCCEEDED(hrc) && SUCCEEDED(rc)) -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r47716 r48538 6 6 7 7 /* 8 * Copyright (C) 2008-201 2Oracle Corporation8 * Copyright (C) 2008-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 305 305 case NetworkAttachmentType_HostOnly: strType = "HostOnly"; break; 306 306 case NetworkAttachmentType_Generic: strType = "Generic"; break; 307 case NetworkAttachmentType_NATNetwork: strType = "NATNetwork"; break; 307 308 case NetworkAttachmentType_Null: strType = "Null"; break; 308 309 } … … 775 776 /** @todo: Maybe too cost-intensive; try to find a lighter way */ 776 777 while ( RTPathExists(tmpName) 777 || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, &harddisk) != VBOX_E_OBJECT_NOT_FOUND 778 || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, &harddisk) != VBOX_E_OBJECT_NOT_FOUND 778 779 ) 779 780 { -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r48117 r48538 2714 2714 if (FAILED(rc)) throw rc; 2715 2715 /* Set the interface name to attach to */ 2716 pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw());2716 rc = pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw()); 2717 2717 if (FAILED(rc)) throw rc; 2718 2718 break; … … 2747 2747 if (FAILED(rc)) throw rc; 2748 2748 /* Set the interface name to attach to */ 2749 pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw());2749 rc = pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw()); 2750 2750 if (FAILED(rc)) throw rc; 2751 2751 break; … … 2766 2766 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Generic); 2767 2767 if (FAILED(rc)) throw rc; 2768 } 2769 /* Next test for NAT network interfaces */ 2770 else if (pvsys->strExtraConfigCurrent.endsWith("type=NATNetwork", Utf8Str::CaseInsensitive)) 2771 { 2772 /* Attach to the right interface */ 2773 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork); 2774 if (FAILED(rc)) throw rc; 2775 com::SafeIfaceArray<INATNetwork> nwNATNetworks; 2776 rc = mVirtualBox->COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nwNATNetworks)); 2777 if (FAILED(rc)) throw rc; 2778 // Pick the first NAT network (if there is any) 2779 if (nwNATNetworks.size()) 2780 { 2781 Bstr name; 2782 rc = nwNATNetworks[0]->COMGETTER(NetworkName)(name.asOutParam()); 2783 if (FAILED(rc)) throw rc; 2784 /* Set the NAT network name to attach to */ 2785 rc = pNetworkAdapter->COMSETTER(NATNetwork)(name.raw()); 2786 if (FAILED(rc)) throw rc; 2787 break; 2788 } 2768 2789 } 2769 2790 } … … 3325 3346 it1->fEnabled = false; 3326 3347 if (!( fKeepAllMACs 3327 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT))) 3348 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT) 3349 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NATNetwork))) 3328 3350 Host::generateMACAddress(it1->strMACAddress); 3329 3351 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48505 r48538 2752 2752 mData->m_strConfigFileFull.cloneTo(aFilePath); 2753 2753 return S_OK; 2754 }2755 2756 STDMETHODIMP Machine::COMSETTER(SettingsFilePath)(IN_BSTR aFilePath)2757 {2758 CheckComArgStrNotEmptyOrNull(aFilePath);2759 2760 AutoCaller autoCaller(this);2761 if (FAILED(autoCaller.rc())) return autoCaller.rc();2762 2763 ReturnComNotImplemented();2764 2754 } 2765 2755 … … 5287 5277 5288 5278 return S_OK; 5279 } 5280 5281 STDMETHODIMP Machine::SetSettingsFilePath(IN_BSTR aFilePath, IProgress **aProgress) 5282 { 5283 CheckComArgStrNotEmptyOrNull(aFilePath); 5284 CheckComArgOutPointerValid(aProgress); 5285 5286 AutoCaller autoCaller(this); 5287 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5288 5289 *aProgress = NULL; 5290 ReturnComNotImplemented(); 5289 5291 } 5290 5292 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r48297 r48538 1543 1543 } 1544 1544 1545 STDMETHODIMP Medium::COMSETTER(Location)(IN_BSTR aLocation)1546 {1547 CheckComArgStrNotEmptyOrNull(aLocation);1548 1549 AutoCaller autoCaller(this);1550 if (FAILED(autoCaller.rc())) return autoCaller.rc();1551 1552 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);1553 1554 /// @todo NEWMEDIA for file names, add the default extension if no extension1555 /// is present (using the information from the VD backend which also implies1556 /// that one more parameter should be passed to setLocation() requesting1557 /// that functionality since it is only allowed when called from this method1558 1559 /// @todo NEWMEDIA rename the file and set m->location on success, then save1560 /// the global registry (and local registries of portable VMs referring to1561 /// this medium), this will also require to add the mRegistered flag to data1562 1563 ReturnComNotImplemented();1564 }1565 1566 1545 STDMETHODIMP Medium::COMGETTER(Name)(BSTR *aName) 1567 1546 { … … 2892 2871 2893 2872 return rc; 2873 } 2874 2875 STDMETHODIMP Medium::SetLocation(IN_BSTR aLocation, IProgress **aProgress) 2876 { 2877 CheckComArgStrNotEmptyOrNull(aLocation); 2878 CheckComArgOutPointerValid(aProgress); 2879 2880 AutoCaller autoCaller(this); 2881 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2882 2883 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2884 2885 /// @todo NEWMEDIA for file names, add the default extension if no extension 2886 /// is present (using the information from the VD backend which also implies 2887 /// that one more parameter should be passed to setLocation() requesting 2888 /// that functionality since it is only allowed when called from this method 2889 2890 /// @todo NEWMEDIA rename the file and set m->location on success, then save 2891 /// the global registry (and local registries of portable VMs referring to 2892 /// this medium), this will also require to add the mRegistered flag to data 2893 2894 *aProgress = NULL; 2895 ReturnComNotImplemented(); 2894 2896 } 2895 2897 … … 5986 5988 pToken->Abandon(); 5987 5989 pToken.setNull(); 5988 5990 5989 5991 if (FAILED(rc)) return rc; 5990 5992 -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r42825 r48538 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 478 478 } 479 479 480 /* there must a NAT network name */ 481 if (mData->mNATNetwork.isEmpty()) 482 { 483 Log(("NAT network name not defined, setting to default \"NatNetwork\"\n")); 484 mData->mNATNetwork = "NatNetwork"; 485 } 486 480 487 mData->mAttachmentType = aAttachmentType; 481 488 … … 526 533 if (mData->mBridgedInterface != aBridgedInterface) 527 534 { 535 /* if an empty/null string is to be set, bridged interface must be 536 * turned off */ 537 if ( (aBridgedInterface == NULL || *aBridgedInterface == '\0') 538 && mData->mAttachmentType == NetworkAttachmentType_Bridged) 539 { 540 return setError(E_FAIL, 541 tr("Empty or null bridged interface name is not valid")); 542 } 543 528 544 mData.backup(); 529 545 mData->mBridgedInterface = aBridgedInterface; … … 577 593 if (mData->mHostOnlyInterface != aHostOnlyInterface) 578 594 { 595 /* if an empty/null string is to be set, host only interface must be 596 * turned off */ 597 if ( (aHostOnlyInterface == NULL || *aHostOnlyInterface == '\0') 598 && mData->mAttachmentType == NetworkAttachmentType_HostOnly) 599 { 600 return setError(E_FAIL, 601 tr("Empty or null host only interface name is not valid")); 602 } 603 579 604 mData.backup(); 580 605 mData->mHostOnlyInterface = aHostOnlyInterface; … … 684 709 if (mData->mNATNetwork != aNATNetwork) 685 710 { 711 /* if an empty/null string is to be set, host only interface must be 712 * turned off */ 713 if ( (aNATNetwork == NULL || *aNATNetwork == '\0') 714 && mData->mAttachmentType == NetworkAttachmentType_NATNetwork) 715 { 716 return setError(E_FAIL, 717 tr("Empty or null NAT network name is not valid")); 718 } 719 686 720 mData.backup(); 687 721 mData->mNATNetwork = aNATNetwork; … … 695 729 mlock.release(); 696 730 697 /* Changing the NAT network isn't allowed during runtime, therefore 698 * no immediate replug in CFGM logic => changeAdapter=FALSE */ 699 mParent->onNetworkAdapterChange(this, FALSE); 731 /* When changing the host adapter, adapt the CFGM logic to make this 732 * change immediately effect and to notify the guest that the network 733 * might have changed, therefore changeAdapter=TRUE. */ 734 mParent->onNetworkAdapterChange(this, TRUE); 700 735 } 701 736 … … 1209 1244 mData->mGenericDriver = data.strGenericDriver; 1210 1245 mData->mGenericProperties = data.genericProperties; 1246 mData->mNATNetwork = data.strNATNetworkName; 1211 1247 1212 1248 // leave the lock before setting attachment type … … 1269 1305 data.genericProperties = mData->mGenericProperties; 1270 1306 1307 data.strNATNetworkName = mData->mNATNetwork; 1308 1271 1309 // after saving settings, we are no longer different from the XML on disk 1272 1310 m_fModified = false; -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r48004 r48538 390 390 case NetworkAttachmentType_NAT: 391 391 case NetworkAttachmentType_Internal: 392 case NetworkAttachmentType_NATNetwork: 392 393 /* chipset default is OK */ 393 394 break; -
trunk/src/VBox/Main/xml/Settings.cpp
r48408 r48538 2422 2422 } 2423 2423 } 2424 else if (elmMode.nameEquals("NATNetwork")) 2425 { 2426 enmAttachmentType = NetworkAttachmentType_NATNetwork; 2427 2428 if (!elmMode.getAttributeValue("name", nic.strNATNetworkName)) // required network name 2429 throw ConfigFileError(this, &elmMode, N_("Required NATNetwork/@name element is missing")); 2430 } 2424 2431 else if (elmMode.nameEquals("VDE")) 2425 2432 { … … 4460 4467 if (nic.mode != NetworkAttachmentType_Generic) 4461 4468 buildNetworkXML(NetworkAttachmentType_Generic, *pelmDisabledNode, false, nic); 4469 if (nic.mode != NetworkAttachmentType_NATNetwork) 4470 buildNetworkXML(NetworkAttachmentType_NATNetwork, *pelmDisabledNode, false, nic); 4462 4471 buildNetworkXML(nic.mode, *pelmAdapter, true, nic); 4463 4472 } … … 4772 4781 } 4773 4782 } 4783 break; 4784 4785 case NetworkAttachmentType_NATNetwork: 4786 if (fEnabled || !nic.strNATNetworkName.isEmpty()) 4787 elmParent.createChild("NATNetwork")->setAttribute("name", nic.strNATNetworkName); 4774 4788 break; 4775 4789 … … 5319 5333 { 5320 5334 // VirtualBox 4.3 adds default frontend setting, graphics controller 5321 // setting, explicit long mode setting and video capturing.5335 // setting, explicit long mode setting, video capturing and NAT networking. 5322 5336 if ( !hardwareMachine.strDefaultFrontend.isEmpty() 5323 5337 || hardwareMachine.graphicsControllerType != GraphicsControllerType_VBoxVGA … … 5325 5339 || machineUserData.ovIcon.length() > 0 5326 5340 || hardwareMachine.fVideoCaptureEnabled) 5341 { 5327 5342 m->sv = SettingsVersion_v1_14; 5343 return; 5344 } 5345 NetworkAdaptersList::const_iterator netit; 5346 for (netit = hardwareMachine.llNetworkAdapters.begin(); 5347 netit != hardwareMachine.llNetworkAdapters.end(); 5348 ++netit) 5349 { 5350 if (netit->mode == NetworkAttachmentType_NATNetwork) 5351 { 5352 m->sv = SettingsVersion_v1_14; 5353 break; 5354 } 5355 } 5328 5356 } 5329 5357
Note:
See TracChangeset
for help on using the changeset viewer.