VirtualBox

Ignore:
Timestamp:
Aug 13, 2013 2:40:20 PM (11 years ago)
Author:
vboxsync
Message:

Additions/GuestCtrl: Use a separate filter mask + value for message filtering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r47621 r47695  
    287287    int CopyTo(VBOXHGCMSVCPARM paDstParms[], uint32_t cDstParms) const
    288288    {
    289         LogFlowFunc(("pHostCmd=%p, mMsgType=%RU32, mParmCount=%RU32, mContextID=%RU32\n",
    290                      this, mMsgType, mParmCount, mContextID));
     289        LogFlowFunc(("pHostCmd=%p, mMsgType=%RU32, mParmCount=%RU32, mContextID=%RU32 (Session %RU32)\n",
     290                     this, mMsgType, mParmCount, mContextID, VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(mContextID)));
    291291
    292292        int rc = VINF_SUCCESS;
     
    478478        : mSvcHelpers(NULL),
    479479          mID(0),
    480           mFlags(0), mContextFilter(0),
     480          mFlags(0),
     481          mFilterMask(0), mFilterValue(0),
    481482          mHostCmdRc(VINF_SUCCESS), mHostCmdTries(0),
    482483          mHostCmdTS(0),
     
    487488        : mSvcHelpers(pSvcHelpers),
    488489          mID(uClientID),
    489           mFlags(0), mContextFilter(0),
     490          mFlags(0),
     491          mFilterMask(0), mFilterValue(0),
    490492          mHostCmdRc(VINF_SUCCESS), mHostCmdTries(0),
    491493          mHostCmdTS(0),
     
    571573        if (mFlags & CLIENTSTATE_FLAG_CONTEXTFILTER)
    572574        {
    573             fWant =
    574                 (pHostCmd->mContextID & mContextFilter) == pHostCmd->mContextID;
     575            fWant = (pHostCmd->mContextID & mFilterMask) == mFilterValue;
    575576        }
    576577        else /* Client is interested in all commands. */
    577578            fWant = true;
    578579
    579         LogFlowFunc(("[Client %RU32] mFlags=0x%x, mContextID=%RU32 (session %RU32), mContextFilter=0x%x, fWant=%RTbool\n",
     580        LogFlowFunc(("[Client %RU32] mFlags=0x%x, mContextID=%RU32 (session %RU32), mFilterMask=0x%x, mFilterValue=%RU32, fWant=%RTbool\n",
    580581                     mID, mFlags, pHostCmd->mContextID,
    581582                     VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCmd->mContextID),
    582                      mContextFilter, fWant));
     583                     mFilterMask, mFilterValue, fWant));
    583584
    584585        return fWant;
     
    831832    /** Client flags. @sa CLIENTSTATE_FLAG_ flags. */
    832833    uint32_t mFlags;
    833     /** The context ID filter, based on the flags set. */
    834     uint32_t mContextFilter;
     834    /** The context ID filter mask, if any. */
     835    uint32_t mFilterMask;
     836    /** The context ID filter value, if any. */
     837    uint32_t mFilterValue;
    835838    /** Host command list to process. */
    836839    HostCmdList mHostCmdList;
     
    11521155        return VERR_NOT_FOUND; /* Should never happen. */
    11531156
    1154     if (cParms != 3)
     1157    if (cParms != 4)
    11551158        return VERR_INVALID_PARAMETER;
    11561159
    1157     uint32_t uMaskAdd, uMaskRemove;
    1158     int rc = paParms[0].getUInt32(&uMaskAdd);
     1160    uint32_t uValue, uMaskAdd, uMaskRemove;
     1161    int rc = paParms[0].getUInt32(&uValue);
    11591162    if (RT_SUCCESS(rc))
    1160         rc = paParms[1].getUInt32(&uMaskRemove);
     1163        rc = paParms[1].getUInt32(&uMaskAdd);
     1164    if (RT_SUCCESS(rc))
     1165        rc = paParms[2].getUInt32(&uMaskRemove);
     1166    /** @todo paParm[3] (flags) not used yet. */
    11611167    if (RT_SUCCESS(rc))
    11621168    {
     
    11651171        clientState.mFlags |= CLIENTSTATE_FLAG_CONTEXTFILTER;
    11661172        if (uMaskAdd)
    1167             clientState.mContextFilter |= uMaskAdd;
     1173            clientState.mFilterMask |= uMaskAdd;
    11681174        if (uMaskRemove)
    1169             clientState.mContextFilter &= ~uMaskRemove;
    1170 
    1171         LogFlowFunc(("[Client %RU32] Setting message filter=0x%x set (flags=0x%x, maskAdd=0x%x, maskRemove=0x%x)\n",
    1172                      u32ClientID, clientState.mContextFilter, clientState.mFlags,
    1173                      uMaskAdd, uMaskRemove));
     1175            clientState.mFilterMask &= ~uMaskRemove;
     1176
     1177        clientState.mFilterValue = uValue;
     1178
     1179        LogFlowFunc(("[Client %RU32] Setting message filterMask=0x%x, filterVal=%RU32 set (flags=0x%x, maskAdd=0x%x, maskRemove=0x%x)\n",
     1180                     u32ClientID, clientState.mFilterMask, clientState.mFilterValue,
     1181                     clientState.mFlags, uMaskAdd, uMaskRemove));
    11741182    }
    11751183
     
    11961204
    11971205    clientState.mFlags &= ~CLIENTSTATE_FLAG_CONTEXTFILTER;
    1198     clientState.mContextFilter = 0;
     1206    clientState.mFilterMask = 0;
     1207    clientState.mFilterValue = 0;
    11991208
    12001209    LogFlowFunc(("[Client %RU32} Unset message filter\n", u32ClientID));
Note: See TracChangeset for help on using the changeset viewer.

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