1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/*********************************************************
* Copyright (C) 2007 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 2.1 and no later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*********************************************************/
/*
* dndClipboard.h
*
* This file maintains an interface for the clipboard object. The object
* may contain several representations of the same object. For
* example, we could have a plain text filename as well as the file's
* contents on the clipboard at the same time.
*
* The purpose of this structure is to store cross platform clipboard
* data for further processing. The UI is responsible for converting local
* clipboard data to a crossplatform format and inserting it into the
* cross platform clipboard.
*/
#ifndef _DND_CLIPBOARD_H_
#define _DND_CLIPBOARD_H_
#include "vm_basic_types.h"
#include "dnd.h"
#include "dynbuf.h"
/*
* Make sure each clipboard item is at most 64kb - 100 b. This limitation is
* copied from the current text copy paste limit.
*/
#define CPCLIPITEM_MAX_SIZE_V1 ((1 << 16) - 100)
#define CPCLIPITEM_MAX_SIZE_V2 ((1 << 16) - 100)
#define CPCLIPITEM_MAX_SIZE_V3 (DNDMSG_MAX_ARGSZ - 100)
/* Cross platform formats */
typedef
#include "vmware_pack_begin.h"
struct CPFileList {
uint64 fileSize;
uint32 relPathsLen;
uint32 fulPathsLen;
uint8 filelists[1];
}
#include "vmware_pack_end.h"
CPFileList;
#define CPFILELIST_HEADER_SIZE (1* sizeof(uint64) + 2 * sizeof(uint32))
typedef
#include "vmware_pack_begin.h"
struct UriFileList {
uint64 fileSize;
uint32 uriPathsLen;
uint8 filelists[1];
}
#include "vmware_pack_end.h"
UriFileList;
#define URI_FILELIST_HEADER_SIZE (1* sizeof(uint64) + 1 * sizeof(uint32))
/* Types which can be stored on the clipboard. */
/*
* XXX
* This is currently in dnd.h, but should be moved over to dndClipboard.h
* Ling's vmx code reorg should handle this.
*/
/*
typedef enum
{
CPFORMAT_UNKNOWN = 0
CPFORMAT_TEXT,
CPFORMAT_FILELIST,
CPFORMAT_MAX,
} DND_CPFORMAT;
*/
#define CPFORMAT_MIN CPFORMAT_TEXT
/* CPClipboard */
void CPClipboard_Init(CPClipboard *clip);
void CPClipboard_Destroy(CPClipboard *clip);
void CPClipboard_Clear(CPClipboard *clip);
Bool CPClipboard_SetItem(CPClipboard *clip, const DND_CPFORMAT fmt, const void *buf,
const size_t size);
void CPClipboard_SetChanged(CPClipboard *clip, Bool changed);
Bool CPClipboard_Changed(const CPClipboard *clip);
Bool CPClipboard_ClearItem(CPClipboard *clip, DND_CPFORMAT fmt);
Bool CPClipboard_GetItem(const CPClipboard *clip, DND_CPFORMAT fmt,
void **buf, size_t *size);
Bool CPClipboard_ItemExists(const CPClipboard *clip, DND_CPFORMAT fmt);
Bool CPClipboard_IsEmpty(const CPClipboard *clip);
size_t CPClipboard_GetTotalSize(const CPClipboard *clip);
Bool CPClipboard_Copy(CPClipboard *dest, const CPClipboard *src);
Bool CPClipboard_Serialize(const CPClipboard *clip, DynBuf *buf);
Bool CPClipboard_Unserialize(CPClipboard *clip, void *buf, size_t len);
#endif // _DND_CLIPBOARD_H_
|