cliprdr: add UI data request -> server data response.
This commit is contained in:
parent
a93194da06
commit
e10aba7cae
@ -142,7 +142,7 @@ void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* data_in
|
||||
svc_plugin_send_event((rdpSvcPlugin*)cliprdr, (FRDP_EVENT*)cb_event);
|
||||
}
|
||||
|
||||
void cliprdr_process_data_response_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_RESPONSE_EVENT* cb_event)
|
||||
void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_RESPONSE_EVENT* cb_event)
|
||||
{
|
||||
STREAM* data_out;
|
||||
|
||||
@ -150,3 +150,23 @@ void cliprdr_process_data_response_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_RE
|
||||
stream_write(data_out, cb_event->data, cb_event->size);
|
||||
cliprdr_packet_send(cliprdr, data_out);
|
||||
}
|
||||
|
||||
void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_REQUEST_EVENT* cb_event)
|
||||
{
|
||||
STREAM* data_out;
|
||||
|
||||
data_out = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4);
|
||||
stream_write_uint32(data_out, cb_event->format);
|
||||
cliprdr_packet_send(cliprdr, data_out);
|
||||
}
|
||||
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* data_in, uint32 dataLen)
|
||||
{
|
||||
FRDP_CB_DATA_RESPONSE_EVENT* cb_event;
|
||||
|
||||
cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL);
|
||||
cb_event->size = dataLen;
|
||||
cb_event->data = (uint8*)xmalloc(dataLen);
|
||||
memcpy(cb_event->data, stream_get_tail(data_in), dataLen);
|
||||
svc_plugin_send_event((rdpSvcPlugin*)cliprdr, (FRDP_EVENT*)cb_event);
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, FRDP_CB_FORMAT_LI
|
||||
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* data_in, uint32 dataLen);
|
||||
|
||||
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* data_in);
|
||||
void cliprdr_process_data_response_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_RESPONSE_EVENT* cb_event);
|
||||
void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_RESPONSE_EVENT* cb_event);
|
||||
|
||||
void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, FRDP_CB_DATA_REQUEST_EVENT* cb_event);
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* data_in, uint32 dataLen);
|
||||
|
||||
#endif /* __CLIPRDR_FORMAT_H */
|
||||
|
@ -130,6 +130,10 @@ static void cliprdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
cliprdr_process_format_data_request(cliprdr, data_in);
|
||||
break;
|
||||
|
||||
case CB_FORMAT_DATA_RESPONSE:
|
||||
cliprdr_process_format_data_response(cliprdr, data_in, dataLen);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("unknown msgType %d", msgType);
|
||||
break;
|
||||
@ -146,8 +150,12 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, FRDP_EVENT* event)
|
||||
cliprdr_process_format_list_event((cliprdrPlugin*)plugin, (FRDP_CB_FORMAT_LIST_EVENT*)event);
|
||||
break;
|
||||
|
||||
case FRDP_EVENT_TYPE_CB_DATA_REQUEST:
|
||||
cliprdr_process_format_data_request_event((cliprdrPlugin*)plugin, (FRDP_CB_DATA_REQUEST_EVENT*)event);
|
||||
break;
|
||||
|
||||
case FRDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
||||
cliprdr_process_data_response_event((cliprdrPlugin*)plugin, (FRDP_CB_DATA_RESPONSE_EVENT*)event);
|
||||
cliprdr_process_format_data_response_event((cliprdrPlugin*)plugin, (FRDP_CB_DATA_RESPONSE_EVENT*)event);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -89,7 +89,7 @@ static const uint8 test_data_response_data[] =
|
||||
static int test_rdp_channel_data(rdpInst* inst, int chan_id, char* data, int data_size)
|
||||
{
|
||||
printf("chan_id %d data_size %d\n", chan_id, data_size);
|
||||
/*freerdp_hexdump(data, data_size);*/
|
||||
freerdp_hexdump(data, data_size);
|
||||
}
|
||||
|
||||
static int event_processed;
|
||||
@ -209,6 +209,38 @@ void test_cliprdr(void)
|
||||
freerdp_chanman_check_fds(chan_man, &inst);
|
||||
}
|
||||
|
||||
/* UI sends data request event to cliprdr */
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_REQUEST, event_process_callback, NULL);
|
||||
data_request_event = (FRDP_CB_DATA_REQUEST_EVENT*)event;
|
||||
data_request_event->format = CB_FORMAT_UNICODETEXT;
|
||||
event_processed = 0;
|
||||
freerdp_chanman_send_event(chan_man, "cliprdr", event);
|
||||
|
||||
/* cliprdr sends data request PDU to server */
|
||||
while (!event_processed)
|
||||
{
|
||||
freerdp_chanman_check_fds(chan_man, &inst);
|
||||
}
|
||||
|
||||
/* server sends data response PDU to cliprdr */
|
||||
freerdp_chanman_data(&inst, 0, (char*)test_data_response_data, sizeof(test_data_response_data) - 1,
|
||||
CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_data_response_data) - 1);
|
||||
|
||||
/* cliprdr sends data response event to UI */
|
||||
while ((event = freerdp_chanman_pop_event(chan_man)) == NULL)
|
||||
{
|
||||
freerdp_chanman_check_fds(chan_man, &inst);
|
||||
}
|
||||
printf("Got event %d\n", event->event_type);
|
||||
CU_ASSERT(event->event_type == FRDP_EVENT_TYPE_CB_DATA_RESPONSE);
|
||||
if (event->event_type == FRDP_EVENT_TYPE_CB_DATA_RESPONSE)
|
||||
{
|
||||
data_response_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event;
|
||||
printf("Data response size: %d\n", data_response_event->size);
|
||||
freerdp_hexdump(data_response_event->data, data_response_event->size);
|
||||
}
|
||||
freerdp_event_free(event);
|
||||
|
||||
freerdp_chanman_close(chan_man, &inst);
|
||||
freerdp_chanman_free(chan_man);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user