VirtualBox

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

Last change on this file since 78942 was 78942, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: Update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/* $Id: VBoxSharedClipboardSvc-internal.h 78942 2019-06-03 19:10:19Z 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 <VBox/GuestHost/SharedClipboard-uri.h>
32#endif
33
34#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
35/**
36 * Structure for handling a single URI object context.
37 */
38typedef struct _VBOXCLIPBOARDCLIENTURIOBJCTX
39{
40 /** Pointer to current object being processed. */
41 SharedClipboardURIObject *pObj;
42} VBOXCLIPBOARDCLIENTURIOBJCTX, *PVBOXCLIPBOARDCLIENTURIOBJCTX;
43
44struct VBOXCLIPBOARDCLIENTSTATE;
45
46/**
47 * Structure for maintaining a single URI transfer.
48 * A transfer can contain one or multiple files / directories.
49 */
50typedef struct _VBOXCLIPBOARDCLIENTURITRANSFER
51{
52 /** Node for keeping this transfer in a RTList. */
53 RTLISTNODE Node;
54 /** Pointer to the client state (parent). */
55 VBOXCLIPBOARDCLIENTSTATE *pState;
56 /** The transfer's own (local) area.
57 * The area itself has a clipboard ID assigned, which gets shared (maintained) across all
58 * VMs via VBoxSVC. */
59 SharedClipboardArea Area;
60 /** The transfer's URI list, containing the fs object root entries. */
61 SharedClipboardURIList List;
62 /** Current object being handled. */
63 VBOXCLIPBOARDCLIENTURIOBJCTX ObjCtx;
64 /** The transfer header, needed for verification and accounting. */
65 VBOXCLIPBOARDDATAHDR Hdr;
66 /** Intermediate meta data object. */
67 SHAREDCLIPBOARDMETADATA Meta;
68} VBOXCLIPBOARDCLIENTURITRANSFER, *PVBOXCLIPBOARDCLIENTURITRANSFER;
69#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
70
71/**
72 * Structure for keeping generic client state data within the Shared Clipboard host service.
73 * This structure needs to be serializable by SSM.
74 */
75struct VBOXCLIPBOARDCLIENTSTATE
76{
77 struct VBOXCLIPBOARDCLIENTSTATE *pNext;
78 struct VBOXCLIPBOARDCLIENTSTATE *pPrev;
79
80 VBOXCLIPBOARDCONTEXT *pCtx;
81
82 uint32_t u32ClientID;
83
84 /** The guest is waiting for a message. */
85 bool fAsync;
86 /** The guest is waiting for data from the host */
87 bool fReadPending;
88 /** Whether the host host has sent a quit message. */
89 bool fHostMsgQuit;
90 /** Whether the host host has requested reading clipboard data from the guest. */
91 bool fHostMsgReadData;
92 /** Whether the host host has reported its available formats. */
93 bool fHostMsgFormats;
94
95 struct {
96 VBOXHGCMCALLHANDLE callHandle;
97 VBOXHGCMSVCPARM *paParms;
98 } async;
99
100 struct {
101 VBOXHGCMCALLHANDLE callHandle;
102 VBOXHGCMSVCPARM *paParms;
103 } asyncRead;
104
105 struct {
106 void *pv;
107 uint32_t cb;
108 uint32_t u32Format;
109 } data;
110
111 uint32_t u32AvailableFormats;
112 uint32_t u32RequestedFormat;
113};
114typedef struct VBOXCLIPBOARDCLIENTSTATE *PVBOXCLIPBOARDCLIENTSTATE;
115
116/**
117 * Structure for keeping a HGCM client state within the Shared Clipboard host service.
118 */
119typedef struct _VBOXCLIPBOARDCLIENTDATA
120{
121 /** General client state data. */
122 VBOXCLIPBOARDCLIENTSTATE State;
123#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
124 /** List of concurrent transfers.
125 * At the moment we only support one transfer at a time (per client). */
126 RTLISTANCHOR TransferList;
127 /** Data related to URI transfer handling. */
128 VBOXCLIPBOARDCLIENTURITRANSFER Transfer;
129 /** Number of concurrent transfers.
130 * At the moment we only support one transfer at a time (per client). */
131 uint32_t cTransfers;
132#endif
133} VBOXCLIPBOARDCLIENTDATA, *PVBOXCLIPBOARDCLIENTDATA;
134
135/*
136 * The service functions. Locking is between the service thread and the platform-dependent (window) thread.
137 */
138uint32_t vboxSvcClipboardGetMode(void);
139void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats);
140void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual);
141
142int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENTSTATE pState, uint32_t uClientID);
143void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENTSTATE pState);
144
145#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
146void vboxClipboardSvcURIDirDataDestroy(PVBOXCLIPBOARDDIRDATA pDirData);
147void vboxClipboardSvcURIFileHdrDestroy(PVBOXCLIPBOARDFILEHDR pFileHdr);
148void vboxClipboardSvcURIFileDataDestroy(PVBOXCLIPBOARDFILEDATA pFileData);
149#endif
150
151/*
152 * Platform-dependent implementations.
153 */
154int VBoxClipboardSvcImplInit(void);
155void VBoxClipboardSvcImplDestroy(void);
156
157int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless);
158void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData);
159void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats);
160int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);
161void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format);
162int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData);
163
164#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
165int VBoxClipboardSvcImplURIReadDir(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDDIRDATA pDirData);
166int VBoxClipboardSvcImplURIWriteDir(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDDIRDATA pDirData);
167int VBoxClipboardSvcImplURIReadFileHdr(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDFILEHDR pFileHdr);
168int VBoxClipboardSvcImplURIWriteFileHdr(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDFILEHDR pFileHdr);
169int VBoxClipboardSvcImplURIReadFileData(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDFILEDATA pFileData);
170int VBoxClipboardSvcImplURIWriteFileData(PVBOXCLIPBOARDCLIENTDATA pClientData, PVBOXCLIPBOARDFILEDATA pFileData);
171#endif
172
173/* Host unit testing interface */
174#ifdef UNIT_TEST
175uint32_t TestClipSvcGetMode(void);
176#endif
177
178#endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h */
179
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