incubator-bluesky-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dane0...@apache.org
Subject svn commit: r774247 [2/24] - in /incubator/bluesky: tags/Bluesky_version1.0/ trunk/ trunk/sourcecode/ trunk/sourcecode/dtu_src_v1.0/ trunk/sourcecode/student_src_v1.0/ trunk/sourcecode/student_src_v1.0/pic/ trunk/sourcecode/teacher_src_1.0/ trunk/sourc...
Date Wed, 13 May 2009 07:44:32 GMT
Added: incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.cpp?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.cpp (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.cpp Wed May 13 07:44:26 2009
@@ -0,0 +1,183 @@
+//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 ;
+
+	}
+
+	
+
+	//read incoming data.
+
+	
+	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 received data
+
+		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/sourcecode/dtu_src_v1.0/clientsocket.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.h?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.h (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/clientsocket.h Wed May 13 07:44:26 2009
@@ -0,0 +1,40 @@
+//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/sourcecode/dtu_src_v1.0/dtu.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtu.cpp?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtu.cpp (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtu.cpp Wed May 13 07:44:26 2009
@@ -0,0 +1,174 @@
+//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. 
+
+
+
+// generated 2006/5/26 11:09:27 CST by root@10h86.(none)
+// using glademm V2.6.0
+//
+// newer (non customized) versions of this file go to dtu.cc_new
+
+// This file is for your program, I won't touch it again!
+
+#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;   //   save DTU configuration
+struct entry_usepara mcu_get_user;   //  save user's information
+
+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");  
+ 		
+           //if open unsucessful try to open eth1		 
+		   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
+{
+	//we should add some action,read parameter from file here
+	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
+{
+	//we should add some action,read parameter from file here
+	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 information
+  set_saved_userpara();     //read user information
+	
+  gtk_set_locale ();
+  gtk_init (&argc, &argv);
+
+  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
+
+  /*
+   * The following code was added by Glade to create one of each component
+   * (except popup menus), just so that you see something after building
+   * the project. Delete any components that you don't want shown initially.
+   */
+  window1 = create_main_window();
+  gtk_widget_show (window1);
+
+  gtk_main ();
+  return 0;
+}

Added: incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.cpp?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.cpp (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.cpp Wed May 13 07:44:26 2009
@@ -0,0 +1,239 @@
+//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. 
+
+
+
+/*main start here
+*/
+
+
+
+#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;  //flag bit of DTU type 
+
+CDTUnit dtu;
+
+
+
+//initalize DTU. add four forwarding ports, default base_port 10000,
+
+//TSPORT = base_port, TVPORT = TSPORT + 2, TAPORT = TVPORT + 2...the rest may be deduced
by analogy
+
+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 port pointed by which_port in DUT forwarding list
+
+//which_port 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 the port pointed by which_port in DTU forwarding 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;
+
+}
+
+
+
+// clean all the address in DTU forwarding 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/sourcecode/dtu_src_v1.0/dtufunction.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.h?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.h (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtufunction.h Wed May 13 07:44:26 2009
@@ -0,0 +1,75 @@
+//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>
+
+#ifndef WIN32
+
+	#include <netinet/in.h> 
+
+	#include <arpa/inet.h>
+
+#else
+
+	#include <winsock2.h>
+
+#endif // WIN32
+
+#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/sourcecode/dtu_src_v1.0/dtunit.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.cpp?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.cpp (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.cpp Wed May 13 07:44:26 2009
@@ -0,0 +1,984 @@
+//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 )
+
+		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/sourcecode/dtu_src_v1.0/dtunit.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.h?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.h (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtunit.h Wed May 13 07:44:26 2009
@@ -0,0 +1,166 @@
+//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;
+
+	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/sourcecode/dtu_src_v1.0/dtupollthread.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.cpp?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.cpp (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.cpp Wed May 13 07:44:26
2009
@@ -0,0 +1,204 @@
+//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
+
+		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/sourcecode/dtu_src_v1.0/dtupollthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.h?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.h (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtupollthread.h Wed May 13 07:44:26 2009
@@ -0,0 +1,64 @@
+//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/sourcecode/dtu_src_v1.0/dtuporttype.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtuporttype.h?rev=774247&view=auto
==============================================================================
--- incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtuporttype.h (added)
+++ incubator/bluesky/trunk/sourcecode/dtu_src_v1.0/dtuporttype.h Wed May 13 07:44:26 2009
@@ -0,0 +1,38 @@
+//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