CVS: rdesktop constants.h,1.33,1.34 Makefile,1.43,1.44 orders.c,1.34,1.35 proto.h,1.62,1.63 rdp.c,1.58,1.59 types.h,1.18,1.19

Peter Bystr?m <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24173

Modified Files:
	constants.h Makefile orders.c proto.h rdp.c types.h 
Log Message:
mppc like decompression for the rdp protocol. code not activated. rdp5 gets some extra opcodes, and the decompression seems to work fine. :\

Index: constants.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/constants.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** constants.h	20 Apr 2004 07:01:17 -0000	1.33
--- constants.h	27 Apr 2004 12:55:33 -0000	1.34
***************
*** 252,255 ****
--- 252,261 ----
  #define RDP5_NO_CURSORSETTINGS	0x40	/* disables cursor blinking */
  
+ /* compression types */
+ #define RDP_MPPC_COMPRESSED	0x20
+ #define RDP_MPPC_RESET		0x40
+ #define RDP_MPPC_FLUSH		0x80
+ #define RDP_MPPC_DICT_SIZE      8192
+ 
  /* Keymap flags */
  #define MapRightShiftMask   (1<<0)

Index: Makefile
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Makefile,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** Makefile	18 Apr 2004 19:37:53 -0000	1.43
--- Makefile	27 Apr 2004 12:55:33 -0000	1.44
***************
*** 16,20 ****
  KEYMAP_PATH = $(datadir)/keymaps/
  
! RDPOBJ   = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o
  X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
  VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
--- 16,20 ----
  KEYMAP_PATH = $(datadir)/keymaps/
  
! RDPOBJ   = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o
  X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
  VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o

Index: orders.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/orders.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** orders.c	3 Nov 2003 13:22:09 -0000	1.34
--- orders.c	27 Apr 2004 12:55:33 -0000	1.35
***************
*** 949,955 ****
  		processed++;
  	}
! 
  	if (s->p != g_next_packet)
  		error("%d bytes remaining\n", (int) (g_next_packet - s->p));
  }
  
--- 949,958 ----
  		processed++;
  	}
! #if 0
! 	/* not true when RDP_COMPRESSION is set */
  	if (s->p != g_next_packet)
  		error("%d bytes remaining\n", (int) (g_next_packet - s->p));
+ #endif
+ 
  }
  

Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** proto.h	26 Apr 2004 13:48:39 -0000	1.62
--- proto.h	27 Apr 2004 12:55:33 -0000	1.63
***************
*** 32,35 ****
--- 32,37 ----
  NTSTATUS disk_query_volume_information(HANDLE handle, uint32 info_class, STREAM out);
  NTSTATUS disk_query_directory(HANDLE handle, uint32 info_class, char *pattern, STREAM out);
+ /* mppc.c */
+ int mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen);
  /* ewmhints.c */
  int get_current_workarea(uint32 * x, uint32 * y, uint32 * width, uint32 * height);

Index: rdp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdp.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** rdp.c	26 Apr 2004 22:31:22 -0000	1.58
--- rdp.c	27 Apr 2004 12:55:33 -0000	1.59
***************
*** 39,42 ****
--- 39,44 ----
  uint32 g_rdp_shareid;
  
+ extern RDPCOMP mppc_dict;
+ 
  #if WITH_DEBUG
  static uint32 g_packetno;
***************
*** 175,187 ****
  	time_t tzone;
  
- #if 0
- 	// enable rdp compression
- 	flags |= RDP_COMPRESSION;
- #endif
- 
  	if (!g_use_rdp5 || 1 == g_server_rdp_version)
  	{
  		DEBUG_RDP5(("Sending RDP4-style Logon packet\n"));
  
  		s = sec_init(sec_flags, 18 + len_domain + len_user + len_password
  			     + len_program + len_directory + 10);
--- 177,190 ----
  	time_t tzone;
  
  	if (!g_use_rdp5 || 1 == g_server_rdp_version)
  	{
  		DEBUG_RDP5(("Sending RDP4-style Logon packet\n"));
  
+ #if 0
+ 		/* enable rdp compression */
+ 		/* decompression also works with rdp5 */
+ 		/* but there are some unknown opcodes */
+ 		flags |= RDP_COMPRESSION;
+ #endif
  		s = sec_init(sec_flags, 18 + len_domain + len_user + len_password
  			     + len_program + len_directory + 10);
***************
*** 202,205 ****
--- 205,209 ----
  	else
  	{
+ 
  		flags |= RDP_LOGON_BLOB;
  		DEBUG_RDP5(("Sending RDP5-style Logon packet\n"));
***************
*** 438,442 ****
  	order_caps[1] = 1;	/* pat blt */
  	order_caps[2] = 1;	/* screen blt */
! 	order_caps[3] = (g_bitmap_cache ? 1 : 0); /* memblt */
  	order_caps[8] = 1;	/* line */
  	order_caps[9] = 1;	/* line */
--- 442,446 ----
  	order_caps[1] = 1;	/* pat blt */
  	order_caps[2] = 1;	/* screen blt */
! 	order_caps[3] = (g_bitmap_cache ? 1 : 0);	/* memblt */
  	order_caps[8] = 1;	/* line */
  	order_caps[9] = 1;	/* line */
***************
*** 955,964 ****
  	uint8 ctype;
  	uint16 clen;
! 	int len;
! #if 0
! 	int roff, rlen, ret;
! 	static struct stream ns;
! 	static signed char *dict = 0;
! #endif
  
  	in_uint8s(s, 6);	/* shareid, pad, streamid */
--- 959,968 ----
  	uint8 ctype;
  	uint16 clen;
! 	uint32 len;
! 
! 	uint32 roff, rlen;
! 
! 	struct stream *ns = &(mppc_dict.ns);
! 	uint8 *dict = (mppc_dict.hist);
  
  	in_uint8s(s, 6);	/* shareid, pad, streamid */
***************
*** 969,997 ****
  	clen -= 18;
  
! #if 0
! 	if (ctype & 0x20)
  	{
- 		if (!dict)
- 		{
- 			dict = (signed char *) malloc(8200 * sizeof(signed char));
- 			dict = (signed char *) memset(dict, 0, 8200 * sizeof(signed char));
- 		}
  
! 		ret = decompress(s->p, clen, ctype, (signed char *) dict, &roff, &rlen);
  
  		len -= 18;
  
! 		ns.data = xrealloc(ns.data, len);
  
! 		ns.data = (unsigned char *) memcpy(ns.data, (unsigned char *) (dict + roff), len);
  
! 		ns.size = len;
! 		ns.end = ns.data + ns.size;
! 		ns.p = ns.data;
! 		ns.rdp_hdr = ns.p;
  
! 		s = &ns;
  	}
- #endif
  
  	switch (data_pdu_type)
--- 973,1000 ----
  	clen -= 18;
  
! 	if (ctype & RDP_MPPC_COMPRESSED)
  	{
  
! 		if (mppc_expand(s->p, clen, ctype, &roff, &rlen) == -1)
! 			error("error while decompressing packet\n");
  
  		len -= 18;
  
! 		/* this should never happen */
! 		if (len != rlen)
! 			error("decompression error len != rlen\n");
  
! 		/* allocate memory and copy the uncompressed data into the temporary stream */
! 		ns->data = xrealloc(ns->data, len);
  
! 		memcpy((ns->data), (unsigned char *) (mppc_dict.hist + roff), len);
  
! 		ns->size = len;
! 		ns->end = (ns->data + ns->size);
! 		ns->p = ns->data;
! 		ns->rdp_hdr = ns->p;
! 
! 		s = ns;
  	}
  
  	switch (data_pdu_type)

Index: types.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/types.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** types.h	4 Mar 2004 08:24:40 -0000	1.18
--- types.h	27 Apr 2004 12:55:33 -0000	1.19
***************
*** 135,138 ****
--- 135,146 ----
  } WAVEFORMATEX;
  
+ typedef struct _RDPCOMP
+ {
+ 	uint32 roff;
+ 	uint8 hist[RDP_MPPC_DICT_SIZE];
+ 	struct stream ns;
+ }
+ RDPCOMP;
+ 
  /* RDPDR */
  typedef uint32 NTSTATUS;



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.