added option for rdp compression

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@772 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2004-09-11 22:57:42 +00:00
parent 06e4ea81a9
commit 7f5acf5e64
3 changed files with 17 additions and 5 deletions

View File

@ -122,6 +122,7 @@ usage(char *program)
fprintf(stderr, " -N: enable numlock syncronization\n");
fprintf(stderr, " -X: embed into another window with a given id.\n");
fprintf(stderr, " -a: connection colour depth\n");
fprintf(stderr, " -z: enable rdp compression\n");
fprintf(stderr, " -x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex nr.)\n");
fprintf(stderr, " -P: use persistent bitmap caching\n");
fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n");
@ -363,7 +364,7 @@ main(int argc, char *argv[])
#endif
while ((c = getopt(argc, argv,
VNCOPT "u:d:s:c:p:n:k:g:fbBeEmCDKS:T:NX:a:x:Pr:045h?")) != -1)
VNCOPT "u:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
{
switch (c)
{
@ -524,8 +525,12 @@ main(int argc, char *argv[])
}
break;
case 'x':
case 'z':
DEBUG(("rdp compression enabled\n"));
flags |= RDP_COMPRESSION;
break;
case 'x':
if (strncmp("modem", optarg, 1) == 0)
{
g_rdp5_performanceflags =
@ -847,7 +852,11 @@ xmalloc(int size)
void *
xrealloc(void *oldmem, int size)
{
void *mem = realloc(oldmem, size);
void * mem;
if (size < 1)
size = 1;
mem = realloc(oldmem, size);
if (mem == NULL)
{
error("xrealloc %d\n", size);

4
rdp.c
View File

@ -1071,6 +1071,7 @@ process_data_pdu(STREAM s, uint32 * ext_disc_reason)
uint8 ctype;
uint16 clen;
uint32 len;
static int max_size;
uint32 roff, rlen;
@ -1085,7 +1086,8 @@ process_data_pdu(STREAM s, uint32 * ext_disc_reason)
if (ctype & RDP_MPPC_COMPRESSED)
{
if (len > RDP_MPPC_DICT_SIZE)
error("error decompressed packet size exceeds max\n");
if (mppc_expand(s->p, clen, ctype, &roff, &rlen) == -1)
error("error while decompressing packet\n");

3
rdp5.c
View File

@ -60,7 +60,8 @@ rdp5_process(STREAM s)
if (ctype & RDP_MPPC_COMPRESSED)
{
if (length > RDP_MPPC_DICT_SIZE)
error("error decompressed packet size exceeds max\n");
if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
error("error while decompressing packet\n");