VBoxClipboard.h revision a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fc
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync/** @file
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync *
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * Shared Clipboard
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync/*
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Copyright (C) 2006-2007 innotek GmbH
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync *
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * available from http://www.virtualbox.org. This file is free software;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * General Public License (GPL) as published by the Free Software
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync#ifndef __VBOXCLIPBOARD__H
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync#define __VBOXCLIPBOARD__H
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync#define LOG_GROUP LOG_GROUP_HGCM
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync#include <VBox/log.h>
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync/** Constants needed for string conversions done by the Linux clipboard code. */
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsyncenum {
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync /** In Linux, lines end with a linefeed character. */
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync LINEFEED = 0xa,
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync /** In Windows, lines end with a carriage return and a linefeed character. */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync CARRIAGERETURN = 0xd,
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync /** Little endian "real" Utf16 strings start with this marker. */
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync UTF16LEMARKER = 0xfeff,
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync /** Big endian "real" Utf16 strings start with this marker. */
ab93606043a9881487aa83be04191d2f4ea24071vboxsync UTF16BEMARKER = 0xfffe
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync};
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsyncenum {
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync /** The number of milliseconds before the clipboard times out. */
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync CLIPBOARDTIMEOUT = 2000
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync};
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsyncstruct _VBOXCLIPBOARDCONTEXT;
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsynctypedef struct _VBOXCLIPBOARDCONTEXT VBOXCLIPBOARDCONTEXT;
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsync
0a7b20727716a00270f358a1c546473d8c36e8f3vboxsynctypedef struct _VBOXCLIPBOARDCLIENTDATA
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync{
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync struct _VBOXCLIPBOARDCLIENTDATA *pNext;
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync struct _VBOXCLIPBOARDCLIENTDATA *pPrev;
3aad980b92149dd95a1ab72ddb8d11d61a28ace6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync VBOXCLIPBOARDCONTEXT *pCtx;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync uint32_t u32ClientID;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync bool fAsync: 1; /* Guest is waiting for a message. */
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync bool fMsgQuit: 1;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync bool fMsgReadData: 1;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync bool fMsgFormats: 1;
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync struct {
7ccd30dd4bbced565b32c255a11640cd4093abb6vboxsync VBOXHGCMCALLHANDLE callHandle;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync VBOXHGCMSVCPARM *paParms;
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync } async;
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync struct {
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync void *pv;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync uint32_t cb;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync uint32_t u32Format;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync } data;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync uint32_t u32AvailableFormats;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync uint32_t u32RequestedFormat;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync} VBOXCLIPBOARDCLIENTDATA;
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync/*
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * The service functions. Locking is between the service thread and the platform dependedn windows thread.
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncbool vboxSvcClipboardLock (void);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncvoid vboxSvcClipboardUnlock (void);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncvoid vboxSvcClipboardReportMsg (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Msg, uint32_t u32Formats);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync/*
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync * Platform dependent functions.
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncint vboxClipboardInit (void);
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsyncvoid vboxClipboardDestroy (void);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncint vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncvoid vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient);
d605d5391db09e6395a1c091f148f4b86af84bd3vboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsyncvoid vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Formats);
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsyncint vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsyncvoid vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv, uint32_t cb, uint32_t u32Format);
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsyncint vboxClipboardSync (VBOXCLIPBOARDCLIENTDATA *pClient);
8e342a5c34610667d2b554cb86f1dc2f38a5313cvboxsync
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync#endif /* __VBOXCLIPBOARD__H */
9e5c26690d45216629b5f588aced8fcfb68c23b6vboxsync