/[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 24 by matty, Sat Jan 6 03:12:10 2001 UTC revision 25 by matty, Sat Jan 6 03:47:04 2001 UTC
# Line 28  unsigned char *next_packet; Line 28  unsigned char *next_packet;
28  uint32 rdp_shareid;  uint32 rdp_shareid;
29    
30  /* Initialise an RDP packet */  /* Initialise an RDP packet */
31  static STREAM rdp_init(int maxlen)  static STREAM
32    rdp_init(int maxlen)
33  {  {
34          STREAM s;          STREAM s;
35    
# Line 39  static STREAM rdp_init(int maxlen) Line 40  static STREAM rdp_init(int maxlen)
40  }  }
41    
42  /* Send an RDP packet */  /* Send an RDP packet */
43  static void rdp_send(STREAM s, uint8 pdu_type)  static void
44    rdp_send(STREAM s, uint8 pdu_type)
45  {  {
46          uint16 length;          uint16 length;
47    
# Line 54  static void rdp_send(STREAM s, uint8 pdu Line 56  static void rdp_send(STREAM s, uint8 pdu
56  }  }
57    
58  /* Receive an RDP packet */  /* Receive an RDP packet */
59  static STREAM rdp_recv(uint8 *type)  static STREAM
60    rdp_recv(uint8 *type)
61  {  {
62          static STREAM rdp_s;          static STREAM rdp_s;
63          uint16 length, pdu_type;          uint16 length, pdu_type;
# Line 88  static STREAM rdp_recv(uint8 *type) Line 91  static STREAM rdp_recv(uint8 *type)
91  }  }
92    
93  /* Initialise an RDP data packet */  /* Initialise an RDP data packet */
94  static STREAM rdp_init_data(int maxlen)  static STREAM
95    rdp_init_data(int maxlen)
96  {  {
97          STREAM s;          STREAM s;
98    
# Line 99  static STREAM rdp_init_data(int maxlen) Line 103  static STREAM rdp_init_data(int maxlen)
103  }  }
104    
105  /* Send an RDP data packet */  /* Send an RDP data packet */
106  static void rdp_send_data(STREAM s, uint8 data_pdu_type)  static void
107    rdp_send_data(STREAM s, uint8 data_pdu_type)
108  {  {
109          uint16 length;          uint16 length;
110    
# Line 122  static void rdp_send_data(STREAM s, uint Line 127  static void rdp_send_data(STREAM s, uint
127  }  }
128    
129  /* Output a string in Unicode */  /* Output a string in Unicode */
130  void rdp_out_unistr(STREAM s, char *string, int len)  void
131    rdp_out_unistr(STREAM s, char *string, int len)
132  {  {
133          int i = 0, j = 0;          int i = 0, j = 0;
134    
# Line 138  void rdp_out_unistr(STREAM s, char *stri Line 144  void rdp_out_unistr(STREAM s, char *stri
144  }  }
145    
146  /* Parse a logon info packet */  /* Parse a logon info packet */
147  static void rdp_send_logon_info(uint32 flags, char *domain, char *user,  static void
148                                  char *password, char *program,  rdp_send_logon_info(uint32 flags, char *domain, char *user,
149                                  char *directory)                      char *password, char *program, char *directory)
150  {  {
151          int len_domain = 2 * strlen(domain);          int len_domain = 2 * strlen(domain);
152          int len_user = 2 * strlen(user);          int len_user = 2 * strlen(user);
# Line 171  static void rdp_send_logon_info(uint32 f Line 177  static void rdp_send_logon_info(uint32 f
177  }  }
178    
179  /* Send a control PDU */  /* Send a control PDU */
180  static void rdp_send_control(uint16 action)  static void
181    rdp_send_control(uint16 action)
182  {  {
183          STREAM s;          STREAM s;
184    
# Line 186  static void rdp_send_control(uint16 acti Line 193  static void rdp_send_control(uint16 acti
193  }  }
194    
195  /* Send a synchronisation PDU */  /* Send a synchronisation PDU */
196  static void rdp_send_synchronise()  static void
197    rdp_send_synchronise()
198  {  {
199          STREAM s;          STREAM s;
200    
# Line 200  static void rdp_send_synchronise() Line 208  static void rdp_send_synchronise()
208  }  }
209    
210  /* Send a single input event */  /* Send a single input event */
211  void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags,  void
212                      uint16 param1, uint16 param2)  rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags,
213                   uint16 param1, uint16 param2)
214  {  {
215          STREAM s;          STREAM s;
216    
# Line 221  void rdp_send_input(uint32 time, uint16 Line 230  void rdp_send_input(uint32 time, uint16
230  }  }
231    
232  /* Send an (empty) font information PDU */  /* Send an (empty) font information PDU */
233  static void rdp_send_fonts(uint16 seq)  static void
234    rdp_send_fonts(uint16 seq)
235  {  {
236          STREAM s;          STREAM s;
237    
# Line 237  static void rdp_send_fonts(uint16 seq) Line 247  static void rdp_send_fonts(uint16 seq)
247  }  }
248    
249  /* Output general capability set */  /* Output general capability set */
250  static void rdp_out_general_caps(STREAM s)  static void
251    rdp_out_general_caps(STREAM s)
252  {  {
253          out_uint16_le(s, RDP_CAPSET_GENERAL);          out_uint16_le(s, RDP_CAPSET_GENERAL);
254          out_uint16_le(s, RDP_CAPLEN_GENERAL);          out_uint16_le(s, RDP_CAPLEN_GENERAL);
# Line 255  static void rdp_out_general_caps(STREAM Line 266  static void rdp_out_general_caps(STREAM
266  }  }
267    
268  /* Output bitmap capability set */  /* Output bitmap capability set */
269  static void rdp_out_bitmap_caps(STREAM s)  static void
270    rdp_out_bitmap_caps(STREAM s)
271  {  {
272          out_uint16_le(s, RDP_CAPSET_BITMAP);          out_uint16_le(s, RDP_CAPSET_BITMAP);
273          out_uint16_le(s, RDP_CAPLEN_BITMAP);          out_uint16_le(s, RDP_CAPLEN_BITMAP);
# Line 275  static void rdp_out_bitmap_caps(STREAM s Line 287  static void rdp_out_bitmap_caps(STREAM s
287  }  }
288    
289  /* Output order capability set */  /* Output order capability set */
290  static void rdp_out_order_caps(STREAM s)  static void
291    rdp_out_order_caps(STREAM s)
292  {  {
293          uint8 order_caps[32];          uint8 order_caps[32];
294    
# Line 300  static void rdp_out_order_caps(STREAM s) Line 313  static void rdp_out_order_caps(STREAM s)
313  }  }
314    
315  /* Output bitmap cache capability set */  /* Output bitmap cache capability set */
316  static void rdp_out_bmpcache_caps(STREAM s)  static void
317    rdp_out_bmpcache_caps(STREAM s)
318  {  {
319          out_uint16_le(s, RDP_CAPSET_BMPCACHE);          out_uint16_le(s, RDP_CAPSET_BMPCACHE);
320          out_uint16_le(s, RDP_CAPLEN_BMPCACHE);          out_uint16_le(s, RDP_CAPLEN_BMPCACHE);
# Line 315  static void rdp_out_bmpcache_caps(STREAM Line 329  static void rdp_out_bmpcache_caps(STREAM
329  }  }
330    
331  /* Output control capability set */  /* Output control capability set */
332  static void rdp_out_control_caps(STREAM s)  static void
333    rdp_out_control_caps(STREAM s)
334  {  {
335          out_uint16_le(s, RDP_CAPSET_CONTROL);          out_uint16_le(s, RDP_CAPSET_CONTROL);
336          out_uint16_le(s, RDP_CAPLEN_CONTROL);          out_uint16_le(s, RDP_CAPLEN_CONTROL);
# Line 327  static void rdp_out_control_caps(STREAM Line 342  static void rdp_out_control_caps(STREAM
342  }  }
343    
344  /* Output activation capability set */  /* Output activation capability set */
345  static void rdp_out_activate_caps(STREAM s)  static void
346    rdp_out_activate_caps(STREAM s)
347  {  {
348          out_uint16_le(s, RDP_CAPSET_ACTIVATE);          out_uint16_le(s, RDP_CAPSET_ACTIVATE);
349          out_uint16_le(s, RDP_CAPLEN_ACTIVATE);          out_uint16_le(s, RDP_CAPLEN_ACTIVATE);
# Line 339  static void rdp_out_activate_caps(STREAM Line 355  static void rdp_out_activate_caps(STREAM
355  }  }
356    
357  /* Output pointer capability set */  /* Output pointer capability set */
358  static void rdp_out_pointer_caps(STREAM s)  static void
359    rdp_out_pointer_caps(STREAM s)
360  {  {
361          out_uint16_le(s, RDP_CAPSET_POINTER);          out_uint16_le(s, RDP_CAPSET_POINTER);
362          out_uint16_le(s, RDP_CAPLEN_POINTER);          out_uint16_le(s, RDP_CAPLEN_POINTER);
# Line 349  static void rdp_out_pointer_caps(STREAM Line 366  static void rdp_out_pointer_caps(STREAM
366  }  }
367    
368  /* Output share capability set */  /* Output share capability set */
369  static void rdp_out_share_caps(STREAM s)  static void
370    rdp_out_share_caps(STREAM s)
371  {  {
372          out_uint16_le(s, RDP_CAPSET_SHARE);          out_uint16_le(s, RDP_CAPSET_SHARE);
373          out_uint16_le(s, RDP_CAPLEN_SHARE);          out_uint16_le(s, RDP_CAPLEN_SHARE);
# Line 359  static void rdp_out_share_caps(STREAM s) Line 377  static void rdp_out_share_caps(STREAM s)
377  }  }
378    
379  /* Output colour cache capability set */  /* Output colour cache capability set */
380  static void rdp_out_colcache_caps(STREAM s)  static void
381    rdp_out_colcache_caps(STREAM s)
382  {  {
383          out_uint16_le(s, RDP_CAPSET_COLCACHE);          out_uint16_le(s, RDP_CAPSET_COLCACHE);
384          out_uint16_le(s, RDP_CAPLEN_COLCACHE);          out_uint16_le(s, RDP_CAPLEN_COLCACHE);
# Line 371  static void rdp_out_colcache_caps(STREAM Line 390  static void rdp_out_colcache_caps(STREAM
390  static uint8 canned_caps[] = {  static uint8 canned_caps[] = {
391          0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x04,          0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x04,
392          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
393                  0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00,
394          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395                  0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00,
396          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397                  0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00,
398          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399                  0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00,
400          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401                  0x0C, 0x00, 0x08, 0x00, 0x01,          0x0C, 0x00, 0x08, 0x00, 0x01,
402          0x00, 0x00, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,          0x00, 0x00, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
403                  0x10, 0x00, 0x34, 0x00, 0xFE,          0x10, 0x00, 0x34, 0x00, 0xFE,
404          0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x08, 0x00,          0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x08, 0x00,
405                  0xFE, 0x00, 0x08, 0x00, 0xFE,          0xFE, 0x00, 0x08, 0x00, 0xFE,
406          0x00, 0x10, 0x00, 0xFE, 0x00, 0x20, 0x00, 0xFE, 0x00, 0x40, 0x00,          0x00, 0x10, 0x00, 0xFE, 0x00, 0x20, 0x00, 0xFE, 0x00, 0x40, 0x00,
407                  0xFE, 0x00, 0x80, 0x00, 0xFE,          0xFE, 0x00, 0x80, 0x00, 0xFE,
408          0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01,          0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01,
409                  0x02, 0x00, 0x00, 0x00          0x02, 0x00, 0x00, 0x00
410  };  };
411    
412  /* Output unknown capability set */  /* Output unknown capability set */
413  static void rdp_out_unknown_caps(STREAM s)  static void
414    rdp_out_unknown_caps(STREAM s)
415  {  {
416          out_uint16_le(s, RDP_CAPSET_UNKNOWN);          out_uint16_le(s, RDP_CAPSET_UNKNOWN);
417          out_uint16_le(s, 0x58);          out_uint16_le(s, 0x58);
# Line 400  static void rdp_out_unknown_caps(STREAM Line 420  static void rdp_out_unknown_caps(STREAM
420  }  }
421    
422  /* Send a confirm active PDU */  /* Send a confirm active PDU */
423  static void rdp_send_confirm_active()  static void
424    rdp_send_confirm_active()
425  {  {
426          STREAM s;          STREAM s;
427          uint16 caplen =          uint16 caplen =
# Line 436  static void rdp_send_confirm_active() Line 457  static void rdp_send_confirm_active()
457  }  }
458    
459  /* Respond to a demand active PDU */  /* Respond to a demand active PDU */
460  static void process_demand_active(STREAM s)  static void
461    process_demand_active(STREAM s)
462  {  {
463          uint8 type;          uint8 type;
464    
# Line 459  static void process_demand_active(STREAM Line 481  static void process_demand_active(STREAM
481  }  }
482    
483  /* Process a pointer PDU */  /* Process a pointer PDU */
484  static void process_pointer_pdu(STREAM s)  static void
485    process_pointer_pdu(STREAM s)
486  {  {
487          uint16 message_type;          uint16 message_type;
488          uint16 x, y;          uint16 x, y;
# Line 482  static void process_pointer_pdu(STREAM s Line 505  static void process_pointer_pdu(STREAM s
505  }  }
506    
507  /* Process bitmap updates */  /* Process bitmap updates */
508  static void process_bitmap_updates(STREAM s)  static void
509    process_bitmap_updates(STREAM s)
510  {  {
511          uint16 num_updates;          uint16 num_updates;
512          uint16 left, top, right, bottom, width, height;          uint16 left, top, right, bottom, width, height;
# Line 535  static void process_bitmap_updates(STREA Line 559  static void process_bitmap_updates(STREA
559  }  }
560    
561  /* Process a palette update */  /* Process a palette update */
562  static void process_palette(STREAM s)  static void
563    process_palette(STREAM s)
564  {  {
565          HCOLOURMAP hmap;          HCOLOURMAP hmap;
566          COLOURMAP map;          COLOURMAP map;
# Line 550  static void process_palette(STREAM s) Line 575  static void process_palette(STREAM s)
575  }  }
576    
577  /* Process an update PDU */  /* Process an update PDU */
578  static void process_update_pdu(STREAM s)  static void
579    process_update_pdu(STREAM s)
580  {  {
581          uint16 update_type;          uint16 update_type;
582    
# Line 580  static void process_update_pdu(STREAM s) Line 606  static void process_update_pdu(STREAM s)
606  }  }
607    
608  /* Process data PDU */  /* Process data PDU */
609  static void process_data_pdu(STREAM s)  static void
610    process_data_pdu(STREAM s)
611  {  {
612          uint8 data_pdu_type;          uint8 data_pdu_type;
613    
# Line 612  static void process_data_pdu(STREAM s) Line 639  static void process_data_pdu(STREAM s)
639  }  }
640    
641  /* Process incoming packets */  /* Process incoming packets */
642  void rdp_main_loop()  void
643    rdp_main_loop()
644  {  {
645          uint8 type;          uint8 type;
646          STREAM s;          STREAM s;
# Line 639  void rdp_main_loop() Line 667  void rdp_main_loop()
667  }  }
668    
669  /* Establish a connection up to the RDP layer */  /* Establish a connection up to the RDP layer */
670  BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password,  BOOL
671                   char *command, char *directory)  rdp_connect(char *server, uint32 flags, char *domain, char *password,
672                char *command, char *directory)
673  {  {
674          if (!sec_connect(server))          if (!sec_connect(server))
675                  return False;                  return False;
# Line 651  BOOL rdp_connect(char *server, uint32 fl Line 680  BOOL rdp_connect(char *server, uint32 fl
680  }  }
681    
682  /* Disconnect from the RDP layer */  /* Disconnect from the RDP layer */
683  void rdp_disconnect()  void
684    rdp_disconnect()
685  {  {
686          sec_disconnect();          sec_disconnect();
687  }  }

Legend:
Removed from v.24  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.26