1
/* -*- c-basic-offset: 8 -*-
2
rdesktop: A Remote Desktop Protocol client.
4
Copyright (C) Jay Sorg 2009
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
#include <freerdp/constants_vchan.h>
34
vchan_send(rdpChannels * chan, int mcs_id, char * data, int total_length)
43
struct rdp_chan * channel;
45
settings = chan->mcs->sec->rdp->settings;
46
chan_index = (mcs_id - MCS_GLOBAL_CHANNEL) - 1;
47
if ((chan_index < 0) || (chan_index >= settings->num_channels))
49
ui_error(chan->mcs->sec->rdp->inst, "error\n");
52
channel = &(settings->channels[chan_index]);
53
chan_flags = CHANNEL_FLAG_FIRST;
55
sec_flags = settings->encryption ? SEC_ENCRYPT : 0;
56
while (sent < total_length)
58
length = MIN(CHANNEL_CHUNK_LENGTH, total_length);
59
length = MIN(total_length - sent, length);
60
if ((sent + length) >= total_length)
62
chan_flags |= CHANNEL_FLAG_LAST;
64
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
66
chan_flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
68
s = sec_init(chan->mcs->sec, sec_flags, length + 8);
69
out_uint32_le(s, total_length);
70
out_uint32_le(s, chan_flags);
71
out_uint8p(s, data + sent, length);
73
sec_send_to_channel(chan->mcs->sec, s, sec_flags, mcs_id);
81
vchan_process(rdpChannels * chan, STREAM s, int mcs_id)
88
in_uint32_le(s, total_length);
89
in_uint32_le(s, flags);
90
length = (int) (s->end - s->p);
91
data = (char *) (s->p);
93
ui_channel_data(chan->mcs->sec->rdp->inst, mcs_id, data, length, flags, total_length);
97
vchan_new(struct rdp_mcs * mcs)
101
self = (rdpChannels *) xmalloc(sizeof(rdpChannels));
104
memset(self, 0, sizeof(rdpChannels));
111
vchan_free(rdpChannels * chan)