VirtualBox

source: vbox/trunk/include/VBox/GuestHost/SharedClipboard.h@ 82513

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

SharedClipboardSvc,Vbgl: Reviewed and adjusted the handling of the VBOX_SHCL_GUEST_FN_REPORT_FORMATS message, paddling back the parameter changes from the 6.1 dev cycle and fixing a couple of bugs introduced. Also documented the message and renamed it to a more sensible name. Dropped the new Vbgl method, renaming the old one. bugref:9437

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1/** @file
2 * Shared Clipboard - Common guest and host Code.
3 */
4
5/*
6 * Copyright (C) 2006-2019 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_GuestHost_SharedClipboard_h
27#define VBOX_INCLUDED_GuestHost_SharedClipboard_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/types.h>
33#include <iprt/list.h>
34
35/**
36 * Shared Clipboard transfer direction.
37 */
38typedef enum SHCLTRANSFERDIR
39{
40 /** Unknown transfer directory. */
41 SHCLTRANSFERDIR_UNKNOWN = 0,
42 /** Read transfer (from source). */
43 SHCLTRANSFERDIR_FROM_REMOTE,
44 /** Write transfer (to target). */
45 SHCLTRANSFERDIR_TO_REMOTE,
46 /** The usual 32-bit hack. */
47 SHCLTRANSFERDIR_32BIT_HACK = 0x7fffffff
48} SHCLTRANSFERDIR;
49/** Pointer to a shared clipboard transfer direction. */
50typedef SHCLTRANSFERDIR *PSHCLTRANSFERDIR;
51
52
53/** A single Shared Clipboard format (VBOX_SHCL_FMT_XXX). */
54typedef uint32_t SHCLFORMAT;
55/** Pointer to a single Shared Clipboard format (VBOX_SHCL_FMT_XXX). */
56typedef SHCLFORMAT *PSHCLFORMAT;
57
58/** Bit map (flags) of Shared Clipboard formats (VBOX_SHCL_FMT_XXX). */
59typedef uint32_t SHCLFORMATS;
60/** Pointer to a bit map of Shared Clipboard formats (VBOX_SHCL_FMT_XXX). */
61typedef SHCLFORMATS *PSHCLFORMATS;
62
63
64/**
65 * Generic Shared Clipboard data block.
66 */
67typedef struct SHCLDATABLOCK
68{
69 /** Clipboard format this data block represents. */
70 SHCLFORMAT uFormat;
71 /** Size (in bytes) of actual data block. */
72 uint32_t cbData;
73 /** Pointer to actual data block. */
74 void *pvData;
75} SHCLDATABLOCK;
76/** Pointer to a generic shared clipboard data block. */
77typedef SHCLDATABLOCK *PSHCLDATABLOCK;
78
79/**
80 * Shared Clipboard data read request.
81 */
82typedef struct SHCLDATAREQ
83{
84 /** In which format the data needs to be sent. */
85 SHCLFORMAT uFmt;
86 /** Read flags; currently unused. */
87 uint32_t fFlags;
88 /** Maximum data (in byte) can be sent. */
89 uint32_t cbSize;
90} SHCLDATAREQ;
91/** Pointer to a shared clipboard data request. */
92typedef SHCLDATAREQ *PSHCLDATAREQ;
93
94/**
95 * Shared Clipboard formats specification.
96 * @todo r=bird: Pointless as we don't have any fFlags defined, so, unless
97 * someone can give me a plausible scenario where we will need flags here,
98 * this structure will be eliminated.
99 */
100typedef struct SHCLFORMATDATA
101{
102 /** Available format(s) as bit map. */
103 SHCLFORMATS Formats;
104 /** Formats flags. Currently unused. */
105 uint32_t fFlags;
106} SHCLFORMATDATA;
107/** Pointer to a shared clipboard formats specification. */
108typedef SHCLFORMATDATA *PSHCLFORMATDATA;
109
110/**
111 * Shared Clipboard event payload (optional).
112 */
113typedef struct SHCLEVENTPAYLOAD
114{
115 /** Payload ID; currently unused. */
116 uint32_t uID;
117 /** Size (in bytes) of actual payload data. */
118 uint32_t cbData;
119 /** Pointer to actual payload data. */
120 void *pvData;
121} SHCLEVENTPAYLOAD;
122/** Pointer to a shared clipboard event payload. */
123typedef SHCLEVENTPAYLOAD *PSHCLEVENTPAYLOAD;
124
125/** A shared clipboard event source ID. */
126typedef uint16_t SHCLEVENTSOURCEID;
127/** Pointer to a shared clipboard event source ID. */
128typedef SHCLEVENTSOURCEID *PSHCLEVENTSOURCEID;
129
130/** A shared clipboard session ID. */
131typedef uint16_t SHCLSESSIONID;
132/** Pointer to a shared clipboard session ID. */
133typedef SHCLSESSIONID *PSHCLSESSIONID;
134/** NIL shared clipboard session ID. */
135#define NIL_SHCLSESSIONID UINT16_MAX
136
137/** A shared clipboard transfer ID. */
138typedef uint16_t SHCLTRANSFERID;
139/** Pointer to a shared clipboard transfer ID. */
140typedef SHCLTRANSFERID *PSHCLTRANSFERID;
141/** NIL shared clipboardtransfer ID. */
142#define NIL_SHCLTRANSFERID UINT16_MAX
143
144/** A shared clipboard event ID. */
145typedef uint32_t SHCLEVENTID;
146/** Pointer to a shared clipboard event source ID. */
147typedef SHCLEVENTID *PSHCLEVENTID;
148/** NIL shared clipboard event ID. */
149#define NIL_SHCLEVENTID UINT32_MAX
150
151/**
152 * Shared Clipboard event.
153 */
154typedef struct SHCLEVENT
155{
156 /** List node. */
157 RTLISTNODE Node;
158 /** The event's ID, for self-reference. */
159 SHCLEVENTID uID;
160 /** Event semaphore for signalling the event. */
161 RTSEMEVENT hEventSem;
162 /** Payload to this event, optional (NULL). */
163 PSHCLEVENTPAYLOAD pPayload;
164} SHCLEVENT;
165/** Pointer to a shared clipboard event. */
166typedef SHCLEVENT *PSHCLEVENT;
167
168/**
169 * Shared Clipboard event source.
170 *
171 * Each event source maintains an own counter for events, so that it can be used
172 * in different contexts.
173 */
174typedef struct SHCLEVENTSOURCE
175{
176 /** The event source ID. */
177 SHCLEVENTSOURCEID uID;
178 /** Next upcoming event ID. */
179 SHCLEVENTID uEventIDNext;
180 /** List of events (PSHCLEVENT). */
181 RTLISTANCHOR lstEvents;
182} SHCLEVENTSOURCE;
183/** Pointer to a shared clipboard event source. */
184typedef SHCLEVENTSOURCE *PSHCLEVENTSOURCE;
185
186/** @name Shared Clipboard data payload functions.
187 * @{
188 */
189int ShClPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData, PSHCLEVENTPAYLOAD *ppPayload);
190void ShClPayloadFree(PSHCLEVENTPAYLOAD pPayload);
191/** @} */
192
193/** @name Shared Clipboard event source functions.
194 * @{
195 */
196int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID idEvtSrc);
197void ShClEventSourceDestroy(PSHCLEVENTSOURCE pSource);
198void ShClEventSourceReset(PSHCLEVENTSOURCE pSource);
199/** @} */
200
201/** @name Shared Clipboard event functions.
202 * @{
203 */
204SHCLEVENTID ShClEventIDGenerate(PSHCLEVENTSOURCE pSource);
205SHCLEVENTID ShClEventGetLast(PSHCLEVENTSOURCE pSource);
206int ShClEventRegister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
207int ShClEventUnregister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
208int ShClEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload);
209int ShClEventSignal(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, PSHCLEVENTPAYLOAD pPayload);
210void ShClEventPayloadDetach(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
211/** @} */
212
213/**
214 * Shared Clipboard transfer source type.
215 * @note Part of saved state!
216 */
217typedef enum SHCLSOURCE
218{
219 /** Invalid source type. */
220 SHCLSOURCE_INVALID = 0,
221 /** Source is local. */
222 SHCLSOURCE_LOCAL,
223 /** Source is remote. */
224 SHCLSOURCE_REMOTE,
225 /** The usual 32-bit hack. */
226 SHCLSOURCE_32BIT_HACK = 0x7fffffff
227} SHCLSOURCE;
228
229/** Opaque data structure for the X11/VBox frontend/glue code.
230 * @{ */
231struct SHCLCONTEXT;
232typedef struct SHCLCONTEXT SHCLCONTEXT;
233/** @} */
234/** Pointer to opaque data structure the X11/VBox frontend/glue code. */
235typedef SHCLCONTEXT *PSHCLCONTEXT;
236
237/** Opaque request structure for X11 clipboard data.
238 * @{ */
239struct CLIPREADCBREQ;
240typedef struct CLIPREADCBREQ CLIPREADCBREQ;
241/** @} */
242
243#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_h */
244
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