VirtualBox

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

Last change on this file since 87566 was 86959, checked in by vboxsync, 4 years ago

Shared Clipboard: Convert VBox clipboard formats to strings to improve logging.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1/** @file
2 * Shared Clipboard - Common guest and host Code.
3 */
4
5/*
6 * Copyright (C) 2006-2020 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/** @name VBOX_SHCL_FMT_XXX - Data formats (flags) for Shared Clipboard.
36 * @{
37 */
38/** No format set. */
39#define VBOX_SHCL_FMT_NONE 0
40/** Shared Clipboard format is an Unicode text. */
41#define VBOX_SHCL_FMT_UNICODETEXT RT_BIT(0)
42/** Shared Clipboard format is bitmap (BMP / DIB). */
43#define VBOX_SHCL_FMT_BITMAP RT_BIT(1)
44/** Shared Clipboard format is HTML. */
45#define VBOX_SHCL_FMT_HTML RT_BIT(2)
46#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
47/** Shared Clipboard format is a transfer list. */
48# define VBOX_SHCL_FMT_URI_LIST RT_BIT(3)
49#endif
50/** @} */
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 * Shared Clipboard transfer direction.
66 */
67typedef enum SHCLTRANSFERDIR
68{
69 /** Unknown transfer directory. */
70 SHCLTRANSFERDIR_UNKNOWN = 0,
71 /** Read transfer (from source). */
72 SHCLTRANSFERDIR_FROM_REMOTE,
73 /** Write transfer (to target). */
74 SHCLTRANSFERDIR_TO_REMOTE,
75 /** The usual 32-bit hack. */
76 SHCLTRANSFERDIR_32BIT_HACK = 0x7fffffff
77} SHCLTRANSFERDIR;
78/** Pointer to a shared clipboard transfer direction. */
79typedef SHCLTRANSFERDIR *PSHCLTRANSFERDIR;
80
81
82/**
83 * Shared Clipboard data read request.
84 */
85typedef struct SHCLDATAREQ
86{
87 /** In which format the data needs to be sent. */
88 SHCLFORMAT uFmt;
89 /** Read flags; currently unused. */
90 uint32_t fFlags;
91 /** Maximum data (in byte) can be sent. */
92 uint32_t cbSize;
93} SHCLDATAREQ;
94/** Pointer to a shared clipboard data request. */
95typedef SHCLDATAREQ *PSHCLDATAREQ;
96
97/**
98 * Shared Clipboard event payload (optional).
99 */
100typedef struct SHCLEVENTPAYLOAD
101{
102 /** Payload ID; currently unused. */
103 uint32_t uID;
104 /** Size (in bytes) of actual payload data. */
105 uint32_t cbData;
106 /** Pointer to actual payload data. */
107 void *pvData;
108} SHCLEVENTPAYLOAD;
109/** Pointer to a shared clipboard event payload. */
110typedef SHCLEVENTPAYLOAD *PSHCLEVENTPAYLOAD;
111
112/** A shared clipboard event source ID. */
113typedef uint16_t SHCLEVENTSOURCEID;
114/** Pointer to a shared clipboard event source ID. */
115typedef SHCLEVENTSOURCEID *PSHCLEVENTSOURCEID;
116
117/** A shared clipboard session ID. */
118typedef uint16_t SHCLSESSIONID;
119/** Pointer to a shared clipboard session ID. */
120typedef SHCLSESSIONID *PSHCLSESSIONID;
121/** NIL shared clipboard session ID. */
122#define NIL_SHCLSESSIONID UINT16_MAX
123
124/** A shared clipboard transfer ID. */
125typedef uint16_t SHCLTRANSFERID;
126/** Pointer to a shared clipboard transfer ID. */
127typedef SHCLTRANSFERID *PSHCLTRANSFERID;
128/** NIL shared clipboardtransfer ID. */
129#define NIL_SHCLTRANSFERID UINT16_MAX
130
131/** A shared clipboard event ID. */
132typedef uint32_t SHCLEVENTID;
133/** Pointer to a shared clipboard event source ID. */
134typedef SHCLEVENTID *PSHCLEVENTID;
135/** NIL shared clipboard event ID. */
136#define NIL_SHCLEVENTID UINT32_MAX
137
138/**
139 * Shared Clipboard event.
140 */
141typedef struct SHCLEVENT
142{
143 /** List node. */
144 RTLISTNODE Node;
145 /** The event's ID, for self-reference. */
146 SHCLEVENTID idEvent;
147 /** Reference count to this event. */
148 uint32_t cRefs;
149 /** Event semaphore for signalling the event. */
150 RTSEMEVENTMULTI hEvtMulSem;
151 /** Payload to this event, optional (NULL). */
152 PSHCLEVENTPAYLOAD pPayload;
153} SHCLEVENT;
154/** Pointer to a shared clipboard event. */
155typedef SHCLEVENT *PSHCLEVENT;
156
157/**
158 * Shared Clipboard event source.
159 *
160 * Each event source maintains an own counter for events, so that it can be used
161 * in different contexts.
162 */
163typedef struct SHCLEVENTSOURCE
164{
165 /** The event source ID. */
166 SHCLEVENTSOURCEID uID;
167 /** Next upcoming event ID. */
168 SHCLEVENTID idNextEvent;
169 /** List of events (PSHCLEVENT). */
170 RTLISTANCHOR lstEvents;
171} SHCLEVENTSOURCE;
172/** Pointer to a shared clipboard event source. */
173typedef SHCLEVENTSOURCE *PSHCLEVENTSOURCE;
174
175/** @name Shared Clipboard data payload functions.
176 * @{
177 */
178int ShClPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData, PSHCLEVENTPAYLOAD *ppPayload);
179void ShClPayloadFree(PSHCLEVENTPAYLOAD pPayload);
180/** @} */
181
182/** @name Shared Clipboard event source functions.
183 * @{
184 */
185int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID idEvtSrc);
186void ShClEventSourceDestroy(PSHCLEVENTSOURCE pSource);
187void ShClEventSourceReset(PSHCLEVENTSOURCE pSource);
188/** @} */
189
190/** @name Shared Clipboard event functions.
191 * @{
192 */
193SHCLEVENTID ShClEventIdGenerateAndRegister(PSHCLEVENTSOURCE pSource);
194PSHCLEVENT ShClEventGet(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
195SHCLEVENTID ShClEventGetLast(PSHCLEVENTSOURCE pSource);
196uint32_t ShClEventGetRefs(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
197uint32_t ShClEventRetain(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
198uint32_t ShClEventRelease(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
199int ShClEventSignal(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, PSHCLEVENTPAYLOAD pPayload);
200int ShClEventUnregister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
201int ShClEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload);
202/** @} */
203
204/**
205 * Shared Clipboard transfer source type.
206 * @note Part of saved state!
207 */
208typedef enum SHCLSOURCE
209{
210 /** Invalid source type. */
211 SHCLSOURCE_INVALID = 0,
212 /** Source is local. */
213 SHCLSOURCE_LOCAL,
214 /** Source is remote. */
215 SHCLSOURCE_REMOTE,
216 /** The usual 32-bit hack. */
217 SHCLSOURCE_32BIT_HACK = 0x7fffffff
218} SHCLSOURCE;
219
220/** Opaque data structure for the X11/VBox frontend/glue code.
221 * @{ */
222struct SHCLCONTEXT;
223typedef struct SHCLCONTEXT SHCLCONTEXT;
224/** @} */
225/** Pointer to opaque data structure the X11/VBox frontend/glue code. */
226typedef SHCLCONTEXT *PSHCLCONTEXT;
227
228/** Opaque request structure for X11 clipboard data.
229 * @{ */
230struct CLIPREADCBREQ;
231typedef struct CLIPREADCBREQ CLIPREADCBREQ;
232/** @} */
233
234#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_h */
235
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