/[rdesktop]/sourceforge.net/trunk/rdesktop/rdp5.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdp5.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 411 by forsberg, Fri Jun 6 10:48:38 2003 UTC revision 713 by jsorg71, Wed Jun 16 03:08:55 2004 UTC
# Line 3  Line 3 
3     Protocol services - Multipoint Communications Service     Protocol services - Multipoint Communications Service
4     Copyright (C) Matthew Chapman 1999-2002     Copyright (C) Matthew Chapman 1999-2002
5     Copyright (C) Erik Forsberg 2003     Copyright (C) Erik Forsberg 2003
6      
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.     (at your option) any later version.
11      
12     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16      
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software
19     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Line 21  Line 21 
21    
22  #include "rdesktop.h"  #include "rdesktop.h"
23    
24  extern uint8 *next_packet;  extern uint8 *g_next_packet;
25    
26    extern RDPCOMP g_mppc_dict;
27    
28  void  void
29  rdp5_process(STREAM s, BOOL encryption, BOOL shortform)  rdp5_process(STREAM s, BOOL encryption)
30  {  {
31          uint16 length, count;          uint16 length, count, x, y;
32          uint8 type;          uint8 type, ctype;
33          uint8 *next;          uint8 *next;
34    
35            uint32 roff, rlen;
36            struct stream *ns = &(g_mppc_dict.ns);
37            struct stream *ts;
38    
39          if (encryption)          if (encryption)
40          {          {
41                  in_uint8s(s, shortform ? 6 : 7 /* XXX HACK */ );        /* signature */                  in_uint8s(s, 8);        /* signature */
42                  sec_decrypt(s->p, s->end - s->p);                  sec_decrypt(s->p, s->end - s->p);
43          }          }
44    
# Line 41  rdp5_process(STREAM s, BOOL encryption, Line 47  rdp5_process(STREAM s, BOOL encryption,
47          hexdump(s->p, s->end - s->p);          hexdump(s->p, s->end - s->p);
48  #endif  #endif
49    
50            ui_begin_update();
51          while (s->p < s->end)          while (s->p < s->end)
52          {          {
53                  in_uint8(s, type);                  in_uint8(s, type);
54                  in_uint16_le(s, length);                  if (type & RDP_COMPRESSION)
55                  next_packet = next = s->p + length;                  {
56                            in_uint8(s, ctype);
57                            in_uint16_le(s, length);
58                            type ^= RDP_COMPRESSION;
59                    }
60                    else
61                    {
62                            ctype = 0;
63                            in_uint16_le(s, length);
64                    }
65                    g_next_packet = next = s->p + length;
66    
67                    if (ctype & RDP_MPPC_COMPRESSED)
68                    {
69    
70                            if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
71                                    error("error while decompressing packet\n");
72    
73                            /* allocate memory and copy the uncompressed data into the temporary stream */
74                            ns->data = (uint8 *) xrealloc(ns->data, rlen);
75    
76                            memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen);
77    
78                            ns->size = rlen;
79                            ns->end = (ns->data + ns->size);
80                            ns->p = ns->data;
81                            ns->rdp_hdr = ns->p;
82    
83                            ts = ns;
84                    }
85                    else
86                            ts = s;
87    
88                  switch (type)                  switch (type)
89                  {                  {
90                                    /* Thanks to Jeroen Meijer <jdmeijer at yahoo
91                                       dot com> for finding out the meaning of
92                                       most of the opcodes here. Especially opcode
93                                       8! :) */
94                          case 0: /* orders */                          case 0: /* orders */
95                                  in_uint16_le(s, count);                                  in_uint16_le(ts, count);
96                                  process_orders(s, count);                                  process_orders(ts, count);
97                                  break;                                  break;
98                          case 1: /* bitmap update (???) */                          case 1: /* bitmap update (???) */
99                                  in_uint8s(s, 2);        /* part length */                                  in_uint8s(ts, 2);       /* part length */
100                                  process_bitmap_updates(s);                                  process_bitmap_updates(ts);
101                                  break;                                  break;
102                          case 2: /* palette */                          case 2: /* palette */
103                                  in_uint8s(s, 2);        /* uint16 = 2 */                                  in_uint8s(ts, 2);       /* uint16 = 2 */
104                                  process_palette(s);                                  process_palette(ts);
105                                  break;                                  break;
106                          case 3: /* probably an palette with offset 3. Weird */                          case 3: /* probably an palette with offset 3. Weird */
107                                  break;                                  break;
108                          case 5:                          case 5:
109                                  process_null_system_pointer_pdu(s);                                  ui_set_null_cursor();
110                                    break;
111                            case 8:
112                                    in_uint16_le(ts, x);
113                                    in_uint16_le(ts, y);
114                                    if (s_check(ts))
115                                            ui_move_pointer(x, y);
116                                  break;                                  break;
117                          case 9:                          case 9:
118                                  process_colour_pointer_pdu(s);                                  process_colour_pointer_pdu(ts);
119                                  break;                                  break;
120                          case 10:                          case 10:
121                                  process_cached_pointer_pdu(s);                                  process_cached_pointer_pdu(ts);
122                                  break;                                  break;
123                          default:                          default:
124                                  unimpl("RDP5 opcode %d\n", type);                                  unimpl("RDP5 opcode %d\n", type);
# Line 78  rdp5_process(STREAM s, BOOL encryption, Line 126  rdp5_process(STREAM s, BOOL encryption,
126    
127                  s->p = next;                  s->p = next;
128          }          }
129  }          ui_end_update();
   
 void  
 rdp5_process_channel(STREAM s, uint16 channelno)  
 {  
         rdp5_channel *channel;  
         channel = find_channel_by_channelno(channelno);  
         if (NULL != channel)  
         {  
                 channel->channelcallback(s, channelno);  
         }  
130  }  }

Legend:
Removed from v.411  
changed lines
  Added in v.713

  ViewVC Help
Powered by ViewVC 1.1.26