Changeset 79503 in vbox
- Timestamp:
- Jul 3, 2019 2:05:53 PM (5 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r79501 r79503 76 76 /** 77 77 * Structure for keeping generic client state data within the Shared Clipboard host service. 78 * This structure needs to be serializable by SSM .78 * This structure needs to be serializable by SSM (must be a POD type). 79 79 */ 80 80 typedef struct VBOXCLIPBOARDCLIENTSTATE … … 125 125 uint32_t u32AvailableFormats; 126 126 uint32_t u32RequestedFormat; 127 127 } VBOXCLIPBOARDCLIENTSTATE, *PVBOXCLIPBOARDCLIENTSTATE; 128 129 /** 130 * Structure for keeping a HGCM client state within the Shared Clipboard host service. 131 */ 132 typedef struct _VBOXCLIPBOARDCLIENTDATA 133 { 134 /** General client state data. */ 135 VBOXCLIPBOARDCLIENTSTATE State; 128 136 /** The client's message queue (FIFO). */ 129 137 RTCList<VBOXCLIPBOARDCLIENTMSG *> queueMsg; 130 } VBOXCLIPBOARDCLIENTSTATE, *PVBOXCLIPBOARDCLIENTSTATE;131 132 /**133 * Structure for keeping a HGCM client state within the Shared Clipboard host service.134 */135 typedef struct _VBOXCLIPBOARDCLIENTDATA136 {137 /** General client state data. */138 VBOXCLIPBOARDCLIENTSTATE State;139 138 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 140 139 /** URI context data. */ 141 SHAREDCLIPBOARDURICTX URI;140 SHAREDCLIPBOARDURICTX URI; 142 141 #endif 143 142 } VBOXCLIPBOARDCLIENTDATA, *PVBOXCLIPBOARDCLIENTDATA; … … 191 190 int vboxSvcClipboardClientDeferredSetMsgInfo(PVBOXCLIPBOARDCLIENT pClient, uint32_t uMsg, uint32_t cParms); 192 191 193 void vboxSvcClipboardMsgQueueReset(PVBOXCLIPBOARDCLIENT STATE pState);192 void vboxSvcClipboardMsgQueueReset(PVBOXCLIPBOARDCLIENTDATA pClientData); 194 193 PVBOXCLIPBOARDCLIENTMSG vboxSvcClipboardMsgAlloc(uint32_t uMsg, uint32_t cParms); 195 194 void vboxSvcClipboardMsgFree(PVBOXCLIPBOARDCLIENTMSG pMsg); 196 int vboxSvcClipboardMsgAdd(PVBOXCLIPBOARDCLIENT STATE pState, PVBOXCLIPBOARDCLIENTMSG pMsg, bool fAppend);197 int vboxSvcClipboardMsgGetNextInfo(PVBOXCLIPBOARDCLIENT STATE pState, uint32_t *puType, uint32_t *pcParms);198 int vboxSvcClipboardMsgGetNext(PVBOXCLIPBOARDCLIENT STATE pState,195 int vboxSvcClipboardMsgAdd(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDCLIENTMSG pMsg, bool fAppend); 196 int vboxSvcClipboardMsgGetNextInfo(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t *puType, uint32_t *pcParms); 197 int vboxSvcClipboardMsgGetNext(PVBOXCLIPBOARDCLIENTDATA pClientData, 199 198 uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 200 199 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r79502 r79503 159 159 * Prototypes * 160 160 *********************************************************************************************************************************/ 161 static int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENT STATE pState, uint32_t uClientID);162 static int vboxSvcClipboardClientStateDestroy(PVBOXCLIPBOARDCLIENT STATE pState);163 static void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENT STATE pState);161 static int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t uClientID); 162 static int vboxSvcClipboardClientStateDestroy(PVBOXCLIPBOARDCLIENTDATA pClientData); 163 static void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENTDATA pClientData); 164 164 165 165 … … 265 265 * Resets a client's state message queue. 266 266 * 267 * @param p State Pointer to the client's statestructure to reset message queue for.268 */ 269 void vboxSvcClipboardMsgQueueReset(PVBOXCLIPBOARDCLIENT STATE pState)267 * @param pClientData Pointer to the client data structure to reset message queue for. 268 */ 269 void vboxSvcClipboardMsgQueueReset(PVBOXCLIPBOARDCLIENTDATA pClientData) 270 270 { 271 271 LogFlowFuncEnter(); 272 272 273 while (!p State->queueMsg.isEmpty())274 { 275 RTMemFree(p State->queueMsg.last());276 p State->queueMsg.removeLast();273 while (!pClientData->queueMsg.isEmpty()) 274 { 275 RTMemFree(pClientData->queueMsg.last()); 276 pClientData->queueMsg.removeLast(); 277 277 } 278 278 } … … 326 326 * 327 327 * @returns IPRT status code. 328 * @param p State Pointer to the client's statestructure to add new message to.328 * @param pClientData Pointer to the client data structure to add new message to. 329 329 * @param pMsg Pointer to message to add. The queue then owns the pointer. 330 330 * @param fAppend Whether to append or prepend the message to the queue. 331 331 */ 332 int vboxSvcClipboardMsgAdd(PVBOXCLIPBOARDCLIENT STATE pState, PVBOXCLIPBOARDCLIENTMSG pMsg, bool fAppend)332 int vboxSvcClipboardMsgAdd(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDCLIENTMSG pMsg, bool fAppend) 333 333 { 334 334 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); … … 337 337 338 338 if (fAppend) 339 p State->queueMsg.append(pMsg);339 pClientData->queueMsg.append(pMsg); 340 340 else 341 p State->queueMsg.prepend(pMsg);341 pClientData->queueMsg.prepend(pMsg); 342 342 343 343 /** @todo Catch / handle OOM? */ … … 350 350 * 351 351 * @returns IPRT status code. VERR_NO_DATA if no next message is available. 352 * @param p State Pointer to the client's statestructure to get message info for.352 * @param pClientDAta Pointer to the client data structure to get message info for. 353 353 * @param puType Where to store the message type. 354 354 * @param pcParms Where to store the message parameter count. 355 355 */ 356 int vboxSvcClipboardMsgGetNextInfo(PVBOXCLIPBOARDCLIENT STATE pState, uint32_t *puType, uint32_t *pcParms)356 int vboxSvcClipboardMsgGetNextInfo(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t *puType, uint32_t *pcParms) 357 357 { 358 358 AssertPtrReturn(puType, VERR_INVALID_POINTER); … … 361 361 int rc; 362 362 363 if (p State->queueMsg.isEmpty())363 if (pClientData->queueMsg.isEmpty()) 364 364 { 365 365 rc = VERR_NO_DATA; … … 367 367 else 368 368 { 369 PVBOXCLIPBOARDCLIENTMSG pMsg = p State->queueMsg.first();369 PVBOXCLIPBOARDCLIENTMSG pMsg = pClientData->queueMsg.first(); 370 370 AssertPtr(pMsg); 371 371 … … 385 385 * 386 386 * @returns IPRT status code. 387 * @param p State Pointer to the client's statestructure to get message for.387 * @param pClientData Pointer to the client data structure to get message for. 388 388 * @param uMsg Message type to retrieve. 389 389 * @param cParms Number of parameters the \@a paParms array can store. 390 390 * @param paParms Where to store the message parameters. 391 391 */ 392 int vboxSvcClipboardMsgGetNext(PVBOXCLIPBOARDCLIENT STATE pState,392 int vboxSvcClipboardMsgGetNext(PVBOXCLIPBOARDCLIENTDATA pClientData, 393 393 uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 394 394 { … … 396 396 397 397 /* Check for pending messages in our queue. */ 398 if (p State->queueMsg.isEmpty())398 if (pClientData->queueMsg.isEmpty()) 399 399 return VERR_NO_DATA; 400 400 401 401 /* Get the current message. */ 402 PVBOXCLIPBOARDCLIENTMSG pMsg = p State->queueMsg.first();402 PVBOXCLIPBOARDCLIENTMSG pMsg = pClientData->queueMsg.first(); 403 403 AssertPtr(pMsg); 404 404 … … 422 422 423 423 /** @todo Only remove on success? */ 424 p State->queueMsg.removeFirst(); /* Remove the current message from the queue. */424 pClientData->queueMsg.removeFirst(); /* Remove the current message from the queue. */ 425 425 } 426 426 else 427 427 { 428 vboxSvcClipboardMsgQueueReset(p State);428 vboxSvcClipboardMsgQueueReset(pClientData); 429 429 /** @todo Cleanup, send notification to guest. */ 430 430 } … … 706 706 VBoxClipboardSvcImplDisconnect(pClientData); 707 707 708 vboxSvcClipboardClientStateReset( &pClientData->State);709 vboxSvcClipboardClientStateDestroy( &pClientData->State);708 vboxSvcClipboardClientStateReset(pClientData); 709 vboxSvcClipboardClientStateDestroy(pClientData); 710 710 711 711 RTMemFree(itClient->second); … … 738 738 739 739 /* Reset the client state. */ 740 vboxSvcClipboardClientStateReset( &pClient->pData->State);740 vboxSvcClipboardClientStateReset(pClient->pData); 741 741 742 742 /* (Re-)initialize the client state. */ 743 vboxSvcClipboardClientStateInit( &pClient->pData->State, u32ClientID);743 vboxSvcClipboardClientStateInit(pClient->pData, u32ClientID); 744 744 745 745 rc = VBoxClipboardSvcImplConnect(pClient->pData, VBoxSvcClipboardGetHeadless()); … … 1346 1346 * 1347 1347 * @returns VBox status code. 1348 * @param p StateClient state to initialize.1348 * @param pClientData Client state to initialize. 1349 1349 * @param uClientID Client ID (HGCM) to use for this client state. 1350 1350 */ 1351 static int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENT STATE pState, uint32_t uClientID)1351 static int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t uClientID) 1352 1352 { 1353 1353 LogFlowFuncEnter(); … … 1355 1355 /* Register the client. 1356 1356 * Note: Do *not* memset the struct, as it contains classes (for caching). */ 1357 p State->u32ClientID = uClientID;1357 pClientData->State.u32ClientID = uClientID; 1358 1358 1359 1359 return VINF_SUCCESS; … … 1364 1364 * 1365 1365 * @returns VBox status code. 1366 * @param p StateClient state to destroy.1367 */ 1368 static int vboxSvcClipboardClientStateDestroy(PVBOXCLIPBOARDCLIENT STATE pState)1366 * @param pClientData Client state to destroy. 1367 */ 1368 static int vboxSvcClipboardClientStateDestroy(PVBOXCLIPBOARDCLIENTDATA pClientData) 1369 1369 { 1370 1370 LogFlowFuncEnter(); 1371 1371 1372 vboxSvcClipboardMsgQueueReset(p State);1372 vboxSvcClipboardMsgQueueReset(pClientData); 1373 1373 1374 1374 return VINF_SUCCESS; … … 1378 1378 * Resets a Shared Clipboard service's client state. 1379 1379 * 1380 * @param p StateClient state to reset.1381 */ 1382 static void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENT STATE pState)1380 * @param pClientData Client state to reset. 1381 */ 1382 static void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENTDATA pClientData) 1383 1383 { 1384 1384 LogFlowFuncEnter(); 1385 1385 1386 1386 /** @todo Clear async / asynRead / ... data? */ 1387 vboxSvcClipboardMsgQueueReset(p State);1388 1389 p State->u32ClientID = 0;1390 p State->fAsync = false;1391 p State->fReadPending = false;1392 1393 p State->fHostMsgQuit = false;1394 p State->fHostMsgReadData = false;1395 p State->fHostMsgFormats = false;1387 vboxSvcClipboardMsgQueueReset(pClientData); 1388 1389 pClientData->State.u32ClientID = 0; 1390 pClientData->State.fAsync = false; 1391 pClientData->State.fReadPending = false; 1392 1393 pClientData->State.fHostMsgQuit = false; 1394 pClientData->State.fHostMsgReadData = false; 1395 pClientData->State.fHostMsgFormats = false; 1396 1396 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 1397 p State->URI.fTransferStart = false;1398 p State->URI.enmTransferDir = SHAREDCLIPBOARDURITRANSFERDIR_UNKNOWN;1397 pClientData->State.URI.fTransferStart = false; 1398 pClientData->State.URI.enmTransferDir = SHAREDCLIPBOARDURITRANSFERDIR_UNKNOWN; 1399 1399 #endif 1400 1400 1401 p State->u32AvailableFormats = 0;1402 p State->u32RequestedFormat = 0;1401 pClientData->State.u32AvailableFormats = 0; 1402 pClientData->State.u32RequestedFormat = 0; 1403 1403 } 1404 1404
Note:
See TracChangeset
for help on using the changeset viewer.