You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bluesky-commits@incubator.apache.org by pi...@apache.org on 2009/11/30 11:24:43 UTC
svn commit: r885379 [28/28] - in /incubator/bluesky/trunk/RealClass:
DTU/src/ TServer/ TServer/autom4te.cache/ TServer/intl/ TServer/po/
TServer/src/ TServer/src/.deps/
Added: incubator/bluesky/trunk/RealClass/TServer/src/listencomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/listencomm.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/listencomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/listencomm.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,128 @@
+//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.
+
+// ListenComm.cpp: implementation of the CListenComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "asyncsocketex.h"
+#include "listencomm.h"
+
+#define SOCKETMUTEX_LOCK {\
+ socketmutex.Lock(); \
+ }
+
+
+#define SOCKETMUTEX_UNLOCK { \
+ socketmutex.Unlock();}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CListenComm::CListenComm()
+{
+
+ m_socket = 0;
+}
+
+CListenComm::~CListenComm()
+{
+ m_socket = 0;
+}
+
+bool CListenComm::Init()
+{
+ if(!CTCPComm::Init())
+ return false;
+
+ if (!socketmutex.IsInitialized())
+ {
+ if (socketmutex.Init() < 0)
+ return false;
+ }
+
+ return true;
+}
+
+int CListenComm::OnPollThreadError(int status)
+{
+
+ return -1;
+}
+
+int CListenComm::Poll()
+{
+ int nRes;
+ SOCKETMUTEX_LOCK
+
+ if(m_socket == 0){
+ SOCKETMUTEX_UNLOCK
+ return 0;
+ }
+
+ nRes = m_socket->Poll();
+ if(nRes < 0){
+ SOCKETMUTEX_UNLOCK
+ return nRes;
+ }
+
+ m_socket->SetStatus(nRes);
+
+ SOCKETMUTEX_UNLOCK
+ return nRes;
+}
+
+int CListenComm::PolledSocket()
+{
+
+ SOCKETMUTEX_LOCK
+
+ if(m_socket == 0){
+ SOCKETMUTEX_UNLOCK
+ return 0;
+ }
+
+ m_socket->OnEvent();
+
+ SOCKETMUTEX_UNLOCK
+ return 1;
+}
+
+
+void CListenComm::Attach(CAsyncSocketEx* socket)
+{
+ SOCKETMUTEX_LOCK
+
+ m_socket = socket;
+ SOCKETMUTEX_UNLOCK
+}
+
+CAsyncSocketEx* CListenComm::Detach()
+{
+ SOCKETMUTEX_LOCK
+ CAsyncSocketEx* p = m_socket;
+ m_socket = 0;
+ SOCKETMUTEX_UNLOCK
+ return p;
+}
+
+void CListenComm::OnPollThreadStep()
+{
+
+ usleep(200000);
+}
Added: incubator/bluesky/trunk/RealClass/TServer/src/listencomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/listencomm.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/listencomm.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/listencomm.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,48 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+// ListenComm.h: interface for the CListenComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(LISTENCOMM_H)
+#define LISTENCOMM_H
+
+#include "tcpcomm.h"
+#include "jmutex.h"
+
+class CListenComm : public CTCPComm
+{
+public:
+ CAsyncSocketEx* Detach();
+ void Attach(CAsyncSocketEx* socket);
+ CListenComm();
+ virtual ~CListenComm();
+ virtual bool Init();
+
+protected:
+ virtual void OnPollThreadStep();
+ virtual int OnPollThreadError(int status);
+ virtual int PolledSocket();
+ virtual int Poll() ;
+
+private:
+ JMutex socketmutex;
+ CAsyncSocketEx* m_socket;
+};
+
+#endif // !defined(LISTENCOMM_H)
Added: incubator/bluesky/trunk/RealClass/TServer/src/mcu_setpara.conf
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/mcu_setpara.conf?rev=885379&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/bluesky/trunk/RealClass/TServer/src/mcu_setpara.conf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/bluesky/trunk/RealClass/TServer/src/mcu_userpara.conf
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/mcu_userpara.conf?rev=885379&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/bluesky/trunk/RealClass/TServer/src/mcu_userpara.conf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/bluesky/trunk/RealClass/TServer/src/msgtype.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/msgtype.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/msgtype.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/msgtype.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,807 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+#include "stdafx.h"
+#include <list>
+#include <string>
+#include "jmutex.h"
+#define ServerVersionID 0x10000000
+#define NAMELEN 200
+
+///////////////////////////////////////////////////////
+
+
+struct CRCLNodeIP
+{
+ SOCKET s;
+ char IP[16];
+};
+
+
+struct CRCLClient
+{
+ DWORD rclClientID;
+ SOCKET s;
+ char rclIP[16];
+ char rclLocalIP[16];
+ char rclName[NAMELEN];
+ char rclPass[16];
+ DWORD rclRoomID;
+ DWORD rclMCUID;
+ int ThreadEvent;
+
+ DWORD rclTAPort;
+ DWORD rclTVPort;
+ DWORD rclTSPort;
+ DWORD rclSAPort;
+ DWORD rclSVPort;
+
+ DWORD rclIfSeMCU;
+ DWORD rclClientType;
+
+ DWORD rclSeMCU_TAPort;
+ DWORD rclSeMCU_TVPort;
+ DWORD rclSeMCU_TSPort;
+ DWORD rclSeMCU_SAPort;
+ DWORD rclSeMCU_SVPort;
+};
+
+
+struct CRCLTeacher
+{
+ DWORD rclTeacherID;
+ SOCKET s;
+ char rclIP[16];
+ char rclLocalIP[16];
+ int rclPort;
+ char rclName[NAMELEN];
+ char rclPass[16];
+ DWORD rclRoomID;
+ int ThreadEvent;
+
+ DWORD rclSAPort;
+ DWORD rclSVPort;
+
+};
+
+
+struct CRCLMCU
+{
+ DWORD rclMCUID;
+ SOCKET s;//MCU Socket
+ char rclIP[16];
+ char rclLocalIP[16];
+ //char rcPIP[16];
+ DWORD rclRoomID;//room ID
+ char rclName[NAMELEN];//MCU Name
+ char rclPass[16];//MCU Pass
+ int ThreadEvent;
+
+ DWORD rclTAPort;
+ DWORD rclTVPort;
+ DWORD rclTSPort;
+ DWORD rclSAPort;
+ DWORD rclSVPort;
+
+};
+
+
+struct CRCLSeMCU
+{
+ DWORD rclMCUID;//MCUID
+ SOCKET s;//MCU Socket
+ char rclIP[16]; //MCU IP
+ char rclLocalIP[16];;//MCU Local IP
+ DWORD rclRoomID;//room ID
+ char rclName[NAMELEN];//MCU Name
+ char rclPass[16];//MCU Pass
+ DWORD rclType;
+ int ThreadEvent;
+ DWORD rclTransMCUID;
+
+ DWORD rclTAPort;
+ DWORD rclTVPort;
+ DWORD rclTSPort;
+ DWORD rclSAPort;
+ DWORD rclSVPort;
+
+};
+
+
+struct CRCLRoom
+{
+ DWORD rclRoomID;
+ char rclName[128];
+ DWORD rclTeacherID;
+ DWORD rclMCUID;
+ DWORD rclFocusUserID;
+ JMutex cs;
+ JMutex ms;
+
+ std::list<DWORD> rclUserRoom;
+
+ std::list<DWORD> rclSeMCURoom;
+ int rclAllUser;
+ int rclNowUser;
+ int rclFocusUser;
+
+ DWORD rclRoomMode;
+};
+
+
+struct CRCLLobby
+{
+ std::string rclLobbyID;
+ int rclAllUser;
+ int rclNowUser;
+ std::list<DWORD> rclUserLobby;
+};
+
+
+struct CRCLSendMSG
+{
+ SOCKET s;
+ std::string msg;
+};
+
+
+struct CRCLMSG
+{
+ DWORD rclType;
+ DWORD msglen;
+ char msg[10000];
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 5000
+struct CRCLTeacherLogin
+{
+ char TeacherName[NAMELEN];
+ char TeacherPass[16];
+ char TeacherIP[16];
+};
+
+
+struct CRCLUserClassInfo
+{
+ char ClassName[128];
+};
+
+
+//ID : 5001
+struct CRCLTeacherLoginR
+{
+ DWORD ResponseType;
+ DWORD TeacherID;
+ DWORD ClassInfoReturn;
+ DWORD ClassInfoCount;
+ CRCLUserClassInfo ClassInfo[16];
+};
+
+
+//ID : 5010
+struct CRCLMCULogin
+{
+ char MCUName[NAMELEN];
+ char MCUPass[16];
+ char MCUIP[16];
+ char MCUPIP[16];
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+};
+
+
+//ID : 5011
+struct CRCLMCULoginR
+{
+ DWORD ResponseType;
+ DWORD MCUID; //MCU ID
+};
+
+
+//ID : 5020
+struct CRCLClientLogin
+{
+ char ClientName[NAMELEN];
+ DWORD ClientVersionID;
+ char ClientPass[16];
+ char ClientIP[16];
+
+ DWORD SeMCU_TAPort;
+ DWORD SeMCU_TVPort;
+ DWORD SeMCU_TSPort;
+ DWORD SeMCU_SAPort;
+ DWORD SeMCU_SVPort;
+};
+
+
+struct CGroupInfo
+{
+ DWORD GroupID;
+ char GroupName[128];
+ char TeacherName[NAMELEN];
+};
+
+
+//ID : 5021
+struct CRCLClientLoginR
+{
+ DWORD ResponseType;
+ DWORD ClientID;
+ DWORD ClientType;
+};
+
+
+//ID : 5060
+struct CRLCSeMCULogin
+{
+ char MCUName[NAMELEN];
+ char MCUPass[16];
+ char MCULocalIP[16];
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+};
+
+
+//ID : 5061
+struct CRCLSeMCULoginR
+{
+ DWORD ResponseType;
+ DWORD MCUID;
+ DWORD MCUType;
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////
+
+//ID : 10000
+struct CRCLCreateGroup
+{
+ DWORD TeacherID;
+ char GroupName[128];
+ DWORD CAPort;
+ DWORD CVPort;
+};
+
+
+//ID : 10001
+struct CRCLCreateGroupR
+{
+ DWORD ResponseType;
+ DWORD GroupID;
+ char MCUIP[16];
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+};
+
+
+//ID : 10002
+struct CRCLCreateGroupRMCU
+{
+ DWORD GroupID;
+ DWORD TeacherID;
+ char TeacherIP[16];
+ DWORD CAPort;
+ DWORD CVPort;
+ char GroupName[128];
+};
+
+
+//ID : 10010
+struct CRCLDestroyGroup
+{
+ DWORD TeacherID;
+ DWORD GroupID;
+};
+
+
+//ID : 10011
+struct CRCLDestroyGroupR
+{
+ DWORD ResponseType;
+};
+
+
+//ID : 10012
+struct CRCLDestroyGroupRClient
+{
+ DWORD GroupID;
+};
+
+
+//ID : 10020
+struct CRCLClientJoinInGroup
+{
+ DWORD ClientID;
+ DWORD GroupID;
+
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+
+
+};
+
+
+struct CClientInfo
+{
+ DWORD ClientID;
+ char ClienName[NAMELEN];
+ DWORD IsFocus;
+};
+
+
+//ID : 10021
+struct CRCLClientJoinInGroupR
+{
+ DWORD ResponseType;
+ DWORD GroupID;
+ char MCUIP[16];
+ char SeMCUIP[16];
+
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+
+
+
+ DWORD RoomMode;
+};
+
+
+//ID : 10022
+struct CRCLClientJoinInGroupRAll
+{
+ CClientInfo ClientInfo;
+};
+
+
+
+//ID : 10023
+struct CRCLClientJoinInGroupRMCU
+{
+ //DWORD ClientID;
+ char ClientIP[16];
+
+
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+
+
+ CClientInfo ClientInfo;
+ //DWORD IfSeMCU;
+ DWORD ClientType;
+};
+
+
+//ID : 10024
+struct CRCLClientJoinInGroupRSeMCU
+{
+ DWORD ClientID;
+ char ClientIP[16];
+
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+
+};
+
+
+//ID : 10030
+struct CRCLClientLeaveGroup
+{
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 10031
+struct CRCLClientLeaveGroupR
+{
+ DWORD ResponseType;
+ DWORD GroupID;
+};
+
+
+//ID : 10032
+struct CRCLClientLeaveGroupRAll
+{
+ CClientInfo ClientInfo;
+};
+
+
+
+
+
+//ID : 10040
+struct CRCLMCULeaveGroup
+{
+ DWORD MCUID; //MCU ID
+ DWORD GroupID;
+};
+
+
+//ID : 10041
+struct CRCLMCULeaveGroupR
+{
+ DWORD ResponseType;
+};
+
+
+//ID : 10042
+struct CRCLMCULeaveGroupRAll
+{
+ DWORD GroupID; //³·ÃúÃéµÃID
+};
+
+
+//ID : 10050
+struct CRCLClientGetCroupInfo
+{
+ DWORD ClientID;
+};
+
+
+//ID : 10051
+struct CRCLClientGetCroupInfoR
+{
+ DWORD ResponseType;
+ DWORD GroupCount;
+ DWORD TalkMode;
+ CGroupInfo GroupList[10];
+};
+
+
+//ID : 10060
+struct CRCLSeMCUGetGroupInfo
+{
+ DWORD SeMCUID;
+};
+
+
+//ID : 10061
+struct CRCLSeMCUGetGroupInfoR
+{
+ DWORD ResponseType;
+ DWORD GroupCount;
+ CGroupInfo GroupList[10];
+};
+
+
+//ID : 10070
+struct CRCLSeMCUJoinGroup
+{
+ DWORD SeMCUID;
+ DWORD GroupID;
+};
+
+
+//ID : 10071
+struct CRCLSeMCUJoinGroupR
+{
+ DWORD ResponseType;
+ DWORD GroupID;
+ char MCUIP[16];
+
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+
+
+
+};
+
+
+//ID : 10072
+struct CRCLSeMCUJoinGroupRToMCU
+{
+ DWORD SeMCUID;
+ char SeMCUIP[16];
+ DWORD SeMCUType;
+ DWORD TAPort;
+ DWORD TVPort;
+ DWORD TSPort;
+ DWORD CAPort;
+ DWORD CVPort;
+};
+
+
+//ID : 10080
+struct CRCLSeMCULeaveGroup
+{
+ DWORD SeMCUID;
+ DWORD GroupID;
+};
+
+
+//ID : 10081
+struct CRCLSeMCULeaveGroupR
+{
+ DWORD ResponseType;
+};
+
+
+//ID : 10082
+struct CRCLSeMCULeaveGroupRToClient
+{
+ DWORD SeMCUID;
+};
+
+
+//ID : 10083
+struct CRCLSeMCULeaveGroupRToMCU
+{
+ DWORD SeMCUID;
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 5030
+struct CRCLTeacherLogout
+{
+ DWORD TeacherID;
+};
+
+
+//ID : 5040
+struct CRCLMCULogout
+{
+ DWORD MCUID;
+};
+
+
+//ID : 5050
+struct CRCLClientLogout
+{
+ DWORD ClientID;
+};
+
+
+//ID : 5070
+struct CRCLSeMCULogout
+{
+ DWORD MCUID;
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 1000
+struct CRCLTeacherTextBroadcast
+{
+ DWORD ClientID;
+ DWORD GroupID;
+ DWORD InfoLength;
+ char Info[1024];
+};
+
+
+//ID : 1001
+struct CRCLTeacherTextBroadcastR
+{
+ char TeacherName[NAMELEN];
+ DWORD InfoLength;
+ char Info[1024];
+};
+
+
+//ID : 1010
+struct CRCLClientApplyFocus
+{
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 1011
+struct CRCLClientApplyFocusR
+{
+ DWORD ResponseType;
+};
+
+
+//ID : 1012
+struct CRCLClientApplyFocusRToTM
+{
+ DWORD FocusClientID;
+};
+
+
+//ID : 1020
+struct CRCLClientDestroyFocus
+{
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 1021
+struct CRCLClientDestroyFocusR
+{
+ DWORD ResponseType;
+};
+
+
+//ID : 1022
+struct CRCLClientDestroyFocusRToTM
+{
+ DWORD FocusClientID;
+};
+
+
+//ID : 1030
+struct CRCLClientTextBroadcast
+{
+ DWORD ClientID;
+ DWORD GroupID;
+ DWORD InfoLength;
+ char Info[1024];
+};
+
+
+//ID : 1031
+struct CRCLClientTextBroadcastR
+{
+ char ClientName[NAMELEN];
+ DWORD InfoLength;
+ char Info[1024];
+};
+
+
+//ID : 1040
+struct CRCLClientGetClientInfo
+{
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 1041
+struct CRCLClientGetClientInfoR
+{
+ DWORD ResponseType;
+ DWORD ClientCount;
+ CClientInfo ClientList[1024];
+};
+
+
+//ID : 1050
+struct CRCLTeacherAllowClientFocus
+{
+ DWORD TeacherID;
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 1051
+struct CRCLTeacherAllowClientFocusR
+{
+ DWORD ResponseType;
+ DWORD ClientID;
+};
+
+
+struct CRCLTeacherAllowClientFocusRToMS
+{
+ DWORD ClientID;
+};
+
+
+//ID : 1060
+struct CRCLTeacherCancelClientFocus
+{
+ DWORD TeacherID;
+ DWORD ClientID;
+ DWORD GroupID;
+};
+
+
+//ID : 1061
+struct CRCLTeacherCancelClientFocusR
+{
+ DWORD ResponseType;
+ DWORD ClientID;
+};
+
+
+//ID : 1062
+struct CRCLTeacherCancelClientFocusRToMS
+{
+ DWORD ClientID;
+};
+
+
+//ID : 1070
+struct CRCLTeacherGetClientList
+{
+ DWORD TeacherID;
+ DWORD RoomID;
+};
+
+
+
+//ID : 1071
+struct CRCLTeacherGetClientListR
+{
+ DWORD ResponseType;
+ DWORD ClientNum;
+ CClientInfo ClientList[1024];
+};
+
+
+
+
+struct CRCLTeacherSwitchMode
+{
+ DWORD GroupID;
+ DWORD ModeType;
+};
+
+
+
+struct CRCLTeacherSwitchModeR
+{
+ DWORD ModeType;
+};
+
+//ID:1090
+struct CRCLTeacherChat
+{
+ DWORD GroupID;
+ DWORD chat;
+};
+
+//ID:1091
+struct CRCLTeacherChatR
+{
+ DWORD ResponseType;
+};
+
+//ID:1092
+struct CRCLTeacherChatRtoS
+{
+ DWORD chat;
+};
+
+
Added: incubator/bluesky/trunk/RealClass/TServer/src/multicomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/multicomm.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/multicomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/multicomm.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,184 @@
+//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.
+
+
+// MultiComm.cpp: implementation of the CMultiComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include <list>
+
+#include "clientsocket.h"
+#include "multicomm.h"
+
+#define LISTMUTEX_LOCK { \
+ listmutex.Lock(); \
+ }
+
+
+#define LISTMUTEX_UNLOCK {\
+ listmutex.Unlock();}
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CMultiComm::CMultiComm()
+{
+
+}
+
+CMultiComm::~CMultiComm()
+{
+ ClearList();
+}
+
+bool CMultiComm::Init()
+{
+ if(!CTCPComm::Init())
+ return false;
+
+ if (!listmutex.IsInitialized())
+ {
+ if (listmutex.Init() < 0)
+ return false;
+ }
+
+ return true;
+}
+
+int CMultiComm::OnPollThreadError(int status)
+{
+ LISTMUTEX_LOCK
+ LISTMUTEX_UNLOCK
+ return -1;
+}
+
+void CMultiComm::OnPollThreadStep()
+{
+
+
+ usleep(200000);
+}
+
+int CMultiComm::PolledSocket()
+{
+
+ CAsyncSocketEx* psocket = 0;
+ LISTMUTEX_LOCK
+
+ SOCKETLIST::iterator index;
+ for(index=m_socketlist.begin(); index!=m_socketlist.end(); ++index){
+ psocket = *index;
+ if(psocket){
+ psocket->OnEvent();
+ if(psocket->GetSocketHandle() == INVALID_SOCKET){
+ *index = 0;
+ delete psocket;
+ }
+ }
+ }
+
+ m_socketlist.remove(0);
+ LISTMUTEX_UNLOCK
+ return 0;
+}
+int CMultiComm::Poll()
+{
+ int nRes;
+ CAsyncSocketEx* psocket = 0;
+ LISTMUTEX_LOCK
+
+ SOCKETLIST::iterator index;
+
+ for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+ psocket = *index;
+ if(psocket){
+ nRes = psocket->Poll();
+ if(nRes<0){
+ LISTMUTEX_UNLOCK
+ return nRes;
+ }
+ psocket->SetStatus(nRes);
+ }
+ }
+
+ LISTMUTEX_UNLOCK
+ return 0;
+}
+
+void CMultiComm::ClearList()
+{
+ CClientSocket* p = 0;
+
+ SOCKETLIST::iterator index;
+
+ LISTMUTEX_LOCK
+
+ for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+ p = *index;
+ if(p){
+ delete p;
+ }
+ }
+
+ m_socketlist.clear();
+
+ LISTMUTEX_UNLOCK
+}
+
+bool CMultiComm::AddSocket(SOCKET socket)
+{
+ CClientSocket* p;
+ CClientSocket* psocket;
+ SOCKETLIST::iterator index;
+ if(socket == 0)
+ return true;
+
+ psocket = new CClientSocket;
+ if(psocket == 0)
+ return false;
+ psocket->Attach(socket, 0);
+
+ LISTMUTEX_LOCK
+
+ for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+ p = *index;
+ if(p){
+ if(p->GetSocketHandle() == socket){
+ LISTMUTEX_UNLOCK
+ return true;
+ }
+ }
+ }
+
+ m_socketlist.insert(m_socketlist.end(), psocket);
+ LISTMUTEX_UNLOCK
+ return true;
+}
+
+unsigned int CMultiComm::GetCount()
+{
+ unsigned int count;
+ LISTMUTEX_LOCK
+
+ count = m_socketlist.size();
+
+ LISTMUTEX_UNLOCK
+
+ return count;
+}
Added: incubator/bluesky/trunk/RealClass/TServer/src/multicomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/multicomm.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/multicomm.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/multicomm.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,54 @@
+//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.
+
+// MultiComm.h: interface for the CMultiComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(MULTICOMM_H)
+#define MULTICOMM_H
+
+#include "tcpcomm.h"
+#include "jmutex.h"
+
+typedef std::list<CClientSocket*> SOCKETLIST;
+
+class CLisSocket;
+class CMultiComm : public CTCPComm
+{
+ friend class CLisSocket;
+ friend class CClientSocket;
+public:
+ CMultiComm();
+ virtual ~CMultiComm();
+ virtual bool Init();
+
+protected:
+ virtual int OnPollThreadError(int status);
+ virtual int PolledSocket();
+ virtual int Poll() ;
+ virtual void OnPollThreadStep();
+public:
+ void ClearList();
+private:
+ unsigned int GetCount();
+ bool AddSocket(SOCKET socket);
+ JMutex listmutex;
+ SOCKETLIST m_socketlist;
+};
+
+#endif // !defined(MULTICOMM_H)
Added: incubator/bluesky/trunk/RealClass/TServer/src/stdafx.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/stdafx.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/stdafx.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/stdafx.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,20 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+#include "stdafx.h"
+
+
Added: incubator/bluesky/trunk/RealClass/TServer/src/stdafx.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/stdafx.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/stdafx.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/stdafx.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,57 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(STDAFX_H_LINUX)
+#define STDAFX_H_LINUX
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>
+ #include <string.h>
+ #include <netdb.h>
+ #include <unistd.h>
+ #include <stdio.h>
+
+
+ #define RTPSOCKERR -1
+
+
+
+// #define FALSE false
+// #define TRUE true
+ #define INVALID_SOCKET 0
+ #define SOCKET_ERROR RTPSOCKERR
+
+ #define IOCTL ioctl
+ #define CLOSESOCKET(x) close(x);
+
+ typedef int SOCKET;
+ typedef sockaddr SOCKADDR;
+ typedef struct sockaddr_in SOCKADDR_IN;
+ typedef bool BOOL;
+ typedef unsigned int UINT;
+ typedef const char* LPCTSTR;
+ typedef char* LPSTR;
+ typedef unsigned long DWORD;
+ typedef struct hostent HOSTENT, *LPHOSTENT;
+#endif // !defined(STDAFX_H_LINUX)
Added: incubator/bluesky/trunk/RealClass/TServer/src/support.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/support.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/support.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/support.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,114 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+
+#include "support.hh"
+
+static GList *pixmaps_directories = NULL;
+
+/* Use this function to set the directory containing installed pixmaps. */
+void
+add_pixmap_directory (const gchar *directory)
+{
+ pixmaps_directories = g_list_prepend (pixmaps_directories,
+ g_strdup (directory));
+}
+
+/* This is an internally used function to find pixmap files. */
+static gchar*
+find_pixmap_file (const gchar *filename)
+{
+ GList *elem;
+
+ /* We step through each of the pixmaps directory to find it. */
+ elem = pixmaps_directories;
+ while (elem)
+ {
+ gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
+ G_DIR_SEPARATOR_S, filename);
+ if (g_file_test (pathname, G_FILE_TEST_EXISTS))
+ return pathname;
+ g_free (pathname);
+ elem = elem->next;
+ }
+ return NULL;
+}
+
+/* This is an internally used function to create pixmaps. */
+GtkWidget*
+create_pixmap (GtkWidget *widget,
+ const gchar *filename)
+{
+ gchar *pathname = NULL;
+ GtkWidget *pixmap;
+
+ if (!filename || !filename[0])
+ return gtk_image_new ();
+
+ pathname = find_pixmap_file (filename);
+
+ if (!pathname)
+ {
+ g_warning (_("Couldn't find pixmap file: %s"), filename);
+ return gtk_image_new ();
+ }
+
+ pixmap = gtk_image_new_from_file (pathname);
+ g_free (pathname);
+ return pixmap;
+}
+
+/* This is an internally used function to create pixmaps. */
+GdkPixbuf*
+create_pixbuf (const gchar *filename)
+{
+ gchar *pathname = NULL;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+
+ if (!filename || !filename[0])
+ return NULL;
+
+ pathname = find_pixmap_file (filename);
+
+ if (!pathname)
+ {
+ g_warning (_("Couldn't find pixmap file: %s"), filename);
+ return NULL;
+ }
+
+ pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
+ if (!pixbuf)
+ {
+ fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
+ pathname, error->message);
+ g_error_free (error);
+ }
+ g_free (pathname);
+ return pixbuf;
+}
Added: incubator/bluesky/trunk/RealClass/TServer/src/support.hh
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/support.hh?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/support.hh (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/support.hh Mon Nov 30 11:24:38 2009
@@ -0,0 +1,62 @@
+//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>
+
+/*
+ * Standard gettext macros.
+ */
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# undef _
+# define _(String) dgettext (PACKAGE, String)
+# define Q_(String) g_strip_context ((String), gettext (String))
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define Q_(String) g_strip_context ((String), (String))
+# define N_(String) (String)
+#endif
+
+/* Use this function to set the directory containing installed pixmaps. */
+void add_pixmap_directory (const gchar *directory);
+
+
+/*
+ * Private Functions.
+ */
+
+/* This is used to create the pixmaps used in the interface. */
+GtkWidget* create_pixmap (GtkWidget *widget,
+ const gchar *filename);
+
+/* This is used to create the pixbufs used in the interface. */
+GdkPixbuf* create_pixbuf (const gchar *filename);
+
Added: incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,88 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+// TCPComm.cpp: implementation of the CTCPComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "asyncsocketex.h"
+#include "tcpcomm.h"
+#include "tcppollthread.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CTCPComm::CTCPComm()
+{
+
+ m_pThread = 0;
+}
+
+CTCPComm::~CTCPComm()
+{
+ Stop();
+
+}
+
+
+int CTCPComm::OnPollThreadError(int status)
+{
+ return -1;
+}
+
+bool CTCPComm::Init()
+{
+
+ if(m_pThread){
+ m_pThread->Stop();
+ return true;
+ }
+
+ m_pThread = new CTCPPollThread(this);
+
+ if(m_pThread)
+ return true;
+
+ return false;
+}
+
+int CTCPComm::Start()
+{
+ if(m_pThread == 0){
+ return -1;
+ }
+ return m_pThread->Start();
+}
+
+bool CTCPComm::IsPolling()
+{
+ if(m_pThread == 0){
+ return false;
+ }
+ return m_pThread->IsRunning();
+}
+
+
+void CTCPComm::Stop()
+{
+ if(m_pThread){
+ m_pThread->Stop();
+ }
+
+}
Added: incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/tcpcomm.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,48 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+// TCPComm.h: interface for the CTCPComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(TCPCOMM_H)
+#define TCPCOMM_H
+
+class CTCPPollThread;
+class CTCPComm
+{
+ friend class CTCPPollThread;
+public:
+ void Stop();
+ bool IsPolling();
+ int Start();
+ virtual bool Init();
+ CTCPComm();
+ virtual ~CTCPComm();
+
+protected:
+ virtual void OnPollThreadStep() = 0;
+ virtual int OnPollThreadError(int status);
+ virtual int PolledSocket() = 0;
+ virtual int Poll() = 0;
+
+
+
+private:
+ CTCPPollThread *m_pThread;
+};
+
+#endif // !defined(TCPCOMM_H)
Added: incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,97 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+#include "tcppollthread.h"
+#include "tcpcomm.h"
+
+CTCPPollThread::CTCPPollThread(CTCPComm* pcomm)
+{
+ m_pcomm = pcomm;
+ stop = false;
+}
+
+CTCPPollThread::~CTCPPollThread()
+{
+ Stop();
+}
+
+int CTCPPollThread::Start()
+{
+ if (JThread::IsRunning())
+ return -1;
+
+ if (!stopmutex.IsInitialized())
+ {
+ if (stopmutex.Init() < 0)
+ return -1;
+ }
+ stop = false;
+ if (JThread::Start() < 0)
+ return -1;
+ return 0;
+}
+
+void CTCPPollThread::Stop()
+{
+ if (!IsRunning())
+ return;
+
+ stopmutex.Lock();
+ stop = true;
+ stopmutex.Unlock();
+
+
+ if (JThread::IsRunning())
+ {
+ JThread::Kill();
+ }
+ stop = false;
+}
+
+void *CTCPPollThread::Thread()
+{
+ JThread::ThreadStarted();
+
+ int status;
+ bool stopthread;
+
+ stopmutex.Lock();
+ stopthread = stop;
+ stopmutex.Unlock();
+ while (!stopthread)
+ {
+
+ status = m_pcomm->Poll();
+ if(status < 0 ){
+ stopthread = 0;
+ m_pcomm->OnPollThreadError(status);
+ }
+ else{
+ status = m_pcomm->PolledSocket();
+ if(status < 0){
+ stopthread = true;
+ m_pcomm->OnPollThreadError(status);
+ }
+ else{
+ m_pcomm->OnPollThreadStep();
+ stopmutex.Lock();
+ stopthread = stop;
+ stopmutex.Unlock();
+ }
+ }
+ }
+ return 0;
+}
Added: incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.h?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.h (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/tcppollthread.h Mon Nov 30 11:24:38 2009
@@ -0,0 +1,45 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements. See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership. The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied. See the License for the
+//specific language governing permissions and limitations
+//under the License.
+#ifndef CTCPPOLLTHREAD_H
+
+#define CTCPPOLLTHREAD_H
+
+
+
+
+#include "jthread.h"
+#include "jmutex.h"
+
+class CTCPComm;
+class CTCPPollThread : private JThread
+{
+ friend class CTCPComm;
+public:
+ CTCPPollThread(CTCPComm* pcomm);
+ ~CTCPPollThread();
+ int Start();
+ void Stop();
+private:
+ void *Thread();
+
+ bool stop;
+ JMutex stopmutex;
+ CTCPComm *m_pcomm;
+};
+
+
+#endif // CTCPPOLLTHREAD_H
Added: incubator/bluesky/trunk/RealClass/TServer/src/tserver
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tserver?rev=885379&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/bluesky/trunk/RealClass/TServer/src/tserver
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/bluesky/trunk/RealClass/TServer/src/tserver.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/TServer/src/tserver.cpp?rev=885379&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/TServer/src/tserver.cpp (added)
+++ incubator/bluesky/trunk/RealClass/TServer/src/tserver.cpp Mon Nov 30 11:24:38 2009
@@ -0,0 +1,84 @@
+//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.
+
+// TServer.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+#include "asyncsocketex.h"
+#include <list>
+#include <string>
+#include "clientsocket.h"
+#include "multicomm.h"
+#include "listencomm.h"
+
+#include "adminserver.h"
+#include <gtk/gtk.h>
+
+#include "interface.hh"
+#include "callbacks.hh"
+#include "support.hh"
+
+#include <signal.h>
+#include <unistd.h>
+
+#define TSERVER_VERSION "1.2"
+
+
+int main(int argc, char* argv[])
+{
+ if(argc==2)
+ {
+ if(strcmp(argv[1],"--version")==0)
+ printf("\n tserver (copyright @ XJTU), version %s\n\n",TSERVER_VERSION);
+ else if(strcmp(argv[1],"-v")==0)
+ printf("%s\n",TSERVER_VERSION);
+ else
+ printf("\n unknow parameter!\n\n");
+ return 0;
+ }
+ GtkWidget *window1;
+ guint timer;
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+ gtk_set_locale ();
+ gtk_init (&argc, &argv);
+
+ add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
+
+ window1 = create_window_tserver ();
+ gtk_widget_show (window1);
+ gtk_quit_add(gtk_main_level(),quit_callback,NULL);
+ timer = gtk_timeout_add(3000,timer_callback,NULL);
+
+ gtk_main ();
+
+ printf("end\n");
+
+
+
+
+
+
+ return 0;
+
+}