Example #1
0
void
cliprdr_send_data_request(uint32 format)
{
	uint8 buffer[4];

	buf_out_uint32(buffer, format);
	cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer));
}
Example #2
0
static void
cliprdr_process(STREAM s)
{
	uint16 type, status;
	uint32 length, format;
	uint8 *data;

	in_uint16_le(s, type);
	in_uint16_le(s, status);
	in_uint32_le(s, length);
	data = s->p;

	DEBUG_CLIPBOARD(("CLIPRDR recv: type=%d, status=%d, length=%d\n", type, status, length));

	if (status == CLIPRDR_ERROR)
	{
		switch (type)
		{
			case CLIPRDR_FORMAT_ACK:
				/* FIXME: We seem to get this when we send an announce while the server is
				   still processing a paste. Try sending another announce. */
				cliprdr_send_native_format_announce(last_formats,
								    last_formats_length);
				break;
			case CLIPRDR_DATA_RESPONSE:
				ui_clip_request_failed();
				break;
			default:
				DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type));
		}

		return;
	}

	switch (type)
	{
		case CLIPRDR_CONNECT:
			ui_clip_sync();
			break;
		case CLIPRDR_FORMAT_ANNOUNCE:
			ui_clip_format_announce(data, length);
			cliprdr_send_packet(CLIPRDR_FORMAT_ACK, CLIPRDR_RESPONSE, NULL, 0);
			return;
		case CLIPRDR_FORMAT_ACK:
			break;
		case CLIPRDR_DATA_REQUEST:
			in_uint32_le(s, format);
			ui_clip_request_data(format);
			break;
		case CLIPRDR_DATA_RESPONSE:
			ui_clip_handle_data(data, length);
			break;
		case 7:	/* TODO: W2K3 SP1 sends this on connect with a value of 1 */
			break;
		default:
			unimpl("CLIPRDR packet type %d\n", type);
	}
}
Example #3
0
void
cliprdr_send_blah_format_announce(void)
{
	uint8 buffer[36];

	buf_out_uint32(buffer, CF_OEMTEXT);
	memset(buffer + 4, 0, sizeof(buffer) - 4);	/* description */
	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, buffer, sizeof(buffer));
}
Example #4
0
static int
thread_process_message(cliprdrPlugin * plugin, char * data, int data_size)
{
	uint16 type;
	uint32 flag;
	uint32 length;
	uint32 format;

	type = GET_UINT16(data, 0);
	flag = GET_UINT16(data, 2);
	length = GET_UINT32(data, 4);

	LLOGLN(10, ("cliprdr: thread_process_message: type=%d flag=%d length=%d",
		type, flag, length));

	switch (type)
	{
		case CB_MONITOR_READY:
			clipboard_sync(plugin->device_data);
			break;
		case CB_FORMAT_LIST:
			clipboard_format_list(plugin->device_data, flag,
				data + 8, length);
			cliprdr_send_packet(plugin, CB_FORMAT_LIST_RESPONSE,
				CB_RESPONSE_OK, NULL, 0);
			break;
		case CB_FORMAT_LIST_RESPONSE:
			clipboard_format_list_response(plugin->device_data, flag);
			break;
		case CB_FORMAT_DATA_REQUEST:
			format = GET_UINT32(data, 8);
			clipboard_request_data(plugin->device_data, format);
			break;
		case CB_FORMAT_DATA_RESPONSE:
			clipboard_handle_data(plugin->device_data, flag,
				data + 8, length);
			break;
		case CB_CLIP_CAPS:
			clipboard_handle_caps(plugin->device_data, flag,
				data + 8, length);
			break;
		default:
			LLOGLN(0, ("thread_process_message: type %d not supported",
				type));
			break;
	}

	return 0;
}
Example #5
0
/* Announces our readiness to supply clipboard data in multiple
   formats, each denoted by a 36-byte format descriptor of
   [ uint32 format + 32-byte description ].
 */
void
cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length)
{
	DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));

	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data,
			    formats_data_length);

	if (formats_data != last_formats)
	{
		if (last_formats)
			xfree(last_formats);

		last_formats = xmalloc(formats_data_length);
		memcpy(last_formats, formats_data, formats_data_length);
		last_formats_length = formats_data_length;
	}
}
Example #6
0
void
cliprdr_send_data(uint8 * data, uint32 length)
{
	cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);
}
Example #7
0
void
cliprdr_send_native_format_announce(uint8 * data, uint32 length)
{
	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, data, length);
}
Example #8
0
void
cliprdr_send_data(uint8 * data, uint32 length)
{
	DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
	cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);
}