Changeset 28287 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 14, 2010 10:10:40 AM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r28286 r28287 3416 3416 } 3417 3417 3418 /* ENABLE VDE */ 3419 case NetworkAttachmentType_VDE: 3420 { 3421 hrc = aNetworkAdapter->COMGETTER(VDENetwork)(&str); H(); 3422 #if 0 3423 if (str) { 3424 Utf8Str strUtf8 = str; 3425 LogRel(("VDE Network %s\n",(char *)strUtf8.raw())); 3426 } 3427 #endif 3428 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 3429 rc = CFGMR3InsertString(pLunL0, "Driver", "VDE"); RC_CHECK(); 3430 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); RC_CHECK(); 3431 if (str && *str) { 3432 rc = CFGMR3InsertStringW(pCfg, "Network", str); RC_CHECK(); 3433 networkName = str; 3434 } 3435 rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_WhateverNone); RC_CHECK(); 3436 STR_FREE(); 3437 break; 3438 } 3439 /* /ENABLE VDE */ 3440 3418 3441 default: 3419 3442 AssertMsgFailed(("should not get here!\n")); … … 3433 3456 case NetworkAttachmentType_HostOnly: 3434 3457 case NetworkAttachmentType_NAT: 3458 case NetworkAttachmentType_VDE: 3435 3459 { 3436 3460 if (SUCCEEDED(hrc) && SUCCEEDED(rc)) -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r28106 r28287 610 610 } 611 611 612 /* ENABLE VDE */ 613 STDMETHODIMP NetworkAdapter::COMGETTER(VDENetwork) (BSTR *aVDENetwork) 614 { 615 CheckComArgOutPointerValid(aVDENetwork); 616 617 AutoCaller autoCaller(this); 618 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 619 620 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 621 622 mData->mVDENetwork.cloneTo(aVDENetwork); 623 624 return S_OK; 625 } 626 627 STDMETHODIMP NetworkAdapter::COMSETTER(VDENetwork) (IN_BSTR aVDENetwork) 628 { 629 Bstr bstrEmpty(""); 630 if (!aVDENetwork) 631 aVDENetwork = bstrEmpty; 632 633 AutoCaller autoCaller(this); 634 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 635 636 /* the machine needs to be mutable */ 637 AutoMutableStateDependency adep (mParent); 638 if (FAILED(adep.rc())) return adep.rc(); 639 640 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 641 642 if (mData->mVDENetwork != aVDENetwork) 643 { 644 mData.backup(); 645 mData->mVDENetwork = aVDENetwork; 646 647 /* leave the lock before informing callbacks */ 648 alock.release(); 649 650 mParent->onNetworkAdapterChange (this, FALSE); 651 } 652 653 return S_OK; 654 } 655 656 /* /ENABLE VDE */ 657 612 658 STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected) (BOOL *aConnected) 613 659 { … … 1047 1093 return S_OK; 1048 1094 } 1095 1096 /* ENABLE VDE */ 1097 STDMETHODIMP NetworkAdapter::AttachToVDE() 1098 { 1099 AutoCaller autoCaller(this); 1100 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1101 1102 /* the machine needs to be mutable */ 1103 AutoMutableStateDependency adep (mParent); 1104 if (FAILED(adep.rc())) return adep.rc(); 1105 1106 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1107 1108 /* don't do anything if we're already host interface attached */ 1109 if (mData->mAttachmentType != NetworkAttachmentType_VDE) 1110 { 1111 mData.backup(); 1112 1113 /* first detach the current attachment */ 1114 // Commented this for now as it reset the parameter mData->mHostInterface 1115 // which is essential while changing the Attachment dynamically. 1116 //detach(); 1117 1118 mData->mAttachmentType = NetworkAttachmentType_VDE; 1119 1120 /* leave the lock before informing callbacks */ 1121 alock.release(); 1122 1123 HRESULT rc = mParent->onNetworkAdapterChange (this, TRUE); 1124 if (FAILED (rc)) 1125 { 1126 /* If changing the attachment failed then we can't assume 1127 * that the previous attachment will attach correctly 1128 * and thus return error along with dettaching all 1129 * attachments. 1130 */ 1131 Detach(); 1132 return rc; 1133 } 1134 } 1135 1136 return S_OK; 1137 } 1138 1139 /* /ENABLE VDE */ 1049 1140 1050 1141 STDMETHODIMP NetworkAdapter::Detach() … … 1156 1247 break; 1157 1248 1249 /* ENABLE VDE */ 1250 case NetworkAttachmentType_VDE: 1251 mData->mVDENetwork = data.strName; 1252 rc = AttachToVDE(); 1253 if (FAILED(rc)) return rc; 1254 break; 1255 /* ENABLE VDE */ 1256 1257 1158 1258 case NetworkAttachmentType_Null: 1159 1259 rc = Detach(); … … 1219 1319 case NetworkAttachmentType_HostOnly: 1220 1320 data.strName = mData->mHostInterface; 1321 break; 1322 1323 case NetworkAttachmentType_VDE: 1324 data.strName = mData->mVDENetwork; 1221 1325 break; 1222 1326 } -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r28235 r28287 11537 11537 <const name="Internal" value="3"/> 11538 11538 <const name="HostOnly" value="4"/> 11539 <!-- ENABLE VDE --> 11540 <const name="VDE" value="5"/> 11541 <!-- /ENABLE VDE --> 11539 11542 </enum> 11540 11543 … … 11639 11642 </attribute> 11640 11643 11644 <!-- ENABLE VDE --> 11645 <attribute name="VDENetwork" type="wstring"> 11646 <desc> 11647 Name of the VDE switch the VM is attached to. 11648 </desc> 11649 </attribute> 11650 <!-- /ENABLE VDE --> 11651 11641 11652 <attribute name="cableConnected" type="boolean"> 11642 11653 <desc> … … 11704 11715 </desc> 11705 11716 </method> 11717 11718 <!-- ENABLE VDE --> 11719 <method name="attachToVDE"> 11720 <desc> 11721 Attach the network adapter to a VDE network. 11722 </desc> 11723 </method> 11724 <!-- /ENABLE VDE --> 11706 11725 11707 11726 <method name="detach"> -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r28106 r28287 50 50 mHostInterface("") /* cannot be null */, 51 51 mNATNetwork("") /* cannot be null */ 52 /* ENABLE VDE */ 53 , mVDENetwork("") /* can be null */ 54 /* /ENABLE VDE */ 52 55 {} 53 56 … … 64 67 Bstr mInternalNetwork; 65 68 Bstr mNATNetwork; 69 /* ENABLE VDE */ 70 Bstr mVDENetwork; 66 71 ULONG mBootPriority; 67 72 }; … … 105 110 STDMETHOD(COMGETTER(NATNetwork)) (BSTR *aNATNetwork); 106 111 STDMETHOD(COMSETTER(NATNetwork)) (IN_BSTR aNATNetwork); 112 /* ENABLE VDE */ 113 STDMETHOD(COMGETTER(VDENetwork)) (BSTR *aVDENetwork); 114 STDMETHOD(COMSETTER(VDENetwork)) (IN_BSTR aVDENetwork); 115 /* /ENABLE VDE */ 107 116 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected); 108 117 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected); … … 122 131 STDMETHOD(AttachToInternalNetwork)(); 123 132 STDMETHOD(AttachToHostOnlyInterface)(); 133 /* ENABLE VDE */ 134 STDMETHOD(AttachToVDE)(); 135 /* /ENABLE VDE */ 124 136 STDMETHOD(Detach)(); 125 137 -
trunk/src/VBox/Main/xml/Settings.cpp
r28204 r28287 1889 1889 throw ConfigFileError(this, pelmAdapterChild, N_("Required HostOnlyInterface/@name element is missing")); 1890 1890 } 1891 /* ENABLE VDE */ 1892 else if ((pelmAdapterChild = pelmAdapter->findChildElement("VDE"))) 1893 { 1894 nic.mode = NetworkAttachmentType_VDE; 1895 pelmAdapterChild->getAttributeValue("network", nic.strName); // optional network name 1896 } 1897 /* /ENABLE VDE */ 1891 1898 // else: default is NetworkAttachmentType_Null 1892 1899 … … 3388 3395 break; 3389 3396 3397 /* ENABLE VDE */ 3398 case NetworkAttachmentType_VDE: 3399 pelmNAT = pelmAdapter->createChild("VDE"); 3400 if (nic.strName.length()) 3401 pelmNAT->setAttribute("network", nic.strName); 3402 break; 3403 /* /ENABLE VDE */ 3404 3390 3405 default: /*case NetworkAttachmentType_Null:*/ 3391 3406 break;
Note:
See TracChangeset
for help on using the changeset viewer.