VirtualBox

Changeset 61667 in vbox for trunk


Ignore:
Timestamp:
Jun 10, 2016 6:22:09 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108021
Message:

bugref:8238 VBoxSVC settings - USBDeviceFilter

Location:
trunk/src/VBox/Main
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r59381 r61667  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    216216    void i_onPhysicalDetached();
    217217
    218     bool i_isMatch(const USBDeviceFilter::Data &aData);
     218    bool i_isMatch(const USBDeviceFilter::BackupableUSBDeviceFilterData &aData);
    219219    int i_compare(PCUSBDEVICE aDev2);
    220220    static int i_compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach = false);
  • trunk/src/VBox/Main/include/USBDeviceFilterImpl.h

    r51498 r61667  
    55
    66/*
    7  * Copyright (C) 2006-2014 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1919#define ____H_USBDEVICEFILTERIMPL
    2020
     21#include <VBox/settings.h>
    2122#include "Matching.h"
    2223#include <VBox/usbfilter.h>
     
    3839public:
    3940
    40     struct Data
     41    struct BackupableUSBDeviceFilterData
    4142    {
    4243        typedef matching::Matchable <matching::ParsedBoolFilter> BOOLFilter;
    4344
    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)
    4748        {
    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);
    4953        }
    5054
    51         /** The filter name. */
    52         Bstr mName;
    53         /** Indicates whether the filter is active or not. */
    54         BOOL mActive;
    5555        /** Remote or local matching criterion. */
    5656        BOOLFilter mRemote;
     57
    5758        /** The filter data blob. */
    5859        USBFILTER mUSBFilter;
    5960
    60         /** Interface masking bit mask that should be applied to matching devices. */
    61         ULONG mMaskedIfs;
    62 
    6361        /** Arbitrary ID field (not used by the class itself) */
    6462        void *mId;
     63
     64        settings::USBDeviceFilter mData;
    6565    };
    6666
     
    8888    // public methods for internal purposes only
    8989    // (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(); }
    9292    ComObjPtr<USBDeviceFilter> i_peer() { return mPeer; }
    9393
     
    133133    USBDeviceFilter  * const     mPeer;
    134134
    135     Backupable<Data> mData;
     135    Backupable<BackupableUSBDeviceFilterData> bd;
    136136
    137137    bool m_fModified;
     
    153153public:
    154154
    155     struct Data : public USBDeviceFilter::Data
     155    struct BackupableUSBDeviceFilterData : public USBDeviceFilter::BackupableUSBDeviceFilterData
    156156    {
    157         Data() {}
     157        BackupableUSBDeviceFilterData() {}
    158158    };
    159159
     
    173173    void i_saveSettings(settings::USBDeviceFilter &data);
    174174
    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(); }
    178178
    179179    // util::Lockable interface
     
    215215    Host * const        mParent;
    216216
    217     Backupable<Data>    mData;
     217    Backupable<BackupableUSBDeviceFilterData>    bd;
    218218
    219219    /** Used externally to indicate this filter is in the list
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r60509 r61667  
    14031403    /* notify the proxy (only when the filter is active) */
    14041404    if (    m->pUSBProxyService->isActive()
    1405          && pFilter->i_getData().mActive)
     1405         && pFilter->i_getData().mData.fActive)
    14061406    {
    14071407        ComAssertRet(pFilter->i_getId() == NULL, E_FAIL);
     
    14571457
    14581458    /* notify the proxy (only when the filter is active) */
    1459     if (m->pUSBProxyService->isActive() && filter->i_getData().mActive)
     1459    if (m->pUSBProxyService->isActive() && filter->i_getData().mData.fActive)
    14601460    {
    14611461        ComAssertRet(filter->i_getId() != NULL, E_FAIL);
     
    17571757
    17581758        /* notify the proxy (only when the filter is active) */
    1759         if (pFilter->i_getData().mActive)
     1759        if (pFilter->i_getData().mData.fActive)
    17601760        {
    17611761            HostUSBDeviceFilter *flt = pFilter; /* resolve ambiguity */
     
    22502250        {
    22512251            // insert/remove the filter from the proxy
    2252             if (aFilter->i_getData().mActive)
     2252            if (aFilter->i_getData().mData.fActive)
    22532253            {
    22542254                ComAssertRet(aFilter->i_getId() == NULL, E_FAIL);
     
    22642264        else
    22652265        {
    2266             if (aFilter->i_getData().mActive)
     2266            if (aFilter->i_getData().mData.fActive)
    22672267            {
    22682268                // update the filter in the proxy
  • trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp

    r60758 r61667  
    55
    66/*
    7  * Copyright (C) 2005-2014 Oracle Corporation
     7 * Copyright (C) 2005-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    946946 *  @note Locks this object for reading.
    947947 */
    948 bool HostUSBDevice::i_isMatch(const USBDeviceFilter::Data &aData)
     948bool HostUSBDevice::i_isMatch(const USBDeviceFilter::BackupableUSBDeviceFilterData &aData)
    949949{
    950950    AutoCaller autoCaller(this);
     
    953953    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    954954
    955     if (!aData.mActive)
     955    if (!aData.mData.fActive)
    956956        return false;
    957957
  • trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp

    r60161 r61667  
    55
    66/*
    7  * Copyright (C) 2006-2015 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    110110            vrc = RTStrToUInt64Ex(pcszValue, &pszNext, 16, &u64);
    111111            if (RT_SUCCESS(vrc))
    112                 pszNext = RTStrStripL (pszNext);
     112                pszNext = RTStrStripL(pszNext);
    113113            if (    vrc == VINF_SUCCESS
    114114                &&  !*pszNext)
     
    223223    m_fModified = false;
    224224
    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;
    229229
    230230    /* 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;
    233233
    234234    mInList = false;
     
    296296    m_fModified = false;
    297297
    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;
    303303
    304304    /* 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;
    307307
    308308    mInList = false;
     
    330330 *  reading if @a aReshare is false.
    331331 */
    332 HRESULT USBDeviceFilter::init (USBDeviceFilters *aParent, USBDeviceFilter *aThat,
    333                                bool aReshare /* = false */)
     332HRESULT USBDeviceFilter::init(USBDeviceFilters *aParent, USBDeviceFilter *aThat,
     333                              bool aReshare /* = false */)
    334334{
    335335    LogFlowThisFunc(("aParent=%p, aThat=%p, aReshare=%RTbool\n",
     
    347347
    348348    /* sanity */
    349     AutoCaller thatCaller (aThat);
     349    AutoCaller thatCaller(aThat);
    350350    AssertComRCReturnRC(thatCaller.rc());
    351351
     
    355355
    356356        unconst(aThat->mPeer) = this;
    357         mData.attach (aThat->mData);
     357        bd.attach(aThat->bd);
    358358    }
    359359    else
     
    362362
    363363        AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
    364         mData.share (aThat->mData);
     364        bd.share(aThat->bd);
    365365    }
    366366
     
    383383 *  @note Locks @a aThat object for reading.
    384384 */
    385 HRESULT USBDeviceFilter::initCopy (USBDeviceFilters *aParent, USBDeviceFilter *aThat)
     385HRESULT USBDeviceFilter::initCopy(USBDeviceFilters *aParent, USBDeviceFilter *aThat)
    386386{
    387387    LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat));
     
    399399
    400400    /* sanity */
    401     AutoCaller thatCaller (aThat);
     401    AutoCaller thatCaller(aThat);
    402402    AssertComRCReturnRC(thatCaller.rc());
    403403
    404404    AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
    405     mData.attachCopy (aThat->mData);
     405    bd.attachCopy(aThat->bd);
    406406
    407407    /* reset the arbitrary ID field
    408408     * (this field is something unique that two distinct objects, even if they
    409409     * are deep copies of each other, should not share) */
    410     mData->mId = NULL;
     410    bd->mId = NULL;
    411411
    412412    mInList = aThat->mInList;
     
    433433    mInList = false;
    434434
    435     mData.free();
     435    bd.free();
    436436
    437437    unconst(mPeer) = NULL;
     
    447447    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    448448
    449     aName = mData->mName;
     449    aName = bd->mData.strName;
    450450
    451451    return S_OK;
     
    460460    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    461461
    462     if (mData->mName != aName)
     462    if (bd->mData.strName != aName)
    463463    {
    464464        m_fModified = true;
    465465        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
    466466
    467         mData.backup();
    468         mData->mName = aName;
     467        bd.backup();
     468        bd->mData.strName = aName;
    469469
    470470        // leave the lock before informing callbacks
     
    485485    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    486486
    487     *aActive = mData->mActive;
     487    *aActive = bd->mData.fActive;
    488488
    489489    return S_OK;
     
    498498    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    499499
    500     if (mData->mActive != aActive)
     500    if (bd->mData.fActive != RT_BOOL(aActive))
    501501    {
    502502        m_fModified = true;
    503503        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
    504504
    505         mData.backup();
    506         mData->mActive = aActive;
     505        bd.backup();
     506        bd->mData.fActive = RT_BOOL(aActive);
    507507
    508508        // leave the lock before informing callbacks
     
    594594    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    595595
    596     aRemote = mData->mRemote.string();
     596    aRemote = bd->mRemote.string();
    597597
    598598    return S_OK;
     
    607607    Bstr bRemote = Bstr(aRemote).raw();
    608608
    609     if (mData->mRemote.string() != bRemote)
    610     {
    611         Data::BOOLFilter flt = bRemote;
     609    if (bd->mRemote.string() != bRemote)
     610    {
     611        BackupableUSBDeviceFilterData::BOOLFilter flt = bRemote;
    612612        ComAssertRet(!flt.isNull(), E_FAIL);
    613613        if (!flt.isValid())
     
    619619        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
    620620
    621         mData.backup();
    622         mData->mRemote = flt;
     621        bd.backup();
     622        bd->mRemote = flt;
    623623
    624624        // leave the lock before informing callbacks
     
    639639    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    640640
    641     *aMaskedIfs = mData->mMaskedIfs;
     641    *aMaskedIfs = bd->mData.ulMaskedInterfaces;
    642642
    643643    return S_OK;
     
    652652    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    653653
    654     if (mData->mMaskedIfs != aMaskedIfs)
     654    if (bd->mData.ulMaskedInterfaces != aMaskedIfs)
    655655    {
    656656        m_fModified = true;
    657657        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
    658658
    659         mData.backup();
    660         mData->mMaskedIfs = aMaskedIfs;
     659        bd.backup();
     660        bd->mData.ulMaskedInterfaces = aMaskedIfs;
    661661        // leave the lock before informing callbacks
    662662        alock.release();
     
    678678{
    679679    AutoCaller autoCaller(this);
    680     AssertComRCReturn (autoCaller.rc(), false);
     680    AssertComRCReturn(autoCaller.rc(), false);
    681681
    682682    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    695695    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    696696
    697     mData.rollback();
     697    bd.rollback();
    698698}
    699699
     
    706706    /* sanity */
    707707    AutoCaller autoCaller(this);
    708     AssertComRCReturnVoid (autoCaller.rc());
     708    AssertComRCReturnVoid(autoCaller.rc());
    709709
    710710    /* sanity too */
    711     AutoCaller peerCaller (mPeer);
    712     AssertComRCReturnVoid (peerCaller.rc());
     711    AutoCaller peerCaller(mPeer);
     712    AssertComRCReturnVoid(peerCaller.rc());
    713713
    714714    /* lock both for writing since we modify both (mPeer is "master" so locked
     
    716716    AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS);
    717717
    718     if (mData.isBackedUp())
    719     {
    720         mData.commit();
     718    if (bd.isBackedUp())
     719    {
     720        bd.commit();
    721721        if (mPeer)
    722722        {
    723723            /* attach new data to the peer and reshare it */
    724             mPeer->mData.attach (mData);
     724            mPeer->bd.attach(bd);
    725725        }
    726726    }
     
    738738    /* sanity */
    739739    AutoCaller autoCaller(this);
    740     AssertComRCReturnVoid (autoCaller.rc());
     740    AssertComRCReturnVoid(autoCaller.rc());
    741741
    742742    /* sanity too */
    743     AutoCaller peerCaller (mPeer);
    744     AssertComRCReturnVoid (peerCaller.rc());
     743    AutoCaller peerCaller(mPeer);
     744    AssertComRCReturnVoid(peerCaller.rc());
    745745
    746746    /* peer is not modified, lock it for reading (mPeer is "master" so locked
     
    749749    AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS);
    750750
    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();
    757757    }
    758758
     
    772772    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    773773
    774     i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr);
     774    i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, aStr);
    775775    return S_OK;
    776776}
     
    795795
    796796    com::Utf8Str strOld;
    797     i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
     797    i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, strOld);
    798798    if (strOld != strNew)
    799799    {
     
    801801        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
    802802
    803         mData.backup();
     803        bd.backup();
    804804
    805805        com::Utf8Str errStr;
    806         HRESULT rc = i_usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr);
     806        HRESULT rc = i_usbFilterFieldFromString(&bd->mUSBFilter, aIdx, strNew, errStr);
    807807        if (FAILED(rc))
    808808        {
    809             mData.rollback();
     809            bd.rollback();
    810810            return setError(rc, "%s", errStr.c_str());
    811811        }
     
    877877    mParent->i_addChild(this);
    878878
    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;
    885885
    886886    mInList = false;
     
    930930 *  @param aParent  Handle of the parent object.
    931931 */
    932 HRESULT HostUSBDeviceFilter::init (Host *aParent, IN_BSTR aName)
     932HRESULT HostUSBDeviceFilter::init(Host *aParent, IN_BSTR aName)
    933933{
    934934    LogFlowThisFunc(("aParent=%p\n", aParent));
     
    946946    mParent->i_addChild(this);
    947947
    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;
    952952    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;
    956956
    957957    /* Confirm successful initialization */
     
    976976    mInList = false;
    977977
    978     mData.free();
     978    bd.free();
    979979
    980980    mParent->i_removeChild(this);
     
    10001000    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    10011001
    1002     aName = mData->mName;
     1002    aName = bd->mData.strName;
    10031003
    10041004    return S_OK;
     
    10101010    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    10111011
    1012     if (mData->mName != aName)
    1013     {
    1014         mData->mName = aName;
     1012    if (bd->mData.strName != aName)
     1013    {
     1014        bd->mData.strName = aName;
    10151015
    10161016        /* leave the lock before informing callbacks */
    10171017        alock.release();
    10181018
    1019         return mParent->i_onUSBDeviceFilterChange (this);
     1019        return mParent->i_onUSBDeviceFilterChange(this);
    10201020    }
    10211021
     
    10281028    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    10291029
    1030     *aActive = mData->mActive;
     1030    *aActive = bd->mData.fActive;
    10311031
    10321032    return S_OK;
     
    10381038    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    10391039
    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);
    10431043
    10441044        /* leave the lock before informing callbacks */
    10451045        alock.release();
    10461046
    1047         return mParent->i_onUSBDeviceFilterChange (this, TRUE /* aActiveChanged  */);
     1047        return mParent->i_onUSBDeviceFilterChange(this, TRUE /* aActiveChanged  */);
    10481048    }
    10491049
     
    11251125    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    11261126
    1127     aRemote = mData->mRemote.string();
     1127    aRemote = bd->mRemote.string();
    11281128
    11291129    return S_OK;
     
    11411141    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    11421142
    1143     *aMaskedIfs = mData->mMaskedIfs;
     1143    *aMaskedIfs = bd->mData.ulMaskedInterfaces;
    11441144
    11451145    return S_OK;
     
    11591159    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    11601160
    1161     switch (USBFilterGetFilterType (&mData->mUSBFilter))
     1161    switch (USBFilterGetFilterType(&bd->mUSBFilter))
    11621162    {
    11631163        case USBFILTERTYPE_IGNORE:   *aAction = USBDeviceFilterAction_Ignore; break;
     
    11871187                            aAction);
    11881188    }
    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);
    11921192        if (RT_FAILURE(vrc))
    11931193            return setError(E_INVALIDARG,
     
    11981198        alock.release();
    11991199
    1200         return mParent->i_onUSBDeviceFilterChange (this);
     1200        return mParent->i_onUSBDeviceFilterChange(this);
    12011201    }
    12021202
     
    12181218{
    12191219    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1220     i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr);
     1220    i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, aStr);
    12211221    return S_OK;
    12221222}
     
    12281228
    12291229    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);
    12391239
    12401240    COMGETTER(Action)(&data.action);
     
    12551255    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    12561256    Utf8Str strOld;
    1257     i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
     1257    i_usbFilterFieldToString(&bd->mUSBFilter, aIdx, strOld);
    12581258    if (strOld != aStr)
    12591259    {
    1260         //mData.backup();
     1260        //bd.backup();
    12611261        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);
    12631263        if (FAILED(rc))
    12641264        {
    1265             //mData.rollback();
     1265            //bd.rollback();
    12661266            return setError(rc, "%s", errStr.c_str());
    12671267        }
  • trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp

    r60765 r61667  
    380380
    381381    /* notify the proxy (only when it makes sense) */
    382     if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState())
     382    if (pFilter->i_getData().mData.fActive && Global::IsOnline(adep.machineState())
    383383        && pFilter->i_getData().mRemote.isMatch(false))
    384384    {
     
    446446
    447447    /* notify the proxy (only when it makes sense) */
    448     if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState())
     448    if (pFilter->i_getData().mData.fActive && Global::IsOnline(adep.machineState())
    449449        && pFilter->i_getData().mRemote.isMatch(false))
    450450    {
     
    542542    {
    543543        AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
    544         const USBDeviceFilter::Data &filterData = (*it)->i_getData();
     544        const USBDeviceFilter::BackupableUSBDeviceFilterData &filterData = (*it)->i_getData();
    545545
    546546        Bstr str;
    547547
    548548        settings::USBDeviceFilter f;
    549         f.strName = filterData.mName;
    550         f.fActive = !!filterData.mActive;
     549        f.strName = filterData.mData.strName;
     550        f.fActive = !!filterData.mData.fActive;
    551551        (*it)->COMGETTER(VendorId)(str.asOutParam());
    552552        f.strVendorId = str;
     
    564564        f.strPort = str;
    565565        f.strRemote = filterData.mRemote.string();
    566         f.ulMaskedInterfaces = filterData.mMaskedIfs;
     566        f.ulMaskedInterfaces = filterData.mData.ulMaskedInterfaces;
    567567
    568568        data.llDeviceFilters.push_back(f);
     
    601601            {
    602602                /* notify the proxy (only when it makes sense) */
    603                 if ((*it)->i_getData().mActive &&
     603                if ((*it)->i_getData().mData.fActive &&
    604604                    Global::IsOnline(adep.machineState())
    605605                    && (*it)->i_getData().mRemote.isMatch(false))
     
    627627                {
    628628                    /* notify the proxy (only when necessary) */
    629                     if ((*it)->i_getData().mActive
     629                    if ((*it)->i_getData().mData.fActive
    630630                            && (*it)->i_getData().mRemote.isMatch(false))
    631631                    {
     
    839839            {
    840840                /* insert/remove the filter from the proxy */
    841                 if (aFilter->i_getData().mActive)
     841                if (aFilter->i_getData().mData.fActive)
    842842                {
    843843                    ComAssertRet(aFilter->i_getId() == NULL, E_FAIL);
     
    854854        else
    855855        {
    856             if (aFilter->i_getData().mActive)
     856            if (aFilter->i_getData().mData.fActive)
    857857            {
    858858                /* update the filter in the proxy */
     
    897897        if (aDevice->i_isMatch((*it)->i_getData()))
    898898        {
    899             *aMaskedIfs = (*it)->i_getData().mMaskedIfs;
     899            *aMaskedIfs = (*it)->i_getData().mData.ulMaskedInterfaces;
    900900            return true;
    901901        }
     
    995995    {
    996996        AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
    997         const USBDeviceFilter::Data &aData = (*it)->i_getData();
    998 
    999         if (!aData.mActive)
     997        const USBDeviceFilter::BackupableUSBDeviceFilterData &aData = (*it)->i_getData();
     998
     999        if (!aData.mData.fActive)
    10001000            continue;
    10011001        if (!aData.mRemote.isMatch(remote))
     
    10051005
    10061006        match = true;
    1007         *aMaskedIfs = aData.mMaskedIfs;
     1007        *aMaskedIfs = aData.mData.ulMaskedInterfaces;
    10081008        break;
    10091009    }
     
    10411041
    10421042        /* notify the proxy (only if the filter is active) */
    1043         if (   pFilter->i_getData().mActive
     1043        if (   pFilter->i_getData().mData.fActive
    10441044            && pFilter->i_getData().mRemote.isMatch(false) /* and if the filter is NOT remote */
    10451045           )
  • trunk/src/VBox/Main/src-server/USBProxyService.cpp

    r60755 r61667  
    55
    66/*
    7  * Copyright (C) 2006-2014 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    745745    {
    746746        AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
    747         const HostUSBDeviceFilter::Data &data = (*it)->i_getData();
     747        const HostUSBDeviceFilter::BackupableUSBDeviceFilterData &data = (*it)->i_getData();
    748748        if (aDevice->i_isMatch(data))
    749749        {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette