]> git.sesse.net Git - rdpsrv/commitdiff
Support CJrq/CJcf.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 4 Feb 2005 00:30:28 +0000 (00:30 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 4 Feb 2005 00:30:28 +0000 (00:30 +0000)
mcs.c

diff --git a/mcs.c b/mcs.c
index 460e0d4b6610957900c42c8dc2514807b5265583..aa8e90357d71fd4616d7300154c2fb339398fc54 100644 (file)
--- a/mcs.c
+++ b/mcs.c
@@ -250,35 +250,20 @@ mcs_send_cjrq(uint16 chanid)
 }
 
 /* Expect a CJcf message (ASN.1 PER) */
-static BOOL
-mcs_recv_cjcf(void)
+static void
+mcs_send_cjcf(uint16 userid, uint16 chanid)
 {
-       uint8 opcode, result;
        STREAM s;
 
-       s = iso_recv();
-       if (s == NULL)
-               return False;
-
-       in_uint8(s, opcode);
-       if ((opcode >> 2) != MCS_CJCF)
-       {
-               error("expected CJcf, got %d\n", opcode);
-               return False;
-       }
-
-       in_uint8(s, result);
-       if (result != 0)
-       {
-               error("CJrq: %d\n", result);
-               return False;
-       }
+       s = iso_init(5);
 
-       in_uint8s(s, 4);        /* mcs_userid, req_chanid */
-       if (opcode & 2)
-               in_uint8s(s, 2);        /* join_chanid */
+       out_uint8(s, (MCS_CJCF << 2));
+       out_uint8(s, 0); // success
+       out_uint16_be(s, g_mcs_userid);
+       out_uint16_be(s, chanid);
 
-       return s_check_end(s);
+       s_mark_end(s);
+       iso_send(s);
 }
 
 /* Initialise an MCS transport data packet */
@@ -323,7 +308,7 @@ mcs_send(STREAM s)
 STREAM
 mcs_recv(uint16 * channel)
 {
-       uint8 opcode, appid, length;
+       uint8 opcode, appid, length, userid;
        STREAM s;
 
        s = iso_recv();
@@ -354,6 +339,13 @@ mcs_recv(uint16 * channel)
                printf("Received AUrq, sending AUcf\n");
                mcs_send_aucf(0);
                return NULL;
+       case MCS_CJRQ:
+               // Channel Join Request, respond with CJcf (Channel Join Confirm);
+               in_uint16_be(s, userid);
+               in_uint16_be(s, *channel);
+               printf("Received CJrq for channel %hu, sending CJcf\n", *channel);
+               mcs_send_cjcf(userid, *channel);
+               return NULL;
        default:
                error("expected data, got %d\n", opcode);
                return NULL;