From b2df34f3fcf00afd45e2d2da7cd35da94271c33e Mon Sep 17 00:00:00 2001 From: Erik Forsberg Date: Thu, 27 Mar 2003 13:07:28 +0000 Subject: [PATCH] Initial version. Combined code from Matt's RDP5 adventures with some of my own discoveries. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@342 423420c4-83ab-492f-b58f-81f9feb106b5 --- rdp5.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 rdp5.c diff --git a/rdp5.c b/rdp5.c new file mode 100644 index 0000000..3412113 --- /dev/null +++ b/rdp5.c @@ -0,0 +1,88 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Protocol services - Multipoint Communications Service + Copyright (C) Matthew Chapman 1999-2002 + Copyright (C) Erik Forsberg 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rdesktop.h" + +extern uint8 *next_packet; + +void +rdp5_process(STREAM s, BOOL encryption, BOOL shortform) +{ + uint16 length, count; + uint8 type; + uint8 *next; + + if (encryption) + { + in_uint8s(s, shortform ? 6 : 7 /* XXX HACK */ ); /* signature */ + sec_decrypt(s->p, s->end - s->p); + } + +#if 0 + printf("RDP5 data:\n"); + hexdump(s->p, s->end - s->p); +#endif + + while (s->p < s->end) + { + in_uint8(s, type); + in_uint16_le(s, length); + next_packet = next = s->p + length; + + switch (type) + { + case 0: /* orders */ + in_uint16_le(s, count); + process_orders(s, count); + break; + case 1: /* bitmap update (???) */ + in_uint8s(s, 2); /* part length */ + process_bitmap_updates(s); + break; + case 2: /* palette */ + in_uint8s(s, 2); /* uint16 = 2 */ + process_palette(s); + break; + case 3: /* probably an palette with offset 3. Weird */ + break; + case 5: + process_null_system_pointer_pdu(s); + break; + case 9: + process_colour_pointer_pdu(s); + break; + case 10: + process_cached_pointer_pdu(s); + break; + default: + unimpl("RDP5 opcode %d\n", type); + } + + s->p = next; + } +} + +void +rdp5_process_channel(STREAM s, uint16 channel) +{ + printf("Data on channel %02x:\n", channel); + hexdump(s->p, s->end - s->p); +}