/[rdesktop]/sourceforge.net/trunk/rdesktop/rdp.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/rdp.c

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

revision 176 by n-ki, Tue Sep 17 09:55:03 2002 UTC revision 309 by jsorg71, Tue Feb 4 05:32:13 2003 UTC
# Line 1  Line 1 
1  /*  /*
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Protocol services - RDP layer     Protocol services - RDP layer
4     Copyright (C) Matthew Chapman 1999-2001     Copyright (C) Matthew Chapman 1999-2002
5        
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     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
# Line 79  rdp_recv(uint8 * type) Line 79  rdp_recv(uint8 * type)
79          }          }
80    
81          in_uint16_le(rdp_s, length);          in_uint16_le(rdp_s, length);
82            /* 32k packets are really 8, keepalive fix */
83            if (length == 0x8000)
84            {
85                    next_packet += 8;
86                    *type = 0;
87                    return rdp_s;
88            }
89          in_uint16_le(rdp_s, pdu_type);          in_uint16_le(rdp_s, pdu_type);
90          in_uint8s(rdp_s, 2);    /* userid */          in_uint8s(rdp_s, 2);    /* userid */
91          *type = pdu_type & 0xf;          *type = pdu_type & 0xf;
# Line 196  rdp_send_control(uint16 action) Line 203  rdp_send_control(uint16 action)
203    
204  /* Send a synchronisation PDU */  /* Send a synchronisation PDU */
205  static void  static void
206  rdp_send_synchronise()  rdp_send_synchronise(void)
207  {  {
208          STREAM s;          STREAM s;
209    
# Line 434  rdp_out_unknown_caps(STREAM s) Line 441  rdp_out_unknown_caps(STREAM s)
441    
442  /* Send a confirm active PDU */  /* Send a confirm active PDU */
443  static void  static void
444  rdp_send_confirm_active()  rdp_send_confirm_active(void)
445  {  {
446          STREAM s;          STREAM s;
447          uint16 caplen =          uint16 caplen =
# Line 572  process_bitmap_updates(STREAM s) Line 579  process_bitmap_updates(STREAM s)
579                  if (!compress)                  if (!compress)
580                  {                  {
581                          int y;                          int y;
582                          bmpdata = xmalloc(width * height);                          bmpdata = xmalloc(width * height * (bpp / 8));
583                          for (y = 0; y < height; y++)                          for (y = 0; y < height; y++)
584                          {                          {
585                                  in_uint8a(s, &bmpdata[(height - y - 1) * width], width);                                  in_uint8a(s, &bmpdata[(height - y - 1) * (width * (bpp / 8))], width * (bpp / 8));
586                          }                          }
587                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
588                          xfree(bmpdata);                          xfree(bmpdata);
# Line 586  process_bitmap_updates(STREAM s) Line 593  process_bitmap_updates(STREAM s)
593                  in_uint16_le(s, size);                  in_uint16_le(s, size);
594                  in_uint8s(s, 4);        /* line_size, final_size */                  in_uint8s(s, 4);        /* line_size, final_size */
595                  in_uint8p(s, data, size);                  in_uint8p(s, data, size);
596                    bmpdata = xmalloc(width * height * (bpp / 8));
597                  bmpdata = xmalloc(width * height);                  if (bitmap_decompress(bmpdata, width, height, data, size, bpp))
                 if (bitmap_decompress(bmpdata, width, height, data, size))  
598                  {                  {
599                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
600                  }                  }
   
601                  xfree(bmpdata);                  xfree(bmpdata);
602          }          }
603  }  }
# Line 601  process_bitmap_updates(STREAM s) Line 606  process_bitmap_updates(STREAM s)
606  static void  static void
607  process_palette(STREAM s)  process_palette(STREAM s)
608  {  {
609          HCOLOURMAP hmap;          COLOURENTRY *entry;
610          COLOURMAP map;          COLOURMAP map;
611          uint8 *colours;          HCOLOURMAP hmap;
612            int i;
613    
614          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
615          in_uint16_le(s, map.ncolours);          in_uint16_le(s, map.ncolours);
616          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
617          in_uint8p(s, colours, (map.ncolours * 3));  
618          map.colours = (COLOURENTRY *) colours;          map.colours = xmalloc(3 * map.ncolours);
619    
620            for (i = 0; i < map.ncolours; i++)
621            {
622                    entry = &map.colours[i];
623                    in_uint8(s, entry->red);
624                    in_uint8(s, entry->green);
625                    in_uint8(s, entry->blue);
626            }
627    
628          hmap = ui_create_colourmap(&map);          hmap = ui_create_colourmap(&map);
629          ui_set_colourmap(hmap);          ui_set_colourmap(hmap);
630    
631            xfree(map.colours);
632  }  }
633    
634  /* Process an update PDU */  /* Process an update PDU */
# Line 681  process_data_pdu(STREAM s) Line 697  process_data_pdu(STREAM s)
697    
698  /* Process incoming packets */  /* Process incoming packets */
699  void  void
700  rdp_main_loop()  rdp_main_loop(void)
701  {  {
702          uint8 type;          uint8 type;
703          STREAM s;          STREAM s;
# Line 701  rdp_main_loop() Line 717  rdp_main_loop()
717                                  process_data_pdu(s);                                  process_data_pdu(s);
718                                  break;                                  break;
719    
720                            case 0:
721                                    break;
722    
723                          default:                          default:
724                                  unimpl("PDU %d\n", type);                                  unimpl("PDU %d\n", type);
725                  }                  }
# Line 721  rdp_connect(char *server, uint32 flags, Line 740  rdp_connect(char *server, uint32 flags,
740    
741  /* Disconnect from the RDP layer */  /* Disconnect from the RDP layer */
742  void  void
743  rdp_disconnect()  rdp_disconnect(void)
744  {  {
745          sec_disconnect();          sec_disconnect();
746  }  }

Legend:
Removed from v.176  
changed lines
  Added in v.309

  ViewVC Help
Powered by ViewVC 1.1.26