1 | /** @file
|
---|
2 | *
|
---|
3 | * Shared Clipboard
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 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 __VBOXCLIPBOARD__H
|
---|
19 | #define __VBOXCLIPBOARD__H
|
---|
20 |
|
---|
21 | #define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD
|
---|
22 | #include <VBox/hgcmsvc.h>
|
---|
23 | #include <VBox/log.h>
|
---|
24 |
|
---|
25 | struct _VBOXCLIPBOARDCONTEXT;
|
---|
26 | typedef struct _VBOXCLIPBOARDCONTEXT VBOXCLIPBOARDCONTEXT;
|
---|
27 |
|
---|
28 |
|
---|
29 | typedef struct _VBOXCLIPBOARDCLIENTDATA
|
---|
30 | {
|
---|
31 | struct _VBOXCLIPBOARDCLIENTDATA *pNext;
|
---|
32 | struct _VBOXCLIPBOARDCLIENTDATA *pPrev;
|
---|
33 |
|
---|
34 | VBOXCLIPBOARDCONTEXT *pCtx;
|
---|
35 |
|
---|
36 | uint32_t u32ClientID;
|
---|
37 |
|
---|
38 | bool fAsync; /* Guest is waiting for a message. */
|
---|
39 | bool fReadPending; /* The guest is waiting for data from the host */
|
---|
40 |
|
---|
41 | bool fMsgQuit;
|
---|
42 | bool fMsgReadData;
|
---|
43 | bool fMsgFormats;
|
---|
44 |
|
---|
45 | struct {
|
---|
46 | VBOXHGCMCALLHANDLE callHandle;
|
---|
47 | VBOXHGCMSVCPARM *paParms;
|
---|
48 | } async;
|
---|
49 |
|
---|
50 | struct {
|
---|
51 | VBOXHGCMCALLHANDLE callHandle;
|
---|
52 | VBOXHGCMSVCPARM *paParms;
|
---|
53 | } asyncRead;
|
---|
54 |
|
---|
55 | struct {
|
---|
56 | void *pv;
|
---|
57 | uint32_t cb;
|
---|
58 | uint32_t u32Format;
|
---|
59 | } data;
|
---|
60 |
|
---|
61 | uint32_t u32AvailableFormats;
|
---|
62 | uint32_t u32RequestedFormat;
|
---|
63 |
|
---|
64 | } VBOXCLIPBOARDCLIENTDATA;
|
---|
65 |
|
---|
66 | /*
|
---|
67 | * The service functions. Locking is between the service thread and the platform dependent windows thread.
|
---|
68 | */
|
---|
69 | bool vboxSvcClipboardLock (void);
|
---|
70 | void vboxSvcClipboardUnlock (void);
|
---|
71 |
|
---|
72 | void vboxSvcClipboardReportMsg (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Msg, uint32_t u32Formats);
|
---|
73 |
|
---|
74 | void vboxSvcClipboardCompleteReadData(VBOXCLIPBOARDCLIENTDATA *pClient, int rc, uint32_t cbActual);
|
---|
75 |
|
---|
76 | bool vboxSvcClipboardGetHeadless(void);
|
---|
77 |
|
---|
78 | /*
|
---|
79 | * Platform dependent functions.
|
---|
80 | */
|
---|
81 | int vboxClipboardInit (void);
|
---|
82 | void vboxClipboardDestroy (void);
|
---|
83 |
|
---|
84 | int vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient, bool fHeadless);
|
---|
85 | void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient);
|
---|
86 |
|
---|
87 | void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Formats);
|
---|
88 |
|
---|
89 | int vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);
|
---|
90 |
|
---|
91 | void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv, uint32_t cb, uint32_t u32Format);
|
---|
92 |
|
---|
93 | int vboxClipboardSync (VBOXCLIPBOARDCLIENTDATA *pClient);
|
---|
94 |
|
---|
95 | /* Host unit testing interface */
|
---|
96 | #ifdef UNIT_TEST
|
---|
97 | uint32_t TestClipSvcGetMode(void);
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #endif /* __VBOXCLIPBOARD__H */
|
---|