/[rdesktop]/jpeg/rdesktop/trunk/mcs.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 /jpeg/rdesktop/trunk/mcs.c

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

revision 7 by matty, Fri Jul 7 09:40:03 2000 UTC revision 9 by matty, Tue Jul 25 12:34:29 2000 UTC
# Line 33  HCONN mcs_connect(char *server) Line 33  HCONN mcs_connect(char *server)
33          mcs_send_connect_initial(conn);          mcs_send_connect_initial(conn);
34          if (!iso_recv(conn) || !mcs_io_connect_response(&conn->in, &mcr))          if (!iso_recv(conn) || !mcs_io_connect_response(&conn->in, &mcr))
35          {          {
36                  fprintf(stderr, "MCS error, expected Connect-Response\n");                  ERROR("MCS error, expected Connect-Response\n");
37                  iso_disconnect(conn);                  iso_disconnect(conn);
38                  return NULL;                  return NULL;
39          }          }
40    
41          if (mcr.result != 0)          if (mcr.result != 0)
42          {          {
43                  fprintf(stderr, "MCS-Connect-Initial failed, result %d\n",                  ERROR("MCS-Connect-Initial failed, result %d\n", mcr.result);
                         mcr.result);  
44                  iso_disconnect(conn);                  iso_disconnect(conn);
45                  return NULL;                  return NULL;
46          }          }
# Line 51  HCONN mcs_connect(char *server) Line 50  HCONN mcs_connect(char *server)
50          mcs_send_aurq(conn);          mcs_send_aurq(conn);
51          if (!iso_recv(conn) || !mcs_io_aucf(&conn->in, &aucf))          if (!iso_recv(conn) || !mcs_io_aucf(&conn->in, &aucf))
52          {          {
53                  fprintf(stderr, "MCS error, expected AUcf\n");                  ERROR("MCS error, expected AUcf\n");
54                  mcs_disconnect(conn);                  mcs_disconnect(conn);
55                  return NULL;                  return NULL;
56          }          }
57    
58          if (aucf.result != 0)          if (aucf.result != 0)
59          {          {
60                  fprintf(stderr, "AUrq failed, result %d\n", mcr.result);                  ERROR("AUrq failed, result %d\n", mcr.result);
61                  mcs_disconnect(conn);                  mcs_disconnect(conn);
62                  return NULL;                  return NULL;
63          }          }
# Line 82  BOOL mcs_join_channel(HCONN conn, uint16 Line 81  BOOL mcs_join_channel(HCONN conn, uint16
81          mcs_send_cjrq(conn, chanid);          mcs_send_cjrq(conn, chanid);
82          if (!iso_recv(conn) || !mcs_io_cjcf(&conn->in, &cjcf))          if (!iso_recv(conn) || !mcs_io_cjcf(&conn->in, &cjcf))
83          {          {
84                  fprintf(stderr, "MCS error, expected CJcf\n");                  ERROR("MCS error, expected CJcf\n");
85                  return False;                  return False;
86          }          }
87    
88          if (cjcf.result != 0)          if (cjcf.result != 0)
89          {          {
90                  fprintf(stderr, "CJrq failed, result %d\n", cjcf.result);                  ERROR("CJrq failed, result %d\n", cjcf.result);
91                  return False;                  return False;
92          }          }
93    
# Line 179  BOOL mcs_recv(HCONN conn, BOOL request) Line 178  BOOL mcs_recv(HCONN conn, BOOL request)
178          if (!iso_recv(conn) || !mcs_io_data(&conn->in, &data, request))          if (!iso_recv(conn) || !mcs_io_data(&conn->in, &data, request))
179                  return False;                  return False;
180    
 #ifdef MCS_DEBUG  
         fprintf(stderr, "MCS packet\n");  
         dump_data(conn->in.data+conn->in.offset, conn->in.end-conn->in.offset);  
 #endif  
   
181          conn->in.rdp_offset = conn->in.offset;          conn->in.rdp_offset = conn->in.offset;
182          return True;          return True;
183  }  }
# Line 216  char precanned_connect_userdata[] = { Line 210  char precanned_connect_userdata[] = {
210     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
211     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
212     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
213     0x00,0x01,0xca,0x00,0x00,0x02,0xc0,0x08,0x00,0x00,0x00,0x00,0x00 };     0x00,0x01,0xca,0x00,0x00,0x02,0xc0,0x08,0x00,
214       /* encryption disabled */ 0x00,0x00,0x00,0x00 };
215    
216    char precanned_connect_userdata_e[] = {
217    0x00,
218    0x05,0x00,0x14,0x7c,0x00,0x01,0x80,0x9e,0x00,0x08,0x00,0x10,0x00,0x01,0xc0,0x00,
219    0x44,0x75,0x63,0x61,0x80,0x90,0x01,0xc0,0x88,0x00,0x01,0x00,0x08,0x00,0x80,0x02,
220    0xe0,0x01,0x01,0xca,0x03,0xaa,0x09,0x04,0x00,0x00,0xa3,0x01,0x00,0x00,0x57,0x00,
221    0x49,0x00,0x4e,0x00,0x39,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
222    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,
223    0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
224    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
225    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
226    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
227    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xca,0x00,0x00,0x02,0xc0,
228    0x08,0x00,0x01,0x00,0x00,0x00
229    };
230    
231    char domain_data[] = {0x01};
232    
233  /* Initialise a MCS_CONNECT_INITIAL structure */  /* Initialise a MCS_CONNECT_INITIAL structure */
234  void mcs_make_connect_initial(MCS_CONNECT_INITIAL *mci)  void mcs_make_connect_initial(MCS_CONNECT_INITIAL *mci)
235  {  {
236          mci->calling_domain.length = 0;          mci->calling_domain.length = 1;
237          mci->calling_domain.data = NULL;          mci->calling_domain.data = domain_data;
238    
239          mci->called_domain.length = 0;          mci->called_domain.length = 1;
240          mci->called_domain.data = NULL;          mci->called_domain.data = domain_data;
241    
242          mci->upward_flag = 0xff;          mci->upward_flag = 0xff;
243    
# Line 267  BOOL ber_io_header(STREAM s, BOOL islong Line 279  BOOL ber_io_header(STREAM s, BOOL islong
279    
280          if (!res || (tag != tagval))          if (!res || (tag != tagval))
281          {          {
282                  fprintf(stderr, "Invalid ASN.1 tag\n");                  ERROR("Invalid ASN.1 tag\n");
283                  return False;                  return False;
284          }          }
285    
# Line 374  BOOL ber_io_uint8(STREAM s, uint8 *i, in Line 386  BOOL ber_io_uint8(STREAM s, uint8 *i, in
386    
387          if (length != 1)          if (length != 1)
388          {          {
389                  fprintf(stderr, "Wrong length for simple type\n");                  ERROR("Wrong length for simple type\n");
390                  return False;                  return False;
391          }          }
392    
# Line 441  BOOL mcs_io_edrq(STREAM s, MCS_EDRQ *edr Line 453  BOOL mcs_io_edrq(STREAM s, MCS_EDRQ *edr
453          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
454          if (pkt_opcode != opcode)          if (pkt_opcode != opcode)
455          {          {
456                  fprintf(stderr, "Expected EDrq, received %x\n", pkt_opcode);                  ERROR("Expected EDrq, received %x\n", pkt_opcode);
457                  return False;                  return False;
458          }          }
459    
# Line 461  BOOL mcs_io_aurq(STREAM s, MCS_AURQ *aur Line 473  BOOL mcs_io_aurq(STREAM s, MCS_AURQ *aur
473          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
474          if (pkt_opcode != opcode)          if (pkt_opcode != opcode)
475          {          {
476                  fprintf(stderr, "Expected AUrq, received %x\n", pkt_opcode);                  ERROR("Expected AUrq, received %x\n", pkt_opcode);
477                  return False;                  return False;
478          }          }
479    
# Line 478  BOOL mcs_io_aucf(STREAM s, MCS_AUCF *auc Line 490  BOOL mcs_io_aucf(STREAM s, MCS_AUCF *auc
490          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
491          if ((pkt_opcode & 0xfc) != opcode)          if ((pkt_opcode & 0xfc) != opcode)
492          {          {
493                  fprintf(stderr, "Expected AUcf, received %x\n", pkt_opcode);                  ERROR("Expected AUcf, received %x\n", pkt_opcode);
494                  return False;                  return False;
495          }          }
496    
# Line 499  BOOL mcs_io_cjrq(STREAM s, MCS_CJRQ *cjr Line 511  BOOL mcs_io_cjrq(STREAM s, MCS_CJRQ *cjr
511          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
512          if (pkt_opcode != opcode)          if (pkt_opcode != opcode)
513          {          {
514                  fprintf(stderr, "Expected CJrq, received %x\n", pkt_opcode);                  ERROR("Expected CJrq, received %x\n", pkt_opcode);
515                  return False;                  return False;
516          }          }
517    
# Line 519  BOOL mcs_io_cjcf(STREAM s, MCS_CJCF *cjc Line 531  BOOL mcs_io_cjcf(STREAM s, MCS_CJCF *cjc
531          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
532          if ((pkt_opcode & 0xfc) != opcode)          if ((pkt_opcode & 0xfc) != opcode)
533          {          {
534                  fprintf(stderr, "Expected CJcf, received %x\n", pkt_opcode);                  ERROR("Expected CJcf, received %x\n", pkt_opcode);
535                  return False;                  return False;
536          }          }
537    
# Line 543  BOOL mcs_io_data(STREAM s, MCS_DATA *dt, Line 555  BOOL mcs_io_data(STREAM s, MCS_DATA *dt,
555          res = prs_io_uint8(s, &pkt_opcode);          res = prs_io_uint8(s, &pkt_opcode);
556          if (pkt_opcode != opcode)          if (pkt_opcode != opcode)
557          {          {
558                  fprintf(stderr, "Expected MCS data, received %x\n", pkt_opcode);                  ERROR("Expected MCS data, received %x\n", pkt_opcode);
559                  return False;                  return False;
560          }          }
561    
         dt->length |= 0x8000;  
   
562          res = res ? msb_io_uint16(s, &dt->userid) : False;          res = res ? msb_io_uint16(s, &dt->userid) : False;
563          res = res ? msb_io_uint16(s, &dt->chanid) : False;          res = res ? msb_io_uint16(s, &dt->chanid) : False;
564          res = res ? prs_io_uint8 (s, &dt->flags ) : False;          res = res ? prs_io_uint8 (s, &dt->flags ) : False;
565    
566          if (s->marshall)          if (s->marshall)
567          {          {
568                    dt->length |= 0x8000;
569                  res = res ? msb_io_uint16(s, &dt->length) : False;                  res = res ? msb_io_uint16(s, &dt->length) : False;
570          }          }
571          else          else

Legend:
Removed from v.7  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26