VirtualBox

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

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

Shared Clipboard/Transfers: Build fix.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette