1 | /* $Id: VBoxSharedClipboardSvc-internal.h 78897 2019-05-31 15:23:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Shared Clipboard Service - Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h
|
---|
19 | #define VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <iprt/list.h>
|
---|
25 |
|
---|
26 | #include <VBox/hgcmsvc.h>
|
---|
27 | #include <VBox/log.h>
|
---|
28 |
|
---|
29 | #include <VBox/GuestHost/SharedClipboard.h>
|
---|
30 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
31 | # include <VBox/GuestHost/SharedClipboard-uri.h>
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
35 | /**
|
---|
36 | * Structure for handling a single URI object context.
|
---|
37 | */
|
---|
38 | typedef struct _VBOXCLIPBOARDCLIENTURIOBJCTX
|
---|
39 | {
|
---|
40 | /** Pointer to current object being processed. */
|
---|
41 | SharedClipboardURIObject *pObj;
|
---|
42 | } VBOXCLIPBOARDCLIENTURIOBJCTX, *PVBOXCLIPBOARDCLIENTURIOBJCTX;
|
---|
43 |
|
---|
44 | struct VBOXCLIPBOARDCLIENTSTATE;
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Structure for maintaining a single URI transfer.
|
---|
48 | * A transfer can contain one or multiple files / directories.
|
---|
49 | */
|
---|
50 | typedef struct _VBOXCLIPBOARDCLIENTURITRANSFER
|
---|
51 | {
|
---|
52 | /** Node for keeping this transfer in a RTList. */
|
---|
53 | RTLISTNODE Node;
|
---|
54 | /** Pointer to the client state (parent). */
|
---|
55 | VBOXCLIPBOARDCLIENTSTATE *pState;
|
---|
56 | /** The transfer's own (local) area.
|
---|
57 | * The cache itself has a clipboard area ID assigned. */
|
---|
58 | SharedClipboardArea Cache;
|
---|
59 | /** The transfer's URI list, containing the fs object root entries. */
|
---|
60 | SharedClipboardURIList List;
|
---|
61 | /** Current object being handled. */
|
---|
62 | VBOXCLIPBOARDCLIENTURIOBJCTX ObjCtx;
|
---|
63 | /** The transfer header, needed for verification and accounting. */
|
---|
64 | VBOXCLIPBOARDDATAHDR Hdr;
|
---|
65 | /** Intermediate meta data object. */
|
---|
66 | SHAREDCLIPBOARDMETADATA Meta;
|
---|
67 | } VBOXCLIPBOARDCLIENTURITRANSFER, *PVBOXCLIPBOARDCLIENTURITRANSFER;
|
---|
68 | #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Structure for keeping generic client state data within the Shared Clipboard host service.
|
---|
72 | * This structure needs to be serializable by SSM.
|
---|
73 | */
|
---|
74 | struct VBOXCLIPBOARDCLIENTSTATE
|
---|
75 | {
|
---|
76 | struct VBOXCLIPBOARDCLIENTSTATE *pNext;
|
---|
77 | struct VBOXCLIPBOARDCLIENTSTATE *pPrev;
|
---|
78 |
|
---|
79 | VBOXCLIPBOARDCONTEXT *pCtx;
|
---|
80 |
|
---|
81 | uint32_t u32ClientID;
|
---|
82 |
|
---|
83 | /** The guest is waiting for a message. */
|
---|
84 | bool fAsync;
|
---|
85 | /** The guest is waiting for data from the host */
|
---|
86 | bool fReadPending;
|
---|
87 | /** Whether the host host has sent a quit message. */
|
---|
88 | bool fHostMsgQuit;
|
---|
89 | /** Whether the host host has requested reading clipboard data from the guest. */
|
---|
90 | bool fHostMsgReadData;
|
---|
91 | /** Whether the host host has reported its available formats. */
|
---|
92 | bool fHostMsgFormats;
|
---|
93 |
|
---|
94 | struct {
|
---|
95 | VBOXHGCMCALLHANDLE callHandle;
|
---|
96 | VBOXHGCMSVCPARM *paParms;
|
---|
97 | } async;
|
---|
98 |
|
---|
99 | struct {
|
---|
100 | VBOXHGCMCALLHANDLE callHandle;
|
---|
101 | VBOXHGCMSVCPARM *paParms;
|
---|
102 | } asyncRead;
|
---|
103 |
|
---|
104 | struct {
|
---|
105 | void *pv;
|
---|
106 | uint32_t cb;
|
---|
107 | uint32_t u32Format;
|
---|
108 | } data;
|
---|
109 |
|
---|
110 | uint32_t u32AvailableFormats;
|
---|
111 | uint32_t u32RequestedFormat;
|
---|
112 | };
|
---|
113 | typedef struct VBOXCLIPBOARDCLIENTSTATE *PVBOXCLIPBOARDCLIENTSTATE;
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Structure for keeping a HGCM client state within the Shared Clipboard host service.
|
---|
117 | */
|
---|
118 | typedef struct _VBOXCLIPBOARDCLIENTDATA
|
---|
119 | {
|
---|
120 | /** General client state data. */
|
---|
121 | VBOXCLIPBOARDCLIENTSTATE State;
|
---|
122 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
123 | /** List of concurrent transfers.
|
---|
124 | * At the moment we only support one transfer at a time (per client). */
|
---|
125 | RTLISTANCHOR TransferList;
|
---|
126 | /** Data related to URI transfer handling. */
|
---|
127 | VBOXCLIPBOARDCLIENTURITRANSFER Transfer;
|
---|
128 | /** Number of concurrent transfers.
|
---|
129 | * At the moment we only support one transfer at a time (per client). */
|
---|
130 | uint32_t cTransfers;
|
---|
131 | #endif
|
---|
132 | } VBOXCLIPBOARDCLIENTDATA, *PVBOXCLIPBOARDCLIENTDATA;
|
---|
133 |
|
---|
134 | /*
|
---|
135 | * The service functions. Locking is between the service thread and the platform dependent windows thread.
|
---|
136 | */
|
---|
137 | uint32_t vboxSvcClipboardGetMode(void);
|
---|
138 | void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats);
|
---|
139 | void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual);
|
---|
140 |
|
---|
141 | int vboxSvcClipboardClientStateInit(PVBOXCLIPBOARDCLIENTSTATE pState, uint32_t uClientID);
|
---|
142 | void vboxSvcClipboardClientStateReset(PVBOXCLIPBOARDCLIENTSTATE pState);
|
---|
143 |
|
---|
144 | /*
|
---|
145 | * Platform-dependent implementations.
|
---|
146 | */
|
---|
147 | int VBoxClipboardSvcImplInit(void);
|
---|
148 | void VBoxClipboardSvcImplDestroy(void);
|
---|
149 |
|
---|
150 | int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless);
|
---|
151 | void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData);
|
---|
152 | void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats);
|
---|
153 | int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);
|
---|
154 | void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format);
|
---|
155 | int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData);
|
---|
156 |
|
---|
157 | /* Host unit testing interface */
|
---|
158 | #ifdef UNIT_TEST
|
---|
159 | uint32_t TestClipSvcGetMode(void);
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | #endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h */
|
---|
163 |
|
---|