- Timestamp:
- Jun 10, 2016 6:22:09 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108021
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/HostUSBDeviceImpl.h
r59381 r61667 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 216 216 void i_onPhysicalDetached(); 217 217 218 bool i_isMatch(const USBDeviceFilter:: Data &aData);218 bool i_isMatch(const USBDeviceFilter::BackupableUSBDeviceFilterData &aData); 219 219 int i_compare(PCUSBDEVICE aDev2); 220 220 static int i_compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach = false); -
trunk/src/VBox/Main/include/USBDeviceFilterImpl.h
r51498 r61667 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_USBDEVICEFILTERIMPL 20 20 21 #include <VBox/settings.h> 21 22 #include "Matching.h" 22 23 #include <VBox/usbfilter.h> … … 38 39 public: 39 40 40 struct Data41 struct BackupableUSBDeviceFilterData 41 42 { 42 43 typedef matching::Matchable <matching::ParsedBoolFilter> BOOLFilter; 43 44 44 Data() : mActive (FALSE), mMaskedIfs (0),mId (NULL) {}45 Data (const Data &aThat) : mName (aThat.mName), mActive (aThat.mActive),46 mRemote (aThat.mRemote), mMaskedIfs (aThat.mMaskedIfs) , mId(aThat.mId)45 BackupableUSBDeviceFilterData() : mId (NULL) {} 46 BackupableUSBDeviceFilterData(const BackupableUSBDeviceFilterData &aThat) : 47 mRemote(aThat.mRemote), mId(aThat.mId) 47 48 { 48 USBFilterClone (&mUSBFilter, &aThat.mUSBFilter); 49 mData.strName = aThat.mData.strName; 50 mData.fActive = aThat.mData.fActive; 51 mData.ulMaskedInterfaces = aThat.mData.ulMaskedInterfaces; 52 USBFilterClone(&mUSBFilter, &aThat.mUSBFilter); 49 53 } 50 54 51 /** The filter name. */52 Bstr mName;53 /** Indicates whether the filter is active or not. */54 BOOL mActive;55 55 /** Remote or local matching criterion. */ 56 56 BOOLFilter mRemote; 57 57 58 /** The filter data blob. */ 58 59 USBFILTER mUSBFilter; 59 60 60 /** Interface masking bit mask that should be applied to matching devices. */61 ULONG mMaskedIfs;62 63 61 /** Arbitrary ID field (not used by the class itself) */ 64 62 void *mId; 63 64 settings::USBDeviceFilter mData; 65 65 }; 66 66 … … 88 88 // public methods for internal purposes only 89 89 // (ensure there is a caller and a read lock before calling them!) 90 void *& i_getId() { return mData.data()->mId; }91 const Data& i_getData() { return *mData.data(); }90 void *& i_getId() { return bd->mId; } 91 const BackupableUSBDeviceFilterData& i_getData() { return *bd.data(); } 92 92 ComObjPtr<USBDeviceFilter> i_peer() { return mPeer; } 93 93 … … 133 133 USBDeviceFilter * const mPeer; 134 134 135 Backupable< Data> mData;135 Backupable<BackupableUSBDeviceFilterData> bd; 136 136 137 137 bool m_fModified; … … 153 153 public: 154 154 155 struct Data : public USBDeviceFilter::Data155 struct BackupableUSBDeviceFilterData : public USBDeviceFilter::BackupableUSBDeviceFilterData 156 156 { 157 Data() {}157 BackupableUSBDeviceFilterData() {} 158 158 }; 159 159 … … 173 173 void i_saveSettings(settings::USBDeviceFilter &data); 174 174 175 void*& i_getId() { return mData.data()->mId; }176 177 const Data& i_getData() { return *mData.data(); }175 void*& i_getId() { return bd.data()->mId; } 176 177 const BackupableUSBDeviceFilterData& i_getData() { return *bd.data(); } 178 178 179 179 // util::Lockable interface … … 215 215 Host * const mParent; 216 216 217 Backupable< Data> mData;217 Backupable<BackupableUSBDeviceFilterData> bd; 218 218 219 219 /** Used externally to indicate this filter is in the list -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r60509 r61667 1403 1403 /* notify the proxy (only when the filter is active) */ 1404 1404 if ( m->pUSBProxyService->isActive() 1405 && pFilter->i_getData().m Active)1405 && pFilter->i_getData().mData.fActive) 1406 1406 { 1407 1407 ComAssertRet(pFilter->i_getId() == NULL, E_FAIL); … … 1457 1457 1458 1458 /* notify the proxy (only when the filter is active) */ 1459 if (m->pUSBProxyService->isActive() && filter->i_getData().m Active)1459 if (m->pUSBProxyService->isActive() && filter->i_getData().mData.fActive) 1460 1460 { 1461 1461 ComAssertRet(filter->i_getId() != NULL, E_FAIL); … … 1757 1757 1758 1758 /* notify the proxy (only when the filter is active) */ 1759 if (pFilter->i_getData().m Active)1759 if (pFilter->i_getData().mData.fActive) 1760 1760 { 1761 1761 HostUSBDeviceFilter *flt = pFilter; /* resolve ambiguity */ … … 2250 2250 { 2251 2251 // insert/remove the filter from the proxy 2252 if (aFilter->i_getData().m Active)2252 if (aFilter->i_getData().mData.fActive) 2253 2253 { 2254 2254 ComAssertRet(aFilter->i_getId() == NULL, E_FAIL); … … 2264 2264 else 2265 2265 { 2266 if (aFilter->i_getData().m Active)2266 if (aFilter->i_getData().mData.fActive) 2267 2267 { 2268 2268 // update the filter in the proxy -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r60758 r61667 5 5 6 6 /* 7 * Copyright (C) 2005-201 4Oracle Corporation7 * Copyright (C) 2005-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 946 946 * @note Locks this object for reading. 947 947 */ 948 bool HostUSBDevice::i_isMatch(const USBDeviceFilter:: Data &aData)948 bool HostUSBDevice::i_isMatch(const USBDeviceFilter::BackupableUSBDeviceFilterData &aData) 949 949 { 950 950 AutoCaller autoCaller(this); … … 953 953 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 954 954 955 if (!aData.m Active)955 if (!aData.mData.fActive) 956 956 return false; 957 957 -
trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
r60161 r61667 5 5 6 6 /* 7 * Copyright (C) 2006-201 5Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 110 110 vrc = RTStrToUInt64Ex(pcszValue, &pszNext, 16, &u64); 111 111 if (RT_SUCCESS(vrc)) 112 pszNext = RTStrStripL 112 pszNext = RTStrStripL(pszNext); 113 113 if ( vrc == VINF_SUCCESS 114 114 && !*pszNext) … … 223 223 m_fModified = false; 224 224 225 mData.allocate();226 mData->mName = data.strName;227 mData->mActive = data.fActive;228 mData->mMaskedIfs = 0;225 bd.allocate(); 226 bd->mData.strName = data.strName; 227 bd->mData.fActive = data.fActive; 228 bd->mData.ulMaskedInterfaces = 0; 229 229 230 230 /* initialize all filters to any match using null string */ 231 USBFilterInit(& mData->mUSBFilter, USBFILTERTYPE_CAPTURE);232 mData->mRemote = NULL;231 USBFilterInit(&bd->mUSBFilter, USBFILTERTYPE_CAPTURE); 232 bd->mRemote = NULL; 233 233 234 234 mInList = false; … … 296 296 m_fModified = false; 297 297 298 mData.allocate();299 300 mData->mName = aName;301 mData->mActive = FALSE;302 mData->mMaskedIfs = 0;298 bd.allocate(); 299 300 bd->mData.strName = Utf8Str(aName); 301 bd->mData.fActive = FALSE; 302 bd->mData.ulMaskedInterfaces = 0; 303 303 304 304 /* initialize all filters to any match using null string */ 305 USBFilterInit (&mData->mUSBFilter, USBFILTERTYPE_CAPTURE);306 mData->mRemote = NULL;305 USBFilterInit(&bd->mUSBFilter, USBFILTERTYPE_CAPTURE); 306 bd->mRemote = NULL; 307 307 308 308 mInList = false; … … 330 330 * reading if @a aReshare is false. 331 331 */ 332 HRESULT USBDeviceFilter::init 333 332 HRESULT USBDeviceFilter::init(USBDeviceFilters *aParent, USBDeviceFilter *aThat, 333 bool aReshare /* = false */) 334 334 { 335 335 LogFlowThisFunc(("aParent=%p, aThat=%p, aReshare=%RTbool\n", … … 347 347 348 348 /* sanity */ 349 AutoCaller thatCaller 349 AutoCaller thatCaller(aThat); 350 350 AssertComRCReturnRC(thatCaller.rc()); 351 351 … … 355 355 356 356 unconst(aThat->mPeer) = this; 357 mData.attach (aThat->mData);357 bd.attach(aThat->bd); 358 358 } 359 359 else … … 362 362 363 363 AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); 364 mData.share (aThat->mData);364 bd.share(aThat->bd); 365 365 } 366 366 … … 383 383 * @note Locks @a aThat object for reading. 384 384 */ 385 HRESULT USBDeviceFilter::initCopy 385 HRESULT USBDeviceFilter::initCopy(USBDeviceFilters *aParent, USBDeviceFilter *aThat) 386 386 { 387 387 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); … … 399 399 400 400 /* sanity */ 401 AutoCaller thatCaller 401 AutoCaller thatCaller(aThat); 402 402 AssertComRCReturnRC(thatCaller.rc()); 403 403 404 404 AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); 405 mData.attachCopy (aThat->mData);405 bd.attachCopy(aThat->bd); 406 406 407 407 /* reset the arbitrary ID field 408 408 * (this field is something unique that two distinct objects, even if they 409 409 * are deep copies of each other, should not share) */ 410 mData->mId = NULL;410 bd->mId = NULL; 411 411 412 412 mInList = aThat->mInList; … … 433 433 mInList = false; 434 434 435 mData.free();435 bd.free(); 436 436 437 437 unconst(mPeer) = NULL; … … 447 447 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 448 448 449 aName = mData->mName;449 aName = bd->mData.strName; 450 450 451 451 return S_OK; … … 460 460 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 461 461 462 if ( mData->mName != aName)462 if (bd->mData.strName != aName) 463 463 { 464 464 m_fModified = true; 465 465 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 466 466 467 mData.backup();468 mData->mName = aName;467 bd.backup(); 468 bd->mData.strName = aName; 469 469 470 470 // leave the lock before informing callbacks … … 485 485 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 486 486 487 *aActive = mData->mActive;487 *aActive = bd->mData.fActive; 488 488 489 489 return S_OK; … … 498 498 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 499 499 500 if ( mData->mActive != aActive)500 if (bd->mData.fActive != RT_BOOL(aActive)) 501 501 { 502 502 m_fModified = true; 503 503 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 504 504 505 mData.backup();506 mData->mActive = aActive;505 bd.backup(); 506 bd->mData.fActive = RT_BOOL(aActive); 507 507 508 508 // leave the lock before informing callbacks … … 594 594 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 595 595 596 aRemote = mData->mRemote.string();596 aRemote = bd->mRemote.string(); 597 597 598 598 return S_OK; … … 607 607 Bstr bRemote = Bstr(aRemote).raw(); 608 608 609 if ( mData->mRemote.string() != bRemote)610 { 611 Data::BOOLFilter flt = bRemote;609 if (bd->mRemote.string() != bRemote) 610 { 611 BackupableUSBDeviceFilterData::BOOLFilter flt = bRemote; 612 612 ComAssertRet(!flt.isNull(), E_FAIL); 613 613 if (!flt.isValid()) … … 619 619 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 620 620 621 mData.backup();622 mData->mRemote = flt;621 bd.backup(); 622 bd->mRemote = flt; 623 623 624 624 // leave the lock before informing callbacks … … 639 639 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 640 640 641 *aMaskedIfs = mData->mMaskedIfs;641 *aMaskedIfs = bd->mData.ulMaskedInterfaces; 642 642 643 643 return S_OK; … … 652 652 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 653 653 654 if ( mData->mMaskedIfs != aMaskedIfs)654 if (bd->mData.ulMaskedInterfaces != aMaskedIfs) 655 655 { 656 656 m_fModified = true; 657 657 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 658 658 659 mData.backup();660 mData->mMaskedIfs = aMaskedIfs;659 bd.backup(); 660 bd->mData.ulMaskedInterfaces = aMaskedIfs; 661 661 // leave the lock before informing callbacks 662 662 alock.release(); … … 678 678 { 679 679 AutoCaller autoCaller(this); 680 AssertComRCReturn 680 AssertComRCReturn(autoCaller.rc(), false); 681 681 682 682 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 695 695 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 696 696 697 mData.rollback();697 bd.rollback(); 698 698 } 699 699 … … 706 706 /* sanity */ 707 707 AutoCaller autoCaller(this); 708 AssertComRCReturnVoid 708 AssertComRCReturnVoid(autoCaller.rc()); 709 709 710 710 /* sanity too */ 711 AutoCaller peerCaller 712 AssertComRCReturnVoid 711 AutoCaller peerCaller(mPeer); 712 AssertComRCReturnVoid(peerCaller.rc()); 713 713 714 714 /* lock both for writing since we modify both (mPeer is "master" so locked … … 716 716 AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS); 717 717 718 if ( mData.isBackedUp())719 { 720 mData.commit();718 if (bd.isBackedUp()) 719 { 720 bd.commit(); 721 721 if (mPeer) 722 722 { 723 723 /* attach new data to the peer and reshare it */ 724 mPeer-> mData.attach (mData);724 mPeer->bd.attach(bd); 725 725 } 726 726 } … … 738 738 /* sanity */ 739 739 AutoCaller autoCaller(this); 740 AssertComRCReturnVoid 740 AssertComRCReturnVoid(autoCaller.rc()); 741 741 742 742 /* sanity too */ 743 AutoCaller peerCaller 744 AssertComRCReturnVoid 743 AutoCaller peerCaller(mPeer); 744 AssertComRCReturnVoid(peerCaller.rc()); 745 745 746 746 /* peer is not modified, lock it for reading (mPeer is "master" so locked … … 749 749 AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS); 750 750 751 if ( mData.isShared())752 { 753 if (! mData.isBackedUp())754 mData.backup();755 756 mData.commit();751 if (bd.isShared()) 752 { 753 if (!bd.isBackedUp()) 754 bd.backup(); 755 756 bd.commit(); 757 757 } 758 758 … … 772 772 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 773 773 774 i_usbFilterFieldToString(& mData->mUSBFilter, aIdx, aStr);774 i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, aStr); 775 775 return S_OK; 776 776 } … … 795 795 796 796 com::Utf8Str strOld; 797 i_usbFilterFieldToString(& mData->mUSBFilter, aIdx, strOld);797 i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, strOld); 798 798 if (strOld != strNew) 799 799 { … … 801 801 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 802 802 803 mData.backup();803 bd.backup(); 804 804 805 805 com::Utf8Str errStr; 806 HRESULT rc = i_usbFilterFieldFromString(& mData->mUSBFilter, aIdx, strNew, errStr);806 HRESULT rc = i_usbFilterFieldFromString(&bd->mUSBFilter, aIdx, strNew, errStr); 807 807 if (FAILED(rc)) 808 808 { 809 mData.rollback();809 bd.rollback(); 810 810 return setError(rc, "%s", errStr.c_str()); 811 811 } … … 877 877 mParent->i_addChild(this); 878 878 879 mData.allocate();880 mData->mName = data.strName;881 mData->mActive = data.fActive;882 USBFilterInit (& mData->mUSBFilter, USBFILTERTYPE_IGNORE);883 mData->mRemote = NULL;884 mData->mMaskedIfs = 0;879 bd.allocate(); 880 bd->mData.strName = data.strName; 881 bd->mData.fActive = data.fActive; 882 USBFilterInit (&bd->mUSBFilter, USBFILTERTYPE_IGNORE); 883 bd->mRemote = NULL; 884 bd->mData.ulMaskedInterfaces = 0; 885 885 886 886 mInList = false; … … 930 930 * @param aParent Handle of the parent object. 931 931 */ 932 HRESULT HostUSBDeviceFilter::init 932 HRESULT HostUSBDeviceFilter::init(Host *aParent, IN_BSTR aName) 933 933 { 934 934 LogFlowThisFunc(("aParent=%p\n", aParent)); … … 946 946 mParent->i_addChild(this); 947 947 948 mData.allocate();949 950 mData->mName = aName;951 mData->mActive = FALSE;948 bd.allocate(); 949 950 bd->mData.strName = Utf8Str(aName); 951 bd->mData.fActive = FALSE; 952 952 mInList = false; 953 USBFilterInit (&mData->mUSBFilter, USBFILTERTYPE_IGNORE);954 mData->mRemote = NULL;955 mData->mMaskedIfs = 0;953 USBFilterInit(&bd->mUSBFilter, USBFILTERTYPE_IGNORE); 954 bd->mRemote = NULL; 955 bd->mData.ulMaskedInterfaces = 0; 956 956 957 957 /* Confirm successful initialization */ … … 976 976 mInList = false; 977 977 978 mData.free();978 bd.free(); 979 979 980 980 mParent->i_removeChild(this); … … 1000 1000 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1001 1001 1002 aName = mData->mName;1002 aName = bd->mData.strName; 1003 1003 1004 1004 return S_OK; … … 1010 1010 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1011 1011 1012 if ( mData->mName != aName)1013 { 1014 mData->mName = aName;1012 if (bd->mData.strName != aName) 1013 { 1014 bd->mData.strName = aName; 1015 1015 1016 1016 /* leave the lock before informing callbacks */ 1017 1017 alock.release(); 1018 1018 1019 return mParent->i_onUSBDeviceFilterChange 1019 return mParent->i_onUSBDeviceFilterChange(this); 1020 1020 } 1021 1021 … … 1028 1028 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1029 1029 1030 *aActive = mData->mActive;1030 *aActive = bd->mData.fActive; 1031 1031 1032 1032 return S_OK; … … 1038 1038 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1039 1039 1040 if ( mData->mActive != aActive)1041 { 1042 mData->mActive = aActive;1040 if (bd->mData.fActive != RT_BOOL(aActive)) 1041 { 1042 bd->mData.fActive = RT_BOOL(aActive); 1043 1043 1044 1044 /* leave the lock before informing callbacks */ 1045 1045 alock.release(); 1046 1046 1047 return mParent->i_onUSBDeviceFilterChange 1047 return mParent->i_onUSBDeviceFilterChange(this, TRUE /* aActiveChanged */); 1048 1048 } 1049 1049 … … 1125 1125 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1126 1126 1127 aRemote = mData->mRemote.string();1127 aRemote = bd->mRemote.string(); 1128 1128 1129 1129 return S_OK; … … 1141 1141 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1142 1142 1143 *aMaskedIfs = mData->mMaskedIfs;1143 *aMaskedIfs = bd->mData.ulMaskedInterfaces; 1144 1144 1145 1145 return S_OK; … … 1159 1159 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1160 1160 1161 switch (USBFilterGetFilterType (&mData->mUSBFilter))1161 switch (USBFilterGetFilterType(&bd->mUSBFilter)) 1162 1162 { 1163 1163 case USBFILTERTYPE_IGNORE: *aAction = USBDeviceFilterAction_Ignore; break; … … 1187 1187 aAction); 1188 1188 } 1189 if (USBFilterGetFilterType (&mData->mUSBFilter) != filterType)1190 { 1191 int vrc = USBFilterSetFilterType (&mData->mUSBFilter, filterType);1189 if (USBFilterGetFilterType(&bd->mUSBFilter) != filterType) 1190 { 1191 int vrc = USBFilterSetFilterType(&bd->mUSBFilter, filterType); 1192 1192 if (RT_FAILURE(vrc)) 1193 1193 return setError(E_INVALIDARG, … … 1198 1198 alock.release(); 1199 1199 1200 return mParent->i_onUSBDeviceFilterChange 1200 return mParent->i_onUSBDeviceFilterChange(this); 1201 1201 } 1202 1202 … … 1218 1218 { 1219 1219 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1220 i_usbFilterFieldToString(& mData->mUSBFilter, aIdx, aStr);1220 i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, aStr); 1221 1221 return S_OK; 1222 1222 } … … 1228 1228 1229 1229 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1230 data.strName = mData->mName;1231 data.fActive = !!mData->mActive;1232 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId);1233 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId);1234 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision);1235 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);1236 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct);1237 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);1238 i_usbFilterFieldToString(& mData->mUSBFilter, USBFILTERIDX_PORT, data.strPort);1230 data.strName = bd->mData.strName; 1231 data.fActive = bd->mData.fActive; 1232 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId); 1233 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId); 1234 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision); 1235 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer); 1236 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct); 1237 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber); 1238 i_usbFilterFieldToString(&bd->mUSBFilter, USBFILTERIDX_PORT, data.strPort); 1239 1239 1240 1240 COMGETTER(Action)(&data.action); … … 1255 1255 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1256 1256 Utf8Str strOld; 1257 i_usbFilterFieldToString(& mData->mUSBFilter, aIdx, strOld);1257 i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, strOld); 1258 1258 if (strOld != aStr) 1259 1259 { 1260 // mData.backup();1260 //bd.backup(); 1261 1261 com::Utf8Str errStr; 1262 HRESULT rc = USBDeviceFilter::i_usbFilterFieldFromString(& mData->mUSBFilter, aIdx, aStr, errStr);1262 HRESULT rc = USBDeviceFilter::i_usbFilterFieldFromString(&bd->mUSBFilter, aIdx, aStr, errStr); 1263 1263 if (FAILED(rc)) 1264 1264 { 1265 // mData.rollback();1265 //bd.rollback(); 1266 1266 return setError(rc, "%s", errStr.c_str()); 1267 1267 } -
trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
r60765 r61667 380 380 381 381 /* notify the proxy (only when it makes sense) */ 382 if (pFilter->i_getData().m Active && Global::IsOnline(adep.machineState())382 if (pFilter->i_getData().mData.fActive && Global::IsOnline(adep.machineState()) 383 383 && pFilter->i_getData().mRemote.isMatch(false)) 384 384 { … … 446 446 447 447 /* notify the proxy (only when it makes sense) */ 448 if (pFilter->i_getData().m Active && Global::IsOnline(adep.machineState())448 if (pFilter->i_getData().mData.fActive && Global::IsOnline(adep.machineState()) 449 449 && pFilter->i_getData().mRemote.isMatch(false)) 450 450 { … … 542 542 { 543 543 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 544 const USBDeviceFilter:: Data &filterData = (*it)->i_getData();544 const USBDeviceFilter::BackupableUSBDeviceFilterData &filterData = (*it)->i_getData(); 545 545 546 546 Bstr str; 547 547 548 548 settings::USBDeviceFilter f; 549 f.strName = filterData.m Name;550 f.fActive = !!filterData.m Active;549 f.strName = filterData.mData.strName; 550 f.fActive = !!filterData.mData.fActive; 551 551 (*it)->COMGETTER(VendorId)(str.asOutParam()); 552 552 f.strVendorId = str; … … 564 564 f.strPort = str; 565 565 f.strRemote = filterData.mRemote.string(); 566 f.ulMaskedInterfaces = filterData.m MaskedIfs;566 f.ulMaskedInterfaces = filterData.mData.ulMaskedInterfaces; 567 567 568 568 data.llDeviceFilters.push_back(f); … … 601 601 { 602 602 /* notify the proxy (only when it makes sense) */ 603 if ((*it)->i_getData().m Active &&603 if ((*it)->i_getData().mData.fActive && 604 604 Global::IsOnline(adep.machineState()) 605 605 && (*it)->i_getData().mRemote.isMatch(false)) … … 627 627 { 628 628 /* notify the proxy (only when necessary) */ 629 if ((*it)->i_getData().m Active629 if ((*it)->i_getData().mData.fActive 630 630 && (*it)->i_getData().mRemote.isMatch(false)) 631 631 { … … 839 839 { 840 840 /* insert/remove the filter from the proxy */ 841 if (aFilter->i_getData().m Active)841 if (aFilter->i_getData().mData.fActive) 842 842 { 843 843 ComAssertRet(aFilter->i_getId() == NULL, E_FAIL); … … 854 854 else 855 855 { 856 if (aFilter->i_getData().m Active)856 if (aFilter->i_getData().mData.fActive) 857 857 { 858 858 /* update the filter in the proxy */ … … 897 897 if (aDevice->i_isMatch((*it)->i_getData())) 898 898 { 899 *aMaskedIfs = (*it)->i_getData().m MaskedIfs;899 *aMaskedIfs = (*it)->i_getData().mData.ulMaskedInterfaces; 900 900 return true; 901 901 } … … 995 995 { 996 996 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 997 const USBDeviceFilter:: Data &aData = (*it)->i_getData();998 999 if (!aData.m Active)997 const USBDeviceFilter::BackupableUSBDeviceFilterData &aData = (*it)->i_getData(); 998 999 if (!aData.mData.fActive) 1000 1000 continue; 1001 1001 if (!aData.mRemote.isMatch(remote)) … … 1005 1005 1006 1006 match = true; 1007 *aMaskedIfs = aData.m MaskedIfs;1007 *aMaskedIfs = aData.mData.ulMaskedInterfaces; 1008 1008 break; 1009 1009 } … … 1041 1041 1042 1042 /* notify the proxy (only if the filter is active) */ 1043 if ( pFilter->i_getData().m Active1043 if ( pFilter->i_getData().mData.fActive 1044 1044 && pFilter->i_getData().mRemote.isMatch(false) /* and if the filter is NOT remote */ 1045 1045 ) -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r60755 r61667 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 745 745 { 746 746 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 747 const HostUSBDeviceFilter:: Data &data = (*it)->i_getData();747 const HostUSBDeviceFilter::BackupableUSBDeviceFilterData &data = (*it)->i_getData(); 748 748 if (aDevice->i_isMatch(data)) 749 749 {
Note:
See TracChangeset
for help on using the changeset viewer.