VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h@ 79366

Last change on this file since 79366 was 79366, checked in by vboxsync, 5 years ago

Shared Clipboard/URI: Update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1/* $Id: VBoxSharedClipboardSvc-internal.h 79366 2019-06-26 15:59:30Z vboxsync $ */
2/** @file
3 * Shared Clipboard Service - Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h
19#define VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/list.h>
25
26#include <VBox/hgcmsvc.h>
27#include <VBox/log.h>
28
29#include <VBox/GuestHost/SharedClipboard.h>
30#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
31# include <iprt/semaphore.h>
32# include <VBox/GuestHost/SharedClipboard-uri.h>
33#endif
34
35#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
36/**
37 * Structure for handling a single URI object context.
38 */
39typedef struct _VBOXCLIPBOARDCLIENTURIOBJCTX
40{
41 /** Pointer to current object being processed. */
42 SharedClipboardURIObject *pObj;
43} VBOXCLIPBOARDCLIENTURIOBJCTX, *PVBOXCLIPBOARDCLIENTURIOBJCTX;
44
45struct VBOXCLIPBOARDCLIENTSTATE;
46#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
47
48/**
49 * Structure for keeping generic client state data within the Shared Clipboard host service.
50 * This structure needs to be serializable by SSM.
51 */
52struct VBOXCLIPBOARDCLIENTSTATE
53{
54 struct VBOXCLIPBOARDCLIENTSTATE *pNext;
55 struct VBOXCLIPBOARDCLIENTSTATE *pPrev;
56
57 VBOXCLIPBOARDCONTEXT *pCtx;
58
59 uint32_t u32ClientID;
60
61 SHAREDCLIPBOARDSOURCE enmSource;
62
63 /** The guest is waiting for a message. */
64 bool fAsync;
65 /** The guest is waiting for data from the host */
66 bool fReadPending;
67 /** Whether the host host has sent a quit message. */
68 bool fHostMsgQuit;
69 /** Whether the host host has requested reading clipboard data from the guest. */
70 bool fHostMsgReadData;
71 /** Whether the host host has reported its available formats. */
72 bool fHostMsgFormats;
73
74 struct {
75 VBOXHGCMCALLHANDLE callHandle;
76 uint32_t cParms;
77 VBOXHGCMSVCPARM *paParms;
78 } async;
79
80 struct {
81 VBOXHGCMCALLHANDLE callHandle;
82 uint32_t cParms;
83 VBOXHGCMSVCPARM *paParms;
84 } asyncRead;
85
86 struct {
87 void *pv;
88 uint32_t cb;
89 uint32_t u32Format;
90 } data;
91
92 uint32_t u32AvailableFormats;
93 uint32_t u32RequestedFormat;
94};
95typedef struct VBOXCLIPBOARDCLIENTSTATE *PVBOXCLIPBOARDCLIENTSTATE;
96
97/**
98 * Structure for keeping a HGCM client state within the Shared Clipboard host service.
99 */
100typedef struct _VBOXCLIPBOARDCLIENTDATA
101{
102 /** General client state data. */
103 VBOXCLIPBOARDCLIENTSTATE State;
104#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
105 SHAREDCLIPBOARDURICTX URI;
106#endif
107} VBOXCLIPBOARDCLIENTDATA, *PVBOXCLIPBOARDCLIENTDATA;
108
109/*
110 * The service functions. Locking is between the service thread and the platform-dependent (window) thread.
111 */
112int vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual);
113uint32_t vboxSvcClipboardGetMode(void);
114int vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t uMsg, uint32_t uFormats);
115int vboxSvcClipboardSetSource(PVBOXCLIPBOARDCLIENTDATA pClientData, SHAREDCLIPBOARDSOURCE enmSource);
116
117# ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
118bool vboxSvcClipboardURIMsgIsAllowed(uint32_t uMode, uint32_t uMsg);
119int vboxSvcClipboardURIReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats);
120bool vboxSvcClipboardURIReturnMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
121# endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
122
123/*
124 * Platform-dependent implementations.
125 */
126int VBoxClipboardSvcImplInit(void);
127void VBoxClipboardSvcImplDestroy(void);
128
129int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless);
130int VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData);
131int VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats);
132int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);
133int VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format);
134/**
135 * Synchronise the contents of the host clipboard with the guest, called by the HGCM layer
136 * after a save and restore of the guest.
137 */
138int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData);
139
140#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
141int VBoxSvcClipboardProviderImplURIReadDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDATAHDR *ppDataHdr);
142int VBoxSvcClipboardProviderImplURIWriteDataHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr);
143int VBoxSvcClipboardProviderImplURIReadDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead);
144int VBoxSvcClipboardProviderImplURIWriteDataChunk(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten);
145int VBoxSvcClipboardProviderImplURIReadDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDDIRDATA *ppDirData);
146int VBoxSvcClipboardProviderImplURIWriteDir(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDDIRDATA pDirData);
147int VBoxSvcClipboardProviderImplURIReadFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, PVBOXCLIPBOARDFILEHDR *ppFileHdr);
148int VBoxSvcClipboardProviderImplURIWriteFileHdr(PSHAREDCLIPBOARDPROVIDERCTX pCtx, const PVBOXCLIPBOARDFILEHDR pFileHdr);
149int VBoxSvcClipboardProviderImplURIReadFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead);
150int VBoxSvcClipboardProviderImplURIWriteFileData(PSHAREDCLIPBOARDPROVIDERCTX pCtx, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten);
151
152DECLCALLBACK(void) VBoxSvcClipboardURITransferPrepareCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);
153DECLCALLBACK(void) VBoxSvcClipboardURIDataHeaderCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);
154DECLCALLBACK(void) VBoxSvcClipboardURIDataCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);
155DECLCALLBACK(void) VBoxSvcClipboardURITransferCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc);
156DECLCALLBACK(void) VBoxSvcClipboardURITransferCanceledCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);
157DECLCALLBACK(void) VBoxSvcClipboardURITransferErrorCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc);
158
159int VBoxClipboardSvcImplURITransferCreate(PVBOXCLIPBOARDCLIENTDATA pClientData, PSHAREDCLIPBOARDURITRANSFER pTransfer);
160int VBoxClipboardSvcImplURITransferDestroy(PVBOXCLIPBOARDCLIENTDATA pClientData, PSHAREDCLIPBOARDURITRANSFER pTransfer);
161
162void VBoxClipboardSvcImplURIOnDataHeaderComplete(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);
163#endif
164
165/* Host unit testing interface */
166#ifdef UNIT_TEST
167uint32_t TestClipSvcGetMode(void);
168#endif
169
170#endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h */
171
Note: See TracBrowser for help on using the repository browser.

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