VirtualBox

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

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

Shared Clipboard/Transfers: Update.

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