diff --git a/libfreerdp-core/freerdp.c b/libfreerdp-core/freerdp.c index 24d15cdca..6ff5f68d7 100644 --- a/libfreerdp-core/freerdp.c +++ b/libfreerdp-core/freerdp.c @@ -65,6 +65,11 @@ boolean freerdp_check_fds(freerdp* instance) return True; } +static int freerdp_send_channel_data(freerdp* instance, int channel_id, uint8* data, int size) +{ + return rdp_send_channel_data(instance->rdp, channel_id, data, size); +} + freerdp* freerdp_new() { freerdp* instance; @@ -82,6 +87,7 @@ freerdp* freerdp_new() instance->Connect = freerdp_connect; instance->GetFileDescriptor = freerdp_get_fds; instance->CheckFileDescriptor = freerdp_check_fds; + instance->SendChannelData = freerdp_send_channel_data; } return instance; diff --git a/libfreerdp-core/rdp.c b/libfreerdp-core/rdp.c index 74d19492e..7ac4765d0 100644 --- a/libfreerdp-core/rdp.c +++ b/libfreerdp-core/rdp.c @@ -448,6 +448,11 @@ static int rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra) return 1; } +int rdp_send_channel_data(rdpRdp* rdp, int channel_id, uint8* data, int size) +{ + return vchan_send(rdp->vchan, channel_id, data, size); +} + /** * Set non-blocking mode information. * @param rdp RDP module diff --git a/libfreerdp-core/rdp.h b/libfreerdp-core/rdp.h index 5829d16b4..fe3c327d4 100644 --- a/libfreerdp-core/rdp.h +++ b/libfreerdp-core/rdp.h @@ -238,6 +238,8 @@ void rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id); void rdp_send(rdpRdp* rdp, STREAM* s); void rdp_recv(rdpRdp* rdp); +int rdp_send_channel_data(rdpRdp* rdp, int channel_id, uint8* data, int size); + void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking); int rdp_check_fds(rdpRdp* rdp); diff --git a/libfreerdp-core/vchan.c b/libfreerdp-core/vchan.c index 3c2cbb183..4688c4b8f 100644 --- a/libfreerdp-core/vchan.c +++ b/libfreerdp-core/vchan.c @@ -26,9 +26,23 @@ #include "vchan.h" +int vchan_send(rdpVchan* vchan, uint16 channel_id, uint8* data, int size) +{ + printf("vchan_send\n"); +} + void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id) { - printf("vchan_process\n"); + uint32 length; + uint32 flags; + int chunk_length; + + stream_read_uint32(s, length); + stream_read_uint32(s, flags); + chunk_length = stream_get_left(s); + + IFCALL(vchan->instance->ReceiveChannelData, vchan->instance, + channel_id, stream_get_tail(s), chunk_length, flags, length); } rdpVchan* vchan_new(freerdp* instance) diff --git a/libfreerdp-core/vchan.h b/libfreerdp-core/vchan.h index 16c6d0447..000aebe5e 100644 --- a/libfreerdp-core/vchan.h +++ b/libfreerdp-core/vchan.h @@ -26,6 +26,7 @@ struct rdp_vchan }; typedef struct rdp_vchan rdpVchan; +int vchan_send(rdpVchan* vchan, uint16 channel_id, uint8* data, int size); void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id); rdpVchan* vchan_new(freerdp* instance);