Changeset 47620 in vbox for trunk/src/VBox/HostServices/GuestControl/service.cpp
- Timestamp:
- Aug 8, 2013 8:09:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestControl/service.cpp
r47488 r47620 563 563 return false; 564 564 565 #ifdef DEBUG_andy 566 LogFlowFunc(("[Client %RU32] mFlags=%x, mContextID=%RU32, mContextFilter=%x, filterRes=%x, sessionID=%RU32\n", 567 mID, mFlags, pHostCmd->mContextID, mContextFilter, 568 pHostCmd->mContextID & mContextFilter, VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCmd->mContextID))); 565 #ifdef DEBUG 566 LogFlowFunc(("[Client %RU32] mFlags=0x%x, mContextID=%RU32 (session %RU32), mContextFilter=0x%x (result=%x -> %RTbool)\n", 567 mID, mFlags, pHostCmd->mContextID, 568 VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCmd->mContextID), 569 mContextFilter, 570 pHostCmd->mContextID & pHostCmd->mContextID, 571 (pHostCmd->mContextID & mContextFilter) == pHostCmd->mContextID)); 569 572 #endif 570 573 /* 571 * If a sesseion filter is set, only obey those sessions we're interested in. 574 * If a sesseion filter is set, only obey those commands we're interested in 575 * by applying our context ID filter mask and compare the result with the 576 * original context ID. 572 577 */ 573 bool fWant = false;578 bool fWant; 574 579 if (mFlags & CLIENTSTATE_FLAG_CONTEXTFILTER) 575 580 { 576 if ((pHostCmd->mContextID & mContextFilter) == mContextFilter)577 fWant = true;581 fWant = 582 (pHostCmd->mContextID & mContextFilter) == pHostCmd->mContextID; 578 583 } 579 584 else /* Client is interested in all commands. */ … … 995 1000 int clientDisconnect(uint32_t u32ClientID, void *pvClient); 996 1001 int clientGetCommand(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 997 int clientSetMsgFilter(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 1002 int clientSetMsgFilterSet(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 1003 int clientSetMsgFilterUnset(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 998 1004 int clientSkipMsg(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 999 1005 int cancelHostCmd(uint32_t u32ContextID); … … 1136 1142 } 1137 1143 1138 int Service::clientSetMsgFilter (uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle,1139 uint32_t cParms, VBOXHGCMSVCPARM paParms[])1144 int Service::clientSetMsgFilterSet(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, 1145 uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 1140 1146 { 1141 1147 /* … … 1149 1155 return VERR_NOT_FOUND; /* Should never happen. */ 1150 1156 1151 if (cParms != 2)1157 if (cParms != 3) 1152 1158 return VERR_INVALID_PARAMETER; 1153 1159 … … 1166 1172 clientState.mContextFilter &= ~uMaskRemove; 1167 1173 1168 LogFlowFunc((" Client ID=%RU32 now has filter=%x enabled (flags=%x, maskAdd=%x, maskRemove=%x)\n",1174 LogFlowFunc(("[Client %RU32] Setting message filter=0x%x set (flags=0x%x, maskAdd=0x%x, maskRemove=0x%x)\n", 1169 1175 u32ClientID, clientState.mContextFilter, clientState.mFlags, 1170 1176 uMaskAdd, uMaskRemove)); … … 1172 1178 1173 1179 return rc; 1180 } 1181 1182 int Service::clientSetMsgFilterUnset(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, 1183 uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 1184 { 1185 /* 1186 * Lookup client in our list so that we can assign the context ID of 1187 * a command to that client. 1188 */ 1189 ClientStateMapIter itClientState = mClientStateMap.find(u32ClientID); 1190 AssertMsg(itClientState != mClientStateMap.end(), ("Client with ID=%RU32 not found when it should be present\n", 1191 u32ClientID)); 1192 if (itClientState == mClientStateMap.end()) 1193 return VERR_NOT_FOUND; /* Should never happen. */ 1194 1195 if (cParms != 1) 1196 return VERR_INVALID_PARAMETER; 1197 1198 ClientState &clientState = itClientState->second; 1199 1200 clientState.mFlags &= ~CLIENTSTATE_FLAG_CONTEXTFILTER; 1201 clientState.mContextFilter = 0; 1202 1203 LogFlowFunc(("[Client %RU32} Unset message filter\n", u32ClientID)); 1204 return VINF_SUCCESS; 1174 1205 } 1175 1206 … … 1187 1218 return VERR_NOT_FOUND; /* Should never happen. */ 1188 1219 1189 if (cParms != 0)1220 if (cParms != 1) 1190 1221 return VERR_INVALID_PARAMETER; 1191 1222 … … 1325 1356 LogFlowFunc(("Waking up client ID=%RU32 failed with rc=%Rrc\n", 1326 1357 itClientState->first, rc2)); 1327 #ifdef DEBUG _andy1358 #ifdef DEBUG 1328 1359 uClientsWokenUp++; 1329 1360 #endif … … 1333 1364 } 1334 1365 1335 #ifdef DEBUG _andy1366 #ifdef DEBUG 1336 1367 LogFlowFunc(("%RU32 clients have been woken up\n", uClientsWokenUp)); 1337 1368 #endif … … 1385 1416 * Since VBox 4.3+. 1386 1417 */ 1387 case GUEST_MSG_FILTER: 1388 LogFlowFunc(("[Client %RU32] GUEST_MSG_FILTER\n", u32ClientID)); 1389 rc = clientSetMsgFilter(u32ClientID, callHandle, cParms, paParms); 1418 case GUEST_MSG_FILTER_SET: 1419 LogFlowFunc(("[Client %RU32] GUEST_MSG_FILTER_SET\n", u32ClientID)); 1420 rc = clientSetMsgFilterSet(u32ClientID, callHandle, cParms, paParms); 1421 break; 1422 1423 /* 1424 * Unsetting the message filter flag. 1425 */ 1426 case GUEST_MSG_FILTER_UNSET: 1427 LogFlowFunc(("[Client %RU32] GUEST_MSG_FILTER_UNSET\n", u32ClientID)); 1428 rc = clientSetMsgFilterUnset(u32ClientID, callHandle, cParms, paParms); 1390 1429 break; 1391 1430
Note:
See TracChangeset
for help on using the changeset viewer.