VirtualBox

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

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

Shared Clipboard: Update.

  • 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 81768 2019-11-11 16:36:41Z 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 SHCLLISTHANDLE uHandle;
402 } ListClose;
403 struct
404 {
405 SHCLOBJHANDLE uHandle;
406 } ObjOpen;
407 struct
408 {
409 SHCLOBJHANDLE uHandle;
410 } ObjClose;
411 } u;
412 /** Pointer to optional payload. */
413 void *pvPayload;
414 /** Payload size (in bytes). */
415 uint32_t cbPayload;
416} SHCLREPLY, *PSHCLREPLY;
417
418struct _SHCLLISTENTRY;
419typedef _SHCLLISTENTRY SHCLLISTENTRY;
420
421/** Defines a single root list entry. Currently the same as a regular list entry. */
422typedef SHCLLISTENTRY SHCLROOTLISTENTRY;
423/** Defines a pointer to a single root list entry. Currently the same as a regular list entry pointer. */
424typedef SHCLROOTLISTENTRY *PSHCLROOTLISTENTRY;
425
426/**
427 * Structure for keeping Shared Clipboard root list headers.
428 */
429typedef struct _SHCLROOTLISTHDR
430{
431 /** Roots listing flags; unused at the moment. */
432 uint32_t fRoots;
433 /** Number of root list entries. */
434 uint32_t cRoots;
435} SHCLROOTLISTHDR, *PSHCLROOTLISTHDR;
436
437/**
438 * Structure for maintaining a Shared Clipboard root list.
439 */
440typedef struct _SHCLROOTLIST
441{
442 /** Root list header. */
443 SHCLROOTLISTHDR Hdr;
444 /** Root list entries. */
445 SHCLROOTLISTENTRY *paEntries;
446} SHCLROOTLIST, *PSHCLROOTLIST;
447
448/**
449 * Structure for maintaining Shared Clipboard list open paramters.
450 */
451typedef struct _SHCLLISTOPENPARMS
452{
453 /** Listing flags (see VBOX_SHCL_LIST_FLAG_XXX). */
454 uint32_t fList;
455 /** Size (in bytes) of the filter string. */
456 uint32_t cbFilter;
457 /** Filter string. DOS wilcard-style. */
458 char *pszFilter;
459 /** Size (in bytes) of the listing path. */
460 uint32_t cbPath;
461 /** Listing path (absolute). If empty or NULL the listing's root path will be opened. */
462 char *pszPath;
463} SHCLLISTOPENPARMS, *PSHCLLISTOPENPARMS;
464
465/**
466 * Structure for keeping a Shared Clipboard list header.
467 */
468typedef struct _SHCLLISTHDR
469{
470 /** Feature flag(s). Not being used atm. */
471 uint32_t fFeatures;
472 /** Total objects returned. */
473 uint64_t cTotalObjects;
474 /** Total size (in bytes) returned. */
475 uint64_t cbTotalSize;
476} SHCLLISTHDR, *PSHCLLISTHDR;
477
478/**
479 * Structure for a Shared Clipboard list entry.
480 */
481typedef struct _SHCLLISTENTRY
482{
483 /** Entry name. */
484 char *pszName;
485 /** Size (in bytes) of entry name. */
486 uint32_t cbName;
487 /** Information flag(s). */
488 uint32_t fInfo;
489 /** Size (in bytes) of the actual list entry. */
490 uint32_t cbInfo;
491 /** Data of the actual list entry. */
492 void *pvInfo;
493} SHCLLISTENTRY, *PSHCLLISTENTRY;
494
495/** Maximum length (in UTF-8 characters) of a list entry name. */
496#define SHCLLISTENTRY_MAX_NAME RTPATH_MAX /** @todo Improve this to be more dynamic. */
497
498/**
499 * Structure for maintaining a Shared Clipboard list.
500 */
501typedef struct _SHCLLIST
502{
503 /** List header. */
504 SHCLLISTHDR Hdr;
505 /** List entries. */
506 SHCLROOTLISTENTRY *paEntries;
507} SHCLLIST, *PSHCLLIST;
508
509/**
510 * Structure for keeping a Shared Clipboard object data chunk.
511 */
512typedef struct _SHCLOBJDATACHUNK
513{
514 /** Handle of object this data chunk is related to. */
515 uint64_t uHandle;
516 /** Pointer to actual data chunk. */
517 void *pvData;
518 /** Size (in bytes) of data chunk. */
519 uint32_t cbData;
520} SHCLOBJDATACHUNK, *PSHCLOBJDATACHUNK;
521
522/**
523 * Enumeration for specifying a clipboard area object type.
524 */
525typedef enum _SHCLAREAOBJTYPE
526{
527 /** Unknown object type; do not use. */
528 SHCLAREAOBJTYPE_UNKNOWN = 0,
529 /** Object is a directory. */
530 SHCLAREAOBJTYPE_DIR,
531 /** Object is a file. */
532 SHCLAREAOBJTYPE_FILE,
533 /** Object is a symbolic link. */
534 SHCLAREAOBJTYPE_SYMLINK,
535 /** The usual 32-bit hack. */
536 SHCLAREAOBJTYPE_32Bit_Hack = 0x7fffffff
537} SHCLAREAOBJTYPE;
538
539/** Clipboard area ID. A valid area is >= 1.
540 * If 0 is specified, the last (most recent) area is meant.
541 * Set to UINT32_MAX if not initialized. */
542typedef uint32_t SHCLAREAID;
543
544/** Defines a non-initialized (nil) clipboard area. */
545#define NIL_SHCLAREAID UINT32_MAX
546
547/** SharedClipboardArea open flags. */
548typedef uint32_t SHCLAREAOPENFLAGS;
549
550/** No clipboard area open flags specified. */
551#define SHCLAREA_OPEN_FLAGS_NONE 0
552/** The clipboard area must not exist yet. */
553#define SHCLAREA_OPEN_FLAGS_MUST_NOT_EXIST RT_BIT(0)
554/** Mask of all valid clipboard area open flags. */
555#define SHCLAREA_OPEN_FLAGS_VALID_MASK 0x1
556
557/** Defines a clipboard area object state. */
558typedef uint32_t SHCLAREAOBJSTATE;
559
560/** No object state set. */
561#define SHCLAREAOBJSTATE_NONE 0
562/** The object is considered as being complete (e.g. serialized). */
563#define SHCLAREAOBJSTATE_COMPLETE RT_BIT(0)
564
565/**
566 * Lightweight structure to keep a clipboard area object's state.
567 *
568 * Note: We don't want to use the ClipboardURIObject class here, as this
569 * is too heavy for this purpose.
570 */
571typedef struct _SHCLAREAOBJ
572{
573 SHCLAREAOBJTYPE enmType;
574 SHCLAREAOBJSTATE fState;
575} SHCLAREAOBJ, *PSHCLAREAOBJ;
576
577/**
578 * Class for maintaining a Shared Clipboard area
579 * on the host or guest. This will contain all received files & directories
580 * for a single Shared Clipboard operation.
581 *
582 * In case of a failed Shared Clipboard operation this class can also
583 * perform a gentle rollback if required.
584 */
585class SharedClipboardArea
586{
587public:
588
589 SharedClipboardArea(void);
590 SharedClipboardArea(const char *pszPath, SHCLAREAID uID = NIL_SHCLAREAID,
591 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
592 virtual ~SharedClipboardArea(void);
593
594public:
595
596 uint32_t AddRef(void);
597 uint32_t Release(void);
598
599 int Lock(void);
600 int Unlock(void);
601
602 int AddObject(const char *pszPath, const SHCLAREAOBJ &Obj);
603 int GetObject(const char *pszPath, PSHCLAREAOBJ pObj);
604
605 int Close(void);
606 bool IsOpen(void) const;
607 int OpenEx(const char *pszPath, SHCLAREAID uID = NIL_SHCLAREAID,
608 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
609 int OpenTemp(SHCLAREAID uID = NIL_SHCLAREAID,
610 SHCLAREAOPENFLAGS fFlags = SHCLAREA_OPEN_FLAGS_NONE);
611 SHCLAREAID GetID(void) const;
612 const char *GetDirAbs(void) const;
613 uint32_t GetRefCount(void);
614 int Reopen(void);
615 int Reset(bool fDeleteContent);
616 int Rollback(void);
617
618public:
619
620 static int PathConstruct(const char *pszBase, SHCLAREAID uID, char *pszPath, size_t cbPath);
621
622protected:
623
624 int initInternal(void);
625 int destroyInternal(void);
626 int closeInternal(void);
627
628protected:
629
630 typedef std::map<RTCString, SHCLAREAOBJ> SharedClipboardAreaFsObjMap;
631
632 /** Creation timestamp (in ms). */
633 uint64_t m_tsCreatedMs;
634 /** Number of references to this instance. */
635 volatile uint32_t m_cRefs;
636 /** Critical section for serializing access. */
637 RTCRITSECT m_CritSect;
638 /** Open flags. */
639 uint32_t m_fOpen;
640 /** Directory handle for root clipboard directory. */
641 RTDIR m_hDir;
642 /** Absolute path to root clipboard directory. */
643 RTCString m_strPathAbs;
644 /** List for holding created directories in the case of a rollback. */
645 SharedClipboardAreaFsObjMap m_mapObj;
646 /** Associated clipboard area ID. */
647 SHCLAREAID m_uID;
648};
649
650/**
651 * Structure for handling a single transfer object context.
652 */
653typedef struct _SHCLCLIENTTRANSFEROBJCTX
654{
655 SHCLTRANSFER *pTransfer;
656 SHCLOBJHANDLE uHandle;
657} SHCLCLIENTTRANSFEROBJCTX, *PSHCLCLIENTTRANSFEROBJCTX;
658
659typedef struct _SHCLTRANSFEROBJSTATE
660{
661 /** How many bytes were processed (read / write) so far. */
662 uint64_t cbProcessed;
663} SHCLTRANSFEROBJSTATE, *PSHCLTRANSFEROBJSTATE;
664
665typedef struct _SHCLTRANSFEROBJ
666{
667 SHCLOBJHANDLE uHandle;
668 char *pszPathAbs;
669 SHCLFSOBJINFO objInfo;
670 SHCLSOURCE enmSource;
671 SHCLTRANSFEROBJSTATE State;
672} SHCLTRANSFEROBJ, *PSHCLTRANSFEROBJ;
673
674/** Defines a transfer ID. */
675typedef uint16_t SHCLTRANSFERID;
676
677/**
678 * Enumeration for specifying a Shared Clipboard object type.
679 */
680typedef enum _SHCLOBJTYPE
681{
682 /** Invalid object type. */
683 SHCLOBJTYPE_INVALID = 0,
684 /** Object is a directory. */
685 SHCLOBJTYPE_DIRECTORY,
686 /** Object is a file. */
687 SHCLOBJTYPE_FILE,
688 /** Object is a symbolic link. */
689 SHCLOBJTYPE_SYMLINK,
690 /** The usual 32-bit hack. */
691 SHCLOBJTYPE_32BIT_SIZE_HACK = 0x7fffffff
692} SHCLOBJTYPE;
693
694/**
695 * Structure for keeping transfer list handle information.
696 * This is using to map own (local) handles to the underlying file system.
697 */
698typedef struct _SHCLLISTHANDLEINFO
699{
700 /** The list node. */
701 RTLISTNODE Node;
702 /** The list's handle. */
703 SHCLLISTHANDLE hList;
704 /** Type of list handle. */
705 SHCLOBJTYPE enmType;
706 /** Absolute local path of the list object. */
707 char *pszPathLocalAbs;
708 union
709 {
710 /** Local data, based on enmType. */
711 struct
712 {
713 union
714 {
715 RTDIR hDir;
716 RTFILE hFile;
717 };
718 } Local;
719 } u;
720} SHCLLISTHANDLEINFO, *PSHCLLISTHANDLEINFO;
721
722/**
723 * Structure for keeping transfer object handle information.
724 * This is using to map own (local) handles to the underlying file system.
725 */
726typedef struct _SHCLOBJHANDLEINFO
727{
728 /** The list node. */
729 RTLISTNODE Node;
730 /** The object's handle. */
731 SHCLOBJHANDLE hObj;
732 /** Type of object handle. */
733 SHCLOBJTYPE enmType;
734 /** Absolute local path of the object. */
735 char *pszPathLocalAbs;
736 union
737 {
738 /** Local data, based on enmType. */
739 struct
740 {
741 union
742 {
743 RTDIR hDir;
744 RTFILE hFile;
745 };
746 } Local;
747 } u;
748} SHCLOBJHANDLEINFO, *PSHCLOBJHANDLEINFO;
749
750/**
751 * Structure for keeping a single root list entry.
752 */
753typedef struct _SHCLLISTROOT
754{
755 /** The list node. */
756 RTLISTNODE Node;
757 /** Absolute path of entry. */
758 char *pszPathAbs;
759} SHCLLISTROOT, *PSHCLLISTROOT;
760
761/**
762 * Structure for maintaining an Shared Clipboard transfer state.
763 * Everything in here will be part of a saved state (later).
764 */
765typedef struct _SHCLTRANSFERSTATE
766{
767 /** The transfer's (local) ID. */
768 SHCLTRANSFERID uID;
769 /** The transfer's current status. */
770 SHCLTRANSFERSTATUS enmStatus;
771 /** The transfer's direction, seen from the perspective who created the transfer. */
772 SHCLTRANSFERDIR enmDir;
773 /** The transfer's source, seen from the perspective who created the transfer. */
774 SHCLSOURCE enmSource;
775} SHCLTRANSFERSTATE, *PSHCLTRANSFERSTATE;
776
777struct _SHCLTRANSFER;
778typedef struct _SHCLTRANSFER *PSHCLTRANSFER;
779
780/**
781 * Structure maintaining clipboard transfer provider context data.
782 * This is handed in to the provider implementation callbacks.
783 */
784 typedef struct _SHCLPROVIDERCTX
785{
786 /** Pointer to the related Shared Clipboard transfer. */
787 PSHCLTRANSFER pTransfer;
788 /** User-defined data pointer. Can be NULL if not needed. */
789 void *pvUser;
790} SHCLPROVIDERCTX, *PSHCLPROVIDERCTX;
791
792/** @todo r=bird: These macros must go as they do no lend themselves to writing
793 * sane documentation. Use the DECLCALLBACK macro instead, as you
794 * probably do not need the function and function pointer typedefs.
795 *
796 * However, we need the documentation as you don't document a flying
797 * flamingo elsewhere regarding these functions.
798 */
799/** Defines an clipboard transfer provider function declaration with additional parameters. */
800#define SHCLPROVIDERFUNCDECL(a_Name, ...) \
801 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
802 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
803
804/** Defines an clipboard transfer provider function declaration with additional parameters. */
805#define SHCLPROVIDERFUNCDECLRET(a_Ret, a_Name, ...) \
806 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
807 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
808
809/** Defines an clipboard transfer provider function declaration (no additional parameters). */
810#define SHCLPROVIDERFUNCDECLVOID(a_Name) \
811 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX); \
812 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
813
814/** Declares a clipboard transfer provider function member. */
815#define SHCLPROVIDERFUNCMEMBER(a_Name, a_Member) \
816 RT_CONCAT(PFNSHCLPROVIDER, a_Name) a_Member;
817
818SHCLPROVIDERFUNCDECLVOID(TRANSFEROPEN)
819SHCLPROVIDERFUNCDECLVOID(TRANSFERCLOSE)
820SHCLPROVIDERFUNCDECL(GETROOTS, PSHCLROOTLIST *ppRootList)
821SHCLPROVIDERFUNCDECL(LISTOPEN, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList)
822SHCLPROVIDERFUNCDECL(LISTCLOSE, SHCLLISTHANDLE hList)
823SHCLPROVIDERFUNCDECL(LISTHDRREAD, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
824SHCLPROVIDERFUNCDECL(LISTHDRWRITE, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
825SHCLPROVIDERFUNCDECL(LISTENTRYREAD, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
826SHCLPROVIDERFUNCDECL(LISTENTRYWRITE, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
827SHCLPROVIDERFUNCDECL(OBJOPEN, PSHCLOBJOPENCREATEPARMS pCreateParms, PSHCLOBJHANDLE phObj)
828SHCLPROVIDERFUNCDECL(OBJCLOSE, SHCLOBJHANDLE hObj)
829SHCLPROVIDERFUNCDECL(OBJREAD, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead)
830SHCLPROVIDERFUNCDECL(OBJWRITE, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten)
831
832/**
833 * Shared Clipboard transfer provider interface table.
834 */
835typedef struct _SHCLPROVIDERINTERFACE
836{
837 SHCLPROVIDERFUNCMEMBER(TRANSFEROPEN, pfnTransferOpen)
838 SHCLPROVIDERFUNCMEMBER(TRANSFERCLOSE, pfnTransferClose)
839 SHCLPROVIDERFUNCMEMBER(GETROOTS, pfnRootsGet)
840 SHCLPROVIDERFUNCMEMBER(LISTOPEN, pfnListOpen)
841 SHCLPROVIDERFUNCMEMBER(LISTCLOSE, pfnListClose)
842 SHCLPROVIDERFUNCMEMBER(LISTHDRREAD, pfnListHdrRead)
843 SHCLPROVIDERFUNCMEMBER(LISTHDRWRITE, pfnListHdrWrite)
844 SHCLPROVIDERFUNCMEMBER(LISTENTRYREAD, pfnListEntryRead)
845 SHCLPROVIDERFUNCMEMBER(LISTENTRYWRITE, pfnListEntryWrite)
846 SHCLPROVIDERFUNCMEMBER(OBJOPEN, pfnObjOpen)
847 SHCLPROVIDERFUNCMEMBER(OBJCLOSE, pfnObjClose)
848 SHCLPROVIDERFUNCMEMBER(OBJREAD, pfnObjRead)
849 SHCLPROVIDERFUNCMEMBER(OBJWRITE, pfnObjWrite)
850} SHCLPROVIDERINTERFACE, *PSHCLPROVIDERINTERFACE;
851
852/**
853 * Structure for the Shared Clipboard provider creation context.
854 */
855typedef struct _SHCLPROVIDERCREATIONCTX
856{
857 /** Specifies what the source of the provider is. */
858 SHCLSOURCE enmSource;
859 /** The provider interface table. */
860 SHCLPROVIDERINTERFACE Interface;
861 /** Provider callback data. */
862 void *pvUser;
863} SHCLPROVIDERCREATIONCTX, *PSHCLPROVIDERCREATIONCTX;
864
865struct _SHCLTRANSFER;
866typedef _SHCLTRANSFER *PSHCLTRANSFER;
867
868/**
869 * Structure for storing Shared Clipboard transfer callback data.
870 */
871typedef struct _SHCLTRANSFERCALLBACKDATA
872{
873 /** Pointer to related Shared Clipboard transfer. */
874 PSHCLTRANSFER pTransfer;
875 /** Saved user pointer. */
876 void *pvUser;
877 /** Size (in bytes) of data at user pointer. */
878 size_t cbUser;
879} SHCLTRANSFERCALLBACKDATA, *PSHCLTRANSFERCALLBACKDATA;
880
881/** Declares a Shared Clipboard transfer callback. */
882#define SHCLTRANSFERCALLBACKDECL(a_Ret, a_Name) \
883 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData); \
884 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
885
886/** Declares a Shared Clipboard transfer callback with variable arguments. */
887#define SHCLTRANSFERCALLBACKDECL_VA(a_Ret, a_Name, ...) \
888 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData, __VA_ARGS__); \
889 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
890
891/** Declares a Shared Clipboard transfer callback member function. */
892#define SHCLTRANSFERCALLBACKMEMBER(a_Name, a_Member) \
893 RT_CONCAT(PFNSHCLCALLBACK, a_Name) a_Member;
894
895SHCLTRANSFERCALLBACKDECL (int, TRANSFERINITIALIZE)
896SHCLTRANSFERCALLBACKDECL (int, TRANSFERSTART)
897SHCLTRANSFERCALLBACKDECL (void, LISTHEADERCOMPLETE)
898SHCLTRANSFERCALLBACKDECL (void, LISTENTRYCOMPLETE)
899SHCLTRANSFERCALLBACKDECL_VA(void, TRANSFERCOMPLETE, int rc)
900SHCLTRANSFERCALLBACKDECL (void, TRANSFERCANCELED)
901SHCLTRANSFERCALLBACKDECL_VA(void, TRANSFERERROR, int rc)
902
903/**
904 * Structure acting as a function callback table for Shared Clipboard transfers.
905 * All callbacks are optional and therefore can be NULL.
906 */
907typedef struct _SHCLTRANSFERCALLBACKS
908{
909 /** User pointer to data. Optional and can be NULL. */
910 void *pvUser;
911 /** Size (in bytes) of user data pointing at. Optional and can be 0. */
912 size_t cbUser;
913 /** Function pointer, called after the transfer has been initialized. */
914 SHCLTRANSFERCALLBACKMEMBER(TRANSFERINITIALIZE, pfnTransferInitialize)
915 /** Function pointer, called before the transfer will be started. */
916 SHCLTRANSFERCALLBACKMEMBER(TRANSFERSTART, pfnTransferStart)
917 /** Function pointer, called when reading / writing the list header is complete. */
918 SHCLTRANSFERCALLBACKMEMBER(LISTHEADERCOMPLETE, pfnListHeaderComplete)
919 /** Function pointer, called when reading / writing a list entry is complete. */
920 SHCLTRANSFERCALLBACKMEMBER(LISTENTRYCOMPLETE, pfnListEntryComplete)
921 /** Function pointer, called when the transfer is complete. */
922 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCOMPLETE, pfnTransferComplete)
923 /** Function pointer, called when the transfer has been canceled. */
924 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCANCELED, pfnTransferCanceled)
925 /** Function pointer, called when transfer resulted in an unrecoverable error. */
926 SHCLTRANSFERCALLBACKMEMBER(TRANSFERERROR, pfnTransferError)
927} SHCLTRANSFERCALLBACKS, *PSHCLTRANSFERCALLBACKS;
928
929/**
930 * Structure for thread-related members for a single Shared Clipboard transfer.
931 */
932typedef struct _SHCLTRANSFERTHREAD
933{
934 /** Thread handle for the reading / writing thread.
935 * Can be NIL_RTTHREAD if not being used. */
936 RTTHREAD hThread;
937 /** Thread started indicator. */
938 volatile bool fStarted;
939 /** Thread stop flag. */
940 volatile bool fStop;
941 /** Thread cancelled flag / indicator. */
942 volatile bool fCancelled;
943} SHCLTRANSFERTHREAD, *PSHCLTRANSFERTHREAD;
944
945/**
946 * Structure for maintaining a single Shared Clipboard transfer.
947 *
948 ** @todo Not yet thread safe.
949 */
950typedef struct _SHCLTRANSFER
951{
952 /** The node member for using this struct in a RTList. */
953 RTLISTNODE Node;
954 /** Critical section for serializing access. */
955 RTCRITSECT CritSect;
956 /** The transfer's state (for SSM, later). */
957 SHCLTRANSFERSTATE State;
958 /** Timeout (in ms) for waiting of events. Default is 30s. */
959 RTMSINTERVAL uTimeoutMs;
960 /** Absolute path to root entries. */
961 char *pszPathRootAbs;
962 /** Maximum data chunk size (in bytes) to transfer. Default is 64K. */
963 uint32_t cbMaxChunkSize;
964 /** The transfer's own event source. */
965 SHCLEVENTSOURCE Events;
966 /** Current number of concurrent list handles. */
967 uint32_t cListHandles;
968 /** Maximum number of concurrent list handles. */
969 uint32_t cMaxListHandles;
970 /** Next upcoming list handle. */
971 SHCLLISTHANDLE uListHandleNext;
972 /** List of all list handles elated to this transfer. */
973 RTLISTANCHOR lstList;
974 /** Number of root entries in list. */
975 uint64_t cRoots;
976 /** List of root entries of this transfer. */
977 RTLISTANCHOR lstRoots;
978 /** Current number of concurrent object handles. */
979 uint32_t cObjHandles;
980 /** Maximum number of concurrent object handles. */
981 uint32_t cMaxObjHandles;
982 /** Next upcoming object handle. */
983 SHCLOBJHANDLE uObjHandleNext;
984 /** Map of all objects handles related to this transfer. */
985 RTLISTANCHOR lstObj;
986 /** The transfer's own (local) area, if any (can be NULL if not needed).
987 * The area itself has a clipboard area ID assigned.
988 * On the host this area ID gets shared (maintained / locked) across all VMs via VBoxSVC. */
989 SharedClipboardArea *pArea;
990 /** The transfer's own provider context. */
991 SHCLPROVIDERCTX ProviderCtx;
992 /** The transfer's provider interface. */
993 SHCLPROVIDERINTERFACE ProviderIface;
994 /** The transfer's (optional) callback table. */
995 SHCLTRANSFERCALLBACKS Callbacks;
996 /** Opaque pointer to implementation-specific parameters. */
997 void *pvUser;
998 /** Size (in bytes) of implementation-specific parameters. */
999 size_t cbUser;
1000 /** Contains thread-related attributes. */
1001 SHCLTRANSFERTHREAD Thread;
1002} SHCLTRANSFER, *PSHCLTRANSFER;
1003
1004/**
1005 * Structure for keeping an Shared Clipboard transfer status report.
1006 */
1007typedef struct _SHCLTRANSFERREPORT
1008{
1009 /** Actual status to report. */
1010 SHCLTRANSFERSTATUS uStatus;
1011 /** Result code (rc) to report; might be unused / invalid, based on enmStatus. */
1012 int rc;
1013 /** Reporting flags. Currently unused and must be 0. */
1014 uint32_t fFlags;
1015} SHCLTRANSFERREPORT, *PSHCLTRANSFERREPORT;
1016
1017/**
1018 * Structure for keeping Shared Clipboard transfer context around.
1019 */
1020typedef struct _SHCLTRANSFERCTX
1021{
1022 /** Critical section for serializing access. */
1023 RTCRITSECT CritSect;
1024 /** List of transfers. */
1025 RTLISTANCHOR List;
1026 /** Transfer ID allocation bitmap; clear bits are free, set bits are busy. */
1027 uint64_t bmTransferIds[VBOX_SHCL_MAX_TRANSFERS / sizeof(uint64_t) / 8];
1028 /** Number of running (concurrent) transfers. */
1029 uint16_t cRunning;
1030 /** Maximum Number of running (concurrent) transfers. */
1031 uint16_t cMaxRunning;
1032 /** Number of total transfers (in list). */
1033 uint16_t cTransfers;
1034} SHCLTRANSFERCTX, *PSHCLTRANSFERCTX;
1035
1036int ShClTransferObjCtxInit(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1037void ShClTransferObjCtxDestroy(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1038bool ShClTransferObjCtxIsValid(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1039
1040int ShClTransferObjHandleInfoInit(PSHCLOBJHANDLEINFO pInfo);
1041void ShClTransferObjHandleInfoDestroy(PSHCLOBJHANDLEINFO pInfo);
1042
1043int ShClTransferObjOpenParmsInit(PSHCLOBJOPENCREATEPARMS pParms);
1044int ShClTransferObjOpenParmsCopy(PSHCLOBJOPENCREATEPARMS pParmsDst, PSHCLOBJOPENCREATEPARMS pParmsSrc);
1045void ShClTransferObjOpenParmsDestroy(PSHCLOBJOPENCREATEPARMS pParms);
1046
1047int ShClTransferObjOpen(PSHCLTRANSFER pTransfer, PSHCLOBJOPENCREATEPARMS pOpenCreateParms, PSHCLOBJHANDLE phObj);
1048int ShClTransferObjClose(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj);
1049int ShClTransferObjRead(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead, uint32_t fFlags);
1050int ShClTransferObjWrite(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten, uint32_t fFlags);
1051
1052PSHCLOBJDATACHUNK ShClTransferObjDataChunkDup(PSHCLOBJDATACHUNK pDataChunk);
1053void ShClTransferObjDataChunkDestroy(PSHCLOBJDATACHUNK pDataChunk);
1054void ShClTransferObjDataChunkFree(PSHCLOBJDATACHUNK pDataChunk);
1055
1056int ShClTransferCreate(PSHCLTRANSFER *ppTransfer);
1057int ShClTransferDestroy(PSHCLTRANSFER pTransfer);
1058
1059int ShClTransferInit(PSHCLTRANSFER pTransfer, uint32_t uID, SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource);
1060int ShClTransferOpen(PSHCLTRANSFER pTransfer);
1061int ShClTransferClose(PSHCLTRANSFER pTransfer);
1062
1063int ShClTransferListOpen(PSHCLTRANSFER pTransfer, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList);
1064int ShClTransferListClose(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1065int ShClTransferListGetHeader(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTHDR pHdr);
1066PSHCLTRANSFEROBJ ShClTransferListGetObj(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, uint64_t uIdx);
1067int ShClTransferListRead(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry);
1068int ShClTransferListWrite(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry);
1069bool ShClTransferListHandleIsValid(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1070
1071int ShClPathSanitizeFilename(char *pszPath, size_t cbPath);
1072int ShClPathSanitize(char *pszPath, size_t cbPath);
1073
1074PSHCLROOTLIST ShClTransferRootListAlloc(void);
1075void ShClTransferRootListFree(PSHCLROOTLIST pRootList);
1076
1077PSHCLROOTLISTHDR ShClTransferRootListHdrDup(PSHCLROOTLISTHDR pRoots);
1078int ShClTransferRootListHdrInit(PSHCLROOTLISTHDR pRoots);
1079void ShClTransferRootListHdrDestroy(PSHCLROOTLISTHDR pRoots);
1080
1081int ShClTransferRootListEntryCopy(PSHCLROOTLISTENTRY pDst, PSHCLROOTLISTENTRY pSrc);
1082int ShClTransferRootListEntryInit(PSHCLROOTLISTENTRY pRootListEntry);
1083void ShClTransferRootListEntryDestroy(PSHCLROOTLISTENTRY pRootListEntry);
1084PSHCLROOTLISTENTRY ShClTransferRootListEntryDup(PSHCLROOTLISTENTRY pRootListEntry);
1085
1086int ShClTransferListHandleInfoInit(PSHCLLISTHANDLEINFO pInfo);
1087void ShClTransferListHandleInfoDestroy(PSHCLLISTHANDLEINFO pInfo);
1088
1089int ShClTransferListHdrAlloc(PSHCLLISTHDR *ppListHdr);
1090void ShClTransferListHdrFree(PSHCLLISTHDR pListHdr);
1091PSHCLLISTHDR ShClTransferListHdrDup(PSHCLLISTHDR pListHdr);
1092int ShClTransferListHdrInit(PSHCLLISTHDR pListHdr);
1093void ShClTransferListHdrDestroy(PSHCLLISTHDR pListHdr);
1094void ShClTransferListHdrReset(PSHCLLISTHDR pListHdr);
1095bool ShClTransferListHdrIsValid(PSHCLLISTHDR pListHdr);
1096
1097int ShClTransferListOpenParmsCopy(PSHCLLISTOPENPARMS pDst, PSHCLLISTOPENPARMS pSrc);
1098PSHCLLISTOPENPARMS ShClTransferListOpenParmsDup(PSHCLLISTOPENPARMS pParms);
1099int ShClTransferListOpenParmsInit(PSHCLLISTOPENPARMS pParms);
1100void ShClTransferListOpenParmsDestroy(PSHCLLISTOPENPARMS pParms);
1101
1102int ShClTransferListEntryAlloc(PSHCLLISTENTRY *ppListEntry);
1103void ShClTransferListEntryFree(PSHCLLISTENTRY pListEntry);
1104int ShClTransferListEntryCopy(PSHCLLISTENTRY pDst, PSHCLLISTENTRY pSrc);
1105PSHCLLISTENTRY ShClTransferListEntryDup(PSHCLLISTENTRY pListEntry);
1106int ShClTransferListEntryInit(PSHCLLISTENTRY pListEntry);
1107void ShClTransferListEntryDestroy(PSHCLLISTENTRY pListEntry);
1108bool ShClTransferListEntryIsValid(PSHCLLISTENTRY pListEntry);
1109
1110int ShClTransferSetInterface(PSHCLTRANSFER pTransfer, PSHCLPROVIDERCREATIONCTX pCreationCtx);
1111int ShClTransferRootsSet(PSHCLTRANSFER pTransfer, const char *pszRoots, size_t cbRoots);
1112void ShClTransferReset(PSHCLTRANSFER pTransfer);
1113SharedClipboardArea *ShClTransferGetArea(PSHCLTRANSFER pTransfer);
1114
1115uint32_t ShClTransferRootsCount(PSHCLTRANSFER pTransfer);
1116int ShClTransferRootsEntry(PSHCLTRANSFER pTransfer, uint64_t uIndex, PSHCLROOTLISTENTRY pEntry);
1117int ShClTransferRootsGet(PSHCLTRANSFER pTransfer, PSHCLROOTLIST *ppRootList);
1118
1119SHCLTRANSFERID ShClTransferGetID(PSHCLTRANSFER pTransfer);
1120SHCLTRANSFERDIR ShClTransferGetDir(PSHCLTRANSFER pTransfer);
1121SHCLSOURCE ShClTransferGetSource(PSHCLTRANSFER pTransfer);
1122SHCLTRANSFERSTATUS ShClTransferGetStatus(PSHCLTRANSFER pTransfer);
1123int ShClTransferRun(PSHCLTRANSFER pTransfer, PFNRTTHREAD pfnThreadFunc, void *pvUser);
1124int ShClTransferStart(PSHCLTRANSFER pTransfer);
1125void ShClTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks);
1126
1127int ShClTransferCtxInit(PSHCLTRANSFERCTX pTransferCtx);
1128void ShClTransferCtxDestroy(PSHCLTRANSFERCTX pTransferCtx);
1129void ShClTransferCtxReset(PSHCLTRANSFERCTX pTransferCtx);
1130PSHCLTRANSFER ShClTransferCtxGetTransfer(PSHCLTRANSFERCTX pTransferCtx, uint32_t uIdx);
1131uint32_t ShClTransferCtxGetRunningTransfers(PSHCLTRANSFERCTX pTransferCtx);
1132uint32_t ShClTransferCtxGetTotalTransfers(PSHCLTRANSFERCTX pTransferCtx);
1133void ShClTransferCtxCleanup(PSHCLTRANSFERCTX pTransferCtx);
1134bool ShClTransferCtxTransfersMaximumReached(PSHCLTRANSFERCTX pTransferCtx);
1135int ShClTransferCtxTransferRegister(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t *pidTransfer);
1136int ShClTransferCtxTransferRegisterByIndex(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t idTransfer);
1137int ShClTransferCtxTransferUnregister(PSHCLTRANSFERCTX pTransferCtx, uint32_t idTransfer);
1138
1139void ShClFsObjFromIPRT(PSHCLFSOBJINFO pDst, PCRTFSOBJINFO pSrc);
1140
1141bool ShClMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax);
1142bool ShClMIMENeedsCache(const char *pcszFormat, size_t cchFormatMax);
1143
1144const char *ShClTransferStatusToStr(SHCLTRANSFERSTATUS enmStatus);
1145
1146#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_transfers_h */
1147
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