VirtualBox

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

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

SharedClipboard-transfers.h: The SHCLPROVIDERFUNCDECL lazyness should be replaced by DECLCALLBACKMEMBER and doxygen comments. bugref:9437

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 41.7 KB
Line 
1/* $Id: SharedClipboard-transfers.h 81331 2019-10-17 20:23:14Z 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 * Enumeration specifying an Shared Clipboard transfer direction.
652 */
653typedef enum _SHCLTRANSFERDIR
654{
655 /** Unknown transfer directory. */
656 SHCLTRANSFERDIR_UNKNOWN = 0,
657 /** Read transfer (from source). */
658 SHCLTRANSFERDIR_READ,
659 /** Write transfer (to target). */
660 SHCLTRANSFERDIR_WRITE,
661 /** The usual 32-bit hack. */
662 SHCLTRANSFERDIR_32BIT_HACK = 0x7fffffff
663} SHCLTRANSFERDIR, *PSHCLTRANSFERDIR;
664
665struct _SHCLTRANSFER;
666typedef struct _SHCLTRANSFER SHCLTRANSFER;
667
668/**
669 * Structure for handling a single transfer object context.
670 */
671typedef struct _SHCLCLIENTTRANSFEROBJCTX
672{
673 SHCLTRANSFER *pTransfer;
674 SHCLOBJHANDLE uHandle;
675} SHCLCLIENTTRANSFEROBJCTX, *PSHCLCLIENTTRANSFEROBJCTX;
676
677typedef struct _SHCLTRANSFEROBJSTATE
678{
679 /** How many bytes were processed (read / write) so far. */
680 uint64_t cbProcessed;
681} SHCLTRANSFEROBJSTATE, *PSHCLTRANSFEROBJSTATE;
682
683typedef struct _SHCLTRANSFEROBJ
684{
685 SHCLOBJHANDLE uHandle;
686 char *pszPathAbs;
687 SHCLFSOBJINFO objInfo;
688 SHCLSOURCE enmSource;
689 SHCLTRANSFEROBJSTATE State;
690} SHCLTRANSFEROBJ, *PSHCLTRANSFEROBJ;
691
692/** Defines a transfer ID. */
693typedef uint16_t SHCLTRANSFERID;
694
695/**
696 * Enumeration for specifying a Shared Clipboard object type.
697 */
698typedef enum _SHCLOBJTYPE
699{
700 /** Invalid object type. */
701 SHCLOBJTYPE_INVALID = 0,
702 /** Object is a directory. */
703 SHCLOBJTYPE_DIRECTORY,
704 /** Object is a file. */
705 SHCLOBJTYPE_FILE,
706 /** Object is a symbolic link. */
707 SHCLOBJTYPE_SYMLINK,
708 /** The usual 32-bit hack. */
709 SHCLOBJTYPE_32BIT_SIZE_HACK = 0x7fffffff
710} SHCLOBJTYPE;
711
712/**
713 * Structure for keeping transfer list handle information.
714 * This is using to map own (local) handles to the underlying file system.
715 */
716typedef struct _SHCLLISTHANDLEINFO
717{
718 /** The list node. */
719 RTLISTNODE Node;
720 /** The list's handle. */
721 SHCLLISTHANDLE hList;
722 /** Type of list handle. */
723 SHCLOBJTYPE enmType;
724 /** Absolute local path of the list object. */
725 char *pszPathLocalAbs;
726 union
727 {
728 /** Local data, based on enmType. */
729 struct
730 {
731 union
732 {
733 RTDIR hDir;
734 RTFILE hFile;
735 };
736 } Local;
737 } u;
738} SHCLLISTHANDLEINFO, *PSHCLLISTHANDLEINFO;
739
740/**
741 * Structure for keeping transfer object handle information.
742 * This is using to map own (local) handles to the underlying file system.
743 */
744typedef struct _SHCLOBJHANDLEINFO
745{
746 /** The list node. */
747 RTLISTNODE Node;
748 /** The object's handle. */
749 SHCLOBJHANDLE hObj;
750 /** Type of object handle. */
751 SHCLOBJTYPE enmType;
752 /** Absolute local path of the object. */
753 char *pszPathLocalAbs;
754 union
755 {
756 /** Local data, based on enmType. */
757 struct
758 {
759 union
760 {
761 RTDIR hDir;
762 RTFILE hFile;
763 };
764 } Local;
765 } u;
766} SHCLOBJHANDLEINFO, *PSHCLOBJHANDLEINFO;
767
768/**
769 * Structure for keeping a single root list entry.
770 */
771typedef struct _SHCLLISTROOT
772{
773 /** The list node. */
774 RTLISTNODE Node;
775 /** Absolute path of entry. */
776 char *pszPathAbs;
777} SHCLLISTROOT, *PSHCLLISTROOT;
778
779/**
780 * Structure for maintaining an Shared Clipboard transfer state.
781 * Everything in here will be part of a saved state (later).
782 */
783typedef struct _SHCLTRANSFERSTATE
784{
785 /** The transfer's (local) ID. */
786 SHCLTRANSFERID uID;
787 /** The transfer's current status. */
788 SHCLTRANSFERSTATUS enmStatus;
789 /** The transfer's direction, seen from the perspective who created the transfer. */
790 SHCLTRANSFERDIR enmDir;
791 /** The transfer's source, seen from the perspective who created the transfer. */
792 SHCLSOURCE enmSource;
793} SHCLTRANSFERSTATE, *PSHCLTRANSFERSTATE;
794
795struct _SHCLTRANSFER;
796typedef struct _SHCLTRANSFER *PSHCLTRANSFER;
797
798/**
799 * Structure maintaining clipboard transfer provider context data.
800 * This is handed in to the provider implementation callbacks.
801 */
802 typedef struct _SHCLPROVIDERCTX
803{
804 /** Pointer to the related Shared Clipboard transfer. */
805 PSHCLTRANSFER pTransfer;
806 /** User-defined data pointer. Can be NULL if not needed. */
807 void *pvUser;
808} SHCLPROVIDERCTX, *PSHCLPROVIDERCTX;
809
810/** @todo r=bird: These macros must go as they do no lend themselves to writing
811 * sane documentation. Use the DECLCALLBACK macro instead, as you
812 * probably do not need the function and function pointer typedefs.
813 *
814 * However, we need the documentation as you don't document a flying
815 * flamingo elsewhere regarding these functions.
816 */
817/** Defines an clipboard transfer provider function declaration with additional parameters. */
818#define SHCLPROVIDERFUNCDECL(a_Name, ...) \
819 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
820 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
821
822/** Defines an clipboard transfer provider function declaration with additional parameters. */
823#define SHCLPROVIDERFUNCDECLRET(a_Ret, a_Name, ...) \
824 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX, __VA_ARGS__); \
825 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
826
827/** Defines an clipboard transfer provider function declaration (no additional parameters). */
828#define SHCLPROVIDERFUNCDECLVOID(a_Name) \
829 typedef DECLCALLBACK(int) RT_CONCAT(FNSHCLPROVIDER, a_Name)(PSHCLPROVIDERCTX); \
830 typedef RT_CONCAT(FNSHCLPROVIDER, a_Name) RT_CONCAT(*PFNSHCLPROVIDER, a_Name);
831
832/** Declares a clipboard transfer provider function member. */
833#define SHCLPROVIDERFUNCMEMBER(a_Name, a_Member) \
834 RT_CONCAT(PFNSHCLPROVIDER, a_Name) a_Member;
835
836SHCLPROVIDERFUNCDECLVOID(TRANSFEROPEN)
837SHCLPROVIDERFUNCDECLVOID(TRANSFERCLOSE)
838SHCLPROVIDERFUNCDECL(GETROOTS, PSHCLROOTLIST *ppRootList)
839SHCLPROVIDERFUNCDECL(LISTOPEN, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList)
840SHCLPROVIDERFUNCDECL(LISTCLOSE, SHCLLISTHANDLE hList)
841SHCLPROVIDERFUNCDECL(LISTHDRREAD, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
842SHCLPROVIDERFUNCDECL(LISTHDRWRITE, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr)
843SHCLPROVIDERFUNCDECL(LISTENTRYREAD, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
844SHCLPROVIDERFUNCDECL(LISTENTRYWRITE, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry)
845SHCLPROVIDERFUNCDECL(OBJOPEN, PSHCLOBJOPENCREATEPARMS pCreateParms, PSHCLOBJHANDLE phObj)
846SHCLPROVIDERFUNCDECL(OBJCLOSE, SHCLOBJHANDLE hObj)
847SHCLPROVIDERFUNCDECL(OBJREAD, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead)
848SHCLPROVIDERFUNCDECL(OBJWRITE, SHCLOBJHANDLE hObj, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten)
849
850/**
851 * Shared Clipboard transfer provider interface table.
852 */
853typedef struct _SHCLPROVIDERINTERFACE
854{
855 SHCLPROVIDERFUNCMEMBER(TRANSFEROPEN, pfnTransferOpen)
856 SHCLPROVIDERFUNCMEMBER(TRANSFERCLOSE, pfnTransferClose)
857 SHCLPROVIDERFUNCMEMBER(GETROOTS, pfnRootsGet)
858 SHCLPROVIDERFUNCMEMBER(LISTOPEN, pfnListOpen)
859 SHCLPROVIDERFUNCMEMBER(LISTCLOSE, pfnListClose)
860 SHCLPROVIDERFUNCMEMBER(LISTHDRREAD, pfnListHdrRead)
861 SHCLPROVIDERFUNCMEMBER(LISTHDRWRITE, pfnListHdrWrite)
862 SHCLPROVIDERFUNCMEMBER(LISTENTRYREAD, pfnListEntryRead)
863 SHCLPROVIDERFUNCMEMBER(LISTENTRYWRITE, pfnListEntryWrite)
864 SHCLPROVIDERFUNCMEMBER(OBJOPEN, pfnObjOpen)
865 SHCLPROVIDERFUNCMEMBER(OBJCLOSE, pfnObjClose)
866 SHCLPROVIDERFUNCMEMBER(OBJREAD, pfnObjRead)
867 SHCLPROVIDERFUNCMEMBER(OBJWRITE, pfnObjWrite)
868} SHCLPROVIDERINTERFACE, *PSHCLPROVIDERINTERFACE;
869
870/**
871 * Structure for the Shared Clipboard provider creation context.
872 */
873typedef struct _SHCLPROVIDERCREATIONCTX
874{
875 /** Specifies what the source of the provider is. */
876 SHCLSOURCE enmSource;
877 /** The provider interface table. */
878 SHCLPROVIDERINTERFACE Interface;
879 /** Provider callback data. */
880 void *pvUser;
881} SHCLPROVIDERCREATIONCTX, *PSHCLPROVIDERCREATIONCTX;
882
883struct _SHCLTRANSFER;
884typedef _SHCLTRANSFER *PSHCLTRANSFER;
885
886/**
887 * Structure for storing Shared Clipboard transfer callback data.
888 */
889typedef struct _SHCLTRANSFERCALLBACKDATA
890{
891 /** Pointer to related Shared Clipboard transfer. */
892 PSHCLTRANSFER pTransfer;
893 /** Saved user pointer. */
894 void *pvUser;
895 /** Size (in bytes) of data at user pointer. */
896 size_t cbUser;
897} SHCLTRANSFERCALLBACKDATA, *PSHCLTRANSFERCALLBACKDATA;
898
899/** Declares a Shared Clipboard transfer callback. */
900#define SHCLTRANSFERCALLBACKDECL(a_Ret, a_Name) \
901 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData); \
902 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
903
904/** Declares a Shared Clipboard transfer callback with variable arguments. */
905#define SHCLTRANSFERCALLBACKDECL_VA(a_Ret, a_Name, ...) \
906 typedef DECLCALLBACK(a_Ret) RT_CONCAT(FNSHCLCALLBACK, a_Name)(PSHCLTRANSFERCALLBACKDATA pData, __VA_ARGS__); \
907 typedef RT_CONCAT(FNSHCLCALLBACK, a_Name) RT_CONCAT(*PFNSHCLCALLBACK, a_Name);
908
909/** Declares a Shared Clipboard transfer callback member function. */
910#define SHCLTRANSFERCALLBACKMEMBER(a_Name, a_Member) \
911 RT_CONCAT(PFNSHCLCALLBACK, a_Name) a_Member;
912
913SHCLTRANSFERCALLBACKDECL (int, TRANSFERINITIALIZE)
914SHCLTRANSFERCALLBACKDECL (int, TRANSFERSTART)
915SHCLTRANSFERCALLBACKDECL (void, LISTHEADERCOMPLETE)
916SHCLTRANSFERCALLBACKDECL (void, LISTENTRYCOMPLETE)
917SHCLTRANSFERCALLBACKDECL_VA(void, TRANSFERCOMPLETE, int rc)
918SHCLTRANSFERCALLBACKDECL (void, TRANSFERCANCELED)
919SHCLTRANSFERCALLBACKDECL_VA(void, TRANSFERERROR, int rc)
920
921/**
922 * Structure acting as a function callback table for Shared Clipboard transfers.
923 * All callbacks are optional and therefore can be NULL.
924 */
925typedef struct _SHCLTRANSFERCALLBACKS
926{
927 /** User pointer to data. Optional and can be NULL. */
928 void *pvUser;
929 /** Size (in bytes) of user data pointing at. Optional and can be 0. */
930 size_t cbUser;
931 /** Function pointer, called after the transfer has been initialized. */
932 SHCLTRANSFERCALLBACKMEMBER(TRANSFERINITIALIZE, pfnTransferInitialize)
933 /** Function pointer, called before the transfer will be started. */
934 SHCLTRANSFERCALLBACKMEMBER(TRANSFERSTART, pfnTransferStart)
935 /** Function pointer, called when reading / writing the list header is complete. */
936 SHCLTRANSFERCALLBACKMEMBER(LISTHEADERCOMPLETE, pfnListHeaderComplete)
937 /** Function pointer, called when reading / writing a list entry is complete. */
938 SHCLTRANSFERCALLBACKMEMBER(LISTENTRYCOMPLETE, pfnListEntryComplete)
939 /** Function pointer, called when the transfer is complete. */
940 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCOMPLETE, pfnTransferComplete)
941 /** Function pointer, called when the transfer has been canceled. */
942 SHCLTRANSFERCALLBACKMEMBER(TRANSFERCANCELED, pfnTransferCanceled)
943 /** Function pointer, called when transfer resulted in an unrecoverable error. */
944 SHCLTRANSFERCALLBACKMEMBER(TRANSFERERROR, pfnTransferError)
945} SHCLTRANSFERCALLBACKS, *PSHCLTRANSFERCALLBACKS;
946
947/**
948 * Structure for thread-related members for a single Shared Clipboard transfer.
949 */
950typedef struct _SHCLTRANSFERTHREAD
951{
952 /** Thread handle for the reading / writing thread.
953 * Can be NIL_RTTHREAD if not being used. */
954 RTTHREAD hThread;
955 /** Thread started indicator. */
956 volatile bool fStarted;
957 /** Thread stop flag. */
958 volatile bool fStop;
959 /** Thread cancelled flag / indicator. */
960 volatile bool fCancelled;
961} SHCLTRANSFERTHREAD, *PSHCLTRANSFERTHREAD;
962
963/**
964 * Structure for maintaining a single Shared Clipboard transfer.
965 *
966 ** @todo Not yet thread safe.
967 */
968typedef struct _SHCLTRANSFER
969{
970 /** The node member for using this struct in a RTList. */
971 RTLISTNODE Node;
972 /** Critical section for serializing access. */
973 RTCRITSECT CritSect;
974 /** The transfer's state (for SSM, later). */
975 SHCLTRANSFERSTATE State;
976 /** Timeout (in ms) for waiting of events. Default is 30s. */
977 RTMSINTERVAL uTimeoutMs;
978 /** Absolute path to root entries. */
979 char *pszPathRootAbs;
980 /** Maximum data chunk size (in bytes) to transfer. Default is 64K. */
981 uint32_t cbMaxChunkSize;
982 /** The transfer's own event source. */
983 SHCLEVENTSOURCE Events;
984 /** Current number of concurrent list handles. */
985 uint32_t cListHandles;
986 /** Maximum number of concurrent list handles. */
987 uint32_t cMaxListHandles;
988 /** Next upcoming list handle. */
989 SHCLLISTHANDLE uListHandleNext;
990 /** List of all list handles elated to this transfer. */
991 RTLISTANCHOR lstList;
992 /** Number of root entries in list. */
993 uint64_t cRoots;
994 /** List of root entries of this transfer. */
995 RTLISTANCHOR lstRoots;
996 /** Current number of concurrent object handles. */
997 uint32_t cObjHandles;
998 /** Maximum number of concurrent object handles. */
999 uint32_t cMaxObjHandles;
1000 /** Next upcoming object handle. */
1001 SHCLOBJHANDLE uObjHandleNext;
1002 /** Map of all objects handles related to this transfer. */
1003 RTLISTANCHOR lstObj;
1004 /** The transfer's own (local) area, if any (can be NULL if not needed).
1005 * The area itself has a clipboard area ID assigned.
1006 * On the host this area ID gets shared (maintained / locked) across all VMs via VBoxSVC. */
1007 SharedClipboardArea *pArea;
1008 /** The transfer's own provider context. */
1009 SHCLPROVIDERCTX ProviderCtx;
1010 /** The transfer's provider interface. */
1011 SHCLPROVIDERINTERFACE ProviderIface;
1012 /** The transfer's (optional) callback table. */
1013 SHCLTRANSFERCALLBACKS Callbacks;
1014 /** Opaque pointer to implementation-specific parameters. */
1015 void *pvUser;
1016 /** Size (in bytes) of implementation-specific parameters. */
1017 size_t cbUser;
1018 /** Contains thread-related attributes. */
1019 SHCLTRANSFERTHREAD Thread;
1020} SHCLTRANSFER, *PSHCLTRANSFER;
1021
1022/**
1023 * Structure for keeping an Shared Clipboard transfer status report.
1024 */
1025typedef struct _SHCLTRANSFERREPORT
1026{
1027 /** Actual status to report. */
1028 SHCLTRANSFERSTATUS uStatus;
1029 /** Result code (rc) to report; might be unused / invalid, based on enmStatus. */
1030 int rc;
1031 /** Reporting flags. Currently unused and must be 0. */
1032 uint32_t fFlags;
1033} SHCLTRANSFERREPORT, *PSHCLTRANSFERREPORT;
1034
1035/**
1036 * Structure for keeping Shared Clipboard transfer context around.
1037 */
1038typedef struct _SHCLTRANSFERCTX
1039{
1040 /** Critical section for serializing access. */
1041 RTCRITSECT CritSect;
1042 /** List of transfers. */
1043 RTLISTANCHOR List;
1044 /** Transfer ID allocation bitmap; clear bits are free, set bits are busy. */
1045 uint64_t bmTransferIds[VBOX_SHCL_MAX_TRANSFERS / sizeof(uint64_t) / 8];
1046 /** Number of running (concurrent) transfers. */
1047 uint16_t cRunning;
1048 /** Maximum Number of running (concurrent) transfers. */
1049 uint16_t cMaxRunning;
1050 /** Number of total transfers (in list). */
1051 uint16_t cTransfers;
1052} SHCLTRANSFERCTX, *PSHCLTRANSFERCTX;
1053
1054int ShClTransferObjCtxInit(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1055void ShClTransferObjCtxDestroy(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1056bool ShClTransferObjCtxIsValid(PSHCLCLIENTTRANSFEROBJCTX pObjCtx);
1057
1058int ShClTransferObjHandleInfoInit(PSHCLOBJHANDLEINFO pInfo);
1059void ShClTransferObjHandleInfoDestroy(PSHCLOBJHANDLEINFO pInfo);
1060
1061int ShClTransferObjOpenParmsInit(PSHCLOBJOPENCREATEPARMS pParms);
1062int ShClTransferObjOpenParmsCopy(PSHCLOBJOPENCREATEPARMS pParmsDst, PSHCLOBJOPENCREATEPARMS pParmsSrc);
1063void ShClTransferObjOpenParmsDestroy(PSHCLOBJOPENCREATEPARMS pParms);
1064
1065int ShClTransferObjOpen(PSHCLTRANSFER pTransfer, PSHCLOBJOPENCREATEPARMS pOpenCreateParms, PSHCLOBJHANDLE phObj);
1066int ShClTransferObjClose(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj);
1067int ShClTransferObjRead(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead, uint32_t fFlags);
1068int ShClTransferObjWrite(PSHCLTRANSFER pTransfer, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten, uint32_t fFlags);
1069
1070PSHCLOBJDATACHUNK ShClTransferObjDataChunkDup(PSHCLOBJDATACHUNK pDataChunk);
1071void ShClTransferObjDataChunkDestroy(PSHCLOBJDATACHUNK pDataChunk);
1072void ShClTransferObjDataChunkFree(PSHCLOBJDATACHUNK pDataChunk);
1073
1074int ShClTransferCreate(PSHCLTRANSFER *ppTransfer);
1075int ShClTransferDestroy(PSHCLTRANSFER pTransfer);
1076
1077int ShClTransferInit(PSHCLTRANSFER pTransfer, uint32_t uID, SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource);
1078int ShClTransferOpen(PSHCLTRANSFER pTransfer);
1079int ShClTransferClose(PSHCLTRANSFER pTransfer);
1080
1081int ShClTransferListOpen(PSHCLTRANSFER pTransfer, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList);
1082int ShClTransferListClose(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1083int ShClTransferListGetHeader(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTHDR pHdr);
1084PSHCLTRANSFEROBJ ShClTransferListGetObj(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, uint64_t uIdx);
1085int ShClTransferListRead(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry);
1086int ShClTransferListWrite(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList, PSHCLLISTENTRY pEntry);
1087bool ShClTransferListHandleIsValid(PSHCLTRANSFER pTransfer, SHCLLISTHANDLE hList);
1088
1089int ShClPathSanitizeFilename(char *pszPath, size_t cbPath);
1090int ShClPathSanitize(char *pszPath, size_t cbPath);
1091
1092PSHCLROOTLIST ShClTransferRootListAlloc(void);
1093void ShClTransferRootListFree(PSHCLROOTLIST pRootList);
1094
1095PSHCLROOTLISTHDR ShClTransferRootListHdrDup(PSHCLROOTLISTHDR pRoots);
1096int ShClTransferRootListHdrInit(PSHCLROOTLISTHDR pRoots);
1097void ShClTransferRootListHdrDestroy(PSHCLROOTLISTHDR pRoots);
1098
1099int ShClTransferRootListEntryCopy(PSHCLROOTLISTENTRY pDst, PSHCLROOTLISTENTRY pSrc);
1100int ShClTransferRootListEntryInit(PSHCLROOTLISTENTRY pRootListEntry);
1101void ShClTransferRootListEntryDestroy(PSHCLROOTLISTENTRY pRootListEntry);
1102PSHCLROOTLISTENTRY ShClTransferRootListEntryDup(PSHCLROOTLISTENTRY pRootListEntry);
1103
1104int ShClTransferListHandleInfoInit(PSHCLLISTHANDLEINFO pInfo);
1105void ShClTransferListHandleInfoDestroy(PSHCLLISTHANDLEINFO pInfo);
1106
1107int ShClTransferListHdrAlloc(PSHCLLISTHDR *ppListHdr);
1108void ShClTransferListHdrFree(PSHCLLISTHDR pListHdr);
1109PSHCLLISTHDR ShClTransferListHdrDup(PSHCLLISTHDR pListHdr);
1110int ShClTransferListHdrInit(PSHCLLISTHDR pListHdr);
1111void ShClTransferListHdrDestroy(PSHCLLISTHDR pListHdr);
1112void ShClTransferListHdrReset(PSHCLLISTHDR pListHdr);
1113bool ShClTransferListHdrIsValid(PSHCLLISTHDR pListHdr);
1114
1115int ShClTransferListOpenParmsCopy(PSHCLLISTOPENPARMS pDst, PSHCLLISTOPENPARMS pSrc);
1116PSHCLLISTOPENPARMS ShClTransferListOpenParmsDup(PSHCLLISTOPENPARMS pParms);
1117int ShClTransferListOpenParmsInit(PSHCLLISTOPENPARMS pParms);
1118void ShClTransferListOpenParmsDestroy(PSHCLLISTOPENPARMS pParms);
1119
1120int ShClTransferListEntryAlloc(PSHCLLISTENTRY *ppListEntry);
1121void ShClTransferListEntryFree(PSHCLLISTENTRY pListEntry);
1122int ShClTransferListEntryCopy(PSHCLLISTENTRY pDst, PSHCLLISTENTRY pSrc);
1123PSHCLLISTENTRY ShClTransferListEntryDup(PSHCLLISTENTRY pListEntry);
1124int ShClTransferListEntryInit(PSHCLLISTENTRY pListEntry);
1125void ShClTransferListEntryDestroy(PSHCLLISTENTRY pListEntry);
1126bool ShClTransferListEntryIsValid(PSHCLLISTENTRY pListEntry);
1127
1128int ShClTransferSetInterface(PSHCLTRANSFER pTransfer, PSHCLPROVIDERCREATIONCTX pCreationCtx);
1129int ShClTransferRootsSet(PSHCLTRANSFER pTransfer, const char *pszRoots, size_t cbRoots);
1130void ShClTransferReset(PSHCLTRANSFER pTransfer);
1131SharedClipboardArea *ShClTransferGetArea(PSHCLTRANSFER pTransfer);
1132
1133uint32_t ShClTransferRootsCount(PSHCLTRANSFER pTransfer);
1134int ShClTransferRootsEntry(PSHCLTRANSFER pTransfer, uint64_t uIndex, PSHCLROOTLISTENTRY pEntry);
1135int ShClTransferRootsGet(PSHCLTRANSFER pTransfer, PSHCLROOTLIST *ppRootList);
1136
1137SHCLTRANSFERID ShClTransferGetID(PSHCLTRANSFER pTransfer);
1138SHCLTRANSFERDIR ShClTransferGetDir(PSHCLTRANSFER pTransfer);
1139SHCLSOURCE ShClTransferGetSource(PSHCLTRANSFER pTransfer);
1140SHCLTRANSFERSTATUS ShClTransferGetStatus(PSHCLTRANSFER pTransfer);
1141int ShClTransferRun(PSHCLTRANSFER pTransfer, PFNRTTHREAD pfnThreadFunc, void *pvUser);
1142int ShClTransferStart(PSHCLTRANSFER pTransfer);
1143void ShClTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks);
1144
1145int ShClTransferCtxInit(PSHCLTRANSFERCTX pTransferCtx);
1146void ShClTransferCtxDestroy(PSHCLTRANSFERCTX pTransferCtx);
1147void ShClTransferCtxReset(PSHCLTRANSFERCTX pTransferCtx);
1148PSHCLTRANSFER ShClTransferCtxGetTransfer(PSHCLTRANSFERCTX pTransferCtx, uint32_t uIdx);
1149uint32_t ShClTransferCtxGetRunningTransfers(PSHCLTRANSFERCTX pTransferCtx);
1150uint32_t ShClTransferCtxGetTotalTransfers(PSHCLTRANSFERCTX pTransferCtx);
1151void ShClTransferCtxCleanup(PSHCLTRANSFERCTX pTransferCtx);
1152bool ShClTransferCtxTransfersMaximumReached(PSHCLTRANSFERCTX pTransferCtx);
1153int ShClTransferCtxTransferRegister(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t *pidTransfer);
1154int ShClTransferCtxTransferRegisterByIndex(PSHCLTRANSFERCTX pTransferCtx, PSHCLTRANSFER pTransfer, uint32_t idTransfer);
1155int ShClTransferCtxTransferUnregister(PSHCLTRANSFERCTX pTransferCtx, uint32_t idTransfer);
1156
1157void ShClFsObjFromIPRT(PSHCLFSOBJINFO pDst, PCRTFSOBJINFO pSrc);
1158
1159bool ShClMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax);
1160bool ShClMIMENeedsCache(const char *pcszFormat, size_t cchFormatMax);
1161
1162const char *ShClTransferStatusToStr(SHCLTRANSFERSTATUS enmStatus);
1163
1164#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_transfers_h */
1165
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