Changeset 79347 in vbox for trunk/include
- Timestamp:
- Jun 26, 2019 9:15:29 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 9 9 /branches/VBox-5.1:112367,115992,116543,116550,116568,116573 10 10 /branches/VBox-5.2:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124260,124263,124271,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812 11 /branches/VBox-6.0:130474-130475,130477,130479 11 /branches/VBox-6.0:130474-130475,130477,130479,131352 12 12 /branches/aeichner/vbox-chromium-cleanup:129816,129818-129851,129853-129861,129871-129872,129876,129880,129882,130013-130015,130036,130094-130095 13 13 /branches/andy/draganddrop:90781-91268
-
- Property svn:mergeinfo
-
trunk/include/VBox/GuestHost/SharedClipboard-uri.h
r79299 r79347 61 61 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_VALID_MASK 0x1 62 62 63 /**64 * Class for maintaining a Shared Clipboard area65 * on the host or guest. This will contain all received files & directories66 * for a single Shared Clipboard operation.67 *68 * In case of a failed Shared Clipboard operation this class can also69 * perform a gentle rollback if required.70 */71 class SharedClipboardArea72 {73 public:74 75 SharedClipboardArea(void);76 SharedClipboardArea(const char *pszPath, SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID,77 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE);78 virtual ~SharedClipboardArea(void);79 80 public:81 82 uint32_t AddRef(void);83 uint32_t Release(void);84 85 int Lock(void);86 int Unlock(void);87 88 int AddFile(const char *pszFile);89 int AddDir(const char *pszDir);90 int Close(void);91 bool IsOpen(void) const;92 int OpenEx(const char *pszPath, SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID,93 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE);94 int OpenTemp(SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID,95 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE);96 SHAREDCLIPBOARDAREAID GetID(void) const;97 const char *GetDirAbs(void) const;98 uint32_t GetRefCount(void);99 int Reopen(void);100 int Reset(bool fDeleteContent);101 int Rollback(void);102 103 public:104 105 static int PathConstruct(const char *pszBase, SHAREDCLIPBOARDAREAID uID, char *pszPath, size_t cbPath);106 107 protected:108 109 int initInternal(void);110 int destroyInternal(void);111 int closeInternal(void);112 113 protected:114 115 /** Creation timestamp (in ms). */116 uint64_t m_tsCreatedMs;117 /** Number of references to this instance. */118 volatile uint32_t m_cRefs;119 /** Critical section for serializing access. */120 RTCRITSECT m_CritSect;121 /** Open flags. */122 uint32_t m_fOpen;123 /** Directory handle for drop directory. */124 RTDIR m_hDir;125 /** Absolute path to drop directory. */126 RTCString m_strPathAbs;127 /** List for holding created directories in the case of a rollback. */128 RTCList<RTCString> m_lstDirs;129 /** List for holding created files in the case of a rollback. */130 RTCList<RTCString> m_lstFiles;131 /** Associated clipboard area ID. */132 SHAREDCLIPBOARDAREAID m_uID;133 };134 135 int SharedClipboardPathSanitizeFilename(char *pszPath, size_t cbPath);136 int SharedClipboardPathSanitize(char *pszPath, size_t cbPath);137 138 63 /** SharedClipboardURIObject flags. */ 139 64 typedef uint32_t SHAREDCLIPBOARDURIOBJECTFLAGS; … … 166 91 /** The usual 32-bit hack. */ 167 92 Type_32Bit_Hack = 0x7fffffff 93 }; 94 95 enum Storage 96 { 97 Storage_Unknown = 0, 98 Storage_Local, 99 Storage_Temporary, 100 /** The usual 32-bit hack. */ 101 Storage_32Bit_Hack = 0x7fffffff 168 102 }; 169 103 … … 269 203 /** The object's view. */ 270 204 View m_enmView; 205 /** Where the object is being stored to. */ 206 Storage m_enmStorage; 271 207 /** Absolute path (base) for the source. */ 272 208 RTCString m_strSrcPathAbs; … … 309 245 }; 310 246 247 /** 248 * Enumeration for specifying a clipboard area object type. 249 */ 250 typedef enum _SHAREDCLIPBOARDAREAOBJTYPE 251 { 252 /** Unknown object type; do not use. */ 253 SHAREDCLIPBOARDAREAOBJTYPE_UNKNOWN = 0, 254 /** Object is a directory. */ 255 SHAREDCLIPBOARDAREAOBJTYPE_DIR, 256 /** Object is a file. */ 257 SHAREDCLIPBOARDAREAOBJTYPE_FILE, 258 /** The usual 32-bit hack. */ 259 SHAREDCLIPBOARDAREAOBJTYPE__32Bit_Hack = 0x7fffffff 260 } SHAREDCLIPBOARDAREAOBJTYPE; 261 262 /** Defines a clipboard area object state. */ 263 typedef uint32_t SHAREDCLIPBOARDAREAOBJSTATE; 264 265 /** No object state set. */ 266 #define SHAREDCLIPBOARDAREAOBJSTATE_NONE 0 267 /** The object is considered as being complete (e.g. serialized). */ 268 #define SHAREDCLIPBOARDAREAOBJSTATE_COMPLETE RT_BIT(0) 269 270 /** 271 * Lightweight structure to keep a clipboard area object's state. 272 * 273 * Note: We don't want to use the ClipboardURIObject class here, as this 274 * is too heavy for this purpose. 275 */ 276 typedef struct _SHAREDCLIPBOARDAREAOBJ 277 { 278 SHAREDCLIPBOARDAREAOBJTYPE enmType; 279 SHAREDCLIPBOARDAREAOBJSTATE fState; 280 } SHAREDCLIPBOARDAREAOBJ, *PSHAREDCLIPBOARDAREAOBJ; 281 282 /** 283 * Class for maintaining a Shared Clipboard area 284 * on the host or guest. This will contain all received files & directories 285 * for a single Shared Clipboard operation. 286 * 287 * In case of a failed Shared Clipboard operation this class can also 288 * perform a gentle rollback if required. 289 */ 290 class SharedClipboardArea 291 { 292 public: 293 294 SharedClipboardArea(void); 295 SharedClipboardArea(const char *pszPath, SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID, 296 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE); 297 virtual ~SharedClipboardArea(void); 298 299 public: 300 301 uint32_t AddRef(void); 302 uint32_t Release(void); 303 304 int Lock(void); 305 int Unlock(void); 306 307 int AddObject(const char *pszPath, const SHAREDCLIPBOARDAREAOBJ &Obj); 308 int GetObject(const char *pszPath, PSHAREDCLIPBOARDAREAOBJ pObj); 309 310 int Close(void); 311 bool IsOpen(void) const; 312 int OpenEx(const char *pszPath, SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID, 313 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE); 314 int OpenTemp(SHAREDCLIPBOARDAREAID uID = NIL_SHAREDCLIPBOARDAREAID, 315 SHAREDCLIPBOARDAREAOPENFLAGS fFlags = SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE); 316 SHAREDCLIPBOARDAREAID GetID(void) const; 317 const char *GetDirAbs(void) const; 318 uint32_t GetRefCount(void); 319 int Reopen(void); 320 int Reset(bool fDeleteContent); 321 int Rollback(void); 322 323 public: 324 325 static int PathConstruct(const char *pszBase, SHAREDCLIPBOARDAREAID uID, char *pszPath, size_t cbPath); 326 327 protected: 328 329 int initInternal(void); 330 int destroyInternal(void); 331 int closeInternal(void); 332 333 protected: 334 335 typedef std::map<RTCString, SHAREDCLIPBOARDAREAOBJ> SharedClipboardAreaFsObjMap; 336 337 /** Creation timestamp (in ms). */ 338 uint64_t m_tsCreatedMs; 339 /** Number of references to this instance. */ 340 volatile uint32_t m_cRefs; 341 /** Critical section for serializing access. */ 342 RTCRITSECT m_CritSect; 343 /** Open flags. */ 344 uint32_t m_fOpen; 345 /** Directory handle for root clipboard directory. */ 346 RTDIR m_hDir; 347 /** Absolute path to root clipboard directory. */ 348 RTCString m_strPathAbs; 349 /** List for holding created directories in the case of a rollback. */ 350 SharedClipboardAreaFsObjMap m_mapObj; 351 /** Associated clipboard area ID. */ 352 SHAREDCLIPBOARDAREAID m_uID; 353 }; 354 355 int SharedClipboardPathSanitizeFilename(char *pszPath, size_t cbPath); 356 int SharedClipboardPathSanitize(char *pszPath, size_t cbPath); 357 311 358 /** SharedClipboardURIList flags. */ 312 359 typedef uint32_t SHAREDCLIPBOARDURILISTFLAGS; … … 408 455 int SharedClipboardURIFileHdrInit(PVBOXCLIPBOARDFILEHDR pFileHdr); 409 456 void SharedClipboardURIFileHdrDestroy(PVBOXCLIPBOARDFILEHDR pFileHdr); 457 void SharedClipboardURIFileHdrFree(PVBOXCLIPBOARDFILEHDR pFileHdr); 410 458 PVBOXCLIPBOARDFILEHDR SharedClipboardURIFileHdrDup(PVBOXCLIPBOARDFILEHDR pFileHdr); 411 459 bool SharedClipboardURIFileHdrIsValid(PVBOXCLIPBOARDFILEHDR pFileHdr, PVBOXCLIPBOARDDATAHDR pDataHdr); … … 457 505 /** How many bytes are being used in the meta data block. */ 458 506 uint32_t cbUsed; 507 /** Current reading offset (in bytes). */ 508 uint32_t cbOffRead; 459 509 } SHAREDCLIPBOARDMETADATA, *PSHAREDCLIPBOARDMETADATA; 460 510 461 511 int SharedClipboardMetaDataInit(PSHAREDCLIPBOARDMETADATA pMeta, SHAREDCLIPBOARDMETADATAFMT enmFmt); 462 512 void SharedClipboardMetaDataDestroy(PSHAREDCLIPBOARDMETADATA pMeta); 513 void SharedClipboardMetaDataFree(PSHAREDCLIPBOARDMETADATA pMeta); 463 514 int SharedClipboardMetaDataAdd(PSHAREDCLIPBOARDMETADATA pMeta, const void *pvDataAdd, uint32_t cbDataAdd); 464 515 int SharedClipboardMetaDataConvertToFormat(const void *pvData, size_t cbData, SHAREDCLIPBOARDMETADATAFMT enmFmt, 465 516 void **ppvData, uint32_t *pcbData); 517 int SharedClipboardMetaDataRead(PSHAREDCLIPBOARDMETADATA pMeta, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead); 466 518 int SharedClipboardMetaDataResize(PSHAREDCLIPBOARDMETADATA pMeta, uint32_t cbNewSize); 467 519 size_t SharedClipboardMetaDataGetFree(PSHAREDCLIPBOARDMETADATA pMeta); … … 486 538 } SHAREDCLIPBOARDURITRANSFERDIR; 487 539 540 struct _SHAREDCLIPBOARDURITRANSFER; 541 typedef struct _SHAREDCLIPBOARDURITRANSFER SHAREDCLIPBOARDURITRANSFER; 542 543 /** 544 * Structure for handling a single URI object context. 545 */ 546 typedef struct _SHAREDCLIPBOARDCLIENTURIOBJCTX 547 { 548 SHAREDCLIPBOARDURITRANSFER *pTransfer; 549 /** Pointer to current object being processed. */ 550 SharedClipboardURIObject *pObj; 551 } SHAREDCLIPBOARDCLIENTURIOBJCTX, *PSHAREDCLIPBOARDCLIENTURIOBJCTX; 552 553 /** 554 * Enumeration specifying an URI transfer status. 555 */ 556 typedef enum SHAREDCLIPBOARDURITRANSFERSTATUS 557 { 558 /** No status set. */ 559 SHAREDCLIPBOARDURITRANSFERSTATUS_NONE = 0, 560 /** The transfer has been announced but is not running yet. */ 561 SHAREDCLIPBOARDURITRANSFERSTATUS_ANNOUNCED, 562 /** The transfer is active and running. */ 563 SHAREDCLIPBOARDURITRANSFERSTATUS_RUNNING 564 }; 565 566 /** 567 * Enumeration to specify the Shared Clipboard URI source type. 568 */ 569 typedef enum SHAREDCLIPBOARDSOURCE 570 { 571 /** Invalid source type. */ 572 SHAREDCLIPBOARDSOURCE_INVALID = 0, 573 /** Source is local. */ 574 SHAREDCLIPBOARDSOURCE_LOCAL, 575 /** Source is remote. */ 576 SHAREDCLIPBOARDSOURCE_REMOTE, 577 /** The usual 32-bit hack. */ 578 SHAREDCLIPBOARDSOURCE_32Bit_Hack = 0x7fffffff 579 } SHAREDCLIPBOARDSOURCE; 580 488 581 /** 489 582 * Structure for maintaining an URI transfer state. … … 492 585 typedef struct _SHAREDCLIPBOARDURITRANSFERSTATE 493 586 { 587 /** The transfer's current status. */ 588 SHAREDCLIPBOARDURITRANSFERSTATUS enmStatus; 494 589 /** The transfer's direction. */ 495 SHAREDCLIPBOARDURITRANSFERDIR enmDir; 590 SHAREDCLIPBOARDURITRANSFERDIR enmDir; 591 /** The transfer's source. */ 592 SHAREDCLIPBOARDSOURCE enmSource; 593 bool fHostMsgSendHeader; 496 594 /** The transfer's cached data header. 497 595 * Can be NULL if no header has been received yet. */ 498 PVBOXCLIPBOARDDATAHDR pHeader; 596 PVBOXCLIPBOARDDATAHDR pHeader; 597 bool fHostMsgSendMetaDataHdr; 598 bool fHostMsgSendMetaDataChunk; 499 599 /** The transfer's cached meta data. 500 600 * Can be NULL if no meta data has been received yet. */ 501 PSHAREDCLIPBOARDMETADATA pMeta; 601 PSHAREDCLIPBOARDMETADATA pMeta; 602 /** Context of current object being handled. */ 603 SHAREDCLIPBOARDCLIENTURIOBJCTX ObjCtx; 502 604 } SHAREDCLIPBOARDURITRANSFERSTATE, *PSHAREDCLIPBOARDURITRANSFERSTATE; 503 605 504 /** 505 * Enumeration to specify the Shared Clipboard URI provider source type. 506 */ 507 typedef enum SHAREDCLIPBOARDURIPROVIDERSOURCE 508 { 509 /** Invalid source type. */ 510 SHAREDCLIPBOARDURIPROVIDERSOURCE_INVALID = 0, 511 /** Source is VbglR3. */ 512 SHAREDCLIPBOARDURIPROVIDERSOURCE_VBGLR3, 513 /** Source is the host service. */ 514 SHAREDCLIPBOARDURIPROVIDERSOURCE_HOSTSERVICE 515 } SHAREDCLIPBOARDURIPROVIDERSOURCE; 516 517 class SharedClipboardProvider; 518 519 /** 520 * Structure for storing clipboard provider callback data. 521 */ 522 typedef struct _SHAREDCLIPBOARDPROVIDERCALLBACKDATA 523 { 524 /** Pointer to related clipboard provider ("this"). */ 525 SharedClipboardProvider *pProvider; 526 /** Saved user pointer. */ 606 struct _SHAREDCLIPBOARDURITRANSFER; 607 typedef struct _SHAREDCLIPBOARDURITRANSFER *PSHAREDCLIPBOARDURITRANSFER; 608 609 typedef struct _SHAREDCLIPBOARDPROVIDERCTX 610 { 611 PSHAREDCLIPBOARDURITRANSFER pTransfer; 527 612 void *pvUser; 528 } SHAREDCLIPBOARDPROVIDERCALLBACKDATA, *PSHAREDCLIPBOARDPROVIDERCALLBACKDATA; 529 530 /** Callback functopn for the Shared Clipboard provider. */ 531 typedef DECLCALLBACK(int) FNSSHAREDCLIPBOARDPROVIDERCALLBACK(PSHAREDCLIPBOARDPROVIDERCALLBACKDATA pData); 532 /** Pointer to a FNSSHAREDCLIPBOARDPROVIDERCALLBACK function. */ 533 typedef FNSSHAREDCLIPBOARDPROVIDERCALLBACK *PFNSSHAREDCLIPBOARDPROVIDERCALLBACK; 534 535 /** 536 * Structure acting as a function callback table for clipboard providers. 537 * All callbacks are optional and therefore can be NULL. 538 */ 539 typedef struct _SHAREDCLIPBOARDPROVIDERCALLBACKS 540 { 541 /** Saved user pointer. Will be passed to the callback (if needed). */ 542 void *pvUser; 543 /** Function pointer, called when reading the (meta) data header. */ 544 PFNSSHAREDCLIPBOARDPROVIDERCALLBACK pfnReadDataHdr; 545 /** Function pointer, called when reading a (meta) data chunk. */ 546 PFNSSHAREDCLIPBOARDPROVIDERCALLBACK pfnReadDataChunk; 547 } SHAREDCLIPBOARDPROVIDERCALLBACKS, *PSHAREDCLIPBOARDPROVIDERCALLBACKS; 613 } SHAREDCLIPBOARDPROVIDERCTX, *PSHAREDCLIPBOARDPROVIDERCTX; 614 615 #define SHAREDCLIPBOARDPROVIDERFUNCDECL(a_Name, ...) \ 616 typedef DECLCALLBACK(int) RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name)(PSHAREDCLIPBOARDPROVIDERCTX, __VA_ARGS__); \ 617 typedef RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDPROVIDER, a_Name); 618 619 #define SHAREDCLIPBOARDPROVIDERFUNCDECLVOID(a_Name) \ 620 typedef DECLCALLBACK(int) RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name)(PSHAREDCLIPBOARDPROVIDERCTX); \ 621 typedef RT_CONCAT(FNSHAREDCLIPBOARDPROVIDER, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDPROVIDER, a_Name); 622 623 #define SHAREDCLIPBOARDPROVIDERFUNCMEMBER(a_Name, a_Member) \ 624 RT_CONCAT(PFNSHAREDCLIPBOARDPROVIDER, a_Name) a_Member; 625 626 SHAREDCLIPBOARDPROVIDERFUNCDECLVOID(PREPARE) 627 SHAREDCLIPBOARDPROVIDERFUNCDECL(READDATAHDR, PVBOXCLIPBOARDDATAHDR *ppDataHdr) 628 SHAREDCLIPBOARDPROVIDERFUNCDECL(WRITEDATAHDR, const PVBOXCLIPBOARDDATAHDR pDataHdr) 629 SHAREDCLIPBOARDPROVIDERFUNCDECL(READDATACHUNK, const PVBOXCLIPBOARDDATAHDR pDataHdr, void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbRead) 630 SHAREDCLIPBOARDPROVIDERFUNCDECL(WRITEDATACHUNK, const PVBOXCLIPBOARDDATAHDR pDataHdr, const void *pvChunk, uint32_t cbChunk, uint32_t fFlags, uint32_t *pcbWritten) 631 SHAREDCLIPBOARDPROVIDERFUNCDECL(READOBJHDR, PVBOXCLIPBOARDOBJHDR *ppObjHdr) 632 SHAREDCLIPBOARDPROVIDERFUNCDECL(READDIRECTORY, PVBOXCLIPBOARDDIRDATA *ppDirData) 633 SHAREDCLIPBOARDPROVIDERFUNCDECL(WRITEDIRECTORY, const PVBOXCLIPBOARDDIRDATA pDirData) 634 SHAREDCLIPBOARDPROVIDERFUNCDECL(READFILEHDR, PVBOXCLIPBOARDFILEHDR *ppFileHdr); 635 SHAREDCLIPBOARDPROVIDERFUNCDECL(WRITEFILEHDR, const PVBOXCLIPBOARDFILEHDR pFileHdr); 636 SHAREDCLIPBOARDPROVIDERFUNCDECL(READFILEDATA, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbRead) 637 SHAREDCLIPBOARDPROVIDERFUNCDECL(WRITEFILEDATA, void *pvData, uint32_t cbData, uint32_t fFlags, uint32_t *pcbWritten) 638 SHAREDCLIPBOARDPROVIDERFUNCDECLVOID(RESET) 639 640 typedef struct _SHAREDCLIPBOARDPROVIDERINTERFACE 641 { 642 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(PREPARE, pfnPrepare); 643 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READDATAHDR, pfnReadDataHdr); 644 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(WRITEDATAHDR, pfnWriteDataHdr); 645 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(WRITEDATACHUNK, pfnWriteDataChunk); 646 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READDATACHUNK, pfnReadDataChunk); 647 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READOBJHDR, pfnReadObjHdr); 648 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READDIRECTORY, pfnReadDirectory); 649 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(WRITEDIRECTORY, pfnWriteDirectory); 650 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READFILEHDR, pfnReadFileHdr); 651 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(WRITEFILEHDR, pfnWriteFileHdr); 652 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(READFILEDATA, pfnReadFileData); 653 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(WRITEFILEDATA, pfnWriteFileData); 654 SHAREDCLIPBOARDPROVIDERFUNCMEMBER(RESET, pfnReset); 655 } SHAREDCLIPBOARDPROVIDERINTERFACE, *PSHAREDCLIPBOARDPROVIDERINTERFACE; 548 656 549 657 /** … … 553 661 { 554 662 /** Specifies what the source of the provider is. */ 555 SHAREDCLIPBOARDURIPROVIDERSOURCE enmSource; 556 /** Specifies whether the provider will read or write data. */ 557 SHAREDCLIPBOARDURITRANSFERDIR enmDir; 558 /** Optional callback table; can be NULL if not needed. */ 559 PSHAREDCLIPBOARDPROVIDERCALLBACKS pCallbacks; 663 SHAREDCLIPBOARDSOURCE enmSource; 664 SHAREDCLIPBOARDPROVIDERINTERFACE Interface; 665 void *pvUser; 560 666 union 561 667 { … … 601 707 } SHAREDCLIPBOARDPROVIDERWRITEPARMS, *PSHAREDCLIPBOARDPROVIDERWRITEPARMS; 602 708 709 #if 0 603 710 /** 604 711 * Interface class acting as a lightweight proxy for abstracting reading / writing clipboard data. … … 800 907 }; 801 908 #endif /* VBOX_WITH_SHARED_CLIPBOARD_HOST */ 909 #endif 802 910 803 911 struct _SHAREDCLIPBOARDURITRANSFER; … … 815 923 } SHAREDCLIPBOARDURITRANSFERCALLBACKDATA, *PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA; 816 924 817 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURITRANSFERSTARTED(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 818 /** Pointer to a FNSHAREDCLIPBOARDURITRANSFERSTARTED function. */ 819 typedef FNSHAREDCLIPBOARDURITRANSFERSTARTED *PFNSHAREDCLIPBOARDURITRANSFERSTARTED; 820 821 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURITRANSFERPREPARE(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 822 /** Pointer to a FNSHAREDCLIPBOARDURITRANSFERPREPARE function. */ 823 typedef FNSHAREDCLIPBOARDURITRANSFERPREPARE *PFNSHAREDCLIPBOARDURITRANSFERPREPARE; 824 825 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURIMETADATACOMPLETE(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 826 /** Pointer to a FNSHAREDCLIPBOARDURIMETADATACOMPLETE function. */ 827 typedef FNSHAREDCLIPBOARDURIMETADATACOMPLETE *PFNSHAREDCLIPBOARDURIMETADATACOMPLETE; 828 829 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURITRANSFERCANCELED(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); 830 /** Pointer to a FNSHAREDCLIPBOARDURITRANSFERCANCELED function. */ 831 typedef FNSHAREDCLIPBOARDURITRANSFERCANCELED *PFNSHAREDCLIPBOARDURITRANSFERCANCELED; 832 833 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURITRANSFERCOMPLETE(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc); 834 /** Pointer to a FNSHAREDCLIPBOARDURITRANSFERCOMPLETE function. */ 835 typedef FNSHAREDCLIPBOARDURITRANSFERCOMPLETE *PFNSHAREDCLIPBOARDURITRANSFERCOMPLETE; 836 837 typedef DECLCALLBACK(void) FNSHAREDCLIPBOARDURITRANSFERERROR(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, int rc); 838 /** Pointer to a FNSHAREDCLIPBOARDURITRANSFERERROR function. */ 839 typedef FNSHAREDCLIPBOARDURITRANSFERERROR *PFNSHAREDCLIPBOARDURITRANSFERERROR; 925 #define SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(a_Name) \ 926 typedef DECLCALLBACK(void) RT_CONCAT(FNSHAREDCLIPBOARDCALLBACK, a_Name)(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData); \ 927 typedef RT_CONCAT(FNSHAREDCLIPBOARDCALLBACK, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDCALLBACK, a_Name); 928 929 #define SHAREDCLIPBOARDTRANSFERCALLBACKDECL(a_Name, ...) \ 930 typedef DECLCALLBACK(void) RT_CONCAT(FNSHAREDCLIPBOARDCALLBACK, a_Name)(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData, __VA_ARGS__); \ 931 typedef RT_CONCAT(FNSHAREDCLIPBOARDCALLBACK, a_Name) RT_CONCAT(*PFNSHAREDCLIPBOARDCALLBACK, a_Name); 932 933 #define SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(a_Name, a_Member) \ 934 RT_CONCAT(PFNSHAREDCLIPBOARDCALLBACK, a_Name) a_Member; 935 936 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERPREPARE) 937 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERSTARTED) 938 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(DATAHDRCOMPLETE) 939 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(DATACHUNKCOMPLETE) 940 SHAREDCLIPBOARDTRANSFERCALLBACKDECLVOID(TRANSFERCANCELED) 941 SHAREDCLIPBOARDTRANSFERCALLBACKDECL (TRANSFERCOMPLETE, int rc) 942 SHAREDCLIPBOARDTRANSFERCALLBACKDECL (TRANSFERERROR, int rc) 840 943 841 944 /** … … 846 949 { 847 950 /** Saved user pointer. */ 848 void *pvUser;951 void *pvUser; 849 952 /** Function pointer, called when the transfer is going to be prepared. */ 850 PFNSHAREDCLIPBOARDURITRANSFERPREPARE pfnTransferPrepare;953 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERPREPARE, pfnTransferPrepare); 851 954 /** Function pointer, called when the transfer has been started. */ 852 PFNSHAREDCLIPBOARDURITRANSFERSTARTED pfnTransferStarted; 853 /** Function pointer, called when reading / writing meta data is complete. */ 854 PFNSHAREDCLIPBOARDURIMETADATACOMPLETE pfnMetaDataComplete; 955 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERSTARTED, pfnTransferStarted); 956 /** Function pointer, called when reading / writing the meta data header is complete. */ 957 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(DATAHDRCOMPLETE, pfnDataHeaderComplete); 958 /** Function pointer, called when reading / writing the meta data is complete. */ 959 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(DATACHUNKCOMPLETE, pfnDataComplete); 855 960 /** Function pointer, called when the transfer is complete. */ 856 PFNSHAREDCLIPBOARDURITRANSFERCOMPLETE pfnTransferComplete;961 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERCOMPLETE, pfnTransferComplete); 857 962 /** Function pointer, called when the transfer has been canceled. */ 858 PFNSHAREDCLIPBOARDURITRANSFERCANCELED pfnTransferCanceled;963 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERCANCELED, pfnTransferCanceled); 859 964 /** Function pointer, called when transfer resulted in an unrecoverable error. */ 860 PFNSHAREDCLIPBOARDURITRANSFERERROR pfnTransferError;965 SHAREDCLIPBOARDTRANSFERCALLBACKMEMBER(TRANSFERERROR, pfnTransferError); 861 966 } SHAREDCLIPBOARDURITRANSFERCALLBACKS, *PSHAREDCLIPBOARDURITRANSFERCALLBACKS; 862 967 … … 874 979 volatile bool fCancelled; 875 980 } SHAREDCLIPBOARDURITRANSFERTHREAD, *PSHAREDCLIPBOARDURITRANSFERTHREAD; 876 877 /**878 * Structure for handling a single URI object context.879 */880 typedef struct _SHAREDCLIPBOARDCLIENTURIOBJCTX881 {882 /** Pointer to current object being processed. */883 SharedClipboardURIObject *pObj;884 } SHAREDCLIPBOARDCLIENTURIOBJCTX, *PSHAREDCLIPBOARDCLIENTURIOBJCTX;885 981 886 982 /** … … 903 999 /** The URI list for this transfer. */ 904 1000 SharedClipboardURIList *pURIList; 905 /** Context of current object being handled. */ 906 SHAREDCLIPBOARDCLIENTURIOBJCTX ObjCtx; 907 /** The Shared Clipboard provider in charge for this transfer. */ 908 SharedClipboardProvider *pProvider; 1001 SHAREDCLIPBOARDPROVIDERCTX ProviderCtx; 1002 /** The transfer's provider interface. */ 1003 SHAREDCLIPBOARDPROVIDERINTERFACE ProviderIface; 1004 /** The transfer's (optional) callback table. */ 1005 SHAREDCLIPBOARDURITRANSFERCALLBACKS Callbacks; 909 1006 /** Opaque pointer to implementation-specific parameters. */ 910 1007 void *pvUser; … … 913 1010 /** Contains thread-related attributes. */ 914 1011 SHAREDCLIPBOARDURITRANSFERTHREAD Thread; 915 /** (Optional) callbacks related to this transfer. */916 SHAREDCLIPBOARDURITRANSFERCALLBACKS Callbacks;917 1012 } SHAREDCLIPBOARDURITRANSFER, *PSHAREDCLIPBOARDURITRANSFER; 918 1013 … … 927 1022 * Use a list or something lateron. */ 928 1023 RTLISTANCHOR List; 929 /** Number of concurrenttransfers.1024 /** Number of running (concurrent) transfers. 930 1025 * At the moment we only support only one transfer per client at a time. */ 931 uint32_t c Transfers;932 /** Maximum Number of concurrenttransfers.1026 uint32_t cRunning; 1027 /** Maximum Number of running (concurrent) transfers. 933 1028 * At the moment we only support only one transfer per client at a time. */ 934 uint32_t cMaxTransfers; 1029 uint32_t cMaxRunning; 1030 #ifdef DEBUG 1031 uint32_t cTransfer; 1032 #endif 935 1033 } SHAREDCLIPBOARDURICTX, *PSHAREDCLIPBOARDURICTX; 936 1034 … … 940 1038 bool SharedClipboardURIObjCtxIsValid(PSHAREDCLIPBOARDCLIENTURIOBJCTX pObjCtx); 941 1039 942 int SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR enmDir, PSHAREDCLIPBOARDURITRANSFER *ppTransfer);1040 int SharedClipboardURITransferCreate(SHAREDCLIPBOARDURITRANSFERDIR enmDir, SHAREDCLIPBOARDSOURCE enmSource, PSHAREDCLIPBOARDURITRANSFER *ppTransfer); 943 1041 int SharedClipboardURITransferDestroy(PSHAREDCLIPBOARDURITRANSFER pTransfer); 944 1042 int SharedClipboardURITransferPrepare(PSHAREDCLIPBOARDURITRANSFER pTransfer); 945 1043 int SharedClipboardURITransferProviderCreate(PSHAREDCLIPBOARDURITRANSFER pTransfer, 946 PSHAREDCLIPBOARDPROVIDERCREATIONCTX p ProviderCtx);1044 PSHAREDCLIPBOARDPROVIDERCREATIONCTX pCreationCtx); 947 1045 void SharedClipboardURITransferReset(PSHAREDCLIPBOARDURITRANSFER pTransfer); 948 1046 SharedClipboardArea *SharedClipboardURITransferGetArea(PSHAREDCLIPBOARDURITRANSFER pTransfer); 949 1047 PSHAREDCLIPBOARDCLIENTURIOBJCTX SharedClipboardURITransferGetCurrentObjCtx(PSHAREDCLIPBOARDURITRANSFER pTransfer); 950 1048 const SharedClipboardURIObject *SharedClipboardURITransferGetCurrentObject(PSHAREDCLIPBOARDURITRANSFER pTransfer); 951 SharedClipboardProvider *SharedClipboardURITransferGetProvider(PSHAREDCLIPBOARDURITRANSFER pTransfer);952 1049 SharedClipboardURIList *SharedClipboardURITransferGetList(PSHAREDCLIPBOARDURITRANSFER pTransfer); 953 1050 SharedClipboardURIObject *SharedClipboardURITransferGetObject(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint64_t uIdx); 1051 SHAREDCLIPBOARDSOURCE SharedClipboardURITransferGetSource(PSHAREDCLIPBOARDURITRANSFER pTransfer); 1052 SHAREDCLIPBOARDURITRANSFERSTATUS SharedClipboardURITransferGetStatus(PSHAREDCLIPBOARDURITRANSFER pTransfer); 954 1053 int SharedClipboardURITransferRun(PSHAREDCLIPBOARDURITRANSFER pTransfer, bool fAsync); 955 1054 void SharedClipboardURITransferSetCallbacks(PSHAREDCLIPBOARDURITRANSFER pTransfer, 956 1055 PSHAREDCLIPBOARDURITRANSFERCALLBACKS pCallbacks); 1056 int SharedClipboardURITransferSetDataHeader(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATAHDR pDataHdr); 1057 int SharedClipboardURITransferSetDataChunk(PSHAREDCLIPBOARDURITRANSFER pTransfer, PVBOXCLIPBOARDDATACHUNK pDataChunk); 957 1058 958 1059 int SharedClipboardURITransferMetaDataAdd(PSHAREDCLIPBOARDURITRANSFER pTransfer, const void *pvMeta, uint32_t cbMeta); … … 971 1072 void SharedClipboardURICtxReset(PSHAREDCLIPBOARDURICTX pURI); 972 1073 PSHAREDCLIPBOARDURITRANSFER SharedClipboardURICtxGetTransfer(PSHAREDCLIPBOARDURICTX pURI, uint32_t uIdx); 973 uint32_t SharedClipboardURICtxGetActiveTransfers(PSHAREDCLIPBOARDURICTX pURI); 974 bool SharedClipboardURICtxMaximumTransfersReached(PSHAREDCLIPBOARDURICTX pURI); 1074 uint32_t SharedClipboardURICtxGetRunningTransfers(PSHAREDCLIPBOARDURICTX pURI); 1075 void SharedClipboardURICtxTransfersCleanup(PSHAREDCLIPBOARDURICTX pURI); 1076 bool SharedClipboardURICtxTransfersMaximumReached(PSHAREDCLIPBOARDURICTX pURI); 975 1077 int SharedClipboardURICtxTransferAdd(PSHAREDCLIPBOARDURICTX pURI, PSHAREDCLIPBOARDURITRANSFER pTransfer); 976 1078 int SharedClipboardURICtxTransferRemove(PSHAREDCLIPBOARDURICTX pURI, PSHAREDCLIPBOARDURITRANSFER pTransfer); -
trunk/include/VBox/GuestHost/SharedClipboard-win.h
r79299 r79347 137 137 int VBoxClipboardWinAnnounceFormats(PVBOXCLIPBOARDWINCTX pWinCtx, VBOXCLIPBOARDFORMATS fFormats); 138 138 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 139 int VBoxClipboardWinURI Announce(PVBOXCLIPBOARDWINCTX pWinCtx, PSHAREDCLIPBOARDURICTX pURICtx,140 139 int VBoxClipboardWinURITransferCreate(PVBOXCLIPBOARDWINCTX pWinCtx, PSHAREDCLIPBOARDURITRANSFER pTransfer); 140 void VBoxClipboardWinURITransferDestroy(PVBOXCLIPBOARDWINCTX pWinCtx, PSHAREDCLIPBOARDURITRANSFER pTransfer); 141 141 #endif 142 142 … … 204 204 205 205 int Init(void); 206 void OnMetaDataComplete(PSHAREDCLIPBOARDURITRANSFER pTransfer); 206 207 void OnTransferComplete(int rc = VINF_SUCCESS); 207 208 void OnTransferCanceled(); … … 222 223 void registerFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, TYMED tyMed = TYMED_HGLOBAL, 223 224 LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL); 224 225 protected: /* URI transfer callbacks */226 227 static DECLCALLBACK(void) onMetaDataCompleteCallback(PSHAREDCLIPBOARDURITRANSFERCALLBACKDATA pData);228 229 225 protected: 230 226 -
trunk/include/VBox/HostServices/VBoxClipboardSvc.h
r79299 r79347 402 402 } VBOXCLIPBOARDDATACHUNK, *PVBOXCLIPBOARDDATACHUNK; 403 403 404 typedef struct _VBOXCLIPBOARDOBJHDR 405 { 406 uint32_t enmType; 407 } VBOXCLIPBOARDOBJHDR, *PVBOXCLIPBOARDOBJHDR; 408 404 409 typedef struct _VBOXCLIPBOARDDIRDATA 405 410 { … … 448 453 449 454 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 450 int VBoxSvcClipboardURI ReadDataHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATAHDR pDataHdr);451 int VBoxSvcClipboardURI WriteDataHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATAHDR pDataHdr);452 int VBoxSvcClipboardURI ReadDataChunk(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATACHUNK pDataChunk);453 int VBoxSvcClipboardURI WriteDataChunk(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATACHUNK pDataChunk);454 int VBoxSvcClipboardURI ReadDir(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDIRDATA pDirData);455 int VBoxSvcClipboardURI WriteDir(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDIRDATA pDirData);456 int VBoxSvcClipboardURI ReadFileHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEHDR pFileHdr);457 int VBoxSvcClipboardURI WriteFileHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEHDR pFileHdr);458 int VBoxSvcClipboardURI ReadFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData);459 int VBoxSvcClipboardURI WriteFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData);455 int VBoxSvcClipboardURIGetDataHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATAHDR pDataHdr); 456 int VBoxSvcClipboardURISetDataHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATAHDR pDataHdr); 457 int VBoxSvcClipboardURISetDataChunk(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATACHUNK pDataChunk); 458 int VBoxSvcClipboardURISetDataChunk(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDATACHUNK pDataChunk); 459 int VBoxSvcClipboardURIGetDir(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDIRDATA pDirData); 460 int VBoxSvcClipboardURISetDir(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDDIRDATA pDirData); 461 int VBoxSvcClipboardURIGetFileHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEHDR pFileHdr); 462 int VBoxSvcClipboardURISetFileHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEHDR pFileHdr); 463 int VBoxSvcClipboardURIGetFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData); 464 int VBoxSvcClipboardURISetFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData); 460 465 #endif 461 466
Note:
See TracChangeset
for help on using the changeset viewer.