/[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 28 by matty, Wed Jun 20 13:54:48 2001 UTC revision 30 by matty, Fri Sep 14 13:51:38 2001 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-2000     Copyright (C) Matthew Chapman 1999-2001
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 24  extern uint16 mcs_userid; Line 24  extern uint16 mcs_userid;
24  extern char username[16];  extern char username[16];
25  extern BOOL bitmap_compression;  extern BOOL bitmap_compression;
26  extern BOOL orders;  extern BOOL orders;
27  extern BOOL use_encryption;  extern BOOL encryption;
28  extern BOOL desktop_save;  extern BOOL desktop_save;
29    
30  uint8 *next_packet;  uint8 *next_packet;
# Line 36  rdp_init(int maxlen) Line 36  rdp_init(int maxlen)
36  {  {
37          STREAM s;          STREAM s;
38    
39          s = sec_init(use_encryption ? SEC_ENCRYPT : 0, maxlen + 6);          s = sec_init(encryption ? SEC_ENCRYPT : 0, maxlen + 6);
40          s_push_layer(s, rdp_hdr, 6);          s_push_layer(s, rdp_hdr, 6);
41    
42          return s;          return s;
# Line 55  rdp_send(STREAM s, uint8 pdu_type) Line 55  rdp_send(STREAM s, uint8 pdu_type)
55          out_uint16_le(s, (pdu_type | 0x10));    /* Version 1 */          out_uint16_le(s, (pdu_type | 0x10));    /* Version 1 */
56          out_uint16_le(s, (mcs_userid + 1001));          out_uint16_le(s, (mcs_userid + 1001));
57    
58          sec_send(s, use_encryption ? SEC_ENCRYPT : 0);          sec_send(s, encryption ? SEC_ENCRYPT : 0);
59  }  }
60    
61  /* Receive an RDP packet */  /* Receive an RDP packet */
# Line 83  rdp_recv(uint8 *type) Line 83  rdp_recv(uint8 *type)
83          in_uint8s(rdp_s, 2);    /* userid */          in_uint8s(rdp_s, 2);    /* userid */
84          *type = pdu_type & 0xf;          *type = pdu_type & 0xf;
85    
86  #if RDP_DEBUG  #if WITH_DEBUG
87          DEBUG("RDP packet (type %x):\n", *type);          DEBUG(("RDP packet (type %x):\n", *type));
88          hexdump(next_packet, length);          hexdump(next_packet, length);
89  #endif /*  */  #endif /*  */
90    
# Line 98  rdp_init_data(int maxlen) Line 98  rdp_init_data(int maxlen)
98  {  {
99          STREAM s;          STREAM s;
100    
101          s = sec_init(use_encryption ? SEC_ENCRYPT : 0, maxlen + 18);          s = sec_init(encryption ? SEC_ENCRYPT : 0, maxlen + 18);
102          s_push_layer(s, rdp_hdr, 18);          s_push_layer(s, rdp_hdr, 18);
103    
104          return s;          return s;
# Line 125  rdp_send_data(STREAM s, uint8 data_pdu_t Line 125  rdp_send_data(STREAM s, uint8 data_pdu_t
125          out_uint8(s, 0);        /* compress_type */          out_uint8(s, 0);        /* compress_type */
126          out_uint16(s, 0);       /* compress_len */          out_uint16(s, 0);       /* compress_len */
127    
128          sec_send(s, use_encryption ? SEC_ENCRYPT : 0);          sec_send(s, encryption ? SEC_ENCRYPT : 0);
129  }  }
130    
131  /* Output a string in Unicode */  /* Output a string in Unicode */
# Line 155  rdp_send_logon_info(uint32 flags, char * Line 155  rdp_send_logon_info(uint32 flags, char *
155          int len_password = 2 * strlen(password);          int len_password = 2 * strlen(password);
156          int len_program = 2 * strlen(program);          int len_program = 2 * strlen(program);
157          int len_directory = 2 * strlen(directory);          int len_directory = 2 * strlen(directory);
158          uint32 sec_flags = use_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT)          uint32 sec_flags = encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT)
159                                  : SEC_LOGON_INFO;                                  : SEC_LOGON_INFO;
160          STREAM s;          STREAM s;
161    
# Line 479  process_demand_active(STREAM s) Line 479  process_demand_active(STREAM s)
479    
480          in_uint32_le(s, rdp_shareid);          in_uint32_le(s, rdp_shareid);
481    
482          DEBUG("DEMAND_ACTIVE(id=0x%x)\n", rdp_shareid);          DEBUG(("DEMAND_ACTIVE(id=0x%x)\n", rdp_shareid));
483    
484          rdp_send_confirm_active();          rdp_send_confirm_active();
485          rdp_send_synchronise();          rdp_send_synchronise();
# Line 538  process_pointer_pdu(STREAM s) Line 538  process_pointer_pdu(STREAM s)
538                          break;                          break;
539    
540                  default:                  default:
541                          DEBUG("Pointer message 0x%x\n", message_type);                          DEBUG(("Pointer message 0x%x\n", message_type));
542          }          }
543  }  }
544    
# Line 569  process_bitmap_updates(STREAM s) Line 569  process_bitmap_updates(STREAM s)
569                  cx = right - left + 1;                  cx = right - left + 1;
570                  cy = bottom - top + 1;                  cy = bottom - top + 1;
571    
572                  DEBUG("UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,cmp=%d)\n",                  DEBUG(("UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,cmp=%d)\n",
573                        left, top, right, bottom, width, height, compress);                         left, top, right, bottom, width, height, compress));
574    
575                  if (!compress)                  if (!compress)
576                  {                  {
# Line 610  process_palette(STREAM s) Line 610  process_palette(STREAM s)
610  {  {
611          HCOLOURMAP hmap;          HCOLOURMAP hmap;
612          COLOURMAP map;          COLOURMAP map;
613            uint8 *colours;
614    
615          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
616          in_uint16_le(s, map.ncolours);          in_uint16_le(s, map.ncolours);
617          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
618          in_uint8p(s, (uint8 *) map.colours, (map.ncolours * 3));          in_uint8p(s, colours, (map.ncolours * 3));
619            map.colours = (COLOURENTRY *)colours;
620    
621          hmap = ui_create_colourmap(&map);          hmap = ui_create_colourmap(&map);
622          ui_set_colourmap(hmap);          ui_set_colourmap(hmap);
# Line 646  process_update_pdu(STREAM s) Line 648  process_update_pdu(STREAM s)
648                          break;                          break;
649    
650                  default:                  default:
651                          NOTIMP("update %d\n", update_type);                          unimpl("update %d\n", update_type);
652          }          }
653    
654  }  }
# Line 680  process_data_pdu(STREAM s) Line 682  process_data_pdu(STREAM s)
682                          break;                          break;
683    
684                  default:                  default:
685                          NOTIMP("data PDU %d\n", data_pdu_type);                          unimpl("data PDU %d\n", data_pdu_type);
686          }          }
687  }  }
688    
# Line 707  rdp_main_loop() Line 709  rdp_main_loop()
709                                  break;                                  break;
710    
711                          default:                          default:
712                                  NOTIMP("PDU %d\n", type);                                  unimpl("PDU %d\n", type);
713                  }                  }
714          }          }
715  }  }

Legend:
Removed from v.28  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26