libfreerdp-core: add initial vchan module.
authorVic Lee <llyzs@163.com>
Tue, 2 Aug 2011 18:03:02 +0000 (02:03 +0800)
committerVic Lee <llyzs@163.com>
Tue, 2 Aug 2011 18:03:02 +0000 (02:03 +0800)
libfreerdp-core/CMakeLists.txt
libfreerdp-core/freerdp.c
libfreerdp-core/rdp.c
libfreerdp-core/rdp.h
libfreerdp-core/vchan.c [new file with mode: 0644]
libfreerdp-core/vchan.h [new file with mode: 0644]

index b0895e0..5cfb79c 100644 (file)
@@ -80,6 +80,8 @@ set(LIBFREERDP_CORE_SRCS
        transport.h
        update.c
        update.h
+       vchan.c
+       vchan.h
 )
 
 add_library(freerdp-core SHARED ${LIBFREERDP_CORE_SRCS})
index d46c9be..24d15cd 100644 (file)
@@ -73,7 +73,7 @@ freerdp* freerdp_new()
 
        if (instance != NULL)
        {
-               rdpRdp* rdp = rdp_new();
+               rdpRdp* rdp = rdp_new(instance);
                instance->rdp = (void*) rdp;
                instance->input = rdp->input;
                instance->update = rdp->update;
index 1883e39..74d1949 100644 (file)
@@ -391,6 +391,10 @@ void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
                        }
                }
        }
+       else if (channelId != MCS_GLOBAL_CHANNEL_ID)
+       {
+               vchan_process(rdp->vchan, s, channelId);
+       }
        else
        {
                rdp_read_share_control_header(s, &pduLength, &pduType, &rdp->settings->pdu_source);
@@ -466,7 +470,7 @@ int rdp_check_fds(rdpRdp* rdp)
  * @return new RDP module
  */
 
-rdpRdp* rdp_new()
+rdpRdp* rdp_new(freerdp* instance)
 {
        rdpRdp* rdp;
 
@@ -483,6 +487,7 @@ rdpRdp* rdp_new()
                rdp->update = update_new(rdp);
                rdp->nego = nego_new(rdp->transport);
                rdp->mcs = mcs_new(rdp->transport);
+               rdp->vchan = vchan_new(instance);
        }
 
        return rdp;
@@ -503,6 +508,7 @@ void rdp_free(rdpRdp* rdp)
                input_free(rdp->input);
                update_free(rdp->update);
                mcs_free(rdp->mcs);
+               vchan_free(rdp->vchan);
                xfree(rdp);
        }
 }
index 52b0b38..5829d16 100644 (file)
@@ -34,6 +34,7 @@ typedef struct rdp_rdp rdpRdp;
 #include "transport.h"
 #include "connection.h"
 #include "capabilities.h"
+#include "vchan.h"
 
 #include <freerdp/freerdp.h>
 #include <freerdp/settings.h>
@@ -213,6 +214,7 @@ struct rdp_rdp
        struct rdp_settings* settings;
        struct rdp_registry* registry;
        struct rdp_transport* transport;
+       struct rdp_vchan* vchan;
 };
 
 void rdp_read_security_header(STREAM* s, uint16* flags);
@@ -239,7 +241,7 @@ void rdp_recv(rdpRdp* rdp);
 void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking);
 int rdp_check_fds(rdpRdp* rdp);
 
-rdpRdp* rdp_new();
+rdpRdp* rdp_new(freerdp* instance);
 void rdp_free(rdpRdp* rdp);
 
 #endif /* __RDP_H */
diff --git a/libfreerdp-core/vchan.c b/libfreerdp-core/vchan.c
new file mode 100644 (file)
index 0000000..3c2cbb1
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * Virtual Channels
+ *
+ * Copyright 2011 Vic Lee
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <freerdp/freerdp.h>
+#include <freerdp/utils/memory.h>
+#include <freerdp/utils/stream.h>
+
+#include "vchan.h"
+
+void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id)
+{
+       printf("vchan_process\n");
+}
+
+rdpVchan* vchan_new(freerdp* instance)
+{
+       rdpVchan* vchan;
+
+       vchan = xnew(rdpVchan);
+       vchan->instance = instance;
+
+       return vchan;
+}
+
+void vchan_free(rdpVchan* vchan)
+{
+       xfree(vchan);
+}
diff --git a/libfreerdp-core/vchan.h b/libfreerdp-core/vchan.h
new file mode 100644 (file)
index 0000000..16c6d04
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * Virtual Channels
+ *
+ * Copyright 2011 Vic Lee
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VCHAN_H
+#define __VCHAN_H
+
+struct rdp_vchan
+{
+       freerdp* instance;
+};
+typedef struct rdp_vchan rdpVchan;
+
+void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id);
+
+rdpVchan* vchan_new(freerdp* instance);
+void vchan_free(rdpVchan* vchan);
+
+#endif /* __VCHAN_H */