incubator-bluesky-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mabo...@apache.org
Subject svn commit: r818464 [5/7] - in /incubator/bluesky/trunk/RealClass/DTU: ./ src/ src/.deps/
Date Thu, 24 Sep 2009 12:40:47 GMT
Added: incubator/bluesky/trunk/RealClass/DTU/src/callbacks.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/callbacks.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/callbacks.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/callbacks.cpp Thu Sep 24 12:40:45 2009
@@ -0,0 +1,728 @@
+//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>
+#include <stdio.h>
+
+#include "callbacks.h"
+#include "interface.h"
+#include "support.h"
+#include "dtufunction.h"
+#include "mcumessage.h"
+#include "ts_communicate.h"
+
+extern int add_udp_destination(char *ip_addr, int port, int which_port); //define in dtufunction.cpp
+extern int clear_udp_destination();
+
+extern entry_setpara mcu_get_para; //  record mcu configuration message, defined in interface.cpp
+extern entry_usepara mcu_get_user; //  record user information
+
+extern GtkTextBuffer *log_buffer; //operation on textview of log
+extern GtkTextIter log_end;
+extern GtkTextIter log_start;
+
+extern int mcu_or_semcu; //  mcu or semcu?  0:mcu 1:semcu define in dtufunction.cpp
+int mcu_or_semcu_temp = 0;
+
+extern MaMCU_TS_communicate mcu_ts_comm; //define in dtufunction.cpp
+extern SeMCU_TS_communicate semcu_ts_comm;
+
+extern group_list semcu_grouplist; //define in ts_communicate.cpp
+
+int clist_focus_row; //record focus line from class chose list
+
+extern int g_get_ip_falled; //define in dtu.cpp
+
+void text_buffer_insert(const char *c_chContent)
+{
+	static JMutex writeTextBufmutex;
+
+	if (!writeTextBufmutex.IsInitialized())
+	{
+		if (writeTextBufmutex.Init())
+		{
+			perror("\nwriteTextBufmutex Init error\n");
+		}
+	}
+	writeTextBufmutex.Lock();
+	gtk_text_buffer_insert(log_buffer, &log_end, c_chContent, -1);
+	writeTextBufmutex.Unlock();
+}
+
+//save user configuration message
+void save_setpara_to_file()
+{
+	FILE *fp;
+	entry_setpara *save_setpara;
+	entry_usepara *save_usepara;
+	if ((fp = fopen("mcu_setpara.conf", "wb+")) == NULL)
+	{
+		text_buffer_insert("Error:can't open parameter file!\n");
+		return;
+	}
+
+	save_setpara = &mcu_get_para;
+	save_usepara = &mcu_get_user;
+	fwrite(save_setpara, sizeof(struct entry_setpara), 1, fp);
+	fclose(fp);
+}
+
+//save password and username of users
+void save_userpara_to_file()
+{
+	FILE *fp;
+
+	entry_usepara *save_usepara;
+	if ((fp = fopen("mcu_userpara.conf", "wb+")) == NULL)
+	{
+		text_buffer_insert("Error:can't open parameter file!\n");
+		return;
+	}
+
+	save_usepara = &mcu_get_user;
+	fwrite(save_usepara, sizeof(struct entry_usepara), 1, fp);
+	fclose(fp);
+}
+
+//open dialog of choosing login mcu type
+void on_select_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *dialog2;
+	dialog2 = create_radio_dialog();
+	gtk_widget_show(dialog2);
+
+}
+
+//open login dialog
+void on_join_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *dialog3;
+	dialog3 = create_login_dialog();
+	gtk_widget_show(dialog3);
+}
+
+//event triggered when leaving
+void on_leave_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	CRCLMSG send_mes;
+	text_buffer_insert("start to logout...... \n");
+
+	if (mcu_or_semcu == 0)
+	{
+		CRCLMCULogout MCU_logoutmes;
+		MCU_logoutmes.MCUID = mcu_ts_comm.get_mcuid();
+
+		send_mes.rclType = 5040;
+		send_mes.msglen = sizeof(MCU_logoutmes);
+		memcpy(send_mes.msg, &MCU_logoutmes, sizeof(MCU_logoutmes));
+
+		if (mcu_ts_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert("Error:DTU send logout message failed!\n");
+			return;
+		}
+
+		if (mcu_ts_comm.close_socket(2) < 0)
+		{
+			perror("DTU close socket error!");
+			text_buffer_insert("Error:DTU close socket failed!\n");
+			return;
+		}
+
+	}
+	else if (mcu_or_semcu == 1)
+	{
+		CRCLSeMCULogout SeMCU_logoutmes;
+		SeMCU_logoutmes.MCUID = semcu_ts_comm.get_semcuid();
+
+		send_mes.rclType = 5070;
+		send_mes.msglen = sizeof(SeMCU_logoutmes);
+		memcpy(send_mes.msg, &SeMCU_logoutmes, sizeof(SeMCU_logoutmes));
+
+		if (semcu_ts_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert(
+					"Error:Assistant DTU send logout message failed!\n");
+			return;
+		}
+
+		if (semcu_ts_comm.close_socket(2) < 0)
+		{
+			perror("DTU close socket error!");
+			text_buffer_insert("Error:Assistant DTU close socket failed!\n");
+			return;
+		}
+	}
+
+	joingroup_set(3);
+	leave_set_false();
+
+	text_buffer_insert("logout sucess! \n");
+}
+
+//mcu quit
+void on_exit_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//open setting dialog
+void on_setpara_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *dialog1;
+	dialog1 = create_para_dialog();
+	gtk_widget_show(dialog1);
+}
+
+//help bar in menu
+void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+
+}
+
+//choosing type cancel button
+void on_select_cancel_button_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//login window cancel
+void on_join_cancle_button_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//setting assert button
+void on_para_okbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	if (g_get_ip_falled == 1)
+	{
+		Error_dia("automaticly get ip address fail\n",
+				" please click advance button, input ip address manually");
+		return;
+	}
+
+	get_entry_setpara();
+	para_set_true();
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+
+	save_setpara_to_file();
+}
+
+//select login type assertation button
+void on_select_okbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	mcu_or_semcu = mcu_or_semcu_temp;
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+
+}
+
+//select login assertation button
+int on_join_okbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	get_entry_userpara();
+
+	//the following create UDP port, create socket connection and login class center
+	init_dtu(mcu_get_para.mcuport);
+	sleep(1);
+
+	clear_udp_destination();
+	if (mcu_or_semcu == 0) //main MCU create process
+	{
+		text_buffer_insert("DTU start to login...... \n");
+
+		LPCTSTR ts_addr = mcu_get_para.serverip;
+		UINT ts_port = mcu_get_para.serverport;
+		CRCLMSG send_mes;
+		CRCLMCULogin MCU_loginmes;
+
+		if (mcu_ts_comm.establish_connect(ts_addr, ts_port) < 0)
+		{
+			perror("DTU can't establish connect!");
+			text_buffer_insert("Error:DTU can't establish connect! \n");
+			return -1;
+		}
+
+		strcpy(MCU_loginmes.MCUName, mcu_get_user.username);
+		strcpy(MCU_loginmes.MCUPass, mcu_get_user.password);
+		strcpy(MCU_loginmes.MCUIP, mcu_get_para.mcuip);
+		strcpy(MCU_loginmes.MCUPIP, mcu_get_para.mcuip);
+
+		MCU_loginmes.TSPort = mcu_get_para.mcuport;
+		MCU_loginmes.TVPort = mcu_get_para.mcuport + 2;
+		MCU_loginmes.TAPort = mcu_get_para.mcuport + 4;
+		MCU_loginmes.CVPort = mcu_get_para.mcuport + 6;
+		MCU_loginmes.CAPort = mcu_get_para.mcuport + 8;
+
+		send_mes.rclType = 5010;
+		send_mes.msglen = sizeof(MCU_loginmes);
+		memcpy(send_mes.msg, &MCU_loginmes, sizeof(MCU_loginmes));
+
+		if (mcu_ts_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert("Error:DTU send login message failed! \n");
+			return -1;
+		}
+		printf("DTU send login message over!\n");
+
+	}
+
+	else if (mcu_or_semcu == 1) //assist MCU create process
+	{
+		text_buffer_insert("Assistant DTU start to login...... \n");
+
+		LPCTSTR ts_addr2 = mcu_get_para.serverip;
+		UINT ts_port2 = mcu_get_para.serverport;
+		CRCLMSG send_mes2;
+		CRLCSeMCULogin SeMCU_loginmes;
+
+		if (semcu_ts_comm.establish_connect(ts_addr2, ts_port2) < 0)
+		{
+			perror("Assistant DTU can't establish connect!");
+			text_buffer_insert(
+					"Error:Assistant DTU can't establish connect! \n");
+			return -1;
+		}
+
+		strcpy(SeMCU_loginmes.MCUName, mcu_get_user.username);
+		strcpy(SeMCU_loginmes.MCUPass, mcu_get_user.password);
+		strcpy(SeMCU_loginmes.MCULocalIP, mcu_get_para.mcuip);
+
+		SeMCU_loginmes.TSPort = mcu_get_para.mcuport;
+		SeMCU_loginmes.TVPort = mcu_get_para.mcuport + 2;
+		SeMCU_loginmes.TAPort = mcu_get_para.mcuport + 4;
+		SeMCU_loginmes.CVPort = mcu_get_para.mcuport + 6;
+		SeMCU_loginmes.CAPort = mcu_get_para.mcuport + 8;
+
+		send_mes2.rclType = 5060;
+		send_mes2.msglen = sizeof(SeMCU_loginmes);
+		memcpy(send_mes2.msg, &SeMCU_loginmes, sizeof(SeMCU_loginmes));
+
+		printf("start to send \n");
+		if (semcu_ts_comm.send_mes(send_mes2, send_mes2.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert(
+					"Error:Assistant DTU send login message over! \n");
+			return -1;
+		}
+
+	}
+
+	joingroup_set(mcu_or_semcu);
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+
+	join_set_true();
+
+	if (mcu_or_semcu == 0)
+		refresh_transfer_clist_button_set(0);
+
+	save_userpara_to_file();
+	return 0;
+
+}
+
+//event when choosing main/assist MCU
+void on_radiobutton_clicked(GtkButton *button, gpointer user_data)
+{
+	switch ((int) user_data)
+	{
+	case 0:
+		mcu_or_semcu_temp = 0;
+		break;
+	case 1:
+		mcu_or_semcu_temp = 1;
+		break;
+	}
+}
+
+//cancel button of setting
+void on_para_cancelbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//open login window of class
+void on_joingroup_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *dialog4;
+	dialog4 = create_chose_class_dialog();
+	gtk_widget_show(dialog4);
+
+	CRCLMSG send_mes;
+	CRCLSeMCUGetGroupInfo semcu_requese_group;
+	semcu_requese_group.SeMCUID = semcu_ts_comm.get_semcuid();
+
+	send_mes.rclType = 10060;
+	send_mes.msglen = sizeof(semcu_requese_group);
+	memcpy(send_mes.msg, &semcu_requese_group, sizeof(semcu_requese_group));
+
+	if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+	{
+		perror("send requese group info failed!");
+		text_buffer_insert(
+				"Error:Assistant DTU send get group info. message failed! \n");
+		return;
+	}
+
+}
+
+//leave current classroom
+void on_leavegroup_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	CRCLMSG send_mes;
+
+	if (mcu_or_semcu == 0)
+	{
+		text_buffer_insert("DTU start to leave current class...... \n");
+
+		CRCLMCULeaveGroup mcu_leave_group;
+		mcu_leave_group.MCUID = mcu_ts_comm.get_mcuid();
+		mcu_leave_group.GroupID = mcu_ts_comm.get_mcugroupid();
+
+		send_mes.rclType = 10040;
+		send_mes.msglen = sizeof(mcu_leave_group);
+		memcpy(send_mes.msg, &mcu_leave_group, sizeof(mcu_leave_group));
+
+		if (mcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+		{
+			perror("send DTU group leave message failed!");
+			text_buffer_insert("Error:DTU send leave class message failed! \n");
+			return;
+		}
+
+		joingroup_set(3);
+	}
+
+	if (mcu_or_semcu == 1)
+	{
+		text_buffer_insert(
+				"Assistant DTU start to leave current class...... \n");
+
+		CRCLSeMCULeaveGroup semcu_leave_group;
+		semcu_leave_group.SeMCUID = semcu_ts_comm.get_semcuid();
+		semcu_leave_group.GroupID
+				= semcu_grouplist.GroupList[clist_focus_row].GroupID;
+		printf("leave Group id is %d\n",
+				semcu_grouplist.GroupList[clist_focus_row].GroupID);
+
+		send_mes.rclType = 10080;
+		send_mes.msglen = sizeof(semcu_leave_group);
+		memcpy(send_mes.msg, &semcu_leave_group, sizeof(semcu_leave_group));
+
+		if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+		{
+			perror("send assistant DTU group leave message failed!");
+			text_buffer_insert(
+					"Error:assistant DTU send leave class message failed! \n");
+			return;
+		}
+
+		joingroup_set(1);
+	}
+	refresh_transfer_clist_button_set(1);
+}
+
+//event of assist MCU choosing in class list
+void on_group_clist_select_row(GtkCList *clist, gint row, gint column,
+		GdkEvent *event, gpointer user_data)
+{
+	clist_focus_row = GTK_CLIST(clist)->focus_row;
+	joingroup_okbutt_set();
+}
+
+//refresh button of login class
+void on_refresh_group_clicked(GtkButton *button, gpointer user_data)
+{
+	CRCLMSG send_mes;
+	CRCLSeMCUGetGroupInfo semcu_requese_group;
+	semcu_requese_group.SeMCUID = semcu_ts_comm.get_semcuid();
+
+	send_mes.rclType = 10060;
+	send_mes.msglen = sizeof(semcu_requese_group);
+	memcpy(send_mes.msg, &semcu_requese_group, sizeof(semcu_requese_group));
+
+	if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+	{
+		perror("send requese group info failed!");
+		return;
+	}
+
+	joingroup_okbutt_set_false();
+}
+
+//cancel button of choosing login class
+void on_cancle_groupjoin_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//assit MCU join in some classroom button
+void on_ok_groupjoin_clicked(GtkButton *button, gpointer user_data)
+{
+	text_buffer_insert("Assistant DTU start to join in select class...... \n");
+
+	CRCLMSG send_mes;
+	CRCLSeMCUJoinGroup semcu_join_group;
+	semcu_join_group.SeMCUID = semcu_ts_comm.get_semcuid();
+	semcu_join_group.GroupID
+			= semcu_grouplist.GroupList[clist_focus_row].GroupID;
+
+	send_mes.rclType = 10070;
+	send_mes.msglen = sizeof(semcu_join_group);
+	memcpy(send_mes.msg, &semcu_join_group, sizeof(semcu_join_group));
+
+	if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+	{
+		perror("send group join in message failed!");
+		text_buffer_insert(
+				"Error:assistant DTU send join in class message failed! \n");
+		return;
+	}
+
+	refresh_transfer_clist_button_set(0);
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+//open dialog of setting
+void on_para_toolbar_button_clicked(GtkButton *button, gpointer user_data)
+{
+	GtkWidget *dialog1;
+	dialog1 = create_para_dialog();
+	gtk_widget_show(dialog1);
+}
+
+//open dialog of choosing MCU type which login
+void on_select_tool_button_clicked(GtkButton *button, gpointer user_data)
+{
+	GtkWidget *dialog2;
+	dialog2 = create_radio_dialog();
+	gtk_widget_show(dialog2);
+
+}
+
+//open login dialog
+void on_join_toolbar_button_clicked(GtkButton *button, gpointer user_data)
+{
+	GtkWidget *dialog3;
+	dialog3 = create_login_dialog();
+	gtk_widget_show(dialog3);
+}
+
+//event triggered when leaving
+void on_leave_toolbar_button_clicked(GtkButton *button, gpointer user_data)
+{
+	CRCLMSG send_mes;
+
+	if (mcu_or_semcu == 0)
+	{
+		text_buffer_insert("DTU sart to leave...... \n");
+		CRCLMCULogout MCU_logoutmes;
+		MCU_logoutmes.MCUID = mcu_ts_comm.get_mcuid();
+
+		send_mes.rclType = 5040;
+		send_mes.msglen = sizeof(MCU_logoutmes);
+		memcpy(send_mes.msg, &MCU_logoutmes, sizeof(MCU_logoutmes));
+
+		if (mcu_ts_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert("Error:DTU send leave message failed! \n");
+			return;
+		}
+
+		if (mcu_ts_comm.close_socket(2) < 0)
+		{
+			perror("DTU close socket error!");
+			text_buffer_insert("Error:DTU close socket failed! \n");
+			return;
+		}
+
+	}
+	else if (mcu_or_semcu == 1)
+	{
+		text_buffer_insert("Assistant start to leave...... \n");
+
+		CRCLSeMCULogout SeMCU_logoutmes;
+		SeMCU_logoutmes.MCUID = semcu_ts_comm.get_semcuid();
+
+		send_mes.rclType = 5070;
+		send_mes.msglen = sizeof(SeMCU_logoutmes);
+		memcpy(send_mes.msg, &SeMCU_logoutmes, sizeof(SeMCU_logoutmes));
+
+		if (semcu_ts_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+			text_buffer_insert(
+					"Error:assistant DTU send leavemessage failed! \n");
+			return;
+		}
+
+		if (semcu_ts_comm.close_socket(2) < 0)
+		{
+			perror("DTU close socket error!");
+			text_buffer_insert("Error:assistant DTU close socket failed! \n");
+			return;
+		}
+
+	}
+
+	joingroup_set(3);
+	leave_set_false();
+}
+
+//open dialog of login classroom
+void on_joinclass_toolbar_button_clicked(GtkButton *button, gpointer user_data)
+{
+	GtkWidget *dialog4;
+	dialog4 = create_chose_class_dialog();
+	gtk_widget_show(dialog4);
+
+	CRCLMSG send_mes;
+	CRCLSeMCUGetGroupInfo semcu_requese_group;
+	semcu_requese_group.SeMCUID = semcu_ts_comm.get_semcuid();
+
+	send_mes.rclType = 10060;
+	send_mes.msglen = sizeof(semcu_requese_group);
+	memcpy(send_mes.msg, &semcu_requese_group, sizeof(semcu_requese_group));
+
+	if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+	{
+		perror("send requese group info failed!");
+		text_buffer_insert(
+				"Error:assistant DTU send requese class info. message failed! \n");
+		return;
+	}
+}
+
+//leave current classroom
+void on_leaveclass_toolbar_button_clicked(GtkButton *button, gpointer user_data)
+{
+	CRCLMSG send_mes;
+
+	if (mcu_or_semcu == 0)
+	{
+		text_buffer_insert("DTU start to leave current class...... \n");
+
+		CRCLMCULeaveGroup mcu_leave_group;
+		mcu_leave_group.MCUID = mcu_ts_comm.get_mcuid();
+		mcu_leave_group.GroupID = mcu_ts_comm.get_mcugroupid();
+
+		send_mes.rclType = 10040;
+		send_mes.msglen = sizeof(mcu_leave_group);
+		memcpy(send_mes.msg, &mcu_leave_group, sizeof(mcu_leave_group));
+
+		if (mcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+		{
+			perror("send DTU group leave message failed!");
+			text_buffer_insert("Error:DTU send leave class message failed! \n");
+			return;
+		}
+
+		joingroup_set(3);
+	}
+
+	if (mcu_or_semcu == 1)
+	{
+		text_buffer_insert(
+				"Assistant DTU start to leave current class...... \n");
+
+		CRCLSeMCULeaveGroup semcu_leave_group;
+		semcu_leave_group.SeMCUID = semcu_ts_comm.get_semcuid();
+		semcu_leave_group.GroupID
+				= semcu_grouplist.GroupList[clist_focus_row].GroupID;
+		printf("leave Group id is %d\n",
+				semcu_grouplist.GroupList[clist_focus_row].GroupID);
+
+		send_mes.rclType = 10080;
+		send_mes.msglen = sizeof(semcu_leave_group);
+		memcpy(send_mes.msg, &semcu_leave_group, sizeof(semcu_leave_group));
+
+		if (semcu_ts_comm.send_mes(send_mes, (send_mes.msglen + 8)) < 0)
+		{
+			perror("send assistant DTU group leave message failed!");
+			text_buffer_insert(
+					"Error:assistant DTU send leave class message failed! \n");
+			return;
+		}
+
+		joingroup_set(1);
+	}
+
+}
+
+void on_para_toolbar_button_enter(GtkButton *button, gpointer user_data)
+{
+
+}
+
+void on_join_toolbar_button_enter(GtkButton *button, gpointer user_data)
+{
+
+}
+
+void on_leave_toolbar_button_enter(GtkButton *button, gpointer user_data)
+{
+
+}
+
+void on_joinclass_toolbar_button_enter(GtkButton *button, gpointer user_data)
+{
+
+}
+
+void on_leaveclass_toolbar_button_enter(GtkButton *button, gpointer user_data)
+{
+
+}
+
+//update transfer_clist
+void on_refresh_transfer_clist_button_clicked(GtkButton *button,
+		gpointer user_data)
+{
+	if (mcu_or_semcu == 0)
+	{
+		if (mcu_ts_comm.refresh_clist() != 0)
+			perror("refresh transfer clist failed!");
+	}
+
+	else if (mcu_or_semcu == 1)
+	{
+		if (semcu_ts_comm.refresh_clist() != 0)
+			perror("refresh transfer clist failed!");
+
+	}
+}
+
+void on_log_button1_clicked(GtkButton *button, gpointer user_data) //clear log
+{
+	gtk_text_buffer_get_start_iter(log_buffer, &log_start);
+	gtk_text_buffer_delete(log_buffer, &log_start, &log_end);
+}
+
+void on_para_advancebutton_clicked(GtkButton *button, gpointer user_data) //make advance setting editable
+{
+	para_advance_set_true();
+	g_get_ip_falled = 0;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/callbacks.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/callbacks.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/callbacks.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/callbacks.h Thu Sep 24 12:40:45 2009
@@ -0,0 +1,122 @@
+//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>
+
+void
+on_select_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_join_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_leave_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_exit_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_setpara_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_about1_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_select_cancel_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_join_cancle_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_para_okbutton_clicked(GtkButton *button, gpointer user_data);
+void
+on_para_advancebutton_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_select_okbutton_clicked(GtkButton *button, gpointer user_data);
+
+int
+on_join_okbutton_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_radiobutton_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_para_cancelbutton_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_joingroup_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_leavegroup_activate(GtkMenuItem *menuitem, gpointer user_data);
+
+void
+on_group_clist_select_row(GtkCList *clist, gint row, gint column,
+		GdkEvent *event, gpointer user_data);
+
+void
+on_refresh_group_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_cancle_groupjoin_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_ok_groupjoin_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_para_toolbar_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_join_toolbar_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_leave_toolbar_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_joinclass_toolbar_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_leaveclass_toolbar_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_para_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_join_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_leave_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_joinclass_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_leaveclass_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_joinclass_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_leaveclass_toolbar_button_enter(GtkButton *button, gpointer user_data);
+
+void
+on_select_tool_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_refresh_transfer_clist_button_clicked(GtkButton *button, gpointer user_data);
+
+void
+on_log_button1_clicked(GtkButton *button, gpointer user_data);

Added: incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.cpp Thu Sep 24 12:40:45 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.
+// ClientSocket.cpp: implementation of the CClientSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "clientsocket.h"
+#include "ts_communicate.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+extern MaMCU_TS_communicate mcu_ts_comm;
+extern SeMCU_TS_communicate semcu_ts_comm;
+extern int mcu_or_semcu;
+
+CClientSocket::CClientSocket()
+{
+
+}
+
+CClientSocket::~CClientSocket()
+{
+}
+
+void CClientSocket::OnEvent()
+{
+	unsigned long len;
+	if (m_lEvent == 0) //no any event.
+		return;
+	IOCtl(FIONREAD, &len);
+	if (len == 0)
+	{ //disconnect.
+		Close();
+		printf("\nA client disconnected.\n");
+		return;
+	}
+
+	char buffer[10008] =
+	{ '\0' };
+	int receive_length = 0;
+
+	memset(buffer, '\0', 10008);
+	if ((receive_length = Receive(buffer, 10008)) == -1)
+	{
+		perror("Receive failed!");
+		return;
+	}
+
+	if (mcu_or_semcu == 0)
+	{
+		CRCLMSG* pM = (CRCLMSG*) buffer;
+		printf("message lenth is %d\n", pM->msglen);
+		int index = receive_length;
+		int to_receive_length = pM->msglen + 8 - receive_length;
+		while (to_receive_length > 0)
+		{
+			receive_length = Receive(buffer + index, to_receive_length);
+			printf("recv a message lenth is %d\n", receive_length);
+			index += receive_length;
+			to_receive_length -= receive_length;
+		}
+		mcu_ts_comm.recevie_msg(buffer, receive_length); //analyse data recieved
+		return;
+	}
+
+	else if (mcu_or_semcu == 1)
+	{
+		CRCLMSG* pM = (CRCLMSG*) buffer;
+		printf("message lenth is %d\n", pM->msglen);
+		int index = receive_length;
+		int to_receive_length = pM->msglen + 8 - receive_length;
+		while (to_receive_length > 0)
+		{
+			receive_length = Receive(buffer + index, to_receive_length);
+			printf("recv a message lenth is %d\n", receive_length);
+			index += receive_length;
+			to_receive_length -= receive_length;
+		}
+		semcu_ts_comm.recevie_msg(buffer, receive_length);
+		return;
+	}
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/clientsocket.h Thu Sep 24 12:40:45 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.
+// ClientSocket.h: interface for the CClientSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(CLIENTSOCKET_H)
+#define CLIENTSOCKET_H
+
+#include "asyncsocketex.h"
+
+class CClientSocket: public CAsyncSocketEx
+{
+public:
+	CClientSocket();
+	virtual ~CClientSocket();
+
+protected:
+	virtual void OnEvent();
+
+};
+
+#endif // !defined(CLIENTSOCKET_H)

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

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

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtu.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtu.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtu.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtu.cpp Thu Sep 24 12:40:45 2009
@@ -0,0 +1,152 @@
+//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 <config.h>
+
+#include <gtk/gtk.h>
+
+#include "interface.h"
+#include "support.h"
+
+#define DTU_VERSION "2.0"   //dtu version
+#define ETH_NAME0   "eth0"    //used in get_mcuip()
+#define  ETH_NAME1    "eth1"
+
+char g_mcu_ip[100]; //save ip address
+int g_get_ip_falled = 0; //record whether get ip address sucess,0:sucess 1:falled
+
+struct entry_setpara mcu_get_para; //  record MCU configration
+struct entry_usepara mcu_get_user; //  record user infomation
+
+int get_mcuip() //get mcu local ip
+{
+	int sock;
+	struct sockaddr_in sin;
+	struct ifreq ifr;
+
+	sock = socket(AF_INET, SOCK_DGRAM, 0);
+	if (sock == -1)
+	{
+		perror("socket");
+		return -1;
+	}
+
+	strncpy(ifr.ifr_name, ETH_NAME0, IFNAMSIZ);
+	ifr.ifr_name[IFNAMSIZ - 1] = 0;
+
+	if (ioctl(sock, SIOCGIFADDR, &ifr) < 0)
+	{
+		perror("ioctl eth0");
+
+		strncpy(ifr.ifr_name, ETH_NAME1, IFNAMSIZ);
+		ifr.ifr_name[IFNAMSIZ - 1] = 0;
+		if (ioctl(sock, SIOCGIFADDR, &ifr) < 0)
+		{
+			perror("ioctl eth1");
+			g_get_ip_falled = 1;
+			return -1;
+		}
+	}
+
+	memcpy(&sin, &ifr.ifr_addr, sizeof(sin));
+	strcpy(g_mcu_ip, inet_ntoa(sin.sin_addr));
+	close(sock);
+
+	return 0;
+}
+
+int set_saved_setpara() //get saved parameter
+{
+	FILE *fp;
+	entry_setpara *save_setpara;
+
+	if ((fp = fopen("mcu_setpara.conf", "rt")) == NULL)
+	{
+		printf("Error:can't open parameter file!\n");
+		strcpy(mcu_get_para.serverip, "202.117.10.88");
+		strcpy(mcu_get_para.mcuip, g_mcu_ip);
+		mcu_get_para.serverport = 12345;
+		mcu_get_para.mcuport = 10000;
+		return 0;
+	}
+
+	save_setpara = &mcu_get_para;
+	fread(save_setpara, sizeof(struct entry_setpara), 1, fp);
+	strcpy(mcu_get_para.mcuip, g_mcu_ip);
+	mcu_get_para.serverport = 12345;
+
+	fclose(fp);
+
+	return 1;
+}
+
+int set_saved_userpara() //get saved parameter
+{
+	FILE *fp;
+	entry_usepara *save_usepara;
+
+	if ((fp = fopen("mcu_userpara.conf", "rt")) == NULL)
+	{
+		printf("Error:can't open user parameter file!\n");
+		strcpy(mcu_get_user.username, "MCU");
+		strcpy(mcu_get_user.password, "MCUMCU");
+
+		return 0;
+	}
+
+	save_usepara = &mcu_get_user;
+	fread(save_usepara, sizeof(struct entry_usepara), 1, fp);
+	fclose(fp);
+
+	return 1;
+}
+
+int main(int argc, char **argv)
+{
+
+	if (argc == 2) //below printf the version information
+	{
+		if (strcmp(argv[1], "--version") == 0)
+		{
+			printf("\n dtu (copyright © XJTU), version %s\n\n", DTU_VERSION);
+
+		}
+		else if (strcmp(argv[1], "-v") == 0)
+			printf("%s\n", DTU_VERSION);
+		else
+			printf("\n unknow parameter!\n\n");
+		return 0;
+	}
+
+	GtkWidget *window1;
+
+	get_mcuip();
+
+	set_saved_setpara(); //read configuration reserved
+	set_saved_userpara(); //read configuration reserved
+
+	gtk_set_locale();
+	gtk_init(&argc, &argv);
+
+	add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
+
+	window1 = create_main_window();
+	gtk_widget_show(window1);
+
+	gtk_main();
+	return 0;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.cpp Thu Sep 24 12:40:45 2009
@@ -0,0 +1,120 @@
+//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 "dtufunction.h"
+#include "dtunit.h"
+#include "dtupollthread.h"
+#include "ts_communicate.h"
+#include "mcumessage.h"
+
+MaMCU_TS_communicate mcu_ts_comm;
+SeMCU_TS_communicate semcu_ts_comm;
+int mcu_or_semcu=0;  //main MCU : assiat MCU 0:main 1:assist
+CDTUnit dtu;
+
+//initialize DTU,add 5 forward ports,from base_port,step + 2,default TSPORT 10000,TVPORT10002
+void init_dtu(int base_port=10000)
+{
+		dtu.Init(base_port);
+		dtu.AddDTUPort(DTU_TSPORT);
+		dtu.AddDTUPort(DTU_TVPORT);
+		dtu.AddDTUPort(DTU_TAPORT);
+		dtu.AddDTUPort(DTU_SVPORT);
+		dtu.AddDTUPort(DTU_SAPORT);
+
+
+
+}
+
+//add to which_ports in forward DTU list
+//which_port meaning 0:TSPort,1:TVPort,2:TAPort,3:SVPORT,4:SAPORT
+int add_udp_destination(char *ip_addr,int port,int which_port)
+{
+	    CDTUPort *p;
+		LISTDTUPORT::iterator i;
+		int j=0;
+	    RTPIPv4Address d_ip(ntohl(inet_addr(ip_addr)),port);
+		for(i=dtu.m_list.begin(); i != dtu.m_list.end(); ++i,j++)
+		{
+			if(j==which_port)
+			{
+				p = *i;
+				printf("which port?: j =%d\n", j);
+				if(!(p->AddDestination(&d_ip)))
+				{
+					perror("ADD destiantion failed!");
+					return -1;
+				}
+				printf("add ip %s,port %d\n",ip_addr,port);
+				p->UndateDesAddr();
+				break;
+			}
+			else
+				continue;
+		}
+
+		return 0;
+}
+
+
+//delete which_ports in forward DTU list
+//which_port含义 0:TSPort,1:TVPort,2:TAPort,3:SVPORT,4:SAPORT
+int remove_udp_destination(char *ip_addr,int port,int which_port)
+{
+		RTPIPv4Address d_ip(ntohl(inet_addr(ip_addr)),port);
+
+	    CDTUPort *p;
+		LISTDTUPORT::iterator i;
+		int j=0;
+
+		for(i=dtu.m_list.begin(); i != dtu.m_list.end(); ++i,j++)
+		{
+			if(j==which_port)
+			{
+				p = *i;
+				if( (p->RemoveDestination(&d_ip))!=true)
+				{
+					perror("Remove destiantion failed!");
+					return -1;
+				}
+				p->UndateDesAddr();
+				break;
+			}
+			else
+				continue;
+		}
+
+		return 0;
+}
+
+//clear all forward address in DTU list
+int clear_udp_destination( )
+{
+
+
+	    CDTUPort *p;
+		LISTDTUPORT::iterator i;
+
+		for(i=dtu.m_list.begin(); i != dtu.m_list.end(); ++i)
+		{
+			p = *i;
+			p->ClearDestinations();
+			p->UndateDesAddr();
+		}
+
+		return 0;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtufunction.h Thu Sep 24 12:40:45 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. #ifndef DTUFUNCTION_H
+
+#define DTUFUNCTION_H
+
+#include <rtpsession.h>
+#include <rtppacket.h>
+#include <rtpudpv4transmitter.h>
+#include <rtpipv4address.h>
+#include <rtpsessionparams.h>
+#include <rtperrors.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <string>
+
+#include "dtuporttype.h"
+
+void init_dtu(int base_port);
+
+#endif	//DTU_H

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtunit.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtunit.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtunit.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtunit.cpp Thu Sep 24 12:40:45 2009
@@ -0,0 +1,556 @@
+//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 "dtufunction.h"
+#include "dtunit.h"
+#include "dtupollthread.h"
+#include "rtprawpacket.h"
+
+#define RTPUDPV4TRANS_RTPRECEIVEBUFFER	32768
+
+extern int mcu_or_semcu; //  mcu or semcu?  0:mcu 1:semcu define in dtufunction.cpp
+
+
+/* CDTUPort */
+CDTUPort::CDTUPort(CDTUnit* pDTU)
+{
+	if (pDTU == 0)
+	{
+		printf("DTUPort create error.\n");
+	}
+	m_nPortType = DTU_UNKNOWNPORT;
+	m_pTransmitter = 0;
+	m_pDTU = pDTU;
+	m_pThread = 0;
+
+	m_NATAddr = 0;
+	memset(&m_natdata, 0, sizeof(NATDATA));
+
+	m_sendmutex.Init();
+	m_NATmutex.Init();
+	m_waitlistmutex.Init();
+}
+CDTUPort::~CDTUPort()
+{
+	if (m_pThread)
+	{
+		printf("In process of stoping pollThread...\n");
+		delete m_pThread;
+		printf("PollThread stoped.\n");
+		m_pThread = 0;
+	}
+	if (m_pTransmitter)
+	{
+		delete m_pTransmitter;
+		m_pTransmitter = 0;
+	}
+
+	if (m_NATAddr)
+	{
+		delete m_NATAddr;
+		m_NATAddr = 0;
+	}
+
+	NATDATA *p;
+	std::list<NATDATA*>::iterator i;
+	for (i = m_waitlist.begin(); i != m_waitlist.end(); ++i)
+	{
+		p = *i;
+		if (p)
+			delete p;
+	}
+	m_waitlist.clear();
+
+	ClearDestinations();
+}
+
+int CDTUPort::CreateIPv4Transmitter(const int porttype)
+{
+	int nRes;
+	unsigned int nCur;
+	RTPUDPv4TransmissionParams transparams;
+
+	if (m_pDTU == 0)
+		return -1;
+
+	uint16_t baseport = m_pDTU->GetBasePort();
+	if (baseport == 0)
+		return -1;
+
+	m_pTransmitter = new RTPUDPv4Transmitter();
+	if (m_pTransmitter == 0)
+	{
+		return -1;
+	}
+
+	m_pTransmitter->Init(true);
+	nCur = m_pDTU->GetCurCount();
+	baseport = baseport + 2 * nCur;
+
+	transparams.SetPortbase(baseport);
+	nRes = m_pTransmitter->Create(RTPUDPV4TRANS_RTPRECEIVEBUFFER, &transparams);
+	if (nRes < 0)
+	{
+		delete m_pTransmitter;
+		m_pTransmitter = 0;
+		return -1;
+	}
+
+	m_pThread = new CDTUPollThread;
+	if (m_pThread == 0)
+	{
+		delete m_pTransmitter;
+		m_pTransmitter = 0;
+		return -1;
+	}
+	nRes = m_pThread->Start(this);
+	if (nRes < 0)
+	{
+		delete m_pTransmitter;
+		m_pTransmitter = 0;
+		delete m_pThread;
+		m_pThread = 0;
+		return -1;
+	}
+
+	m_nPortType = porttype;
+	return 1;
+}
+
+int CDTUPort::CreateIPv6Transmitter(const int porttype)
+{
+	return -1;
+}
+
+void CDTUPort::ProcessPolledData(RTPRawPacket &rawpacket)
+{
+	m_sendmutex.Lock();
+
+	static unsigned int nCount = 0;
+	char buffer[100];
+	int nRes;
+	//delete sender ip.
+	const RTPIPv4Address *pSendAddr =
+			(RTPIPv4Address*) rawpacket.GetSenderAddress();
+
+	uint32_t ip = pSendAddr->GetIP();
+	uint16_t portbase = pSendAddr->GetPort();
+
+	sprintf(buffer, "%d.%d.%d.%d:%d", (int) ((ip >> 24) & 0xFF), (int) ((ip
+			>> 16) & 0xFF), (int) ((ip >> 8) & 0xFF), (int) (ip & 0xFF),
+			(int) (portbase));
+
+	//only available for main MCU.
+	if (mcu_or_semcu == 0)
+	{
+		if (rawpacket.GetDataLength() == sizeof(NATDATA))
+		{
+			if (IsWaitSMCUID((const NATDATA*) rawpacket.GetData()))
+			{
+				m_pTransmitter->AddDestination(*pSendAddr);
+			}
+
+			m_sendmutex.Unlock();
+			return;
+
+		}
+
+	}
+	//only available for main MCU.	
+	printf("Received %d udp data from %s.\n", ++nCount, buffer);
+
+	nRes = m_pTransmitter->DeleteDestination(*pSendAddr);
+
+	if (rawpacket.IsRTP())
+		m_pTransmitter->SendRTPData(rawpacket.GetData(),
+				rawpacket.GetDataLength());
+	else
+		m_pTransmitter->SendRTCPData(rawpacket.GetData(),
+				rawpacket.GetDataLength());
+
+	//Restore sender ip.
+	if (nRes >= 0)
+		m_pTransmitter->AddDestination(*pSendAddr);
+
+	m_sendmutex.Unlock();
+	return;
+
+}
+
+void CDTUPort::UndateDesAddr()
+{
+	m_sendmutex.Lock();
+
+	m_pTransmitter->ClearDestinations();
+	RTPAddress *p;
+	LISTADDR::iterator i;
+	for (i = m_addrlist.begin(); i != m_addrlist.end(); ++i)
+	{
+		p = *i;
+		if (p)
+			m_pTransmitter->AddDestination(*p);
+	}
+
+	m_sendmutex.Unlock();
+	return;
+}
+
+bool CDTUPort::AddDestination(const RTPAddress *addr)
+{
+	RTPAddress *paddr = 0;
+	RTPIPv4Address *ipv4addr = (RTPIPv4Address *) addr;
+	RTPTransmitter::TransmissionProtocol proto;
+	if (!m_pDTU->GetProtocol(proto))
+	{
+		printf("no proto\n");
+		return false;
+	}
+	switch (proto)
+	{
+	case RTPTransmitter::IPv4UDPProto:
+		paddr = new RTPIPv4Address(ipv4addr->GetIP(), ipv4addr->GetPort());
+		if (paddr == 0)
+			return false;
+		m_addrlist.insert(m_addrlist.end(), paddr);
+		break;
+
+	case RTPTransmitter::IPv6UDPProto:
+	default:
+		printf("error proto\n");
+		return false;
+	}
+	return true;
+}
+
+bool CDTUPort::RemoveDestination(const RTPAddress *addr)
+{
+	LISTADDR::iterator i;
+	RTPAddress *p;
+	for (i = m_addrlist.begin(); i != m_addrlist.end(); ++i)
+	{
+		p = *i;
+		if (p->IsSameAddress(addr))
+		{
+			delete p;
+			*i = 0;
+		}
+
+	}
+	m_addrlist.remove(0);
+	return true;
+}
+
+void CDTUPort::ClearDestinations()
+{
+	RTPAddress *p;
+	LISTADDR::iterator i;
+	for (i = m_addrlist.begin(); i != m_addrlist.end(); ++i)
+	{
+		p = *i;
+		if (p)
+			delete p;
+	}
+	m_addrlist.clear();
+
+}
+
+int CDTUPort::GetPollTime()
+{
+
+	return 20000;
+}
+
+bool CDTUPort::SetNATInfo(const RTPAddress* addr, const NATDATA &data)
+{
+
+	RTPIPv4Address *ipv4addr = (RTPIPv4Address *) addr;
+	RTPTransmitter::TransmissionProtocol proto;
+	if (!m_pDTU->GetProtocol(proto))
+	{
+		return false;
+	}
+
+	m_NATmutex.Lock();
+	if (m_NATAddr)
+	{
+		delete m_NATAddr;
+		m_NATAddr = 0;
+	}
+	memcpy(&m_natdata, &data, sizeof(NATDATA));
+	switch (proto)
+	{
+	case RTPTransmitter::IPv4UDPProto:
+		m_NATAddr = new RTPIPv4Address(ipv4addr->GetIP(), ipv4addr->GetPort());
+		if (m_NATAddr == 0)
+		{
+			m_NATmutex.Unlock();
+			return false;
+		}
+		break;
+
+	case RTPTransmitter::IPv6UDPProto:
+	default:
+		m_NATmutex.Unlock();
+		return false;
+	}
+
+	m_NATmutex.Unlock();
+	return true;
+
+}
+
+bool CDTUPort::AddWaitSMCU(const NATDATA &data)
+{
+	NATDATA* p;
+	NATDATA* p1;
+	std::list<NATDATA*>::iterator iter;
+
+	p1 = 0;
+	m_waitlistmutex.Lock();
+	p1 = new NATDATA;
+	p1->SeMCUID = data.SeMCUID;
+	if (p1)
+	{
+		m_waitlist.insert(m_waitlist.end(), p1);
+		printf("Insert sussful\n");
+	}
+
+	m_waitlistmutex.Unlock();
+
+	return true;
+}
+
+bool CDTUPort::IsWaitSMCUID(const NATDATA *data)
+{
+	NATDATA* p;
+	std::list<NATDATA*>::iterator iter;
+
+	m_waitlistmutex.Lock();
+
+	for (iter = m_waitlist.begin(); iter != m_waitlist.end(); iter++)
+	{
+		p = *iter;
+		if (p->SeMCUID == data->SeMCUID)
+		{
+
+			delete p;
+			m_waitlist.erase(iter);
+
+			m_waitlistmutex.Unlock();
+			return true;
+		}
+	}
+
+	m_waitlistmutex.Unlock();
+
+	return false;
+}
+
+void CDTUPort::SendNATData()
+{
+	struct sockaddr_in saddr;
+	RTPIPv4Address* des;
+	RTPUDPv4TransmissionInfo *traninfo;
+
+	m_NATmutex.Lock();
+
+	if (m_NATAddr)
+	{
+		des = (RTPIPv4Address*) m_NATAddr;
+		memset(&saddr, 0, sizeof(struct sockaddr_in));
+		saddr.sin_family = AF_INET;
+		saddr.sin_port = htons(des->GetPort());
+		saddr.sin_addr.s_addr = htonl(des->GetIP());
+
+		traninfo
+				= (RTPUDPv4TransmissionInfo *) m_pTransmitter->GetTransmissionInfo();
+
+		sendto(traninfo->GetRTPSocket(), (const char *) &m_natdata,
+				sizeof(NATDATA), 0, (struct sockaddr *) &saddr,
+				sizeof(struct sockaddr_in));
+
+	}
+
+	m_NATmutex.Unlock();
+}
+
+/* CDTUnit */
+CDTUnit::CDTUnit()
+{
+	m_bInit = false;
+	m_protocol = RTPTransmitter::IPv4UDPProto;
+	m_maxCount = 0;
+	m_baseport = 2000;
+}
+
+CDTUnit::~CDTUnit()
+{
+	CDTUPort *p;
+	LISTDTUPORT::iterator i;
+	for (i = m_list.begin(); i != m_list.end(); ++i)
+	{
+		p = *i;
+		if (p)
+			delete p;
+	}
+	m_list.clear();
+}
+
+int CDTUnit::Init(uint16_t baseport, unsigned int nMaxCount /* = 5 */,
+		RTPTransmitter::TransmissionProtocol proto/* = RTPTransmitter::IPv4UDPProto*/)
+{
+	if (m_bInit)
+		return -1;
+	if (baseport < 2000)//|| baseport > 65535)
+		return -1;
+	if (baseport % 2 != 0)
+		return -1;
+	if (m_maxCount > DTUPORT_MAXNUM)
+	{
+		printf("Init error: nMaxCount less than or equal to 5.\n");
+		return -1;
+	}
+	if (proto != RTPTransmitter::IPv4UDPProto && proto
+			!= RTPTransmitter::IPv6UDPProto)
+	{
+		printf("Init error: proto.\n");
+		return -1;
+	}
+	m_baseport = baseport;
+	m_protocol = proto;
+	m_maxCount = nMaxCount;
+	m_bInit = true;
+
+	return 0;
+}
+int CDTUnit::AddDTUPort(const int porttype)
+{
+	int nRes;
+	if (!m_bInit)
+		return -1;
+	CDTUPort *p = new CDTUPort(this);
+	if (p == 0)
+	{
+		return -1;
+	}
+	nRes = p->CreateIPv4Transmitter(porttype);
+	if (nRes < 0)
+	{
+		delete p;
+	}
+
+	m_list.insert(m_list.end(), p);
+
+	return -1;
+}
+int CDTUnit::DelDTUPort(const int porttype)
+{
+
+	return -1;
+}
+int CDTUnit::DelAllDTUPort()
+{
+
+	return -1;
+}
+
+void CDTUnit::set_NATInf(const CRCLSeMCUJoinGroupR &MCUAddrInfo,
+		const CDTUPort::NATDATA &data)
+{
+	CDTUPort *p;
+	LISTDTUPORT::iterator i;
+	int kk;
+
+	for (i = m_list.begin(), kk = 0; i != m_list.end(); ++i, kk++)
+	{
+		p = *i;
+		if (kk == 0)
+		{
+			RTPIPv4Address d_ip(ntohl(inet_addr(MCUAddrInfo.MCUIP)),
+					MCUAddrInfo.TSPort);
+			p->SetNATInfo(&d_ip, data);
+			continue;
+		}
+		if (kk == 1)
+		{
+			RTPIPv4Address d_ip(ntohl(inet_addr(MCUAddrInfo.MCUIP)),
+					MCUAddrInfo.TVPort);
+			p->SetNATInfo(&d_ip, data);
+			continue;
+		}
+		if (kk == 2)
+		{
+			RTPIPv4Address d_ip(ntohl(inet_addr(MCUAddrInfo.MCUIP)),
+					MCUAddrInfo.TAPort);
+			p->SetNATInfo(&d_ip, data);
+			continue;
+		}
+		if (kk == 3)
+		{
+			RTPIPv4Address d_ip(ntohl(inet_addr(MCUAddrInfo.MCUIP)),
+					MCUAddrInfo.CVPort);
+			p->SetNATInfo(&d_ip, data);
+			continue;
+		}
+		if (kk == 4)
+		{
+			RTPIPv4Address d_ip(ntohl(inet_addr(MCUAddrInfo.MCUIP)),
+					MCUAddrInfo.CAPort);
+			p->SetNATInfo(&d_ip, data);
+			continue;
+		}
+	}
+
+}
+
+void CDTUnit::add_waitList(const CDTUPort::NATDATA &data)
+{
+
+	CDTUPort *p;
+	LISTDTUPORT::iterator i;
+
+	for (i = m_list.begin(); i != m_list.end(); ++i)
+	{
+		p = *i;
+		p->AddWaitSMCU(data);
+	}
+
+}
+
+inline uint16_t CDTUnit::GetBasePort()
+{
+	if (!m_bInit)
+		return 0;
+	return m_baseport;
+}
+
+inline unsigned int CDTUnit::GetCurCount()
+{
+	return m_list.size();
+}
+
+inline bool CDTUnit::GetProtocol(RTPTransmitter::TransmissionProtocol &proto)
+{
+	if (!m_bInit)
+	{
+		return false;
+	}
+	proto = m_protocol;
+	return true;
+}

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtunit.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtunit.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtunit.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtunit.h Thu Sep 24 12:40:45 2009
@@ -0,0 +1,102 @@
+//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 <jmutex.h>
+
+#ifndef DTUNIT_H
+#define DTUNIT_H
+
+#define DTUPORT_MAXNUM	5
+
+#include "mcumessage.h"
+
+typedef std::list<RTPAddress*> LISTADDR;
+class CDTUnit;
+class CDTUPollThread;
+class CDTUPort
+{
+	friend class CDTUnit;
+	friend class CDTUPollThread;
+public:
+	struct NATDATA
+	{
+		unsigned int SeMCUID;
+	};
+public:
+	bool AddWaitSMCU(const NATDATA &data);
+	bool IsWaitSMCUID(const NATDATA *data);
+	bool SetNATInfo(const RTPAddress* addr, const NATDATA &data);
+	int GetPollTime();
+	void ClearDestinations();
+	void UndateDesAddr();
+	bool AddDestination(const RTPAddress *addr);
+	bool RemoveDestination(const RTPAddress *addr);
+	void ProcessPolledData(RTPRawPacket &rawpacket);
+	~CDTUPort();
+private:
+	CDTUPort(CDTUnit* pDTU);
+	void SendNATData();
+	int CreateIPv4Transmitter(const int porttype);
+	int CreateIPv6Transmitter(const int porttype);
+	CDTUnit* m_pDTU;
+	int m_nPortType;
+	RTPTransmitter *m_pTransmitter;
+	CDTUPollThread *m_pThread;
+	JMutex m_sendmutex;
+	LISTADDR m_addrlist;
+	//NAT
+
+	std::list<NATDATA*> m_waitlist;
+	JMutex m_waitlistmutex;
+
+	RTPAddress* m_NATAddr;
+	NATDATA m_natdata;
+	//	LISTADDR m_NATList;
+	JMutex m_NATmutex;
+
+};
+
+typedef std::list<CDTUPort*> LISTDTUPORT;
+class CDTUnit
+{
+
+public:
+	inline bool GetProtocol(RTPTransmitter::TransmissionProtocol &proto);
+	inline unsigned int GetCurCount();
+	inline uint16_t GetBasePort();
+	CDTUnit();
+	~CDTUnit();
+	int Init(uint16_t baseport, unsigned int nMaxCount = 5,
+			RTPTransmitter::TransmissionProtocol proto =
+					RTPTransmitter::IPv4UDPProto);
+	int AddDTUPort(const int porttype);
+	int DelDTUPort(const int porttype);
+	LISTDTUPORT m_list;
+
+	void set_NATInf(const CRCLSeMCUJoinGroupR &MCUAddrInfo,
+			const CDTUPort::NATDATA &data);
+	void add_waitList(const CDTUPort::NATDATA &data);
+
+	int DelAllDTUPort();
+protected:
+private:
+	bool m_bInit;
+	RTPTransmitter::TransmissionProtocol m_protocol;
+	unsigned int m_maxCount;
+	uint16_t m_baseport;
+};
+
+#endif	//DTUNIT_H

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.cpp?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.cpp (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.cpp Thu Sep 24 12:40:45 2009
@@ -0,0 +1,177 @@
+//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 "dtufunction.h"
+#include "dtunit.h"
+#include "dtupollthread.h"
+
+#ifdef RTP_SUPPORT_THREAD
+
+#include <rtpsession.h>
+#include <rtcpscheduler.h>
+#include <rtperrors.h>
+#include <rtprawpacket.h>
+#include <time.h>
+
+#ifndef _WIN32_WCE
+#include <iostream>
+#endif // _WIN32_WCE
+#include <rtpdebug.h>
+
+#include "ts_communicate.h"
+
+extern SeMCU_TS_communicate semcu_ts_comm;
+CDTUPollThread::CDTUPollThread()
+{
+	stop = false;
+	m_pDTUport = 0;
+#if (defined(WIN32) || defined(_WIN32_WCE))
+	timeinit.Dummy();
+#endif // WIN32 || _WIN32_WCE
+}
+
+CDTUPollThread::~CDTUPollThread()
+{
+	Stop();
+
+}
+
+int CDTUPollThread::Start(CDTUPort* pDTUport)
+{
+	if (JThread::IsRunning())
+	return ERR_RTP_POLLTHREAD_ALREADYRUNNING;
+
+	m_pDTUport = pDTUport;
+	if (!stopmutex.IsInitialized())
+	{
+		if (stopmutex.Init() < 0)
+		return ERR_RTP_POLLTHREAD_CANTINITMUTEX;
+	}
+	stop = false;
+	if (JThread::Start() < 0)
+	return ERR_RTP_POLLTHREAD_CANTSTARTTHREAD;
+	return 0;
+}
+
+void CDTUPollThread::Stop()
+{
+	if (!IsRunning())
+	return;
+
+	stopmutex.Lock();
+	stop = true;
+	stopmutex.Unlock();
+
+	RTPTransmitter *transmitter;
+	transmitter = m_pDTUport->m_pTransmitter;
+	if (transmitter)
+	transmitter->AbortWait();
+
+	RTPTime thetime = RTPTime::CurrentTime();
+	bool done = false;
+
+	while (JThread::IsRunning() && !done)
+	{
+		// wait max 5 sec
+		RTPTime curtime = RTPTime::CurrentTime();
+		if ((curtime.GetDouble()-thetime.GetDouble()) > 5.0)
+		done = true;
+		RTPTime::Wait(RTPTime(0,10000));
+	}
+
+	if (JThread::IsRunning())
+	{
+#ifndef _WIN32_WCE
+		std::cerr << "CDTUPollThread: Warning! Having to kill thread!" << std::endl;
+#endif // _WIN32_WCE
+		JThread::Kill();
+	}
+	stop = false;
+	transmitter = 0;
+}
+
+int64_t av_gettime(void)
+{
+	struct timeval tv;
+	gettimeofday(&tv,NULL);
+	return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+}
+
+void *CDTUPollThread::Thread()
+{
+	JThread::ThreadStarted();
+
+	bool stopthread;
+	RTPRawPacket *rawpack;
+
+	stopmutex.Lock();
+	stopthread = stop;
+	stopmutex.Unlock();
+	RTPTransmitter *transmitter;
+	transmitter = m_pDTUport->m_pTransmitter;
+
+	int64_t pre_time, cur_time;
+	pre_time = cur_time = av_gettime();
+	while (!stopthread)
+	{
+		int status;
+		//NAT penetrate proxy. only available for assist MCU.
+		if(semcu_ts_comm.GetSeMCUType()==1)
+		{
+			cur_time = av_gettime();
+			if(cur_time-pre_time>1000000)
+			{
+				m_pDTUport->SendNATData();
+				pre_time = cur_time;
+			}
+		}
+		//NAT
+
+		//		printf("\n...................Polling incoming data in 20000us...................");
+		RTPTime delay(0, m_pDTUport->GetPollTime());
+		if ((status = transmitter->WaitForIncomingData(delay)) < 0)
+		{
+			printf("\nPollThread error.");
+			stopthread = true;
+		}
+		else
+		{
+			if ((status = transmitter->Poll()) < 0)
+			{
+				printf("\nPollThread error.");
+				stopthread = true;
+			}
+			else
+			{
+
+				while ((rawpack = transmitter->GetNextPacket()) != 0)
+				{
+					//Received udp data.
+					m_pDTUport->ProcessPolledData(*rawpack);
+					delete rawpack;
+				}
+				stopmutex.Lock();
+				stopthread = stop;
+				stopmutex.Unlock();
+
+			}
+		}
+	}
+	return 0;
+}
+
+#endif // RTP_SUPPORT_THREAD

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtupollthread.h Thu Sep 24 12:40:45 2009
@@ -0,0 +1,55 @@
+//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 DTUPOLLTHREAD_H
+
+#define DTUPOLLTHREAD_H
+
+#include "rtpconfig.h"
+
+#ifdef RTP_SUPPORT_THREAD
+
+#include "rtptransmitter.h"
+
+#include <jthread.h>
+#include <jmutex.h>
+#include <list>
+
+class RTPUDPv4Transmitter;
+class CDTUPort;
+class CDTUPollThread : public JThread
+{
+public:
+	friend class CDTUPort;
+	~CDTUPollThread();
+	int Start(CDTUPort* pDTUport);
+	void Stop();
+private:
+	CDTUPollThread();
+	void *Thread();
+
+	bool stop;
+	JMutex stopmutex;
+	CDTUPort* m_pDTUport;
+
+};
+
+#endif // RTP_SUPPORT_THREAD
+#endif // DTUPOLLTHREAD_H

Added: incubator/bluesky/trunk/RealClass/DTU/src/dtuporttype.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/DTU/src/dtuporttype.h?rev=818464&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/DTU/src/dtuporttype.h (added)
+++ incubator/bluesky/trunk/RealClass/DTU/src/dtuporttype.h Thu Sep 24 12:40:45 2009
@@ -0,0 +1,32 @@
+//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 DTUPORTTYPE_H
+#define DTUPORTTYPE_H
+
+#define DTU_UNKNOWNPORT		0x0000
+#define DTU_TSPORT			0x0001
+#define DTU_TVPORT			0x0002
+#define DTU_TAPORT			0x0004
+#define DTU_SVPORT			0x0008
+#define DTU_SAPORT			0x0010
+
+#endif	// DTUPORTTYPE_H



Mime
View raw message