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

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

revision 733 by jsorg71, Mon Jul 5 19:09:07 2004 UTC revision 1475 by jsorg71, Fri Jul 11 03:51:23 2008 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Protocol services - Multipoint Communications Service     Protocol services - Multipoint Communications Service
4     Copyright (C) Matthew Chapman 1999-2002     Copyright (C) Matthew Chapman 1999-2008
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
8     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.     (at your option) any later version.
10      
11     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.     GNU General Public License for more details.
15      
16     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Line 25  extern VCHANNEL g_channels[]; Line 25  extern VCHANNEL g_channels[];
25  extern unsigned int g_num_channels;  extern unsigned int g_num_channels;
26    
27  /* Parse an ASN.1 BER header */  /* Parse an ASN.1 BER header */
28  static BOOL  static RD_BOOL
29  ber_parse_header(STREAM s, int tagval, int *length)  ber_parse_header(STREAM s, int tagval, int *length)
30  {  {
31          int tag, len;          int tag, len;
# Line 36  ber_parse_header(STREAM s, int tagval, i Line 36  ber_parse_header(STREAM s, int tagval, i
36          }          }
37          else          else
38          {          {
39          in_uint8(s, tag)}                  in_uint8(s, tag);
40            }
41    
42          if (tag != tagval)          if (tag != tagval)
43          {          {
# Line 105  mcs_out_domain_params(STREAM s, int max_ Line 106  mcs_out_domain_params(STREAM s, int max_
106  }  }
107    
108  /* Parse a DOMAIN_PARAMS structure (ASN.1 BER) */  /* Parse a DOMAIN_PARAMS structure (ASN.1 BER) */
109  static BOOL  static RD_BOOL
110  mcs_parse_domain_params(STREAM s)  mcs_parse_domain_params(STREAM s)
111  {  {
112          int length;          int length;
# Line 147  mcs_send_connect_initial(STREAM mcs_data Line 148  mcs_send_connect_initial(STREAM mcs_data
148  }  }
149    
150  /* Expect a MCS_CONNECT_RESPONSE message (ASN.1 BER) */  /* Expect a MCS_CONNECT_RESPONSE message (ASN.1 BER) */
151  static BOOL  static RD_BOOL
152  mcs_recv_connect_response(STREAM mcs_data)  mcs_recv_connect_response(STREAM mcs_data)
153  {  {
154          uint8 result;          uint8 result;
# Line 221  mcs_send_aurq(void) Line 222  mcs_send_aurq(void)
222  }  }
223    
224  /* Expect a AUcf message (ASN.1 PER) */  /* Expect a AUcf message (ASN.1 PER) */
225  static BOOL  static RD_BOOL
226  mcs_recv_aucf(uint16 * mcs_userid)  mcs_recv_aucf(uint16 * mcs_userid)
227  {  {
228          uint8 opcode, result;          uint8 opcode, result;
# Line 270  mcs_send_cjrq(uint16 chanid) Line 271  mcs_send_cjrq(uint16 chanid)
271  }  }
272    
273  /* Expect a CJcf message (ASN.1 PER) */  /* Expect a CJcf message (ASN.1 PER) */
274  static BOOL  static RD_BOOL
275  mcs_recv_cjcf(void)  mcs_recv_cjcf(void)
276  {  {
277          uint8 opcode, result;          uint8 opcode, result;
# Line 372  mcs_recv(uint16 * channel, uint8 * rdpve Line 373  mcs_recv(uint16 * channel, uint8 * rdpve
373  }  }
374    
375  /* Establish a connection up to the MCS layer */  /* Establish a connection up to the MCS layer */
376  BOOL  RD_BOOL
377  mcs_connect(char *server, STREAM mcs_data, char *username)  mcs_connect(char *server, STREAM mcs_data, char *username)
378  {  {
379          unsigned int i;          unsigned int i;
# Line 412  mcs_connect(char *server, STREAM mcs_dat Line 413  mcs_connect(char *server, STREAM mcs_dat
413          return False;          return False;
414  }  }
415    
416    /* Establish a connection up to the MCS layer */
417    RD_BOOL
418    mcs_reconnect(char *server, STREAM mcs_data)
419    {
420            unsigned int i;
421    
422            if (!iso_reconnect(server))
423                    return False;
424    
425            mcs_send_connect_initial(mcs_data);
426            if (!mcs_recv_connect_response(mcs_data))
427                    goto error;
428    
429            mcs_send_edrq();
430    
431            mcs_send_aurq();
432            if (!mcs_recv_aucf(&g_mcs_userid))
433                    goto error;
434    
435            mcs_send_cjrq(g_mcs_userid + MCS_USERCHANNEL_BASE);
436    
437            if (!mcs_recv_cjcf())
438                    goto error;
439    
440            mcs_send_cjrq(MCS_GLOBAL_CHANNEL);
441            if (!mcs_recv_cjcf())
442                    goto error;
443    
444            for (i = 0; i < g_num_channels; i++)
445            {
446                    mcs_send_cjrq(g_channels[i].mcs_id);
447                    if (!mcs_recv_cjcf())
448                            goto error;
449            }
450            return True;
451    
452          error:
453            iso_disconnect();
454            return False;
455    }
456    
457  /* Disconnect from the MCS layer */  /* Disconnect from the MCS layer */
458  void  void
459  mcs_disconnect(void)  mcs_disconnect(void)
460  {  {
461          iso_disconnect();          iso_disconnect();
462  }  }
463    
464    /* reset the state of the mcs layer */
465    void
466    mcs_reset_state(void)
467    {
468            g_mcs_userid = 0;
469            iso_reset_state();
470    }

Legend:
Removed from v.733  
changed lines
  Added in v.1475

  ViewVC Help
Powered by ViewVC 1.1.26