VirtualBox

source: vbox/trunk/include/VBox/GuestHost/SharedClipboard-transfers.h@ 80886

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

Shared Clipboard/Transfers: More renaming, fixed some assertions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 41.4 KB
Line 
1/* $Id: SharedClipboard-transfers.h 80886 2019-09-18 11:27:18Z vboxsync $ */
2/** @file
3 * Shared Clipboard - Shared transfer functions between host and guest.
4 */
5
6/*
7 * Copyright (C) 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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef VBOX_INCLUDED_GuestHost_SharedClipboard_transfers_h
28#define VBOX_INCLUDED_GuestHost_SharedClipboard_transfers_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <map>
34
35#include <iprt/assert.h>
36#include <iprt/critsect.h>
37#include <iprt/fs.h>
38#include <iprt/list.h>
39
40#include <iprt/cpp/list.h>
41#include <iprt/cpp/ministring.h>
42
43#include <VBox/GuestHost/SharedClipboard.h>
44
45
46/** @name Shared Clipboard transfer definitions.
47 * @{
48 */
49
50/** No status set. */
51#define SHCLTRANSFERSTATUS_NONE 0
52/** The transfer has been announced but is not running yet. */
53#define SHCLTRANSFERSTATUS_READY 1
54/** The transfer is active and running. */
55#define SHCLTRANSFERSTATUS_STARTED 2
56/** The transfer has been stopped. */
57#define SHCLTRANSFERSTATUS_STOPPED 3
58/** The transfer has been canceled. */
59#define SHCLTRANSFERSTATUS_CANCELED 4
60/** The transfer has been killed. */
61#define SHCLTRANSFERSTATUS_KILLED 5
62/** The transfer ran into an unrecoverable error. */
63#define SHCLTRANSFERSTATUS_ERROR 6
64
65/** Defines a transfer status. */
66typedef uint32_t SHCLTRANSFERSTATUS;
67
68/** @} */
69
70/** @name Shared Clipboard handles.
71 * @{
72 */
73
74/** A Shared Clipboard list handle. */
75typedef uint64_t SHCLLISTHANDLE;
76/** Pointer to a Shared Clipboard list handle. */
77typedef SHCLLISTHANDLE *PSHCLLISTHANDLE;
78
79/** Specifies an invalid Shared Clipboard list handle. */
80#define SHCLLISTHANDLE_INVALID ((SHCLLISTHANDLE)~0LL)
81
82/** A Shared Clipboard object handle. */
83typedef uint64_t SHCLOBJHANDLE;
84/** Pointer to a Shared Clipboard object handle. */
85typedef SHCLOBJHANDLE *PSHCLOBJHANDLE;
86
87/** Specifies an invalid Shared Clipboard object handle. */
88#define SHCLOBJHANDLE_INVALID ((SHCLOBJHANDLE)~0LL)
89
90/** @} */
91
92/** @name Shared Clipboard open/create flags.
93 * @{
94 */
95
96/** No flags. Initialization value. */
97#define SHCL_OBJ_CF_NONE (0x00000000)
98
99/** Lookup only the object, do not return a handle. All other flags are ignored. */
100#define SHCL_OBJ_CF_LOOKUP (0x00000001)
101
102/** Create/open a directory. */
103#define SHCL_OBJ_CF_DIRECTORY (0x00000004)
104
105/** Open/create action to do if object exists
106 * and if the object does not exists.
107 * REPLACE file means atomically DELETE and CREATE.
108 * OVERWRITE file means truncating the file to 0 and
109 * setting new size.
110 * When opening an existing directory REPLACE and OVERWRITE
111 * actions are considered invalid, and cause returning
112 * FILE_EXISTS with NIL handle.
113 */
114#define SHCL_OBJ_CF_ACT_MASK_IF_EXISTS (0x000000F0)
115#define SHCL_OBJ_CF_ACT_MASK_IF_NEW (0x00000F00)
116
117/** What to do if object exists. */
118#define SHCL_OBJ_CF_ACT_OPEN_IF_EXISTS (0x00000000)
119#define SHCL_OBJ_CF_ACT_FAIL_IF_EXISTS (0x00000010)
120#define SHCL_OBJ_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
121#define SHCL_OBJ_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
122
123/** What to do if object does not exist. */
124#define SHCL_OBJ_CF_ACT_CREATE_IF_NEW (0x00000000)
125#define SHCL_OBJ_CF_ACT_FAIL_IF_NEW (0x00000100)
126
127/** Read/write requested access for the object. */
128#define SHCL_OBJ_CF_ACCESS_MASK_RW (0x00003000)
129
130/** No access requested. */
131#define SHCL_OBJ_CF_ACCESS_NONE (0x00000000)
132/** Read access requested. */
133#define SHCL_OBJ_CF_ACCESS_READ (0x00001000)
134/** Write access requested. */
135#define SHCL_OBJ_CF_ACCESS_WRITE (0x00002000)
136/** Read/Write access requested. */
137#define SHCL_OBJ_CF_ACCESS_READWRITE (SHCL_OBJ_CF_ACCESS_READ | SHCL_OBJ_CF_ACCESS_WRITE)
138
139/** Requested share access for the object. */
140#define SHCL_OBJ_CF_ACCESS_MASK_DENY (0x0000C000)
141
142/** Allow any access. */
143#define SHCL_OBJ_CF_ACCESS_DENYNONE (0x00000000)
144/** Do not allow read. */
145#define SHCL_OBJ_CF_ACCESS_DENYREAD (0x00004000)
146/** Do not allow write. */
147#define SHCL_OBJ_CF_ACCESS_DENYWRITE (0x00008000)
148/** Do not allow access. */
149#define SHCL_OBJ_CF_ACCESS_DENYALL (SHCL_OBJ_CF_ACCESS_DENYREAD | SHCL_OBJ_CF_ACCESS_DENYWRITE)
150
151/** Requested access to attributes of the object. */
152#define SHCL_OBJ_CF_ACCESS_MASK_ATTR (0x00030000)
153
154/** No access requested. */
155#define SHCL_OBJ_CF_ACCESS_ATTR_NONE (0x00000000)
156/** Read access requested. */
157#define SHCL_OBJ_CF_ACCESS_ATTR_READ (0x00010000)
158/** Write access requested. */
159#define SHCL_OBJ_CF_ACCESS_ATTR_WRITE (0x00020000)
160/** Read/Write access requested. */
161#define SHCL_OBJ_CF_ACCESS_ATTR_READWRITE (SHCL_OBJ_CF_ACCESS_ATTR_READ | SHCL_OBJ_CF_ACCESS_ATTR_WRITE)
162
163/** The file is opened in append mode. Ignored if SHCL_OBJ_CF_ACCESS_WRITE is not set. */
164#define SHCL_OBJ_CF_ACCESS_APPEND (0x00040000)
165
166/** @} */
167
168/** Result of an open/create request.
169 * Along with handle value the result code
170 * identifies what has happened while
171 * trying to open the object.
172 */
173typedef enum _SHCLCREATERESULT
174{
175 SHCL_CREATERESULT_NONE,
176 /** Specified path does not exist. */
177 SHCL_CREATERESULT_PATH_NOT_FOUND,
178 /** Path to file exists, but the last component does not. */
179 SHCL_CREATERESULT_FILE_NOT_FOUND,
180 /** File already exists and either has been opened or not. */
181 SHCL_CREATERESULT_FILE_EXISTS,
182 /** New file was created. */
183 SHCL_CREATERESULT_FILE_CREATED,
184 /** Existing file was replaced or overwritten. */
185 SHCL_CREATERESULT_FILE_REPLACED,
186 /** Blow the type up to 32-bit. */
187 SHCL_CREATERESULT_32BIT_HACK = 0x7fffffff
188} SHCLCREATERESULT;
189AssertCompile(SHCL_CREATERESULT_NONE == 0);
190AssertCompileSize(SHCLCREATERESULT, 4);
191
192/**
193 * The available additional information in a SHCLFSOBJATTR object.
194 */
195typedef enum _SHCLFSOBJATTRADD
196{
197 /** No additional information is available / requested. */
198 SHCLFSOBJATTRADD_NOTHING = 1,
199 /** The additional unix attributes (SHCLFSOBJATTR::u::Unix) are
200 * available / requested. */
201 SHCLFSOBJATTRADD_UNIX,
202 /** The additional extended attribute size (SHCLFSOBJATTR::u::EASize) is
203 * available / requested. */
204 SHCLFSOBJATTRADD_EASIZE,
205 /** The last valid item (inclusive).
206 * The valid range is SHCLFSOBJATTRADD_NOTHING thru
207 * SHCLFSOBJATTRADD_LAST. */
208 SHCLFSOBJATTRADD_LAST = SHCLFSOBJATTRADD_EASIZE,
209
210 /** The usual 32-bit hack. */
211 SHCLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
212} SHCLFSOBJATTRADD;
213
214
215/* Assert sizes of the IRPT types we're using below. */
216AssertCompileSize(RTFMODE, 4);
217AssertCompileSize(RTFOFF, 8);
218AssertCompileSize(RTINODE, 8);
219AssertCompileSize(RTTIMESPEC, 8);
220AssertCompileSize(RTDEV, 4);
221AssertCompileSize(RTUID, 4);
222
223/**
224 * Shared Clipboard filesystem object attributes.
225 */
226#pragma pack(1)
227typedef struct _SHCLFSOBJATTR
228{
229 /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*.
230 * @remarks We depend on a number of RTFS_ defines to remain unchanged.
231 * Fortuntately, these are depending on windows, dos and unix
232 * standard values, so this shouldn't be much of a pain. */
233 RTFMODE fMode;
234
235 /** The additional attributes available. */
236 SHCLFSOBJATTRADD enmAdditional;
237
238 /**
239 * Additional attributes.
240 *
241 * Unless explicitly specified to an API, the API can provide additional
242 * data as it is provided by the underlying OS.
243 */
244 union SHCLFSOBJATTRUNION
245 {
246 /** Additional Unix Attributes
247 * These are available when SHCLFSOBJATTRADD is set in fUnix.
248 */
249 struct SHCLFSOBJATTRUNIX
250 {
251 /** The user owning the filesystem object (st_uid).
252 * This field is ~0U if not supported. */
253 RTUID uid;
254
255 /** The group the filesystem object is assigned (st_gid).
256 * This field is ~0U if not supported. */
257 RTGID gid;
258
259 /** Number of hard links to this filesystem object (st_nlink).
260 * This field is 1 if the filesystem doesn't support hardlinking or
261 * the information isn't available.
262 */
263 uint32_t cHardlinks;
264
265 /** The device number of the device which this filesystem object resides on (st_dev).
266 * This field is 0 if this information is not available. */
267 RTDEV INodeIdDevice;
268
269 /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
270 * Together with INodeIdDevice, this field can be used as a OS wide unique id
271 * when both their values are not 0.
272 * This field is 0 if the information is not available. */
273 RTINODE INodeId;
274
275 /** User flags (st_flags).
276 * This field is 0 if this information is not available. */
277 uint32_t fFlags;
278
279 /** The current generation number (st_gen).
280 * This field is 0 if this information is not available. */
281 uint32_t GenerationId;
282
283 /** The device number of a character or block device type object (st_rdev).
284 * This field is 0 if the file isn't of a character or block device type and
285 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
286 RTDEV Device;
287 } Unix;
288
289 /**
290 * Extended attribute size.
291 */
292 struct SHCLFSOBJATTREASIZE
293 {
294 /** Size of EAs. */
295 RTFOFF cb;
296 } EASize;
297 } u;
298} SHCLFSOBJATTR;
299#pragma pack()
300AssertCompileSize(SHCLFSOBJATTR, 44);
301/** Pointer to a Shared Clipboard filesystem object attributes structure. */
302typedef SHCLFSOBJATTR *PSHCLFSOBJATTR;
303/** Pointer to a const Shared Clipboard filesystem object attributes structure. */
304typedef const SHCLFSOBJATTR *PCSHCLFSOBJATTR;
305
306/**
307 * Shared Clipboard file system object information structure.
308 */
309#pragma pack(1)
310typedef struct _SHCLFSOBJINFO
311{
312 /** Logical size (st_size).
313 * For normal files this is the size of the file.
314 * For symbolic links, this is the length of the path name contained
315 * in the symbolic link.
316 * For other objects this fields needs to be specified.
317 */
318 RTFOFF cbObject;
319
320 /** Disk allocation size (st_blocks * DEV_BSIZE). */
321 RTFOFF cbAllocated;
322
323 /** Time of last access (st_atime).
324 * @remarks Here (and other places) we depend on the IPRT timespec to
325 * remain unchanged. */
326 RTTIMESPEC AccessTime;
327
328 /** Time of last data modification (st_mtime). */
329 RTTIMESPEC ModificationTime;
330
331 /** Time of last status change (st_ctime).
332 * If not available this is set to ModificationTime.
333 */
334 RTTIMESPEC ChangeTime;
335
336 /** Time of file birth (st_birthtime).
337 * If not available this is set to ChangeTime.
338 */
339 RTTIMESPEC BirthTime;
340
341 /** Attributes. */
342 SHCLFSOBJATTR Attr;
343
344} SHCLFSOBJINFO;
345#pragma pack()
346AssertCompileSize(SHCLFSOBJINFO, 92);
347/** Pointer to a Shared Clipboard filesystem object information structure. */
348typedef SHCLFSOBJINFO *PSHCLFSOBJINFO;
349/** Pointer to a const Shared Clipboard filesystem object information
350 * structure. */
351typedef const SHCLFSOBJINFO *PCSHCLFSOBJINFO;
352
353#pragma pack(1)
354/**
355 * Structure for keeping object open/create parameters.
356 */
357typedef struct _SHCLOBJOPENCREATEPARMS
358{
359 /** Path to object to open / create. */
360 char *pszPath;
361 /** Size (in bytes) of path to to object. */
362 uint32_t cbPath;
363 /** SHCL_OBJ_CF_* */
364 uint32_t fCreate;
365 /**
366 * Attributes of object to open/create and
367 * returned actual attributes of opened/created object.
368 */
369 SHCLFSOBJINFO ObjInfo;
370} SHCLOBJOPENCREATEPARMS, *PSHCLOBJOPENCREATEPARMS;
371#pragma pack()
372
373/**
374 * Structure for keeping a reply message.
375 */
376typedef struct _SHCLREPLY
377{
378 /** Message type of type VBOX_SHCL_REPLYMSGTYPE_XXX. */
379 uint32_t uType;
380 /** IPRT result of overall operation. Note: int vs. uint32! */
381 uint32_t rc;
382 union
383 {
384 struct
385 {
386 SHCLTRANSFERSTATUS uStatus;
387 } TransferStatus;
388 struct
389 {
390 SHCLLISTHANDLE uHandle;
391 } ListOpen;
392 struct
393 {
394 SHCLOBJHANDLE uHandle;
395 } ObjOpen;
396 struct
397 {
398 SHCLOBJHANDLE uHandle;
399 } ObjClose;
400 } u;
401 /** Pointer to optional payload. */
402 void *pvPayload;
403 /** Payload size (in bytes). */
404 uint32_t cbPayload;
405} SHCLREPLY, *PSHCLREPLY;
406
407struct _SHCLLISTENTRY;
408typedef _SHCLLISTENTRY SHCLLISTENTRY;
409
410/** Defines a single root list entry. Currently the same as a regular list entry. */
411typedef SHCLLISTENTRY SHCLROOTLISTENTRY;
412/** Defines a pointer to a single root list entry. Currently the same as a regular list entry pointer. */
413typedef SHCLROOTLISTENTRY *PSHCLROOTLISTENTRY;
414
415/**
416 * Structure for keeping Shared Clipboard root list headers.
417 */
418typedef struct _SHCLROOTLISTHDR
419{
420 /** Roots listing flags; unused at the moment. */
421 uint32_t fRoots;
422 /** Number of root list entries. */
423 uint32_t cRoots;
424} SHCLROOTLISTHDR, *PSHCLROOTLISTHDR;
425
426/**
427 * Structure for maintaining a Shared Clipboard root list.
428 */
429typedef struct _SHCLROOTLIST
430{
431 /** Root list header. */
432 SHCLROOTLISTHDR Hdr;
433 /** Root list entries. */
434 SHCLROOTLISTENTRY *paEntries;
435} SHCLROOTLIST, *PSHCLROOTLIST;
436
437/**
438 * Structure for maintaining Shared Clipboard list open paramters.
439 */
440typedef struct _SHCLLISTOPENPARMS
441{
442 /** Listing flags (see VBOX_SHCL_LIST_FLAG_XXX). */
443 uint32_t fList;
444 /** Size (in bytes) of the filter string. */
445 uint32_t cbFilter;
446 /** Filter string. DOS wilcard-style. */
447 char *pszFilter;
448 /** Size (in bytes) of the listing path. */
449 uint32_t cbPath;
450 /** Listing path (absolute). If empty or NULL the listing's root path will be opened. */
451 char *pszPath;
452} SHCLLISTOPENPARMS, *PSHCLLISTOPENPARMS;
453
454/**
455 * Structure for keeping a Shared Clipboard list header.
456 */
457typedef struct _SHCLLISTHDR
458{
459 /** Feature flag(s). Not being used atm. */
460 uint32_t fFeatures;
461 /** Total objects returned. */
462 uint64_t cTotalObjects;
463 /** Total size (in bytes) returned. */
464 uint64_t cbTotalSize;
465} SHCLLISTHDR, *PSHCLLISTHDR;
466
467/**
468 * Structure for a Shared Clipboard list entry.
469 */
470typedef struct _SHCLLISTENTRY
471{
472 /** Entry name. */
473 char *pszName;
474 /** Size (in bytes) of entry name. */
475 uint32_t cbName;
476 /** Information flag(s). */
477 uint32_t fInfo;
478 /** Size (in bytes) of the actual list entry. */
479 uint32_t cbInfo;
480 /** Data of the actual list entry. */
481 void *pvInfo;
482} SHCLLISTENTRY, *PSHCLLISTENTRY;
483
484/** Maximum length (in UTF-8 characters) of a list entry name. */
485#define SHCLLISTENTRY_MAX_NAME RTPATH_MAX /** @todo Improve this to be more dynamic. */
486
487/**
488 * Structure for maintaining a Shared Clipboard list.
489 */
490typedef struct _SHCLLIST
491{
492 /** List header. */
493 SHCLLISTHDR Hdr;
494 /** List entries. */
495 SHCLROOTLISTENTRY *paEntries;
496} SHCLLIST, *PSHCLLIST;
497
498/**
499 * Structure for keeping a Shared Clipboard object data chunk.
500 */
501typedef struct _SHCLOBJDATACHUNK
502{
503 /** Handle of object this data chunk is related to. */
504 uint64_t uHandle;
505 /** Pointer to actual data chunk. */
506 void *pvData;
507 /** Size (in bytes) of data chunk. */
508 uint32_t cbData;
509} SHCLOBJDATACHUNK, *PSHCLOBJDATACHUNK;
510
511/**
512 * Enumeration for specifying a clipboard area object type.
513 */
514typedef enum _SHCLAREAOBJTYPE
515{
516 /** Unknown object type; do not use. */
517 SHCLAREAOBJTYPE_UNKNOWN = 0,
518 /** Object is a directory. */
519 SHCLAREAOBJTYPE_DIR,
520 /** Object is a file. */
521 SHCLAREAOBJTYPE_FILE,
522 /** Object is a symbolic link. */
523 SHCLAREAOBJTYPE_SYMLINK,
524 /** The usual 32-bit hack. */
525 SHCLAREAOBJTYPE_32Bit_Hack = 0x7fffffff
526} SHCLAREAOBJTYPE;
527
528/** Clipboard area ID. A valid area is >= 1.
529 * If 0 is specified, the last (most recent) area is meant.
530 * Set to UINT32_MAX if not initialized. */
531typedef uint32_t SHCLAREAID;
532
533/** Defines a non-initialized (nil) clipboard area. */
534#define NIL_SHCLAREAID UINT32_MAX
535
536/** SharedClipboardArea open flags. */
537typedef uint32_t SHCLAREAOPENFLAGS;
538
539/** No clipboard area open flags specified. */
540#define SHCLAREA_OPEN_FLAGS_NONE 0
541/** The clipboard area must not exist yet. */
542#define SHCLAREA_OPEN_FLAGS_MUST_NOT_EXIST RT_BIT(0)
543/** Mask of all valid clipboard area open flags. */
544#define SHCLAREA_OPEN_FLAGS_VALID_MASK 0x1
545
546/** Defines a clipboard area object state. */
547typedef uint32_t SHCLAREAOBJSTATE;
548
549/** No object state set. */
550#define SHCLAREAOBJSTATE_NONE 0
551/** The object is considered as being complete (e.g. serialized). */
552#define SHCLAREAOBJSTATE_COMPLETE RT_BIT(0)
553
554/**
555 * Lightweight structure to keep a clipboard area object's state.
556 *
557 * Note: We don't want to use the ClipboardURIObject class here, as this
558 * is too heavy for this purpose.
559 */
560typedef struct _SHCLAREAOBJ
561{
562 SHCLAREAOBJTYPE enmType;
563 SHCLAREAOBJSTATE fState;
564} SHCLAREAOBJ, *PSHCLAREAOBJ;
565
566/**
567 * Class for maintaining a Shared Clipboard area
568 * on the host or guest. This will contain all received files & directories
569 * for a single Shared Clipboard operation.
570 *
571 * In case of a failed Shared Clipboard operation this class can also
572 * perform a gentle rollback if required.
573 */
574class SharedClipboardArea
575{
576public:
577
578 SharedClipboardArea(void);
579 SharedClipboardArea(const char *pszPath, SHCLAREAID uID = NIL_SHCLAREAID,
580 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
581 virtual ~SharedClipboardArea(void);
582
583public:
584
585 uint32_t AddRef(void);
586 uint32_t Release(void);
587
588 int Lock(void);
589 int Unlock(void);
590
591 int AddObject(const char *pszPath, const SHCLAREAOBJ &Obj);
592 int GetObject(const char *pszPath, PSHCLAREAOBJ pObj);
593
594 int Close(void);
595 bool IsOpen(void) const;
596 int OpenEx(const char *pszPath, SHCLAREAID uID = NIL_SHCLAREAID,
597 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
598 int OpenTemp(SHCLAREAID uID = NIL_SHCLAREAID,
599 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
600 SHCLAREAID GetID(void) const;
601 const char *GetDirAbs(void) const;
602 uint32_t GetRefCount(void);
603 int Reopen(void);
604 int Reset(bool fDeleteContent);
605 int Rollback(void);
606
607public:
608
609 static int PathConstruct(const char *pszBase, SHCLAREAID uID, char *pszPath, size_t cbPath);
610
611protected:
612
613 int initInternal(void);
614 int destroyInternal(void);
615 int closeInternal(void);
616
617protected:
618
619 typedef std::map<RTCString, SHCLAREAOBJ> SharedClipboardAreaFsObjMap;
620
621 /** Creation timestamp (in ms). */
622 uint64_t m_tsCreatedMs;
623 /** Number of references to this instance. */
624 volatile uint32_t m_cRefs;
625 /** Critical section for serializing access. */
626 RTCRITSECT m_CritSect;
627 /** Open flags. */
628 uint32_t m_fOpen;
629 /** Directory handle for root clipboard directory. */
630 RTDIR m_hDir;
631 /** Absolute path to root clipboard directory. */
632 RTCString m_strPathAbs;
633 /** List for holding created directories in the case of a rollback. */
634 SharedClipboardAreaFsObjMap m_mapObj;
635 /** Associated clipboard area ID. */
636 SHCLAREAID m_uID;
637};
638
639int SharedClipboardPathSanitizeFilename(char *pszPath, size_t cbPath);
640int SharedClipboardPathSanitize(char *pszPath, size_t cbPath);
641
642PSHCLROOTLIST SharedClipboardTransferRootListAlloc(void);
643void SharedClipboardTransferRootListFree(PSHCLROOTLIST pRootList);
644
645PSHCLROOTLISTHDR SharedClipboardTransferRootListHdrDup(PSHCLROOTLISTHDR pRoots);
646int SharedClipboardTransferRootListHdrInit(PSHCLROOTLISTHDR pRoots);
647void SharedClipboardTransferRootListHdrDestroy(PSHCLROOTLISTHDR pRoots);
648
649int SharedClipboardTransferRootListEntryCopy(PSHCLROOTLISTENTRY pDst, PSHCLROOTLISTENTRY pSrc);
650PSHCLROOTLISTENTRY SharedClipboardTransferRootListEntryDup(PSHCLROOTLISTENTRY pRootListEntry);
651void SharedClipboardTransferRootListEntryDestroy(PSHCLROOTLISTENTRY pRootListEntry);
652
653int SharedClipboardTransferListHdrAlloc(PSHCLLISTHDR *ppListHdr);
654void SharedClipboardTransferListHdrFree(PSHCLLISTHDR pListHdr);
655PSHCLLISTHDR SharedClipboardTransferListHdrDup(PSHCLLISTHDR pListHdr);
656int SharedClipboardTransferListHdrInit(PSHCLLISTHDR pListHdr);
657void SharedClipboardTransferListHdrDestroy(PSHCLLISTHDR pListHdr);
658void SharedClipboardTransferListHdrFree(PSHCLLISTHDR pListHdr);
659void SharedClipboardTransferListHdrReset(PSHCLLISTHDR pListHdr);
660bool SharedClipboardTransferListHdrIsValid(PSHCLLISTHDR pListHdr);
661
662int SharedClipboardTransferListOpenParmsCopy(PSHCLLISTOPENPARMS pDst, PSHCLLISTOPENPARMS pSrc);
663PSHCLLISTOPENPARMS SharedClipboardTransferListOpenParmsDup(PSHCLLISTOPENPARMS pParms);
664int SharedClipboardTransferListOpenParmsInit(PSHCLLISTOPENPARMS pParms);
665void SharedClipboardTransferListOpenParmsDestroy(PSHCLLISTOPENPARMS pParms);
666
667int SharedClipboardTransferListEntryAlloc(PSHCLLISTENTRY *ppListEntry);
668void SharedClipboardTransferListEntryFree(PSHCLLISTENTRY pListEntry);
669int SharedClipboardTransferListEntryCopy(PSHCLLISTENTRY pDst, PSHCLLISTENTRY pSrc);
670PSHCLLISTENTRY SharedClipboardTransferListEntryDup(PSHCLLISTENTRY pListEntry);
671int SharedClipboardTransferListEntryInit(PSHCLLISTENTRY pListEntry);
672void SharedClipboardTransferListEntryDestroy(PSHCLLISTENTRY pListEntry);
673bool SharedClipboardTransferListEntryIsValid(PSHCLLISTENTRY pListEntry);
674
675/**
676 * Enumeration specifying an Shared Clipboard transfer direction.
677 */
678typedef enum _SHCLTRANSFERDIR
679{
680 /** Unknown transfer directory. */
681 SHCLTRANSFERDIR_UNKNOWN = 0,
682 /** Read transfer (from source). */
683 SHCLTRANSFERDIR_READ,
684 /** Write transfer (to target). */
685 SHCLTRANSFERDIR_WRITE,
686 /** The usual 32-bit hack. */
687 SHCLTRANSFERDIR_32BIT_HACK = 0x7fffffff
688} SHCLTRANSFERDIR, *PSHCLTRANSFERDIR;
689
690struct _SHCLTRANSFER;
691typedef struct _SHCLTRANSFER SHCLTRANSFER;
692
693/**
694 * Structure for handling a single transfer object context.
695 */
696typedef struct _SHCLCLIENTTRANSFEROBJCTX
697{
698 SHCLTRANSFER *pTransfer;
699 SHCLOBJHANDLE uHandle;
700} SHCLCLIENTTRANSFEROBJCTX, *PSHCLCLIENTTRANSFEROBJCTX;
701
702typedef struct _SHCLTRANSFEROBJSTATE
703{
704 /** How many bytes were processed (read / write) so far. */
705 uint64_t cbProcessed;
706} SHCLTRANSFEROBJSTATE, *PSHCLTRANSFEROBJSTATE;
707
708typedef struct _SHCLTRANSFEROBJ
709{
710 SHCLOBJHANDLE uHandle;
711 char *pszPathAbs;
712 SHCLFSOBJINFO objInfo;
713 SHCLSOURCE enmSource;
714 SHCLTRANSFEROBJSTATE State;
715} SHCLTRANSFEROBJ, *PSHCLTRANSFEROBJ;
716
717/** Defines a transfer ID. */
718typedef uint16_t SHCLTRANSFERID;
719
720/**
721 * Enumeration for specifying a Shared Clipboard object type.
722 */
723typedef enum _SHCLOBJTYPE
724{
725 /** Invalid object type. */
726 SHCLOBJTYPE_INVALID = 0,
727 /** Object is a directory. */
728 SHCLOBJTYPE_DIRECTORY,
729 /** Object is a file. */
730 SHCLOBJTYPE_FILE,
731 /** Object is a symbolic link. */
732 SHCLOBJTYPE_SYMLINK,
733 /** The usual 32-bit hack. */
734 SHCLOBJTYPE_32BIT_SIZE_HACK = 0x7fffffff
735} SHCLOBJTYPE;
736
737/**
738 * Structure for keeping transfer list handle information.
739 * This is using to map own (local) handles to the underlying file system.
740 */
741typedef struct _SHCLLISTHANDLEINFO
742{
743 /** The list node. */
744 RTLISTNODE Node;
745 /** The list's handle. */
746 SHCLLISTHANDLE hList;
747 /** Type of list handle. */
748 SHCLOBJTYPE enmType;
749 /** Absolute local path of the list object. */
750 char *pszPathLocalAbs;
751 union
752 {
753 /** Local data, based on enmType. */
754 struct
755 {
756 union
757 {
758 RTDIR hDir;
759 RTFILE hFile;
760 };
761 } Local;
762 } u;
763} SHCLLISTHANDLEINFO, *PSHCLLISTHANDLEINFO;
764
765/**
766 * Structure for keeping transfer object handle information.
767 * This is using to map own (local) handles to the underlying file system.
768 */
769typedef struct _SHCLOBJHANDLEINFO
770{
771 /** The list node. */
772 RTLISTNODE Node;
773 /** The object's handle. */
774 SHCLOBJHANDLE hObj;
775 /** Type of object handle. */
776 SHCLOBJTYPE enmType;
777 /** Absolute local path of the object. */
778 char *pszPathLocalAbs;
779 union
780 {
781 /** Local data, based on enmType. */
782 struct
783 {
784 union
785 {
786 RTDIR hDir;
787 RTFILE hFile;
788 };
789 } Local;
790 } u;
791} SHCLOBJHANDLEINFO, *PSHCLOBJHANDLEINFO;
792
793/**
794 * Structure for keeping a single root list entry.
795 */
796typedef struct _SHCLLISTROOT
797{
798 /** The list node. */
799 RTLISTNODE Node;
800 /** Absolute path of entry. */
801 char *pszPathAbs;
802} SHCLLISTROOT, *PSHCLLISTROOT;
803
804/**
805 * Structure for maintaining an Shared Clipboard transfer state.
806 * Everything in here will be part of a saved state (later).
807 */
808typedef struct _SHCLTRANSFERSTATE
809{
810 /** The transfer's (local) ID. */
811 SHCLTRANSFERID uID;
812 /** The transfer's current status. */
813 SHCLTRANSFERSTATUS enmStatus;
814 /** The transfer's direction. */
815 SHCLTRANSFERDIR enmDir;
816 /** The transfer's source. */
817 SHCLSOURCE enmSource;
818} SHCLTRANSFERSTATE, *PSHCLTRANSFERSTATE;
819
820struct _SHCLTRANSFER;
821typedef struct _SHCLTRANSFER *PSHCLTRANSFER;
822
823/**
824 * Structure maintaining clipboard transfer provider context data.
825 * This is handed in to the provider implementation callbacks.
826 */
827 typedef struct _SHCLPROVIDERCTX
828{
829 /** Pointer to the related Shared Clipboard transfer. */
830 PSHCLTRANSFER pTransfer;
831 /** User-defined data pointer. Can be NULL if not needed. */
832 void *pvUser;
833} SHCLPROVIDERCTX, *PSHCLPROVIDERCTX;
834
835/** Defines an clipboard transfer provider function declaration with additional parameters. */
836#define SHCLPROVIDERFUNCDECL(a_Name, ...) \
837 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
838 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
839
840/** Defines an clipboard transfer provider function declaration with additional parameters. */
841#define SHCLPROVIDERFUNCDECLRET(a_Ret, a_Name, ...) \
842 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
843 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
844
845/** Defines an clipboard transfer provider function declaration (no additional parameters). */
846#define SHCLPROVIDERFUNCDECLVOID(a_Name) \
847 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX); \
848 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
849
850/** Declares a clipboard transfer provider function member. */
851#define SHCLPROVIDERFUNCMEMBER(a_Name, a_Member) \
852 RT_CONCAT(PFNSHCLPROVIDER, a_Name) a_Member;
853
854SHCLPROVIDERFUNCDECLVOID(TRANSFEROPEN)
855SHCLPROVIDERFUNCDECLVOID(TRANSFERCLOSE)
856SHCLPROVIDERFUNCDECL(GETROOTS, PSHCLROOTLIST *ppRootList)
857SHCLPROVIDERFUNCDECL(LISTOPEN, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList)
858SHCLPROVIDERFUNCDECL(LISTCLOSE, SHCLLISTHANDLE hList)
859SHCLPROVIDERFUNCDECL(LISTHDRREAD, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
860SHCLPROVIDERFUNCDECL(LISTHDRWRITE, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
861SHCLPROVIDERFUNCDECL(LISTENTRYREAD, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
862SHCLPROVIDERFUNCDECL(LISTENTRYWRITE, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
863SHCLPROVIDERFUNCDECL(OBJOPEN, PSHCLOBJOPENCREATEPARMS pCreateParms, PSHCLOBJHANDLE phObj)
864SHCLPROVIDERFUNCDECL(OBJCLOSE, SHCLOBJHANDLE hObj)
865SHCLPROVIDERFUNCDECL(OBJREAD, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead)
866SHCLPROVIDERFUNCDECL(OBJWRITE, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten)
867
868/**
869 * Shared Clipboard transfer provider interface table.
870 */
871typedef struct _SHCLPROVIDERINTERFACE
872{
873 SHCLPROVIDERFUNCMEMBER(TRANSFEROPEN, pfnTransferOpen)
874 SHCLPROVIDERFUNCMEMBER(TRANSFERCLOSE, pfnTransferClose)
875 SHCLPROVIDERFUNCMEMBER(GETROOTS, pfnGetRoots)
876 SHCLPROVIDERFUNCMEMBER(LISTOPEN, pfnListOpen)
877 SHCLPROVIDERFUNCMEMBER(LISTCLOSE, pfnListClose)
878 SHCLPROVIDERFUNCMEMBER(LISTHDRREAD, pfnListHdrRead)
879 SHCLPROVIDERFUNCMEMBER(LISTHDRWRITE, pfnListHdrWrite)
880 SHCLPROVIDERFUNCMEMBER(LISTENTRYREAD, pfnListEntryRead)
881 SHCLPROVIDERFUNCMEMBER(LISTENTRYWRITE, pfnListEntryWrite)
882 SHCLPROVIDERFUNCMEMBER(OBJOPEN, pfnObjOpen)
883 SHCLPROVIDERFUNCMEMBER(OBJCLOSE, pfnObjClose)
884 SHCLPROVIDERFUNCMEMBER(OBJREAD, pfnObjRead)
885 SHCLPROVIDERFUNCMEMBER(OBJWRITE, pfnObjWrite)
886} SHCLPROVIDERINTERFACE, *PSHCLPROVIDERINTERFACE;
887
888/**
889 * Structure for the Shared Clipboard provider creation context.
890 */
891typedef struct _SHCLPROVIDERCREATIONCTX
892{
893 /** Specifies what the source of the provider is. */
894 SHCLSOURCE enmSource;
895 /** The provider interface table. */
896 SHCLPROVIDERINTERFACE Interface;
897 /** Provider callback data. */
898 void *pvUser;
899} SHCLPROVIDERCREATIONCTX, *PSHCLPROVIDERCREATIONCTX;
900
901struct _SHCLTRANSFER;
902typedef _SHCLTRANSFER *PSHCLTRANSFER;
903
904/**
905 * Structure for storing Shared Clipboard transfer callback data.
906 */
907typedef struct _SHCLTRANSFERCALLBACKDATA
908{
909 /** Pointer to related Shared Clipboard transfer. */
910 PSHCLTRANSFER pTransfer;
911 /** Saved user pointer. */
912 void *pvUser;
913} SHCLTRANSFERCALLBACKDATA, *PSHCLTRANSFERCALLBACKDATA;
914
915#define SHCLTRANSFERCALLBACKDECLVOID(a_Name) \
916 typedef DECLCALLBACK(void) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData); \
917 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
918
919#define SHCLTRANSFERCALLBACKDECL(a_Name, ...) \
920 typedef DECLCALLBACK(void) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData, __VA_ARGS__); \
921 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
922
923#define SHCLTRANSFERCALLBACKMEMBER(a_Name, a_Member) \
924 RT_CONCAT(PFNSHCLCALLBACK, a_Name) a_Member;
925
926SHCLTRANSFERCALLBACKDECLVOID(TRANSFERPREPARE)
927SHCLTRANSFERCALLBACKDECLVOID(TRANSFERSTARTED)
928SHCLTRANSFERCALLBACKDECLVOID(LISTHEADERCOMPLETE)
929SHCLTRANSFERCALLBACKDECLVOID(LISTENTRYCOMPLETE)
930SHCLTRANSFERCALLBACKDECL (TRANSFERCOMPLETE, int rc)
931SHCLTRANSFERCALLBACKDECLVOID(TRANSFERCANCELED)
932SHCLTRANSFERCALLBACKDECL (TRANSFERERROR, int rc)
933
934/**
935 * Structure acting as a function callback table for Shared Clipboard transfers.
936 * All callbacks are optional and therefore can be NULL.
937 */
938typedef struct _SHCLTRANSFERCALLBACKS
939{
940 /** Saved user pointer. */
941 void *pvUser;
942 /** Function pointer, called when the transfer is going to be prepared. */
943 SHCLTRANSFERCALLBACKMEMBER(TRANSFERPREPARE, pfnTransferPrepare)
944 /** Function pointer, called when the transfer has been started. */
945 SHCLTRANSFERCALLBACKMEMBER(TRANSFERSTARTED, pfnTransferStarted)
946 /** Function pointer, called when reading / writing the list header is complete. */
947 SHCLTRANSFERCALLBACKMEMBER(LISTHEADERCOMPLETE, pfnListHeaderComplete)
948 /** Function pointer, called when reading / writing a list entry is complete. */
949 SHCLTRANSFERCALLBACKMEMBER(LISTENTRYCOMPLETE, pfnListEntryComplete)
950 /** Function pointer, called when the transfer is complete. */
951 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCOMPLETE, pfnTransferComplete)
952 /** Function pointer, called when the transfer has been canceled. */
953 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCANCELED, pfnTransferCanceled)
954 /** Function pointer, called when transfer resulted in an unrecoverable error. */
955 SHCLTRANSFERCALLBACKMEMBER(TRANSFERERROR, pfnTransferError)
956} SHCLTRANSFERCALLBACKS, *PSHCLTRANSFERCALLBACKS;
957
958/**
959 * Structure for thread-related members for a single Shared Clipboard transfer.
960 */
961typedef struct _SHCLTRANSFERTHREAD
962{
963 /** Thread handle for the reading / writing thread.
964 * Can be NIL_RTTHREAD if not being used. */
965 RTTHREAD hThread;
966 /** Thread started indicator. */
967 volatile bool fStarted;
968 /** Thread stop flag. */
969 volatile bool fStop;
970 /** Thread cancelled flag / indicator. */
971 volatile bool fCancelled;
972} SHCLTRANSFERTHREAD, *PSHCLTRANSFERTHREAD;
973
974/**
975 * Structure for maintaining a single Shared Clipboard transfer.
976 *
977 ** @todo Not yet thread safe.
978 */
979typedef struct _SHCLTRANSFER
980{
981 /** The node member for using this struct in a RTList. */
982 RTLISTNODE Node;
983 /** Critical section for serializing access. */
984 RTCRITSECT CritSect;
985 /** The transfer's state (for SSM, later). */
986 SHCLTRANSFERSTATE State;
987 /** Timeout (in ms) for waiting of events. Default is 30s. */
988 RTMSINTERVAL uTimeoutMs;
989 /** Absolute path to root entries. */
990 char *pszPathRootAbs;
991 /** Maximum data chunk size (in bytes) to transfer. Default is 64K. */
992 uint32_t cbMaxChunkSize;
993 /** The transfer's own event source. */
994 SHCLEVENTSOURCE Events;
995 /** Next upcoming list handle. */
996 SHCLLISTHANDLE uListHandleNext;
997 /** List of all list handles elated to this transfer. */
998 RTLISTANCHOR lstList;
999 /** Number of root entries in list. */
1000 uint64_t cRoots;
1001 /** List of root entries of this transfer. */
1002 RTLISTANCHOR lstRoots;
1003 /** Next upcoming object handle. */
1004 SHCLOBJHANDLE uObjHandleNext;
1005 /** Map of all objects handles related to this transfer. */
1006 RTLISTANCHOR lstObj;
1007 /** The transfer's own (local) area, if any (can be NULL if not needed).
1008 * The area itself has a clipboard area ID assigned.
1009 * On the host this area ID gets shared (maintained / locked) across all VMs via VBoxSVC. */
1010 SharedClipboardArea *pArea;
1011 /** The transfer's own provider context. */
1012 SHCLPROVIDERCTX ProviderCtx;
1013 /** The transfer's provider interface. */
1014 SHCLPROVIDERINTERFACE ProviderIface;
1015 /** The transfer's (optional) callback table. */
1016 SHCLTRANSFERCALLBACKS Callbacks;
1017 /** Opaque pointer to implementation-specific parameters. */
1018 void *pvUser;
1019 /** Size (in bytes) of implementation-specific parameters. */
1020 size_t cbUser;
1021 /** Contains thread-related attributes. */
1022 SHCLTRANSFERTHREAD Thread;
1023} SHCLTRANSFER, *PSHCLTRANSFER;
1024
1025/**
1026 * Structure for keeping an Shared Clipboard transfer status report.
1027 */
1028typedef struct _SHCLTRANSFERREPORT
1029{
1030 /** Actual status to report. */
1031 SHCLTRANSFERSTATUS uStatus;
1032 /** Result code (rc) to report; might be unused / invalid, based on enmStatus. */
1033 int rc;
1034 /** Reporting flags. Currently unused and must be 0. */
1035 uint32_t fFlags;
1036} SHCLTRANSFERREPORT, *PSHCLTRANSFERREPORT;
1037
1038/**
1039 * Structure for keeping Shared Clipboard transfer context around.
1040 */
1041typedef struct _SHCLTRANSFERCTX
1042{
1043 /** Critical section for serializing access. */
1044 RTCRITSECT CritSect;
1045 /** List of transfers. */
1046 RTLISTANCHOR List;
1047 /** Transfer ID allocation bitmap; clear bits are free, set bits are busy. */
1048 uint64_t bmTransferIds[VBOX_SHCL_MAX_TRANSFERS / sizeof(uint64_t) / 8];
1049 /** Number of running (concurrent) transfers. */
1050 uint16_t cRunning;
1051 /** Maximum Number of running (concurrent) transfers. */
1052 uint16_t cMaxRunning;
1053 /** Number of total transfers (in list). */
1054 uint16_t cTransfers;
1055} SHCLTRANSFERCTX, *PSHCLTRANSFERCTX;
1056
1057int SharedClipboardTransferObjCtxInit(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1058void SharedClipboardTransferObjCtxDestroy(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1059bool SharedClipboardTransferObjCtxIsValid(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1060
1061int SharedClipboardTransferObjectOpenParmsInit(PSHCLOBJOPENCREATEPARMS pParms);
1062int SharedClipboardTransferObjectOpenParmsCopy(PSHCLOBJOPENCREATEPARMS pParmsDst, PSHCLOBJOPENCREATEPARMS pParmsSrc);
1063void SharedClipboardTransferObjectOpenParmsDestroy(PSHCLOBJOPENCREATEPARMS pParms);
1064
1065int SharedClipboardTransferObjectOpen(PSHCLTRANSFER pTransfer, PSHCLOBJOPENCREATEPARMS pOpenCreateParms, PSHCLOBJHANDLE phObj);
1066int SharedClipboardTransferObjectClose(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj);
1067int SharedClipboardTransferObjectRead(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead, uint32_t fFlags);
1068int SharedClipboardTransferObjectWrite(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten, uint32_t fFlags);
1069
1070PSHCLOBJDATACHUNK SharedClipboardTransferObjectDataChunkDup(PSHCLOBJDATACHUNK pDataChunk);
1071void SharedClipboardTransferObjectDataChunkDestroy(PSHCLOBJDATACHUNK pDataChunk);
1072void SharedClipboardTransferObjectDataChunkFree(PSHCLOBJDATACHUNK pDataChunk);
1073
1074int SharedClipboardTransferCreate(PSHCLTRANSFER *ppTransfer);
1075int SharedClipboardTransferDestroy(PSHCLTRANSFER pTransfer);
1076
1077int SharedClipboardTransferInit(PSHCLTRANSFER pTransfer, uint32_t uID, SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource);
1078int SharedClipboardTransferOpen(PSHCLTRANSFER pTransfer);
1079int SharedClipboardTransferClose(PSHCLTRANSFER pTransfer);
1080
1081int SharedClipboardTransferListOpen(PSHCLTRANSFER pTransfer, PSHCLLISTOPENPARMS pOpenParms,
1082 PSHCLLISTHANDLE phList);
1083int SharedClipboardTransferListClose(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1084int SharedClipboardTransferListGetHeader(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList,
1085 PSHCLLISTHDR pHdr);
1086PSHCLTRANSFEROBJ SharedClipboardTransferListGetObj(PSHCLTRANSFER pTransfer,
1087 SHCLLISTHANDLE hList, uint64_t uIdx);
1088int SharedClipboardTransferListRead(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList,
1089 PSHCLLISTENTRY pEntry);
1090int SharedClipboardTransferListWrite(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList,
1091 PSHCLLISTENTRY pEntry);
1092bool SharedClipboardTransferListHandleIsValid(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1093
1094int SharedClipboardTransferPrepare(PSHCLTRANSFER pTransfer);
1095int SharedClipboardTransferSetInterface(PSHCLTRANSFER pTransfer,
1096 PSHCLPROVIDERCREATIONCTX pCreationCtx);
1097int SharedClipboardTransferSetRoots(PSHCLTRANSFER pTransfer, const char *pszRoots, size_t cbRoots);
1098void SharedClipboardTransferReset(PSHCLTRANSFER pTransfer);
1099SharedClipboardArea *SharedClipboardTransferGetArea(PSHCLTRANSFER pTransfer);
1100
1101uint32_t SharedClipboardTransferRootsCount(PSHCLTRANSFER pTransfer);
1102int SharedClipboardTransferRootsEntry(PSHCLTRANSFER pTransfer, uint64_t uIndex, PSHCLROOTLISTENTRY pEntry);
1103int SharedClipboardTransferRootsAsList(PSHCLTRANSFER pTransfer, PSHCLROOTLIST *ppRootList);
1104
1105SHCLTRANSFERID SharedClipboardTransferGetID(PSHCLTRANSFER pTransfer);
1106SHCLSOURCE SharedClipboardTransferGetSource(PSHCLTRANSFER pTransfer);
1107SHCLTRANSFERSTATUS SharedClipboardTransferGetStatus(PSHCLTRANSFER pTransfer);
1108int SharedClipboardTransferHandleReply(PSHCLTRANSFER pTransfer, PSHCLREPLY pReply);
1109int SharedClipboardTransferRun(PSHCLTRANSFER pTransfer, PFNRTTHREAD pfnThreadFunc, void *pvUser);
1110void SharedClipboardTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks);
1111
1112int SharedClipboardTransferRead(PSHCLTRANSFER pTransfer);
1113int SharedClipboardTransferReadObjects(PSHCLTRANSFER pTransfer);
1114
1115int SharedClipboardTransferWrite(PSHCLTRANSFER pTransfer);
1116int SharedClipboardTransferWriteObjects(PSHCLTRANSFER pTransfer);
1117
1118int SharedClipboardTransferCtxInit(PSHCLTRANSFERCTX pTransferCtx);
1119void SharedClipboardTransferCtxDestroy(PSHCLTRANSFERCTX pTransferCtx);
1120void SharedClipboardTransferCtxReset(PSHCLTRANSFERCTX pTransferCtx);
1121PSHCLTRANSFER SharedClipboardTransferCtxGetTransfer(PSHCLTRANSFERCTX pTransferCtx, uint32_t uIdx);
1122uint32_t SharedClipboardTransferCtxGetRunningTransfers(PSHCLTRANSFERCTX pTransferCtx);
1123uint32_t SharedClipboardTransferCtxGetTotalTransfers(PSHCLTRANSFERCTX pTransferCtx);
1124void SharedClipboardTransferCtxTransfersCleanup(PSHCLTRANSFERCTX pTransferCtx);
1125bool SharedClipboardTransferCtxTransfersMaximumReached(PSHCLTRANSFERCTX pTransferCtx);
1126int SharedClipboardTransferCtxTransferRegister(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t *pidTransfer);
1127int SharedClipboardTransferCtxTransferRegisterByIndex(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t idTransfer);
1128int SharedClipboardTransferCtxTransferUnregister(PSHCLTRANSFERCTX pTransferCtx, uint32_t idTransfer);
1129
1130void SharedClipboardFsObjFromIPRT(PSHCLFSOBJINFO pDst, PCRTFSOBJINFO pSrc);
1131
1132bool SharedClipboardMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax);
1133bool SharedClipboardMIMENeedsCache(const char *pcszFormat, size_t cchFormatMax);
1134
1135const char *VBoxShClTransferStatusToStr(uint32_t uStatus);
1136
1137#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_transfers_h */
1138
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