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