VirtualBox

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

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

SharedClipboard: Eliminated SHCLFORMATDATA and did some minor darwin cleanups. bugref:9620

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