50 |
channel_send(s, cliprdr_channel); |
channel_send(s, cliprdr_channel); |
51 |
} |
} |
52 |
|
|
53 |
|
/* Helper which announces our readiness to supply clipboard data |
54 |
|
in a single format (such as CF_TEXT) to the RDP side. |
55 |
|
To announce more than one format at a time, use |
56 |
|
cliprdr_send_native_format_announce. |
57 |
|
*/ |
58 |
void |
void |
59 |
cliprdr_send_text_format_announce(void) |
cliprdr_send_simple_native_format_announce(uint32 format) |
60 |
{ |
{ |
61 |
uint8 buffer[36]; |
uint8 buffer[36]; |
62 |
|
|
63 |
buf_out_uint32(buffer, CF_TEXT); |
DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n")); |
|
memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */ |
|
|
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, buffer, sizeof(buffer)); |
|
|
} |
|
|
|
|
|
void |
|
|
cliprdr_send_blah_format_announce(void) |
|
|
{ |
|
|
uint8 buffer[36]; |
|
64 |
|
|
65 |
buf_out_uint32(buffer, CF_OEMTEXT); |
buf_out_uint32(buffer, format); |
66 |
memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */ |
memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */ |
67 |
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, buffer, sizeof(buffer)); |
cliprdr_send_native_format_announce(buffer, sizeof(buffer)); |
68 |
} |
} |
69 |
|
|
70 |
|
/* Announces our readiness to supply clipboard data in multiple |
71 |
|
formats, each denoted by a 36-byte format descriptor of |
72 |
|
[ uint32 format + 32-byte description ]. |
73 |
|
*/ |
74 |
void |
void |
75 |
cliprdr_send_native_format_announce(uint8 * data, uint32 length) |
cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length) |
76 |
{ |
{ |
77 |
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, data, length); |
DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n")); |
78 |
|
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, |
79 |
|
formats_data_length); |
80 |
} |
} |
81 |
|
|
82 |
void |
void |
84 |
{ |
{ |
85 |
uint8 buffer[4]; |
uint8 buffer[4]; |
86 |
|
|
87 |
|
DEBUG_CLIPBOARD(("cliprdr_send_data_request\n")); |
88 |
buf_out_uint32(buffer, format); |
buf_out_uint32(buffer, format); |
89 |
cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer)); |
cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer)); |
90 |
} |
} |
92 |
void |
void |
93 |
cliprdr_send_data(uint8 * data, uint32 length) |
cliprdr_send_data(uint8 * data, uint32 length) |
94 |
{ |
{ |
95 |
|
DEBUG_CLIPBOARD(("cliprdr_send_data\n")); |
96 |
cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length); |
cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length); |
97 |
} |
} |
98 |
|
|
101 |
{ |
{ |
102 |
uint16 type, status; |
uint16 type, status; |
103 |
uint32 length, format; |
uint32 length, format; |
104 |
char *data; |
uint8 *data; |
105 |
|
|
106 |
in_uint16_le(s, type); |
in_uint16_le(s, type); |
107 |
in_uint16_le(s, status); |
in_uint16_le(s, status); |
116 |
{ |
{ |
117 |
/* FIXME: We seem to get this when we send an announce while the server is |
/* FIXME: We seem to get this when we send an announce while the server is |
118 |
still processing a paste. Try sending another announce. */ |
still processing a paste. Try sending another announce. */ |
119 |
cliprdr_send_text_format_announce(); |
cliprdr_send_simple_native_format_announce(CF_TEXT); |
120 |
return; |
return; |
121 |
} |
} |
122 |
|
|
123 |
error("CLIPRDR error (type=%d)\n", type); |
DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type)); |
124 |
return; |
return; |
125 |
} |
} |
126 |
|
|
142 |
case CLIPRDR_DATA_RESPONSE: |
case CLIPRDR_DATA_RESPONSE: |
143 |
ui_clip_handle_data(data, length); |
ui_clip_handle_data(data, length); |
144 |
break; |
break; |
145 |
|
case 7: /* TODO: W2K3 SP1 sends this on connect with a value of 1 */ |
146 |
|
break; |
147 |
default: |
default: |
148 |
unimpl("CLIPRDR packet type %d\n", type); |
unimpl("CLIPRDR packet type %d\n", type); |
149 |
} |
} |