channels.c revision 6e9aa255e3376b2da5824c09c4c62bc233463bfe
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Protocol services - Virtual channels
Copyright 2003 Erik Forsberg <forsberg@cendio.se> for Cendio AB
Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the General Public License version 2 (GPLv2) at this time for any software where
* a choice of GPL license versions is made available with the language indicating
* that GPLv2 or any later version may be used, or where a choice of which version
* of the GPL is applied is otherwise unspecified.
*/
#include "rdesktop.h"
#define MAX_CHANNELS 6
#define CHANNEL_CHUNK_LENGTH 1600
#define CHANNEL_FLAG_FIRST 0x01
#define CHANNEL_FLAG_LAST 0x02
#define CHANNEL_FLAG_SHOW_PROTOCOL 0x10
extern RDP_VERSION g_rdp_version;
extern RD_BOOL g_encryption;
unsigned int g_num_channels;
/* FIXME: We should use the information in TAG_SRV_CHANNELS to map RDP5
channels to MCS channels.
The format of TAG_SRV_CHANNELS seems to be
global_channel_no (uint16le)
number_of_other_channels (uint16le)
..followed by uint16les for the other channels.
*/
VCHANNEL *
{
if (g_rdp_version < RDP_V5)
return NULL;
if (g_num_channels >= MAX_CHANNELS)
{
error("Channel table full, increase MAX_CHANNELS\n");
return NULL;
}
return channel;
}
{
STREAM s;
return s;
}
void
{
#ifdef WITH_SCARD
#endif
/* first fragment sent in-place */
s_pop_layer(s, channel_hdr);
/* Note: In the original clipboard implementation, this number was
1592, not 1600. However, I don't remember the reason and 1600 seems
to work so.. This applies only to *this* length, not the length of
continuation or ending packets. */
out_uint32_le(s, length);
out_uint32_le(s, flags);
/* subsequent segments copied (otherwise would have to generate headers backwards) */
while (remaining > 0)
{
remaining -= thislength;
out_uint32_le(s, length);
out_uint32_le(s, flags);
s_mark_end(s);
data += thislength;
}
#ifdef WITH_SCARD
#endif
}
void
{
unsigned int i;
for (i = 0; i < g_num_channels; i++)
{
channel = &g_channels[i];
break;
}
if (i >= g_num_channels)
return;
in_uint32_le(s, length);
in_uint32_le(s, flags);
{
/* single fragment - pass straight up */
}
else
{
/* add fragment to defragmentation buffer */
if (flags & CHANNEL_FLAG_FIRST)
{
{
}
}
in->p += thislength;
if (flags & CHANNEL_FLAG_LAST)
{
}
}
}