You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bluesky-commits@incubator.apache.org by pi...@apache.org on 2009/11/30 11:44:54 UTC

svn commit: r885383 [18/18] - in /incubator/bluesky/trunk/RealClass: DTU/ DTU/autom4te.cache/ DTU/src/ DTU/src/.deps/ Teacher/src/

Added: incubator/bluesky/trunk/RealClass/DTU/src/language_test.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/language_test.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/language_test.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/language_test.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,254 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 _LANGUAGE_TEST_H_
+#define _LANGUAGE_TEST_H_
+
+#define LANGUAGE_EN
+
+// Main Frame windows title
+extern char  * p_mainframe_WinTitle;
+
+//Toolbar---->menu start
+extern char  * p_Toolbar_Menu_Start;
+//Toolbar---->menu start---->type select
+extern char  * p_Toolbar_Menu_Start_Type;
+//Toolbar---->menu start---->logon Tserver
+extern char  * p_Toolbar_Menu_Start_Logon;
+//Toolbar---->menu start---->logout Tserver
+extern char  * p_Toolbar_Menu_Start_Logout;
+//Toolbar---->menu start---->exit system
+extern char  * p_Toolbar_Menu_Start_Exit;
+//Toolbar---->settings
+extern char  * p_Toolbar_Setting;
+//Toolbar---->settings---->set parameters
+extern char  * p_Toolbar_Setting_SetPara;
+//Toolbar---->Class options
+extern char  * p_Toolbar_ClassOption;
+//Toolbar---->Class options---->join class
+extern char  * p_Toolbar_ClassOption_Join;
+//Toolbar---->Class options---->quit class
+extern char  * p_Toolbar_ClassOption_Quit;
+//Toolbar---->Help
+extern char  * p_Toolbar_Help;
+//
+//
+//
+//													Toolbar
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//											Graphic buttons
+//
+//
+//Graphic buttons---->set parameters
+extern char  * p_GraphButt_SetPara;
+//Graphic buttons---->type select
+extern char  * p_GraphButt_TypeSel;
+//Graphic buttons---->logon Tserver
+extern char  * p_GraphButt_Logon;
+//Graphic buttons---->logout Tserver
+extern char  * p_GraphButt_Logout;
+//Graphic buttons---->join class
+extern char  * p_GraphButt_JoinClass;
+//Graphic buttons---->quit class
+extern char  * p_GraphButt_QuitClass;
+//
+//
+//
+//											Graphic buttons
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Table
+//
+//										Transmit Node List 
+//												
+//
+//
+//Transmit Node List members---->Transmit Node ID
+extern char  * p_TranNodeListMem_ID;
+//Transmit Node List members---->Transmit Node IP
+extern char  * p_TranNodeListMem_IP;
+//Transmit Node List members---->Teacher screen port
+extern char  * p_TranNodeListMem_TeacherScrPort;
+//Transmit Node List members---->Teacher video port
+extern char  * p_TranNodeListMem_TeacherVideoPort;
+//Transmit Node List members---->Teacher audio port
+extern char  * p_TranNodeListMem_TeacherAudioPort;
+//Transmit Node List members---->Students video port
+extern char  * p_TranNodeListMem_StuVideoPort;
+//Transmit Node List members---->Students audio port 
+extern char  * p_TranNodeListMem_StuAudioPort;
+//Transmit Node List Buttons---->Refresh list
+extern char  * p_TranNodeList_Butt_Refresh;
+//Transmit Node List Title
+extern char  * p_TranNodeList_Title;
+//
+//
+//
+//										Transmit Node List
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Table
+//
+//									 Transmit State List 
+//												
+//
+//
+//Transmit State List---->lable class name
+extern char  * p_TranStateList_labClassName;
+//Transmit State List---->lable teacher name
+extern char  * p_TranStateList_labTeacherName;
+//Transmit State List members---->Port ID
+extern char  * p_TranStateListMem_PortID;
+//Transmit State List members---->Port Number
+extern char  * p_TranStateListMem_PortNum;
+//Transmit State List members---->Instant bandwidth
+extern char  * p_TranStateListMem_InsBW;
+//Transmit State List members---->Average bandwidth
+extern char  * p_TranStateListMem_AvgBW;
+//Transmit State List members---->Transmit channel number
+extern char  * p_TranStateListMem_ChNum;
+//Transmit State List members---->Data packets number
+extern char  * p_TranStateListMem_PacketNum;
+//Transmit State List members---->Data packets size
+extern char  * p_TranStateListMem_PacketSize;
+//Transmit State List---->Table title
+extern char  * p_TranStateList_TabTitle;
+//
+//
+//
+//									 Transmit State List
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Table
+//
+//									 		MCU System Log
+//												
+//
+//
+//MCU System Log---->Buttons---->Clear
+extern char  * p_McuSysLog_Butt_Clr;
+//MCU System Log---->Table Title
+extern char  * p_McuSysLog_TabTitle;
+//
+//
+//
+//									 		MCU System Log
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Dialog
+//
+//									 	 MCU Set Parameter
+//												
+//
+//
+//MCU Set Parameter Dialog---->windows title
+extern char  * p_McuSetPara_WinTitle;
+//MCU Set Parameter Dialog---->Lable---->class server address
+extern char  * p_McuSetPara_Lable_ClassServerIP;
+//MCU Set Parameter Dialog---->Lable---->class server port
+extern char  * p_McuSetPara_Lable_ClassServerPort;
+//MCU Set Parameter Dialog---->Lable---->mcu server address
+extern char  * p_McuSetPara_Lable_McuServerIP;
+//MCU Set Parameter Dialog---->Lable---->mcu server send port
+extern char  * p_McuSetPara_Lable_McuServerSendPort;
+//MCU Set Parameter Dialog---->Button comments---->For professional user only
+extern char  * p_McuSetPara_ButtComm_Advanced;
+//MCU Set Parameter Dialog---->Buttons---->Advanced
+extern char  * p_McuSetPara_Butt_Advanced;
+//MCU Set Parameter Dialog---->Buttons---->Cancel
+extern char  * p_McuSetPara_Butt_Cancel;
+//MCU Set Parameter Dialog---->Buttons---->OK
+extern char  * p_McuSetPara_Butt_OK;
+//
+//
+//
+//									 	 MCU Set Parameter
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Dialog
+//
+//									 	 	MCU Type Select
+//												
+//
+//
+//Mcu Type Select Dialog---->windows title
+extern char  * p_McuTypeSel_WinTitle;
+//Mcu Type Select Dialog---->radio label---->main mcu
+extern char  * p_McuTypeSel_RadioLab_MainMcu;
+//Mcu Type Select Dialog---->radio label---->assist mcu
+extern char  * p_McuTypeSel_RadioLab_AssistMcu;
+//Mcu Type Select Dialog---->Buttons---->cancel
+extern char  * p_McuTypeSel_Button_Cancel;
+//Mcu Type Select Dialog---->Buttons---->OK
+extern char  * p_McuTypeSel_Button_OK;
+//
+//
+//
+//									 	  MCU Type Select
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Dialog
+//
+//									 	 	 MCU User login
+//												
+//
+//
+//MCU User Logon Dialog---->windows title
+extern char  * p_McuUserLogon_WinTitle;
+//MCU User Logon Dialog---->Label---->User name
+extern char  * p_McuUserLogon_Label_UserName;
+//MCU User Logon Dialog---->Label---->Password
+extern char  * p_McuUserLogon_Label_Password;
+//MCU User Login Dialog---->Buttons---->Cancel
+extern char  * p_McuUserLogon_Button_Cancel;
+//MCU User Login Dialog---->Buttons---->OK
+extern char  * p_McuUserLogon_Button_OK;
+//
+//
+//
+//									 	  	 MCU User login
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//
+//														Dialog
+//
+//									 	 	  Class Select
+//												
+//
+//
+//Class Select Dialog---->windows title
+extern char  * p_ClassSel_WinTitle;
+//Class Select---->Class list memeber---->Class ID
+extern char  * p_ClassSel_ClasslistMem_ClassID;
+//Class Select---->Class list memeber---->Class Name
+extern char  * p_ClassSel_ClasslistMem_ClassName;
+//Class Select---->Class list memeber---->Teacher Name
+extern char  * p_ClassSel_ClasslistMem_TecherName;
+//Class Select---->Buttons---->Refresh class list
+extern char  * p_ClassSel_Butt_Refresh;
+//Class Select---->Buttons---->Cancel
+extern char  * p_ClassSel_Butt_Cancel;
+//Class Select---->Buttons---->OK Join
+extern char  * p_ClassSel_Butt_OKJoin;
+#endif

Added: incubator/bluesky/trunk/RealClass/DTU/src/mcu_para.conf
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/mcu_para.conf?rev=885383&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bluesky/trunk/RealClass/DTU/src/mcu_para.conf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/bluesky/trunk/RealClass/DTU/src/mcu_setpara.conf
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/mcu_setpara.conf?rev=885383&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bluesky/trunk/RealClass/DTU/src/mcu_setpara.conf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/bluesky/trunk/RealClass/DTU/src/mcu_userpara.conf
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/mcu_userpara.conf?rev=885383&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bluesky/trunk/RealClass/DTU/src/mcu_userpara.conf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/bluesky/trunk/RealClass/DTU/src/mcumessage.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/mcumessage.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/mcumessage.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/mcumessage.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,316 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 "stdafx.h"
+
+#ifndef MCUMESSAGE_H
+#define MCUMESSAGE_H
+
+#define MAXLENGTH 200    //also should modify macro defined in interface.h 
+
+//接收发送消息结构
+struct CRCLMSG 
+{
+	DWORD rclType;//消息类型
+	DWORD msglen;//消息内容长度s
+	char msg[10000];//消息内容
+};
+
+//组内客户信息结构
+struct CClientInfo 
+{
+	DWORD ClientID;
+	char ClienName[MAXLENGTH];    //[16];
+	DWORD IsFocus;	//0表示正在交互,1没有交互
+};
+
+//组信息
+struct CGroupInfo 
+{
+	DWORD GroupID; //组ID
+	char GroupName[128]; //组的名称
+	char TeacherName[MAXLENGTH];//[16]; //教师名称
+};
+
+
+
+//以下包括具体消息
+
+//MCU登陆消息
+//ID : 5010
+struct CRCLMCULogin 
+{
+	char MCUName[MAXLENGTH];//[16]; //MCU用户名
+	char MCUPass[16];//[16]; //MCU口令
+	char MCUIP[16]; //MCU本机获得的IP 公网IP地址
+	char MCUPIP[16];//MCU本机获得的IP 专网IP地址
+	DWORD TAPort; //音频端口;MCU接收用,以下同
+	DWORD TVPort; //视频端口
+	DWORD TSPort; //屏幕端口
+	DWORD CAPort; //焦点音频端口
+	DWORD CVPort; //焦点视频端口
+};
+
+//响应消息
+//ID : 5011
+struct CRCLMCULoginR 
+{
+	DWORD ResponseType;
+	DWORD MCUID; //MCU ID
+};
+
+
+//辅MCU登陆消息
+//ID : 5060
+struct CRLCSeMCULogin 
+{
+	char MCUName[MAXLENGTH]; //[16];
+	char MCUPass[16];//[16];
+	char MCULocalIP[16];
+	DWORD TAPort; //音频端口;MCU接收用,以下同
+	DWORD TVPort; //视频端口
+	DWORD TSPort; //屏幕端口
+	DWORD CAPort; //焦点音频端口
+	DWORD CVPort; //焦点视频端口
+};
+
+//响应消息
+//ID : 5061
+struct CRCLSeMCULoginR 
+{
+	DWORD ResponseType;
+	DWORD MCUID;
+	DWORD MCUType;	//0:外网 1:内网
+};
+
+
+///////////////////////////端点退出消息///////////////////////////////////
+
+//MCU退出消息
+//ID : 5040
+struct CRCLMCULogout 
+{
+	DWORD MCUID;
+};
+
+//辅MCU退出消息
+//ID : 5070
+struct CRCLSeMCULogout 
+{
+	DWORD MCUID;
+};
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+///////////////////////////组操作消息/////////////////////////////////////
+
+//授课端创建组消息
+//响应消息B,给MCU,因为只有MCU存在才可以创建组
+//ID : 10002
+struct CRCLCreateGroupRMCU 
+{
+	DWORD GroupID;
+	DWORD TeacherID; //教师ID
+	char TeacherIP[16]; //教师的IP,要给教师焦点视音频
+	DWORD CAPort; //音频端口
+	DWORD CVPort; //视频端口
+	char GroupName[128]; //改组名称
+};
+
+
+//授课端离开组消息,该组成员就应全部退出
+//响应消息B,给MCU
+//ID : 10012
+struct CRCLDestroyGroupRClient 
+{
+	DWORD GroupID; //停止转发
+};
+
+
+//组内客户信息结构
+
+//回应消息C,给主MCU返回刚登陆接点的信息
+//ID : 10023
+struct CRCLClientJoinInGroupRMCU 
+{
+	//DWORD ClientID;
+	char ClientIP[16]; //听课端IP或SemcuIP
+	//听课端或辅MCU的5路端口
+	
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+
+	
+	CClientInfo ClientInfo;
+	//DWORD IfSeMCU;
+	DWORD ClientType;   //0:公网 1:内网
+};
+
+//回应消息D,给辅MCU返回刚登陆的内网听课端的信息
+//ID : 10024
+struct CRCLClientJoinInGroupRSeMCU
+{
+	DWORD ClientID;
+	char ClientIP[16];
+	//原听课端5路端口
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+	
+};
+
+//客户离开组消息
+//回应消息C,给MCU 10032
+//ID : 10033
+struct CRCLClientLeaveGroupRAll 
+{
+	CClientInfo ClientInfo; //离开用户的信息
+};
+
+
+//MCU离开组消息 
+//ID : 10040
+struct CRCLMCULeaveGroup 
+{
+	DWORD MCUID; //MCU ID
+	DWORD GroupID; //组ID
+};
+
+//回应消息
+//ID : 10041
+struct CRCLMCULeaveGroupR 
+{
+	DWORD ResponseType;
+};
+
+//辅MCU获得当前组信息
+//ID : 10060
+struct CRCLSeMCUGetGroupInfo 
+{
+	DWORD SeMCUID;
+};
+
+//回应消息
+//ID : 10061
+struct CRCLSeMCUGetGroupInfoR
+{
+	DWORD ResponseType;
+	DWORD GroupCount;
+	CGroupInfo GroupList[10];
+};
+
+//辅MCU加入组消息
+//ID : 10070
+struct CRCLSeMCUJoinGroup 
+{
+	DWORD SeMCUID;
+	DWORD GroupID;
+};
+
+//回应消息A
+//ID : 10071
+struct CRCLSeMCUJoinGroupR 
+{
+	DWORD ResponseType;
+	DWORD GroupID;//也返回组ID
+	char MCUIP[16];//主MCU的IP地址
+//	char SeMCUIP[16];//辅MCU的IP地址
+	DWORD TAPort; //主MCU的数据接收端口
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+
+//	DWORD IfSeMCU;
+
+};
+
+//回应消息B,发给主MCU
+//ID : 10072
+struct CRCLSeMCUJoinGroupRToMCU 
+{
+	DWORD SeMCUID;//辅MCU的ID
+	char SeMCUIP[16];//辅MCU的IP
+	DWORD SeMCUType;//辅MCU的类型,0:公网 1:内网
+	DWORD TAPort;//辅MCU的数据接收端口
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+};
+
+//seMCU离开组消息
+//ID : 10080
+struct CRCLSeMCULeaveGroup 
+{
+	DWORD SeMCUID;
+	DWORD GroupID;
+};
+
+//回应消息A
+//ID : 10081
+struct CRCLSeMCULeaveGroupR
+{
+	DWORD ResponseType;
+};
+
+//回应消息C,发送给主MCU,通知其停止给辅MCU转发
+//ID : 10083
+struct CRCLSeMCULeaveGroupRToMCU 
+{
+	DWORD SeMCUID;
+};
+
+/////////////////////////组内操作消息/////////////////////////////////////
+
+//回应消息 发送焦点信息给MCU和教师
+//ID : 1012
+struct CRCLClientApplyFocusRToTM 
+{
+	DWORD FocusClientID;
+};
+
+//回应消息 发送撤销焦点消息给MCU和Teacher
+//ID : 1022
+struct CRCLClientDestroyFocusRToTM
+{
+	DWORD FocusClientID;
+};
+
+//授课端指定焦点消息
+//回应消息 通知MCU和指定的客户端成为焦点
+struct CRCLTeacherAllowClientFocusRToMS
+{
+	DWORD ClientID;
+};
+
+//授课端剥夺焦点消息
+//响应消息 通知MCU和焦点学生撤销焦点
+//ID : 1062
+struct CRCLTeacherCancelClientFocusRToMS
+{
+	DWORD ClientID;
+};
+
+#endif

Added: incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.cpp?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.cpp Mon Nov 30 11:44:51 2009
@@ -0,0 +1,129 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+// CSingleComm.cpp: implementation of the CSingleComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "asyncsocketex.h"
+#include "singlecomm.h"
+
+#define SOCKETMUTEX_LOCK	{\
+							socketmutex.Lock();	\
+							}
+							
+
+#define SOCKETMUTEX_UNLOCK	{	\
+							socketmutex.Unlock();}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CSingleComm::CSingleComm()
+{
+
+	m_socket = 0;
+}
+
+CSingleComm::~CSingleComm()
+{
+
+	m_socket = 0;
+}
+
+bool CSingleComm::Init()
+{
+	if(!CTCPComm::Init())
+		return false;
+
+	if (!socketmutex.IsInitialized())
+	{
+		if (socketmutex.Init() < 0)
+			return false;
+	}
+
+	return true;
+}
+
+int CSingleComm::OnPollThreadError(int status)
+{
+
+	return -1;
+}
+
+int CSingleComm::Poll()
+{
+	int nRes;
+	SOCKETMUTEX_LOCK	
+
+	if(m_socket == 0){
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	nRes = m_socket->Poll();
+	if(nRes < 0){
+		SOCKETMUTEX_UNLOCK
+		return nRes;
+	}
+
+	m_socket->SetStatus(nRes);
+
+	SOCKETMUTEX_UNLOCK
+	return nRes;
+}
+
+int CSingleComm::PolledSocket()
+{
+
+	SOCKETMUTEX_LOCK	
+
+	if(m_socket == 0){
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	m_socket->OnEvent();
+
+	SOCKETMUTEX_UNLOCK
+	return 1;
+}
+
+
+void CSingleComm::Attach(CAsyncSocketEx* socket)
+{
+	SOCKETMUTEX_LOCK	
+
+	m_socket = socket;
+	SOCKETMUTEX_UNLOCK
+}
+
+CAsyncSocketEx* CSingleComm::Detach()
+{
+	SOCKETMUTEX_LOCK	
+	CAsyncSocketEx* p = m_socket;
+	m_socket = 0;
+	SOCKETMUTEX_UNLOCK
+	return p;
+}
+
+void CSingleComm::OnPollThreadStep()
+{
+	//¸øÖ÷Ï̷߳ÃÎÊ socketµÄʱ¼ä.
+//	printf("\nCListenComm sleep(1)");
+	usleep(200000);
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/singlecomm.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,47 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+// CSingleComm.h: interface for the CSingleComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(SINGLECOMM_H)
+#define SINGLECOMM_H
+
+#include <jmutex.h>
+#include "tcpcomm.h"
+
+class CSingleComm : public CTCPComm  
+{
+public:
+	CAsyncSocketEx* Detach();
+	void Attach(CAsyncSocketEx* socket);
+	CSingleComm();
+	virtual ~CSingleComm();
+	virtual bool Init();
+
+protected:
+	virtual void OnPollThreadStep();
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket();
+	virtual int Poll() ;
+
+private:
+	JMutex socketmutex;
+	CAsyncSocketEx* m_socket;
+};
+
+#endif // !defined(SINGLECOMM_H)

Added: incubator/bluesky/trunk/RealClass/DTU/src/stdafx.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/stdafx.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/stdafx.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/stdafx.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,57 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(STDAFX_H_LINUX)
+#define STDAFX_H_LINUX
+	#include <sys/socket.h>
+	#include <netinet/in.h>
+	#include <arpa/inet.h>
+	#include <sys/ioctl.h>
+	#include <net/if.h>
+	#include <string.h>
+	#include <netdb.h>
+	#include <unistd.h>
+	#include <stdio.h>
+
+
+	#define RTPSOCKERR					-1
+
+
+
+//	#define FALSE						false	
+//	#define TRUE							true	
+	#define INVALID_SOCKET				0
+	#define SOCKET_ERROR  			    RTPSOCKERR
+
+	#define IOCTL						ioctl
+	#define CLOSESOCKET(x)				close(x);
+
+	typedef int							SOCKET;
+	typedef sockaddr					SOCKADDR;
+	typedef struct sockaddr_in		SOCKADDR_IN;
+	typedef bool							BOOL;
+	typedef unsigned int				UINT;
+	typedef const char*					LPCTSTR;
+	typedef char*						LPSTR;
+	typedef unsigned long				DWORD;
+	typedef struct hostent				HOSTENT, *LPHOSTENT;
+#endif // !defined(STDAFX_H_LINUX)

Added: incubator/bluesky/trunk/RealClass/DTU/src/support.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/support.cpp?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/support.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/support.cpp Mon Nov 30 11:44:51 2009
@@ -0,0 +1,116 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+
+#include "support.h"
+
+
+static GList *pixmaps_directories = NULL;
+
+/* Use this function to set the directory containing installed pixmaps. */
+void
+add_pixmap_directory                   (const gchar     *directory)
+{
+  pixmaps_directories = g_list_prepend (pixmaps_directories,
+                                        g_strdup (directory));
+}
+
+/* This is an internally used function to find pixmap files. */
+static gchar*
+find_pixmap_file                       (const gchar     *filename)
+{
+  GList *elem;
+
+  /* We step through each of the pixmaps directory to find it. */
+  elem = pixmaps_directories;
+  while (elem)
+    {
+      gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
+                                         G_DIR_SEPARATOR_S, filename);
+      if (g_file_test (pathname, G_FILE_TEST_EXISTS))
+        return pathname;
+      g_free (pathname);
+      elem = elem->next;
+    }
+  return NULL;
+}
+
+/* This is an internally used function to create pixmaps. */
+GtkWidget*
+create_pixmap                          (GtkWidget       *widget,
+                                        const gchar     *filename)
+{
+  gchar *pathname = NULL;
+  GtkWidget *pixmap;
+
+  if (!filename || !filename[0])
+      return gtk_image_new ();
+
+  pathname = find_pixmap_file (filename);
+
+  if (!pathname)
+    {
+      g_warning ("Couldn't find pixmap file: %s", filename);
+      return gtk_image_new ();
+    }
+
+  pixmap = gtk_image_new_from_file (pathname);
+  g_free (pathname);
+  return pixmap;
+}
+
+/* This is an internally used function to create pixmaps. */
+GdkPixbuf*
+create_pixbuf                          (const gchar     *filename)
+{
+  gchar *pathname = NULL;
+  GdkPixbuf *pixbuf;
+  GError *error = NULL;
+
+  if (!filename || !filename[0])
+      return NULL;
+
+  pathname = find_pixmap_file (filename);
+
+  if (!pathname)
+    {
+      g_warning ("Couldn't find pixmap file: %s", filename);
+      return NULL;
+    }
+
+  pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
+  if (!pixbuf)
+    {
+      fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
+               pathname, error->message);
+      g_error_free (error);
+    }
+  g_free (pathname);
+  return pixbuf;
+}
+
+

Added: incubator/bluesky/trunk/RealClass/DTU/src/support.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/support.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/support.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/support.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,37 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+/* Use this function to set the directory containing installed pixmaps. */
+void        add_pixmap_directory       (const gchar     *directory);
+
+
+/*
+ * Private Functions.
+ */
+
+/* This is used to create the pixmaps used in the interface. */
+GtkWidget*  create_pixmap              (GtkWidget       *widget,
+                                        const gchar     *filename);
+
+/* This is used to create the pixbufs used in the interface. */
+GdkPixbuf*  create_pixbuf              (const gchar     *filename);
+

Added: incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.cpp?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.cpp Mon Nov 30 11:44:51 2009
@@ -0,0 +1,86 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+// TCPComm.cpp: implementation of the CTCPComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "asyncsocketex.h"
+#include "tcpcomm.h"
+#include "tcppollthread.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CTCPComm::CTCPComm()
+{
+
+	m_pThread = 0;
+}
+
+CTCPComm::~CTCPComm()
+{
+
+}
+
+
+int CTCPComm::OnPollThreadError(int status)
+{
+	return -1;
+}
+
+bool CTCPComm::Init()
+{
+
+	if(m_pThread){
+		m_pThread->Stop();
+		return true;
+	}
+
+	m_pThread = new CTCPPollThread(this);
+
+	if(m_pThread)
+		return true;
+
+	return false;
+}
+
+int CTCPComm::Start()
+{
+	if(m_pThread == 0){
+		return -1;
+	}
+	return m_pThread->Start();
+}
+
+bool CTCPComm::IsPolling()
+{
+	if(m_pThread == 0){
+		return false;
+	}
+	return m_pThread->IsRunning();
+}
+
+
+void CTCPComm::Stop()
+{
+	if(m_pThread){
+		m_pThread->Stop();
+	}
+
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/tcpcomm.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,48 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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. 
+// TCPComm.h: interface for the CTCPComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(TCPCOMM_H)
+#define TCPCOMM_H
+
+class CTCPPollThread;
+class CTCPComm  
+{
+	friend class CTCPPollThread;
+public:
+	void Stop();
+	bool IsPolling();
+	int Start();
+	virtual bool Init();
+	CTCPComm();
+	virtual ~CTCPComm();
+
+protected:
+	virtual void OnPollThreadStep() = 0;
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket() = 0;
+	virtual int Poll() = 0;
+
+	
+
+private:
+	CTCPPollThread *m_pThread;
+};
+
+#endif // !defined(TCPCOMM_H)

Added: incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.cpp?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.cpp Mon Nov 30 11:44:51 2009
@@ -0,0 +1,98 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 "tcppollthread.h"
+#include "tcpcomm.h"
+
+CTCPPollThread::CTCPPollThread(CTCPComm* pcomm)
+{
+	m_pcomm = pcomm;
+	stop = false;
+}
+
+CTCPPollThread::~CTCPPollThread()
+{
+	Stop();
+}
+ 
+int CTCPPollThread::Start()
+{
+	if (JThread::IsRunning())
+		return -1;
+	
+	if (!stopmutex.IsInitialized())
+	{
+		if (stopmutex.Init() < 0)
+			return -1;
+	}
+	stop = false;
+	if (JThread::Start() < 0)
+		return -1;
+	return 0;
+}
+
+void CTCPPollThread::Stop()
+{	
+	if (!IsRunning())
+		return;
+	
+	stopmutex.Lock();
+	stop = true;
+	stopmutex.Unlock();
+	
+	
+	if (JThread::IsRunning())
+	{
+		JThread::Kill();
+	}
+	stop = false;
+}
+
+void *CTCPPollThread::Thread()
+{
+	JThread::ThreadStarted();
+	
+	int status;
+	bool stopthread;
+
+	stopmutex.Lock();
+	stopthread = stop;
+	stopmutex.Unlock();
+	while (!stopthread)
+	{
+//		struct timeval tv = {0, 50000};
+		status = m_pcomm->Poll();
+		if(status < 0 ){
+			stopthread = 0;
+			m_pcomm->OnPollThreadError(status);
+		}
+		else{
+			status = m_pcomm->PolledSocket();
+			if(status < 0){
+				stopthread = true;
+				m_pcomm->OnPollThreadError(status);
+			}
+			else{
+				m_pcomm->OnPollThreadStep();
+				stopmutex.Lock();
+				stopthread = stop;
+				stopmutex.Unlock();
+			}
+		}
+	}
+	return 0;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/tcppollthread.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,46 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 CTCPPOLLTHREAD_H
+
+#define CTCPPOLLTHREAD_H
+
+
+
+
+#include "jthread.h"
+#include "jmutex.h"
+
+class CTCPComm;
+class CTCPPollThread : private JThread
+{
+	friend class CTCPComm;
+public:
+	CTCPPollThread(CTCPComm* pcomm);
+	~CTCPPollThread();
+	int Start();
+	void Stop();
+private:
+	void *Thread();
+	
+	bool stop;
+	JMutex stopmutex;
+	CTCPComm *m_pcomm;
+};
+
+
+#endif // CTCPPOLLTHREAD_H

Added: incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.cpp?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.cpp Mon Nov 30 11:44:51 2009
@@ -0,0 +1,1065 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 <gtk/gtk.h>
+#include "ts_communicate.h"
+#include "interface.h"
+#include "dtunit.h"
+
+
+
+extern GtkWidget *group_clist;  //define in interface.cpp
+extern GtkWidget *transfer_clist;       //转发节点信息列表
+
+extern GtkWidget *class_name_entry;			//更新课堂名和教师名
+extern GtkWidget *teacher_name_entry;
+
+//extern GtkTextBuffer *log_buffer;      //针对log的textview进行操作
+//extern GtkTextIter log_end;      
+
+extern void text_buffer_insert(const char *c_chContent);   //define in callback.cpp
+
+struct des_client_para_mcu des_temp[200];    //向显示列表中插入值,保存的全局数组
+int des_temp_pos=0;                                    //保存以插入的数量
+
+CRCLClientJoinInGroupRSeMCU SeMCU_des_temp[200];  //向辅MCU显示列表中插入值,保存的全局数组
+int SeMCU_des_temp_pos=0;                                    //保存以插入的数量
+
+extern int add_udp_destination(char *ip_addr,int port,int which_port);    //below define in dtufunction.cpp
+extern int remove_udp_destination(char *ip_addr,int port,int which_port);
+extern int clear_udp_destination(); 
+
+
+extern CDTUnit dtu;                   //basic transmit unit
+
+struct group_list semcu_grouplist;
+
+//LISTCLIENTDES::iterator i1;
+//LISTSEMCUDES::iterator i2;
+
+//MCU connect with TServer
+
+MCU_TS_communicate::MCU_TS_communicate()
+{
+	// may do something about MCU_Group
+
+	
+}
+
+MCU_TS_communicate::~MCU_TS_communicate()
+{
+
+}
+
+
+int MCU_TS_communicate::establish_connect(LPCTSTR ts_IP,UINT ts_Port,UINT nSocketPort)  //在MCU上建立socket线程
+{
+	if( MCU_socket.Create(nSocketPort)!=true)
+	{
+		printf("Create socket failed!/n");
+		return -1;
+	}
+	
+	if( MCU_socket.Connect(ts_IP,ts_Port)!=true)
+	{
+		perror("connet error!");
+		return -1;
+	}
+	
+	MCU_socket_thread.Attach(&MCU_socket);
+	
+	if( MCU_socket_thread.Init()!=true)
+	{
+		printf("Fail to initilize thread!/n");
+		return -1;
+	}
+	MCU_socket_thread.Start();
+	//printf("good!\n");
+	return 0;
+	
+	//CAsyncSocketEx.connect(/**/);
+}
+
+
+
+int MCU_TS_communicate::send_mes(CRCLMSG mes,int mes_length) //向课堂服务中心发送消息
+{
+    //CAsyncSocketEx.send(/**/);
+	
+	if( MCU_socket.Send(&mes,mes_length)==-1 )
+	{
+		perror("Send failed here!");
+		return -1;
+	}
+	return 0;
+}
+
+int MCU_TS_communicate::close_socket(int nHow)
+{
+	if( MCU_socket.ShutDown(nHow)==false)
+	{
+		perror("close socket error!");
+		return -1;		
+	}
+	else
+		return 0;
+}
+
+
+/////////////////////////  Main MCU  ////////////////////////////
+
+MaMCU_TS_communicate::MaMCU_TS_communicate()
+{
+	// may do something about MCU_Group
+	/*if(!mcu_clist_mutex.IsInitialized()){
+		if(!mcu_clist_mutex.Init()){
+			perror("\nmcu_clist_mutex Init error\n");
+		}
+	}
+	
+	if(!access_clist_mutex.IsInitialized()){
+		if(!access_clist_mutex.Init()){
+			perror("\naccess_clist_mutex Init error\n");
+		}
+	}*/
+	mcu_clist_mutex.Init();
+	access_clist_mutex.Init();
+	
+}
+
+MaMCU_TS_communicate::~MaMCU_TS_communicate()
+{
+
+}
+
+int MaMCU_TS_communicate::refresh_clist()     //保存转发列表,便于清除
+{
+	char *insert_row[200][7];
+	char temp_insert[200][6][16];
+	
+	LISTCLIENTDES::iterator i1;
+	struct des_client_para_mcu *client_temp;		
+		
+	struct des_semuc_para_mcu *semcu_temp;    
+	LISTSEMCUDES::iterator i2;
+	
+	access_clist_mutex.Lock();
+	mcu_clist_mutex.Lock();
+	gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+	
+	//mcu_clist_mutex.Lock();
+	gtk_clist_clear(GTK_CLIST(transfer_clist));
+	//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+	//mcu_clist_mutex.Unlock();
+	
+	sprintf(temp_insert[0][0],"%d",MCU_Group.GroupID);
+	memset(temp_insert[0][1],0,1);
+	memset(temp_insert[0][2],0,1);
+	memset(temp_insert[0][3],0,1);
+	sprintf(temp_insert[0][4],"%d",MCU_Group.CVPort);
+	sprintf(temp_insert[0][5],"%d",MCU_Group.CAPort);
+				
+	insert_row[0][0]=temp_insert[0][0];
+	insert_row[0][1]=MCU_Group.TeacherIP;
+	insert_row[0][2]=temp_insert[0][1];
+	insert_row[0][3]=temp_insert[0][2];
+	insert_row[0][4]=temp_insert[0][3];
+	insert_row[0][5]=temp_insert[0][4];
+	insert_row[0][6]=temp_insert[0][5];				
+	
+	
+	//gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+	//mcu_clist_mutex.Lock();
+	gtk_clist_append(GTK_CLIST(transfer_clist),insert_row[0]);
+	//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+	//mcu_clist_mutex.Unlock();
+	
+	int i;
+	
+	for(i=1,i1=client_des.begin(); i1!= client_des.end(); ++i1,i++)
+	{
+		client_temp=*i1;
+				
+		sprintf(temp_insert[i][0],"%d",client_temp->ClientInfo.ClientID);
+		sprintf(temp_insert[i][1],"%d",client_temp->TSPort);
+		sprintf(temp_insert[i][2],"%d",client_temp->TVPort);
+		sprintf(temp_insert[i][3],"%d",client_temp->TAPort);
+		sprintf(temp_insert[i][4],"%d",client_temp->CVPort);
+		sprintf(temp_insert[i][5],"%d",client_temp->CAPort);
+				
+		insert_row[i][0]=temp_insert[i][0];
+		insert_row[i][1]=client_temp->des_ip;
+		insert_row[i][2]=temp_insert[i][1];
+		insert_row[i][3]=temp_insert[i][2];
+		insert_row[i][4]=temp_insert[i][3];
+		insert_row[i][5]=temp_insert[i][4];
+		insert_row[i][6]=temp_insert[i][5];	
+		
+		//gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+		//mcu_clist_mutex.Lock();
+		gtk_clist_append(GTK_CLIST(transfer_clist),insert_row[i]);
+		//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+		//mcu_clist_mutex.Unlock();
+	}		
+	
+			
+	for(i2=mcu_des.begin(); i2!= mcu_des.end(); ++i2)
+	{
+		semcu_temp=*i2;
+				
+		sprintf(temp_insert[i][0],"%d",semcu_temp->des_id);
+		sprintf(temp_insert[i][1],"%d",semcu_temp->TSPort);
+		sprintf(temp_insert[i][2],"%d",semcu_temp->TVPort);
+		sprintf(temp_insert[i][3],"%d",semcu_temp->TAPort);
+		sprintf(temp_insert[i][4],"%d",semcu_temp->CVPort);
+		sprintf(temp_insert[i][5],"%d",semcu_temp->CAPort);
+				
+		insert_row[i][0]=temp_insert[i][0];
+		insert_row[i][1]=semcu_temp->des_ip;
+		insert_row[i][2]=temp_insert[i][1];
+		insert_row[i][3]=temp_insert[i][2];
+		insert_row[i][4]=temp_insert[i][3];
+		insert_row[i][5]=temp_insert[i][4];
+		insert_row[i][6]=temp_insert[i][5];				
+				
+		//gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+		//mcu_clist_mutex.Lock();
+		gtk_clist_append(GTK_CLIST(transfer_clist),insert_row[i]);	
+		//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+		//mcu_clist_mutex.Unlock();
+	
+	}
+	
+	gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+	mcu_clist_mutex.Unlock();	
+	access_clist_mutex.Unlock();
+	
+	return 0;
+}
+
+int MaMCU_TS_communicate::recevie_msg(char *buf,int buf_length )   //接收课堂服务中心消息并处理
+{
+	CRCLMSG * receive_str;
+	receive_str=(CRCLMSG *) buf;
+	
+	switch(receive_str->rclType)
+	{
+		case 5011:
+			//主MCU登录后响应消息
+		    CRCLMCULoginR *loginReceive;
+		    loginReceive=(CRCLMCULoginR *) receive_str->msg;
+			//printf("Resp_Type %d\n",loginReceive->ResponseType);
+			if(loginReceive->ResponseType!=0) //maybe modify
+			{
+				perror("login failed!");
+				//text_buffer_insert("Error:mcu join error from server\n");
+				text_buffer_insert("Error:DTU join error from server\n");
+				return -1;
+			}
+			
+			MCU_ID=loginReceive->MCUID;			
+		    //printf("MCU_id %d\n",MCU_ID);
+			//text_buffer_insert("mcu login OK!!!!\n\n");
+			text_buffer_insert("DTU login OK!!!!\n\n");
+			
+			break;
+		
+		case 10002:
+			//授课端创建组消息给MCU,因为只有MCU存在才可以创建组
+			//CRCLCreateGroupRMCU MCU_ceateG;
+			MCU_Group=* (CRCLCreateGroupRMCU *) receive_str->msg;
+			//printf("Teacher IP    ********%s\n",MCU_Group.TeacherIP);
+			//printf("Teacher CAPort********%d\n",MCU_Group.CAPort);		
+		    //printf("Teacher CVPort********%d\n",MCU_Group.CVPort);
+			
+					
+		    add_udp_destination(MCU_Group.TeacherIP,MCU_Group.CAPort,4); 		
+			add_udp_destination(MCU_Group.TeacherIP,MCU_Group.CVPort,3);
+			
+			char temp_teacherID[10];
+			sprintf(temp_teacherID,"%d",MCU_Group.TeacherID);
+		
+			gtk_entry_set_text(GTK_ENTRY(teacher_name_entry),temp_teacherID);
+			gtk_entry_set_text(GTK_ENTRY(class_name_entry),MCU_Group.GroupName);	
+
+			char *insert_r[7];
+			char temp_i[6][16];
+				
+			sprintf(temp_i[0],"%d",MCU_Group.TeacherID);
+			strcpy(temp_i[1],"");
+			strcpy(temp_i[2],"");
+			strcpy(temp_i[3],"");
+			sprintf(temp_i[4],"%d",MCU_Group.CVPort);
+			sprintf(temp_i[5],"%d",MCU_Group.CAPort);
+				
+			insert_r[0]=temp_i[0];
+			insert_r[1]=MCU_Group.TeacherIP;
+			insert_r[2]=temp_i[1];
+			insert_r[3]=temp_i[2];
+			insert_r[4]=temp_i[3];
+			insert_r[5]=temp_i[4];
+			insert_r[6]=temp_i[5];				
+			
+
+			mcu_clist_mutex.Lock();
+			gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+			gtk_clist_clear(GTK_CLIST(transfer_clist));
+			gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+			mcu_clist_mutex.Unlock();
+			
+	
+			mcu_clist_mutex.Lock();
+			gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+			gtk_clist_append(GTK_CLIST(transfer_clist),insert_r);
+			gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+			mcu_clist_mutex.Unlock();
+		
+			//text_buffer_insert("with mcu,teacher create class sucess! \n\n");	
+			text_buffer_insert("with DTU,teacher create class sucess! \n\n");	
+			
+			refresh_transfer_clist_button_set(0);
+			break;
+		
+		case 10012:
+			//授课端离开组消息,该组成员就应全部退出,响应消息给MCU
+			CRCLDestroyGroupRClient *MCU_destroyG;
+			MCU_destroyG=(CRCLDestroyGroupRClient *) receive_str->msg;
+			
+			clear_udp_destination( );
+		
+			text_buffer_insert("teacher stop class sucess! \n\n");
+		
+		    memset(&MCU_Group,0,sizeof(MCU_Group));
+			
+
+			mcu_clist_mutex.Lock();
+		    gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+		    gtk_clist_clear(GTK_CLIST(transfer_clist));
+			gtk_clist_thaw( GTK_CLIST(transfer_clist) );	
+		    mcu_clist_mutex.Unlock();
+		
+			refresh_transfer_clist_button_set(1);
+		    
+		 	/***********maybe modify***************/
+			break;
+		
+		case 10023:
+		{
+			//回应消息,给主MCU返回刚登陆client接点的信息
+			CRCLClientJoinInGroupRMCU *MCU_add_client_Join;
+			MCU_add_client_Join= (CRCLClientJoinInGroupRMCU *) receive_str->msg;
+			
+			if(MCU_add_client_Join->ClientType==0)
+			{
+		    	add_udp_destination(MCU_add_client_Join->ClientIP,MCU_add_client_Join->TAPort,2);
+		    	add_udp_destination(MCU_add_client_Join->ClientIP,MCU_add_client_Join->TVPort,1);
+				add_udp_destination(MCU_add_client_Join->ClientIP,MCU_add_client_Join->TSPort,0);
+				add_udp_destination(MCU_add_client_Join->ClientIP,MCU_add_client_Join->CAPort,4);
+				add_udp_destination(MCU_add_client_Join->ClientIP,MCU_add_client_Join->CVPort,3);
+		    
+				//以下记录下信息,便于删除
+				//struct des_client_para_mcu des_temp;             //modify define as global var 
+				des_temp[des_temp_pos].ClientInfo.ClientID=MCU_add_client_Join->ClientInfo.ClientID;
+				strcpy(des_temp[des_temp_pos].ClientInfo.ClienName,MCU_add_client_Join->ClientInfo.ClienName);
+				des_temp[des_temp_pos].ClientInfo.IsFocus=MCU_add_client_Join->ClientInfo.IsFocus;
+				
+				strcpy(des_temp[des_temp_pos].des_ip,MCU_add_client_Join->ClientIP);
+				des_temp[des_temp_pos].TAPort=MCU_add_client_Join->TAPort;
+				des_temp[des_temp_pos].TVPort=MCU_add_client_Join->TVPort;
+				des_temp[des_temp_pos].TSPort=MCU_add_client_Join->TSPort;
+				des_temp[des_temp_pos].CAPort=MCU_add_client_Join->CAPort;
+				des_temp[des_temp_pos].CVPort=MCU_add_client_Join->CVPort;
+				
+				access_clist_mutex.Lock();
+				client_des.insert(client_des.end(),&des_temp[des_temp_pos]);
+				access_clist_mutex.Unlock();
+				
+				des_temp_pos++;
+				//插入到tarnsrfer_clist中
+								
+				char *insert_row[7];
+				char temp_insert[6][16];
+				
+				sprintf(temp_insert[0],"%d",MCU_add_client_Join->ClientInfo.ClientID);
+				sprintf(temp_insert[1],"%d",MCU_add_client_Join->TSPort);
+				sprintf(temp_insert[2],"%d",MCU_add_client_Join->TVPort);
+				sprintf(temp_insert[3],"%d",MCU_add_client_Join->TAPort);
+				sprintf(temp_insert[4],"%d",MCU_add_client_Join->CVPort);
+				sprintf(temp_insert[5],"%d",MCU_add_client_Join->CAPort);
+				
+				insert_row[0]=temp_insert[0];
+				insert_row[1]=MCU_add_client_Join->ClientIP;
+				insert_row[2]=temp_insert[1];
+				insert_row[3]=temp_insert[2];
+				insert_row[4]=temp_insert[3];
+				insert_row[5]=temp_insert[4];
+				insert_row[6]=temp_insert[5];				
+				
+
+				mcu_clist_mutex.Lock();
+		        gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+				gtk_clist_append(GTK_CLIST(transfer_clist),insert_row);
+				gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+				mcu_clist_mutex.Unlock();
+										
+			}
+			
+			else
+			{
+				//针对穿透代理需要做些事情
+			}
+			
+			text_buffer_insert("a client join this group success! \n\n");
+			/*****************modify here****************/
+		}
+			break;
+
+		case 10032:
+		{
+			//客户离开组消息,回应消息给MCU
+			CRCLClientLeaveGroupRAll *leave_client;
+			leave_client=(CRCLClientLeaveGroupRAll *) receive_str->msg;
+		
+			struct des_client_para_mcu *remove_client;    //以下删除退出听课端转发地址
+		    LISTCLIENTDES::iterator i1;
+			
+			
+			access_clist_mutex.Lock();
+			for(i1=client_des.begin(); i1!= client_des.end(); ++i1)
+			{
+				remove_client=*i1;
+				if( (remove_client->ClientInfo.ClientID)==(leave_client->ClientInfo.ClientID) )
+				{	
+					remove_udp_destination(remove_client->des_ip,remove_client->TAPort,2);
+		    		remove_udp_destination(remove_client->des_ip,remove_client->TVPort,1);
+					remove_udp_destination(remove_client->des_ip,remove_client->TSPort,0);
+					remove_udp_destination(remove_client->des_ip,remove_client->CAPort,4);
+					remove_udp_destination(remove_client->des_ip,remove_client->CVPort,3);
+					
+					
+					
+					client_des.erase(i1);     //删除掉list中一项
+					
+					
+					
+					//此处应当删除clist上显示的一行
+					
+					
+					break;
+				}
+			}
+			access_clist_mutex.Unlock();
+			
+			
+			refresh_clist();
+			text_buffer_insert("a client leave this group success! \n\n");
+		}
+			
+			break;
+		
+		case 10041:
+			//MCU离开组回应消息 
+			CRCLMCULeaveGroupR *MCU_leaveG;
+			MCU_leaveG=(CRCLMCULeaveGroupR *) receive_str->msg;
+		
+			if(MCU_leaveG->ResponseType!=1)     //maybe modify here
+			{	
+				perror("Leave Group error!");
+				return -1;
+			}
+			
+			clear_udp_destination( );
+
+			gtk_entry_set_text(GTK_ENTRY(class_name_entry),"");
+			gtk_entry_set_text(GTK_ENTRY(teacher_name_entry),"");		
+			
+			//text_buffer_insert("mcu leave class success! \n\n");
+			text_buffer_insert("DTU leave class success! \n\n");
+			break;	
+		
+		case 10072:
+		{
+			//辅MCU加入组回应消息,发给主MCU	
+			CRCLSeMCUJoinGroupRToMCU *MCU_add_SeMCU_Join;		
+		    MCU_add_SeMCU_Join=(CRCLSeMCUJoinGroupRToMCU *) receive_str->msg;
+		
+			if(MCU_add_SeMCU_Join->SeMCUType==0)
+			{
+				add_udp_destination(MCU_add_SeMCU_Join->SeMCUIP,MCU_add_SeMCU_Join->TAPort,2);
+		    	add_udp_destination(MCU_add_SeMCU_Join->SeMCUIP,MCU_add_SeMCU_Join->TVPort,1);
+				add_udp_destination(MCU_add_SeMCU_Join->SeMCUIP,MCU_add_SeMCU_Join->TSPort,0);
+				add_udp_destination(MCU_add_SeMCU_Join->SeMCUIP,MCU_add_SeMCU_Join->CAPort,4);
+				add_udp_destination(MCU_add_SeMCU_Join->SeMCUIP,MCU_add_SeMCU_Join->CVPort,3);
+				
+				//以下记录下信息,便于删除
+				struct des_semuc_para_mcu des_temp;
+				des_temp.des_id=MCU_add_SeMCU_Join->SeMCUID;
+				strcpy(des_temp.des_ip,MCU_add_SeMCU_Join->SeMCUIP);
+				des_temp.TAPort=MCU_add_SeMCU_Join->TAPort;
+				des_temp.TVPort=MCU_add_SeMCU_Join->TVPort;
+				des_temp.TSPort=MCU_add_SeMCU_Join->TSPort;
+				des_temp.CAPort=MCU_add_SeMCU_Join->CAPort;
+				des_temp.CVPort=MCU_add_SeMCU_Join->CVPort;
+				
+				
+				access_clist_mutex.Lock();
+				mcu_des.insert(mcu_des.end(),&des_temp);
+				access_clist_mutex.Unlock();
+				
+				//插入到tarnsrfer_clist中
+								
+				char *insert_row2[7];
+				char temp_insert2[6][16];
+				
+				sprintf(temp_insert2[0],"%d",des_temp.des_id);
+				sprintf(temp_insert2[1],"%d",des_temp.TSPort);
+				sprintf(temp_insert2[2],"%d",des_temp.TVPort);
+				sprintf(temp_insert2[3],"%d",des_temp.TAPort);
+				sprintf(temp_insert2[4],"%d",des_temp.CVPort);
+				sprintf(temp_insert2[5],"%d",des_temp.CAPort);
+				
+				insert_row2[0]=temp_insert2[0];
+				insert_row2[1]=des_temp.des_ip;
+				insert_row2[2]=temp_insert2[1];
+				insert_row2[3]=temp_insert2[2];
+				insert_row2[4]=temp_insert2[3];
+				insert_row2[5]=temp_insert2[4];
+				insert_row2[6]=temp_insert2[5];				
+				
+				mcu_clist_mutex.Lock();
+				gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+				gtk_clist_append(GTK_CLIST(transfer_clist),insert_row2);
+				gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+				mcu_clist_mutex.Unlock();
+							
+
+			}
+			
+			else
+			{
+				//针对穿透代理需要做些事情
+				
+				//below add semcu_id to MCU.
+				struct CDTUPort::NATDATA natdata;
+				natdata.SeMCUID=MCU_add_SeMCU_Join->SeMCUID;
+				
+				printf("init uid is %d\n",natdata.SeMCUID);
+				dtu.add_waitList(natdata);  //define dtufunction.cpp
+				//ok,set nat_info over
+			}
+			
+			//text_buffer_insert("a semcu join the mcu success! \n\n");
+			text_buffer_insert("An assistant DTU join the mcu success! \n\n");
+			break;
+		}
+		case 10083:
+		{
+			//SeMCU离开组,回应消息给主MCU,通知其停止给辅MCU转发
+			CRCLSeMCULeaveGroupRToMCU *MCU_del_SeMCU;
+			MCU_del_SeMCU=(CRCLSeMCULeaveGroupRToMCU *) receive_str->msg;
+			
+			struct des_semuc_para_mcu *remove_semcu;    //以下删除退出听课端转发地址
+			LISTSEMCUDES::iterator i2;
+			
+			access_clist_mutex.Lock();
+			for(i2=mcu_des.begin(); i2!= mcu_des.end(); ++i2)
+			{
+				remove_semcu=*i2;
+				if( (remove_semcu->des_id)==(MCU_del_SeMCU->SeMCUID) )
+				{	
+					remove_udp_destination(remove_semcu->des_ip,remove_semcu->TAPort,2);
+		    		remove_udp_destination(remove_semcu->des_ip,remove_semcu->TVPort,1);
+					remove_udp_destination(remove_semcu->des_ip,remove_semcu->TSPort,0);
+					remove_udp_destination(remove_semcu->des_ip,remove_semcu->CAPort,4);
+					remove_udp_destination(remove_semcu->des_ip,remove_semcu->CVPort,3);
+					
+					
+					mcu_des.erase(i2);     //删除掉list中一项
+					
+								
+					
+					//此处应当删除clist上显示的一行
+					
+					//refresh_clist();
+					
+					break;
+				}
+			}
+			access_clist_mutex.Unlock();
+			
+			refresh_clist();
+			
+			//text_buffer_insert("a semcu leave the mcu success! \n\n");
+			text_buffer_insert("An assistant DTU leave the mcu success! \n\n");
+		}	
+			
+		
+			break;
+		
+		
+		case 1012:
+			//发送焦点信息给MCU
+			CRCLClientApplyFocusRToTM *client_FocusR;
+			client_FocusR=(CRCLClientApplyFocusRToTM *) receive_str->msg;
+		
+			
+			/***************add here****************/
+			break;
+		
+		case 1022:
+			//发送撤销焦点消息给MCU
+			CRCLClientDestroyFocusRToTM *clent_remove_FocuseR;
+			clent_remove_FocuseR=(CRCLClientDestroyFocusRToTM *) receive_str->msg;
+		
+			/********************add here**************/
+			break;
+		
+		case 1052:             //???????
+			//授课端指定焦点消息,回应消息通知MCU指定的客户端成为焦点
+			CRCLTeacherAllowClientFocusRToMS *Teacher_Allow;
+			Teacher_Allow=(CRCLTeacherAllowClientFocusRToMS *) receive_str->msg;
+		
+			/********************add here****************/
+			break;
+		
+		case 1062:
+			//授课端剥夺焦点,响应消息 通知MCU和焦点学生撤销焦点
+			CRCLTeacherCancelClientFocusRToMS *Teacher_Cancel;
+			Teacher_Cancel=(CRCLTeacherCancelClientFocusRToMS *) receive_str->msg;
+		
+			/**********************add here*******************/
+			break;
+		
+		default:
+		
+			break;
+	}
+
+	return 0;
+			
+}
+
+DWORD MaMCU_TS_communicate::get_mcuid()
+{
+	return MCU_ID;
+}
+
+DWORD MaMCU_TS_communicate::get_mcugroupid()
+{
+	return MCU_Group.GroupID;
+}
+
+
+
+/************************below belong to SeMcu***********************/
+
+
+	
+SeMCU_TS_communicate::SeMCU_TS_communicate()
+{
+	SeMCUType = 0;
+	
+/*	if(!semcu_clist_mutex.IsInitialized()){
+		if(!semcu_clist_mutex.Init()){
+			perror("\nsemcu_clist_mutex Init error\n");
+		}
+	}
+	if(!se_access_clist_mutex.IsInitialized()){
+		if(!se_access_clist_mutex.Init()){
+			perror("\nse_access_clist_mutex Init error\n");
+		}
+	}
+*/
+	semcu_clist_mutex.Init();
+	se_access_clist_mutex.Init();
+	semcu_group_clist_mutex.Init();
+
+}
+
+SeMCU_TS_communicate::~SeMCU_TS_communicate()
+{
+
+}
+
+int SeMCU_TS_communicate::refresh_clist()
+{
+	char *insert_row[200][7];
+	char temp_insert[200][6][16];
+	
+	LISTCLIENTDESSEMCU::iterator i1;
+	struct CRCLClientJoinInGroupRSeMCU *client_temp;		
+		
+	se_access_clist_mutex.Lock();
+	semcu_clist_mutex.Lock();	
+	gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+
+	gtk_clist_clear(GTK_CLIST(transfer_clist));
+	//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+	//semcu_clist_mutex.Unlock();
+	
+	int i;
+	
+	for(i=0,i1=semcu_client_des.begin(); i1!= semcu_client_des.end(); ++i1,i++)
+	{
+		client_temp=*i1;
+				
+		sprintf(temp_insert[i][0],"%d",client_temp->ClientID);
+		sprintf(temp_insert[i][1],"%d",client_temp->TSPort);
+		sprintf(temp_insert[i][2],"%d",client_temp->TVPort);
+		sprintf(temp_insert[i][3],"%d",client_temp->TAPort);
+		sprintf(temp_insert[i][4],"%d",client_temp->CVPort);
+		sprintf(temp_insert[i][5],"%d",client_temp->CAPort);
+				
+		insert_row[i][0]=temp_insert[i][0];
+		insert_row[i][1]=client_temp->ClientIP;
+		insert_row[i][2]=temp_insert[i][1];
+		insert_row[i][3]=temp_insert[i][2];
+		insert_row[i][4]=temp_insert[i][3];
+		insert_row[i][5]=temp_insert[i][4];
+		insert_row[i][6]=temp_insert[i][5];				
+		
+		//gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+		//semcu_clist_mutex.Lock();
+		gtk_clist_append(GTK_CLIST(transfer_clist),insert_row[i]);
+		//gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+		//semcu_clist_mutex.Unlock();
+	}		
+	gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+	semcu_clist_mutex.Unlock();
+	se_access_clist_mutex.Unlock();
+	
+	return 0;
+}
+
+int SeMCU_TS_communicate::recevie_msg(char *buf,int buf_length)
+{
+	CRCLMSG * receive_str;
+	receive_str=(CRCLMSG *) buf;
+	
+	int i;
+	
+	switch(receive_str->rclType)
+	{
+		case 5061:
+			//辅MCU登录后响应消息
+		    CRCLSeMCULoginR *loginReceive_semcu;
+		    loginReceive_semcu=(CRCLSeMCULoginR *) receive_str->msg;
+			//printf("Resp_Type %d\n",loginReceive_semcu->ResponseType);
+			if(loginReceive_semcu->ResponseType!=0) //maybe modify
+			{
+				perror("login failed!");
+				//text_buffer_insert("Error:semcu login error from server!\n");
+				text_buffer_insert("Error:assistant DTU login error from server!\n");
+				return -1;
+			}
+			
+			SeMCUID=loginReceive_semcu->MCUID;
+			SeMCUType=loginReceive_semcu->MCUType;	
+
+			//text_buffer_insert("semcu login success! \n\n");
+			text_buffer_insert("Assistant DTU login success! \n\n");
+		    //printf("MCU_id %d\n",MCU_ID);
+			
+			/*
+			//以下semcu要发送请求获得组信息消息
+			CRCLMSG send_mes;
+			CRCLSeMCUGetGroupInfo semcu_requese_group;
+			semcu_requese_group.SeMCUID=SeMCUID;
+			
+			send_mes.rclType=10060;
+			send_mes.msglen=sizeof(semcu_requese_group);
+			memcpy(send_mes.msg,&semcu_requese_group,sizeof(semcu_requese_group) );
+		
+			if(MCU_TS_communicate::send_mes(send_mes,(send_mes.msglen+8))<0)
+			{
+				perror("send requese group info failed!");
+				return -1;
+			}*/
+			
+			break;
+			
+		case 10012:
+			//授课端离开组消息,该组成员就应全部退出 响应消息,给辅MCU
+			CRCLDestroyGroupRClient *SeMCU_destroyG;
+			SeMCU_destroyG=(CRCLDestroyGroupRClient *) receive_str->msg;
+			
+			//add here
+			clear_udp_destination( );
+			
+			//text_buffer_insert("semcu leave group success! \n\n");
+		    text_buffer_insert("Assistant DTU leave group success! \n\n");
+			break;
+		
+		case 10024:
+		{
+			//给辅MCU返回刚登陆的内网听课端的信息
+			CRCLClientJoinInGroupRSeMCU *SeMCU_join_client;
+			SeMCU_join_client=(CRCLClientJoinInGroupRSeMCU *) receive_str->msg;
+		
+			add_udp_destination(SeMCU_join_client->ClientIP,SeMCU_join_client->TAPort,2);
+		    add_udp_destination(SeMCU_join_client->ClientIP,SeMCU_join_client->TVPort,1);
+			add_udp_destination(SeMCU_join_client->ClientIP,SeMCU_join_client->TSPort,0);
+			add_udp_destination(SeMCU_join_client->ClientIP,SeMCU_join_client->CAPort,4);
+			add_udp_destination(SeMCU_join_client->ClientIP,SeMCU_join_client->CVPort,3);
+				
+			//以下记录下信息,便于删除
+		
+
+		    
+			SeMCU_des_temp[SeMCU_des_temp_pos].ClientID=SeMCU_join_client->ClientID;
+			strcpy(SeMCU_des_temp[SeMCU_des_temp_pos].ClientIP,SeMCU_join_client->ClientIP);
+			SeMCU_des_temp[SeMCU_des_temp_pos].TAPort=SeMCU_join_client->TAPort;
+			SeMCU_des_temp[SeMCU_des_temp_pos].TVPort=SeMCU_join_client->TVPort;
+			SeMCU_des_temp[SeMCU_des_temp_pos].TSPort=SeMCU_join_client->TSPort;
+			SeMCU_des_temp[SeMCU_des_temp_pos].CAPort=SeMCU_join_client->CAPort;
+			SeMCU_des_temp[SeMCU_des_temp_pos].CVPort=SeMCU_join_client->CVPort;
+			
+			se_access_clist_mutex.Lock();
+			semcu_client_des.insert(semcu_client_des.end(),&SeMCU_des_temp[SeMCU_des_temp_pos]);
+		    se_access_clist_mutex.Unlock();
+			
+			SeMCU_des_temp_pos++;
+		
+			//插入到tarnsrfer_clist中
+								
+			char *insert_row[7];
+			char temp_insert[6][16];
+				
+			sprintf(temp_insert[0],"%d",SeMCU_join_client->ClientID);
+			sprintf(temp_insert[1],"%d",SeMCU_join_client->TSPort);
+			sprintf(temp_insert[2],"%d",SeMCU_join_client->TVPort);
+			sprintf(temp_insert[3],"%d",SeMCU_join_client->TAPort);
+			sprintf(temp_insert[4],"%d",SeMCU_join_client->CVPort);
+			sprintf(temp_insert[5],"%d",SeMCU_join_client->CAPort);
+				
+			insert_row[0]=temp_insert[0];
+			insert_row[1]=SeMCU_join_client->ClientIP;
+			insert_row[2]=temp_insert[1];
+			insert_row[3]=temp_insert[2];
+			insert_row[4]=temp_insert[3];
+			insert_row[5]=temp_insert[4];
+			insert_row[6]=temp_insert[5];				
+			
+		    semcu_clist_mutex.Lock();
+			gtk_clist_freeze( GTK_CLIST(transfer_clist) );
+			gtk_clist_append(GTK_CLIST(transfer_clist),insert_row);
+			gtk_clist_thaw( GTK_CLIST(transfer_clist) );
+			semcu_clist_mutex.Unlock();
+			
+			text_buffer_insert("a client join group success! \n\n");
+			break;
+		}
+		case 10033:
+		{
+			//客户离开组消息,回应消息给MCU
+			CRCLClientLeaveGroupRAll *leave_client_semcu;
+			leave_client_semcu=(CRCLClientLeaveGroupRAll *) receive_str->msg;
+		
+			struct CRCLClientJoinInGroupRSeMCU *remove_client;    //以下删除退出听课端转发地址
+		    LISTCLIENTDESSEMCU::iterator i1;
+
+			se_access_clist_mutex.Lock();
+			for(i1=semcu_client_des.begin(); i1!= semcu_client_des.end(); ++i1)
+			{
+				remove_client=*i1;
+				if( (remove_client->ClientID)==(leave_client_semcu->ClientInfo.ClientID) )
+				{	
+					remove_udp_destination(remove_client->ClientIP,remove_client->TAPort,2);
+		    		remove_udp_destination(remove_client->ClientIP,remove_client->TVPort,1);
+					remove_udp_destination(remove_client->ClientIP,remove_client->TSPort,0);
+					remove_udp_destination(remove_client->ClientIP,remove_client->CAPort,4);
+					remove_udp_destination(remove_client->ClientIP,remove_client->CVPort,3);
+						
+					
+					semcu_client_des.erase(i1);     //删除掉list中一项
+
+
+					//此处应当删除clist上显示的一行
+					
+					//refresh_clist();					
+										
+					break;
+				}
+				
+				
+			}
+			
+			se_access_clist_mutex.Unlock();
+			
+			refresh_clist();	
+			text_buffer_insert("a client leave group success! \n\n");
+		}
+		
+			
+			break;
+			
+		case 10061:
+		{
+			//辅MCU获得当前组信息,回应消息
+			CRCLSeMCUGetGroupInfoR *semcu_get_groupinfo;
+			semcu_get_groupinfo=(CRCLSeMCUGetGroupInfoR *) receive_str->msg;
+			
+			//printf("response type is %d\n",semcu_get_groupinfo->ResponseType);
+			//printf("group count is %d\n",semcu_get_groupinfo->GroupCount);
+			//printf("get group name is %s\n",semcu_get_groupinfo->GroupList[0].GroupName);
+		
+			if(semcu_get_groupinfo->ResponseType!=0)
+			{
+				//perror("SeMCU get group info error!");
+				perror("Assistant DTU get group info error!");
+				return -1;
+			}
+			
+			semcu_grouplist.GroupCount=semcu_get_groupinfo->GroupCount;  //none:0 
+			//int i;
+			
+			for(i=0;i<semcu_get_groupinfo->GroupCount;i++)
+			{
+				semcu_grouplist.GroupList[i].GroupID=semcu_get_groupinfo->GroupList[i].GroupID;
+				//printf("get group id is %d\n",semcu_grouplist.GroupList[i].GroupID);
+				strcpy(semcu_grouplist.GroupList[i].GroupName,semcu_get_groupinfo->GroupList[i].GroupName);
+				//printf("get group name is %s\n",semcu_grouplist.GroupList[i].GroupName);
+				strcpy(semcu_grouplist.GroupList[i].TeacherName,semcu_get_groupinfo->GroupList[i].TeacherName);	
+				//printf("get teacher name is %s\n",semcu_grouplist.GroupList[i].TeacherName);
+			}
+			
+			
+			//以下刷新group_clist的显示内容
+			
+			gchar *new_row[3];
+			gchar temp_id[5];
+			semcu_group_clist_mutex.Lock();
+			gtk_clist_freeze(GTK_CLIST(group_clist));
+			
+			gtk_clist_clear(GTK_CLIST(group_clist));
+			//gtk_clist_thaw(GTK_CLIST(group_clist));
+			
+			for(i=0;i<semcu_get_groupinfo->GroupCount;i++)
+			{
+
+				sprintf(temp_id,"%d",semcu_grouplist.GroupList[i].GroupID);
+				//printf("show id is %s\n",temp_id);
+				
+				new_row[0]=temp_id;
+				new_row[1]=semcu_grouplist.GroupList[i].GroupName;
+				new_row[2]=semcu_grouplist.GroupList[i].TeacherName;
+				
+				//printf("new_row1 is %s \n",new_row[1]);
+				//printf("new_row2 is %s\n",new_row[2]);
+				//strcpy(new_row[1],semcu_grouplist.GroupList[i].GroupName);
+				//gtk_clist_set_text(GTK_CLIST(group_clist),i,1,temp_GroupName);
+				//strcpy(new_row[2],semcu_grouplist.GroupList[i].TeacherName);
+				//gtk_clist_freeze(GTK_CLIST(group_clist));
+				gtk_clist_append(GTK_CLIST(group_clist),new_row);
+				//gtk_clist_thaw(GTK_CLIST(group_clist));
+			}
+			gtk_clist_thaw(GTK_CLIST(group_clist));			
+			semcu_group_clist_mutex.Unlock();
+
+		}
+			break;
+			
+		case 10071:
+			//辅MCU加入回应组消息 
+			CRCLSeMCUJoinGroupR *semcu_join_Group;
+			semcu_join_Group=(CRCLSeMCUJoinGroupR *) receive_str->msg;
+			
+		    //printf("semcu receive response is %d\n",semcu_join_Group->ResponseType);
+		    printf("Assistant DTU receive response is %d\n",semcu_join_Group->ResponseType);
+			if(semcu_join_Group->ResponseType!=0)
+			{   
+				//printf("semcu receive response is %d\n",semcu_join_Group->ResponseType);
+				//perror("SeMCU join in group error!");
+				perror("Assistant DTU join in group error!");
+				return -1;
+			}				
+			
+			group_info.GroupID=semcu_join_Group->GroupID;
+			strcpy(group_info.MCUIP,semcu_join_Group->MCUIP);
+			group_info.TAPort=semcu_join_Group->TAPort;
+			group_info.TVPort=semcu_join_Group->TVPort;
+			group_info.TSPort=semcu_join_Group->TSPort;
+			group_info.CAPort=semcu_join_Group->CAPort;
+			group_info.CVPort=semcu_join_Group->CVPort;
+			
+			joingroup_set(0);
+			
+			for(i=0;i<semcu_grouplist.GroupCount;i++)
+			{
+				if(semcu_grouplist.GroupList[i].GroupID==semcu_join_Group->GroupID)
+				{
+					gtk_entry_set_text(GTK_ENTRY(class_name_entry),semcu_grouplist.GroupList[i].GroupName);
+					gtk_entry_set_text(GTK_ENTRY(teacher_name_entry),semcu_grouplist.GroupList[i].TeacherName);		
+				}
+			}
+			
+			//below set nat_info of Main MCU to SeMCU.
+			struct CDTUPort::NATDATA natdata;
+			natdata.SeMCUID=SeMCUID;
+				
+			dtu.set_NATInf(*semcu_join_Group, natdata);  //define dtufunction.cpp
+			//ok,set nat_info over
+			
+			//text_buffer_insert("semcu join group success! \n\n");
+			text_buffer_insert("Assistant DTU join group success! \n\n");
+			
+			/*char mssss[1000];
+			strcpy(mssss,semcu_join_Group->MCUIP);
+			strcat(mssss,semcu_join_Group->TAPort);
+			strcat(mssss,semcu_join_Group->TVPort);
+			strcat(mssss,semcu_join_Group->TSPort);
+			strcat(mssss,semcu_join_Group->CAPort);
+			strcat(mssss,semcu_join_Group->CVPort);
+			gtk_text_buffer_insert(log_buffer,&log_end,mssss,-1);
+			*/
+			/**需要加入获得组信息和要加入的组是否匹配代码**/
+			
+			break;
+		
+		case 10081:
+			//seMCU离开组回应消息
+			CRCLSeMCULeaveGroupR *semcu_leave_R;
+			semcu_leave_R=(CRCLSeMCULeaveGroupR *) receive_str->msg;
+			
+			if(semcu_leave_R->ResponseType!=0)
+			{
+				//perror("SeMCU leave errror!");
+				perror("Assistant DTU leave errror!");
+				return -1;
+			}				
+			
+			//add here
+			clear_udp_destination( );
+			
+			gtk_entry_set_text(GTK_ENTRY(class_name_entry),"");
+			gtk_entry_set_text(GTK_ENTRY(teacher_name_entry),"");
+
+			//text_buffer_insert("semcu leave group success! \n\n");
+			text_buffer_insert("Assistant DTU leave group success! \n\n");			
+			break;
+			
+		default:
+			break;
+		
+	}
+	
+	return 0;
+}
+
+DWORD SeMCU_TS_communicate::get_semcuid()
+{
+	return SeMCUID;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/ts_communicate.h Mon Nov 30 11:44:51 2009
@@ -0,0 +1,142 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you 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 TS_COMMUNICATE_H
+#define TS_COMMUNICATE_H
+
+#include "stdafx.h"
+#include "clientsocket.h"
+#include "singlecomm.h"
+#include "mcumessage.h"
+#include "dtufunction.h"
+
+struct des_semuc_para_mcu
+{
+	DWORD des_id;
+	char des_ip[16];
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+};
+
+struct des_client_para_mcu
+{	
+	CClientInfo ClientInfo;
+	char des_ip[16];
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+};
+
+struct group_list
+{
+	DWORD GroupCount;
+	CGroupInfo GroupList[10];	
+};
+
+struct group_para_semcu
+{
+	DWORD GroupID;//也返回组ID
+	char MCUIP[16];//主MCU的IP地址
+//	char SeMCUIP[16];//辅MCU的IP地址
+	DWORD TAPort; //主MCU的数据接收端口
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+
+//	DWORD IfSeMCU;
+};
+
+typedef std::list<des_semuc_para_mcu*> LISTSEMCUDES;
+typedef std::list<des_client_para_mcu*> LISTCLIENTDES;
+typedef std::list<CRCLClientJoinInGroupRSeMCU *> LISTCLIENTDESSEMCU;
+
+////////////////////////// MCU Class////////////////////////////////////
+class MCU_TS_communicate
+{
+	public:
+		MCU_TS_communicate();
+		virtual ~MCU_TS_communicate();
+	
+	   	int establish_connect(LPCTSTR,UINT,UINT nSocketPort=0);
+	    int send_mes(struct CRCLMSG,int mes_length);
+		int close_socket(int nHow);	
+		
+		virtual int recevie_msg(char *buf,int buf_length)=0;
+	
+	private:
+		CClientSocket MCU_socket;
+		CSingleComm MCU_socket_thread;
+	
+};
+
+
+class MaMCU_TS_communicate: public MCU_TS_communicate
+{
+    public:
+		MaMCU_TS_communicate();
+		~MaMCU_TS_communicate();
+		   	
+		int recevie_msg(char *buf,int buf_length);
+		DWORD get_mcuid();
+		DWORD get_mcugroupid();
+	
+		int refresh_clist();               //更新转发列表
+	
+	private:
+		DWORD MCU_ID;     //MCU ID号
+		struct CRCLCreateGroupRMCU  MCU_Group;
+	
+		LISTSEMCUDES mcu_des;          //保存转发列表,便于清除
+		LISTCLIENTDES client_des;
+		
+		JMutex mcu_clist_mutex;
+		JMutex access_clist_mutex;
+};
+
+class SeMCU_TS_communicate: public MCU_TS_communicate
+{
+	public:
+		SeMCU_TS_communicate();
+	    ~SeMCU_TS_communicate();
+	
+		int recevie_msg(char *buf,int buf_length);
+		DWORD get_semcuid();
+	
+		int refresh_clist();               //更新转发列表
+		inline DWORD GetSeMCUType(){return SeMCUType;};
+	private:
+		DWORD SeMCUID;
+		DWORD SeMCUType; //0:外网 1:内网
+	
+		//struct group_list semcu_grouplist;
+		struct group_para_semcu group_info;
+			
+		LISTCLIENTDESSEMCU semcu_client_des;  //保存转发列表,便于清除
+		
+		JMutex semcu_clist_mutex;
+		JMutex semcu_group_clist_mutex;
+		JMutex se_access_clist_mutex;
+};
+
+
+
+#endif

Added: incubator/bluesky/trunk/RealClass/DTU/stamp-h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/stamp-h?rev=885383&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/stamp-h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/stamp-h Mon Nov 30 11:44:51 2009
@@ -0,0 +1 @@
+timestamp