VirtualBox

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

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

Shared Clipboard: Ditched SHCLDATABLOCK.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 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/**
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 * Shared Clipboard data read request.
66 */
67typedef struct SHCLDATAREQ
68{
69 /** In which format the data needs to be sent. */
70 SHCLFORMAT uFmt;
71 /** Read flags; currently unused. */
72 uint32_t fFlags;
73 /** Maximum data (in byte) can be sent. */
74 uint32_t cbSize;
75} SHCLDATAREQ;
76/** Pointer to a shared clipboard data request. */
77typedef SHCLDATAREQ *PSHCLDATAREQ;
78
79/**
80 * Shared Clipboard formats specification.
81 * @todo r=bird: Pointless as we don't have any fFlags defined, so, unless
82 * someone can give me a plausible scenario where we will need flags here,
83 * this structure will be eliminated.
84 */
85typedef struct SHCLFORMATDATA
86{
87 /** Available format(s) as bit map. */
88 SHCLFORMATS Formats;
89 /** Formats flags. Currently unused. */
90 uint32_t fFlags;
91} SHCLFORMATDATA;
92/** Pointer to a shared clipboard formats specification. */
93typedef SHCLFORMATDATA *PSHCLFORMATDATA;
94
95/**
96 * Shared Clipboard event payload (optional).
97 */
98typedef struct SHCLEVENTPAYLOAD
99{
100 /** Payload ID; currently unused. */
101 uint32_t uID;
102 /** Size (in bytes) of actual payload data. */
103 uint32_t cbData;
104 /** Pointer to actual payload data. */
105 void *pvData;
106} SHCLEVENTPAYLOAD;
107/** Pointer to a shared clipboard event payload. */
108typedef SHCLEVENTPAYLOAD *PSHCLEVENTPAYLOAD;
109
110/** A shared clipboard event source ID. */
111typedef uint16_t SHCLEVENTSOURCEID;
112/** Pointer to a shared clipboard event source ID. */
113typedef SHCLEVENTSOURCEID *PSHCLEVENTSOURCEID;
114
115/** A shared clipboard session ID. */
116typedef uint16_t SHCLSESSIONID;
117/** Pointer to a shared clipboard session ID. */
118typedef SHCLSESSIONID *PSHCLSESSIONID;
119/** NIL shared clipboard session ID. */
120#define NIL_SHCLSESSIONID UINT16_MAX
121
122/** A shared clipboard transfer ID. */
123typedef uint16_t SHCLTRANSFERID;
124/** Pointer to a shared clipboard transfer ID. */
125typedef SHCLTRANSFERID *PSHCLTRANSFERID;
126/** NIL shared clipboardtransfer ID. */
127#define NIL_SHCLTRANSFERID UINT16_MAX
128
129/** A shared clipboard event ID. */
130typedef uint32_t SHCLEVENTID;
131/** Pointer to a shared clipboard event source ID. */
132typedef SHCLEVENTID *PSHCLEVENTID;
133/** NIL shared clipboard event ID. */
134#define NIL_SHCLEVENTID UINT32_MAX
135
136/**
137 * Shared Clipboard event.
138 */
139typedef struct SHCLEVENT
140{
141 /** List node. */
142 RTLISTNODE Node;
143 /** The event's ID, for self-reference. */
144 SHCLEVENTID idEvent;
145 /** Reference count to this event. */
146 uint32_t cRefs;
147 /** Event semaphore for signalling the event. */
148 RTSEMEVENTMULTI hEvtMulSem;
149 /** Payload to this event, optional (NULL). */
150 PSHCLEVENTPAYLOAD pPayload;
151} SHCLEVENT;
152/** Pointer to a shared clipboard event. */
153typedef SHCLEVENT *PSHCLEVENT;
154
155/**
156 * Shared Clipboard event source.
157 *
158 * Each event source maintains an own counter for events, so that it can be used
159 * in different contexts.
160 */
161typedef struct SHCLEVENTSOURCE
162{
163 /** The event source ID. */
164 SHCLEVENTSOURCEID uID;
165 /** Next upcoming event ID. */
166 SHCLEVENTID idNextEvent;
167 /** List of events (PSHCLEVENT). */
168 RTLISTANCHOR lstEvents;
169} SHCLEVENTSOURCE;
170/** Pointer to a shared clipboard event source. */
171typedef SHCLEVENTSOURCE *PSHCLEVENTSOURCE;
172
173/** @name Shared Clipboard data payload functions.
174 * @{
175 */
176int ShClPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData, PSHCLEVENTPAYLOAD *ppPayload);
177void ShClPayloadFree(PSHCLEVENTPAYLOAD pPayload);
178/** @} */
179
180/** @name Shared Clipboard event source functions.
181 * @{
182 */
183int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID idEvtSrc);
184void ShClEventSourceDestroy(PSHCLEVENTSOURCE pSource);
185void ShClEventSourceReset(PSHCLEVENTSOURCE pSource);
186/** @} */
187
188/** @name Shared Clipboard event functions.
189 * @{
190 */
191SHCLEVENTID ShClEventIdGenerateAndRegister(PSHCLEVENTSOURCE pSource);
192SHCLEVENTID ShClEventGetLast(PSHCLEVENTSOURCE pSource);
193uint32_t ShClEventRetain(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
194uint32_t ShClEventRelease(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
195int ShClEventSignal(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, PSHCLEVENTPAYLOAD pPayload);
196int ShClEventUnregister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
197int ShClEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload);
198
199void ShClEventPayloadDetach(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
200/** @} */
201
202/**
203 * Shared Clipboard transfer source type.
204 * @note Part of saved state!
205 */
206typedef enum SHCLSOURCE
207{
208 /** Invalid source type. */
209 SHCLSOURCE_INVALID = 0,
210 /** Source is local. */
211 SHCLSOURCE_LOCAL,
212 /** Source is remote. */
213 SHCLSOURCE_REMOTE,
214 /** The usual 32-bit hack. */
215 SHCLSOURCE_32BIT_HACK = 0x7fffffff
216} SHCLSOURCE;
217
218/** Opaque data structure for the X11/VBox frontend/glue code.
219 * @{ */
220struct SHCLCONTEXT;
221typedef struct SHCLCONTEXT SHCLCONTEXT;
222/** @} */
223/** Pointer to opaque data structure the X11/VBox frontend/glue code. */
224typedef SHCLCONTEXT *PSHCLCONTEXT;
225
226/** Opaque request structure for X11 clipboard data.
227 * @{ */
228struct CLIPREADCBREQ;
229typedef struct CLIPREADCBREQ CLIPREADCBREQ;
230/** @} */
231
232#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_h */
233
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