Changeset 3209 for code/branches/netp5/src/network
- Timestamp:
- Jun 23, 2009, 2:12:44 AM (15 years ago)
- Location:
- code/branches/netp5/src/network
- Files:
-
- 56 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp5/src/network/ChatListener.cc
r2896 r3209 28 28 29 29 #include "ChatListener.h" 30 31 30 #include "core/CoreIncludes.h" 32 31 -
code/branches/netp5/src/network/ChatListener.h
r2171 r3209 31 31 32 32 #include "NetworkPrereqs.h" 33 34 #include "ClientInformation.h"35 33 #include "core/OrxonoxClass.h" 36 34 -
code/branches/netp5/src/network/Client.cc
r3206 r3209 39 39 // 40 40 41 #include "Client.h" 42 41 43 #include <cassert> 42 #include <enet/enet.h>43 44 44 #include " Client.h"45 #include " Host.h"45 #include "util/Debug.h" 46 #include "core/Clock.h" 46 47 #include "synchronisable/Synchronisable.h" 47 #include "core/Clock.h" 48 #include "core/CoreIncludes.h" 49 #include "packet/Packet.h" 48 #include "packet/Chat.h" 49 #include "packet/Gamestate.h" 50 50 #include "FunctionCallManager.h" 51 51 -
code/branches/netp5/src/network/Client.h
r3202 r3209 45 45 46 46 #include <string> 47 48 #include "Host.h"49 #include "packet/Chat.h"50 47 #include "ClientConnection.h" 51 48 #include "GamestateClient.h" 52 49 #include "Host.h" 53 50 54 51 namespace orxonox -
code/branches/netp5/src/network/ClientConnection.cc
r3203 r3209 29 29 #include "ClientConnection.h" 30 30 31 #include <iostream>32 31 #include <cassert> 33 32 #include <enet/enet.h> 34 33 #include "util/Debug.h" 35 34 … … 43 42 44 43 ClientConnection::ClientConnection(): 45 server_(NULL),46 established_(false)44 established_(false), 45 server_(NULL) 47 46 { 48 47 this->serverAddress_ = new ENetAddress(); … … 56 55 closeConnection(); 57 56 delete this->serverAddress_; // surely was created 57 } 58 59 void ClientConnection::setServerAddress( const std::string& serverAddress ) { 60 enet_address_set_host (this->serverAddress_, serverAddress.c_str()); 61 } 62 63 void ClientConnection::setPort( unsigned int port ) { 64 this->serverAddress_->port = port; 58 65 } 59 66 -
code/branches/netp5/src/network/ClientConnection.h
r3202 r3209 30 30 #define _ClientConnection_H__ 31 31 32 #include <string>33 34 32 #include "NetworkPrereqs.h" 35 33 #include "Connection.h" … … 41 39 public: 42 40 ClientConnection(); 43 ~ClientConnection();41 virtual ~ClientConnection(); 44 42 45 void setServerAddress( const std::string& serverAddress ) { enet_address_set_host (this->serverAddress_, serverAddress.c_str()); }46 void setPort( unsigned int port ) { this->serverAddress_->port = port; }43 void setServerAddress( const std::string& serverAddress ); 44 void setPort( unsigned int port ); 47 45 48 46 ENetEvent *getEvent(); … … 68 66 69 67 70 71 72 73 74 75 76 68 } 77 69 -
code/branches/netp5/src/network/ClientConnectionListener.cc
r2896 r3209 28 28 29 29 #include "ClientConnectionListener.h" 30 30 31 #include "core/CoreIncludes.h" 31 32 #include "core/GameMode.h" 33 #include "ClientInformation.h" 32 34 33 35 namespace orxonox{ -
code/branches/netp5/src/network/ClientConnectionListener.h
r2171 r3209 1 #ifndef _NETWORK_CLIENTCONNECTIONLISTENER__ 2 #define _NETWORK_CLIENTCONNECTIONLISTENER__ 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 #ifndef _ClientConnectionListener_H__ 30 #define _ClientConnectionListener_H__ 3 31 4 32 #include "NetworkPrereqs.h" 5 #include "ClientInformation.h"6 33 #include "core/OrxonoxClass.h" 7 34 … … 26 53 27 54 28 #endif 55 #endif /* _ClientConnectionListener_H__ */ -
code/branches/netp5/src/network/ClientInformation.cc
r2773 r3209 40 40 41 41 #include "ClientInformation.h" 42 43 42 #include <enet/enet.h> 44 #include <iostream> //debug45 43 46 44 namespace orxonox -
code/branches/netp5/src/network/Connection.cc
r3202 r3209 29 29 #include "Connection.h" 30 30 31 #include <iostream>32 31 #include <cassert> 32 #include <enet/enet.h> 33 33 #include <OgreTimer.h> 34 35 #include "util/Debug.h" 36 #include "util/Math.h" 37 #include "util/Sleep.h" 38 #include "ClientInformation.h" 39 #include "synchronisable/Synchronisable.h" 40 #include "packet/ClassID.h" 34 #include "packet/Packet.h" 41 35 42 36 namespace orxonox … … 55 49 Connection::~Connection(){ 56 50 Connection::instance_=0; 51 } 52 53 int Connection::service(ENetEvent* event) { 54 return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT ); 55 } 56 57 void Connection::disconnectPeer(ENetPeer *peer) { 58 enet_peer_disconnect(peer, 0); 57 59 } 58 60 … … 96 98 } 97 99 100 bool Connection::processPacket(ENetEvent* event) { 101 packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer); 102 return p->process(); 103 } 104 98 105 } -
code/branches/netp5/src/network/Connection.h
r3203 r3209 43 43 #include "NetworkPrereqs.h" 44 44 45 #include <string>46 #include <map>47 #include <enet/enet.h>48 49 #include "packet/Packet.h"50 51 45 namespace orxonox 52 46 { … … 59 53 class _NetworkExport Connection{ 60 54 public: 61 ~Connection();55 virtual ~Connection(); 62 56 63 57 static bool addPacket(ENetPacket *packet, ENetPeer *peer); … … 69 63 static Connection* getInstance(){ return Connection::instance_; } 70 64 71 int service(ENetEvent* event) { return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT ); }72 void disconnectPeer(ENetPeer *peer) { enet_peer_disconnect(peer, 0); }65 int service(ENetEvent* event); 66 void disconnectPeer(ENetPeer *peer); 73 67 74 68 void processQueue(); 75 69 virtual void addClient(ENetEvent* event)=0; 76 70 virtual void disconnectPeer(ENetEvent* event)=0; 77 virtual bool processPacket(ENetEvent* event) { packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer); return p->process(); }71 virtual bool processPacket(ENetEvent* event); 78 72 79 73 ENetHost *host_; -
code/branches/netp5/src/network/FunctionCallManager.h
r3084 r3209 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKFUNCTIONCALLMANAGER_H3 #define NETWORKFUNCTIONCALLMANAGER_H29 #ifndef _FunctionCallManager_H__ 30 #define _FunctionCallManager_H__ 4 31 5 32 #include "NetworkPrereqs.h" 6 #include "packet/FunctionCalls.h" 33 7 34 #include <map> 8 35 #include "util/UtilPrereqs.h" 9 36 10 37 namespace orxonox { … … 12 39 @author 13 40 */ 14 15 class MultiType;16 41 17 42 class _NetworkExport FunctionCallManager … … 42 67 } //namespace orxonox 43 68 44 #endif 69 #endif /* _FunctionCallManager_H__ */ -
code/branches/netp5/src/network/GamestateClient.cc
r3196 r3209 29 29 #include "GamestateClient.h" 30 30 31 #include <cassert> 32 #include <zlib.h> 33 34 #include "core/CoreIncludes.h" 35 #include "core/BaseObject.h" 31 #include "util/Debug.h" 32 #include "core/ObjectList.h" 36 33 #include "synchronisable/Synchronisable.h" 37 34 #include "synchronisable/NetworkCallbackManager.h" 38 35 #include "packet/Acknowledgement.h" 36 #include "packet/Gamestate.h" 39 37 40 38 -
code/branches/netp5/src/network/GamestateClient.h
r2171 r3209 41 41 #define _GamestateClient_H__ 42 42 43 #include "NetworkPrereqs.h" 44 43 45 #include <map> 44 //45 #include "NetworkPrereqs.h"46 46 #include "core/CorePrereqs.h" 47 #include "packet/Gamestate.h"48 47 #include "GamestateHandler.h" 49 48 -
code/branches/netp5/src/network/GamestateHandler.cc
r2773 r3209 1 #include <cassert> 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch>, (C) 2008 24 * Co-authors: 25 * ... 26 * 27 */ 2 28 3 29 #include "GamestateHandler.h" 4 #include "packet/Packet.h"30 #include <cassert> 5 31 6 32 namespace orxonox { -
code/branches/netp5/src/network/GamestateHandler.h
r2171 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKGAMESTATEHANDLER_H29 #define NETWORKGAMESTATEHANDLER_H30 28 31 #include <string> 29 #ifndef _GamestateHandler_H__ 30 #define _GamestateHandler_H__ 32 31 33 32 #include "NetworkPrereqs.h" 34 #include "packet/Chat.h"35 33 36 34 namespace orxonox { … … 58 56 } 59 57 60 #endif 58 #endif /* _GamestateHandler_H__ */ -
code/branches/netp5/src/network/GamestateManager.cc
r3198 r3209 41 41 #include "GamestateManager.h" 42 42 43 #include <utility>44 #include <iostream>45 #include <zlib.h>46 43 #include <cassert> 47 44 48 #include "core/CoreIncludes.h" 49 #include "core/BaseObject.h" 45 #include "util/Debug.h" 50 46 #include "ClientInformation.h" 51 #include "synchronisable/Synchronisable.h" 47 #include "packet/Acknowledgement.h" 48 #include "packet/Gamestate.h" 52 49 #include "synchronisable/NetworkCallbackManager.h" 53 #include " packet/Acknowledgement.h"50 #include "TrafficControl.h" 54 51 55 52 namespace orxonox -
code/branches/netp5/src/network/GamestateManager.h
r3084 r3209 42 42 43 43 #include "NetworkPrereqs.h" 44 45 #include <map> 44 46 #include "GamestateHandler.h" 45 #include "TrafficControl.h"46 #include <map>47 48 #include "packet/Gamestate.h"49 47 50 48 namespace orxonox 51 49 { 52 50 53 51 const int KEEP_GAMESTATES = 10; 54 52 55 53 /** -
code/branches/netp5/src/network/Host.cc
r3095 r3209 27 27 */ 28 28 29 #include "Host.h" 30 29 31 #include <cassert> 32 #include <string> 30 33 31 #include "Host.h"32 34 #include "core/ConsoleCommand.h" 33 #include " packet/Packet.h"35 #include "core/ObjectList.h" 34 36 #include "ChatListener.h" 35 37 -
code/branches/netp5/src/network/Host.h
r3196 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKHOST_H29 #define NETWORKHOST_H30 28 31 #include <string> 29 #ifndef _NETWORK_Host_H__ 30 #define _NETWORK_Host_H__ 32 31 33 32 #include "NetworkPrereqs.h" 34 #include "packet/Chat.h"35 33 36 34 namespace orxonox { … … 86 84 } 87 85 88 #endif 86 #endif /* _NETWORK_Host_H__ */ -
code/branches/netp5/src/network/NetworkFunction.cc
r3084 r3209 28 28 29 29 #include "NetworkFunction.h" 30 #include <string> 31 #include "synchronisable/Synchronisable.h" 30 #include "core/CoreIncludes.h" 32 31 33 32 namespace orxonox … … 42 41 std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_; 43 42 44 NetworkFunctionBase::NetworkFunctionBase( std::stringname)43 NetworkFunctionBase::NetworkFunctionBase(const std::string& name) 45 44 { 46 45 RegisterRootObject(NetworkFunctionBase); … … 58 57 59 58 60 NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, std::stringname, const NetworkFunctionPointer& p):59 NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p): 61 60 NetworkFunctionBase(name) 62 61 { … … 75 74 76 75 77 NetworkMemberFunctionBase::NetworkMemberFunctionBase( std::stringname, const NetworkFunctionPointer& p):76 NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p): 78 77 NetworkFunctionBase(name) 79 78 { -
code/branches/netp5/src/network/NetworkFunction.h
r3208 r3209 27 27 */ 28 28 29 #ifndef NETWORKFUNCTION_H30 #define NETWORKFUNCTION_H29 #ifndef _NetworkFunction_H__ 30 #define _NetworkFunction_H__ 31 31 32 32 #include "NetworkPrereqs.h" 33 34 #include <cassert> 35 #include <map> 36 #include <string> 37 #include <boost/preprocessor/cat.hpp> 38 33 39 #include "core/OrxonoxClass.h" 34 35 #include <string>36 #include <map>37 #include <cassert>38 #include <boost/preprocessor/cat.hpp>39 #include "util/MultiType.h"40 40 #include "core/Functor.h" 41 #include "FunctionCallManager.h" 41 42 #include "synchronisable/Synchronisable.h" 42 #include "OrxonoxConfig.h"43 #include "FunctionCallManager.h"44 45 43 46 44 namespace orxonox … … 72 70 class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass { 73 71 public: 74 NetworkFunctionBase( std::stringname);72 NetworkFunctionBase(const std::string& name); 75 73 ~NetworkFunctionBase(); 76 74 77 75 virtual void setNetworkID(uint32_t id) { this->networkID_ = id; } 78 76 inline uint32_t getNetworkID() const { return this->networkID_; } 79 inline std::string getName() const{ return name_; }77 inline const std::string& getName() const { return name_; } 80 78 static inline bool isStatic( uint32_t networkID ) { return isStaticMap_[networkID]; } 81 79 82 static inline void setNetworkID( std::stringname, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }80 static inline void setNetworkID(const std::string& name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); } 83 81 84 82 protected: … … 95 93 class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase { 96 94 public: 97 NetworkFunctionStatic(FunctorStatic* functor, std::stringname, const NetworkFunctionPointer& p);95 NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p); 98 96 ~NetworkFunctionStatic(); 99 97 … … 121 119 class _NetworkExport NetworkMemberFunctionBase: public NetworkFunctionBase { 122 120 public: 123 NetworkMemberFunctionBase( std::stringname, const NetworkFunctionPointer& p);121 NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p); 124 122 ~NetworkMemberFunctionBase(); 125 123 … … 145 143 template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase { 146 144 public: 147 NetworkMemberFunction(FunctorMember<T>* functor, std::stringname, const NetworkFunctionPointer& p);145 NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p); 148 146 ~NetworkMemberFunction(); 149 147 … … 183 181 }; 184 182 185 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, std::stringname, const NetworkFunctionPointer& p):183 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p): 186 184 NetworkMemberFunctionBase(name, p), functor_(functor) 187 185 { … … 201 199 } 202 200 203 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, std::stringname )201 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name ) 204 202 { 205 203 NetworkFunctionPointer destptr; … … 209 207 } 210 208 211 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, std::stringname )209 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name ) 212 210 { 213 211 NetworkFunctionPointer destptr; … … 239 237 } 240 238 241 #endif 239 #endif /* _NetworkFunction_H__ */ -
code/branches/netp5/src/network/NetworkPrereqs.h
r3201 r3209 114 114 struct QueueItem; 115 115 struct syncData; 116 class TrafficControl; 116 117 class obj; 117 118 class objInfo; … … 129 130 class Welcome; 130 131 } 132 133 namespace PacketFlag 134 { 135 enum Enum 136 { 137 Reliable = 1, 138 Unsequence = 2, 139 NoAllocate = 4 140 }; 141 } 131 142 } 132 143 -
code/branches/netp5/src/network/PacketBuffer.cc
r2773 r3209 33 33 #include "PacketBuffer.h" 34 34 35 #include <enet/enet.h> 36 #include <iostream> 37 #include <queue> 38 #include <string> 39 #include <boost/bind.hpp> 40 #include <boost/thread/mutex.hpp> 35 //#include <iostream> 41 36 #include <boost/thread/recursive_mutex.hpp> 42 37 -
code/branches/netp5/src/network/Server.cc
r3202 r3209 42 42 43 43 #include <enet/enet.h> 44 #include <iostream>45 44 #include <cassert> 46 47 48 // #include "ConnectionManager.h" 49 #include "ClientConnectionListener.h" 45 #include <string> 46 47 #include "util/Debug.h" 48 #include "core/Clock.h" 49 #include "core/ObjectList.h" 50 #include "packet/Chat.h" 51 #include "packet/ClassID.h" 52 #include "packet/DeleteObjects.h" 53 #include "packet/FunctionIDs.h" 54 #include "packet/Gamestate.h" 55 #include "packet/Welcome.h" 56 #include "ChatListener.h" 57 #include "ClientInformation.h" 58 #include "FunctionCallManager.h" 50 59 #include "GamestateManager.h" 51 #include "ClientInformation.h"52 #include "util/Sleep.h"53 #include "core/Clock.h"54 #include "core/ConsoleCommand.h"55 #include "core/CoreIncludes.h"56 #include "packet/Chat.h"57 #include "packet/Packet.h"58 #include "packet/Welcome.h"59 #include "packet/DeleteObjects.h"60 #include "packet/ClassID.h"61 #include "util/Convert.h"62 #include "ChatListener.h"63 #include "FunctionCallManager.h"64 #include "packet/FunctionIDs.h"65 66 60 67 61 namespace orxonox -
code/branches/netp5/src/network/Server.h
r3201 r3209 32 32 #include "NetworkPrereqs.h" 33 33 34 #include <string> 35 34 #include "core/CorePrereqs.h" 36 35 #include "Host.h" 37 36 #include "ServerConnection.h" 38 #include "GamestateManager.h"39 37 40 38 namespace orxonox -
code/branches/netp5/src/network/ServerConnection.cc
r3203 r3209 30 30 31 31 #include <cassert> 32 #include <string> 33 #include <enet/enet.h> 32 34 35 #include "util/Debug.h" 33 36 #include "ClientInformation.h" 34 35 #include "core/CoreIncludes.h"36 37 37 38 namespace orxonox … … 50 51 closeListener(); 51 52 delete this->bindAddress_; 53 } 54 55 void ServerConnection::setBindAddress( const std::string& bindAddress ) { 56 enet_address_set_host (this->bindAddress_, bindAddress.c_str()); 57 } 58 59 void ServerConnection::setPort( unsigned int port ) { 60 this->bindAddress_->port = port; 52 61 } 53 62 -
code/branches/netp5/src/network/ServerConnection.h
r3202 r3209 42 42 43 43 #include "NetworkPrereqs.h" 44 45 44 #include "Connection.h" 46 45 … … 52 51 ~ServerConnection(); 53 52 54 void setBindAddress( const std::string& bindAddress ) { enet_address_set_host (this->bindAddress_, bindAddress.c_str()); }55 void setPort( unsigned int port ) { this->bindAddress_->port = port; }53 void setBindAddress( const std::string& bindAddress ); 54 void setPort( unsigned int port ); 56 55 57 56 bool openListener(); -
code/branches/netp5/src/network/TrafficControl.cc
r3198 r3209 29 29 #include "TrafficControl.h" 30 30 31 #include "synchronisable/Synchronisable.h" 31 #include <cassert> 32 #include <boost/bind.hpp> 33 32 34 #include "core/CoreIncludes.h" 33 35 #include "core/ConfigValueIncludes.h" 34 35 #include <cassert> 36 #include <boost/bind.hpp> 36 #include "synchronisable/Synchronisable.h" 37 37 38 38 namespace orxonox { -
code/branches/netp5/src/network/TrafficControl.h
r3084 r3209 25 25 * ... 26 26 * 27 27 28 */ 28 #ifndef NETWORK_TRAFFICCONTROL_H29 #define NETWORK_TRAFFICCONTROL_H29 #ifndef _TrafficControl_H__ 30 #define _TrafficControl_H__ 30 31 31 32 #include "NetworkPrereqs.h" 32 33 33 #include <string>34 34 #include <list> 35 35 #include <map> 36 #include <utility>37 #include <algorithm>38 #include "core/OrxonoxClass.h"39 36 #include "network/ClientConnectionListener.h" 40 37 … … 143 140 } 144 141 145 #endif 146 142 #endif /* _TrafficControl_H__ */ -
code/branches/netp5/src/network/packet/Acknowledgement.cc
r3198 r3209 27 27 */ 28 28 29 #include "Acknowledgement.h" 29 30 30 #include "Acknowledgement.h" 31 #include "network/Host.h" 31 #include "util/Debug.h" 32 32 #include "network/GamestateHandler.h" 33 #include "core/CoreIncludes.h"34 33 35 34 namespace orxonox { -
code/branches/netp5/src/network/packet/Acknowledgement.h
r2662 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKACKNOLEDGEMENT_H29 #define NETWORKACKNOLEDGEMENT_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _Acknowledgement_H__ 30 #define _Acknowledgement_H__ 31 32 #include "network/NetworkPrereqs.h" 32 33 #include "Packet.h" 33 34 35 namespace orxonox { 34 36 const unsigned int ACKID_NACK = 0; 35 36 namespace orxonox {37 37 namespace packet { 38 38 /** … … 56 56 } //namespace orxonox 57 57 58 #endif 58 #endif /* _Acknowledgement_H__ */ -
code/branches/netp5/src/network/packet/Chat.cc
r2773 r3209 29 29 #include "Chat.h" 30 30 31 #include <enet/enet.h> 32 #include <cassert> 31 #include <string> 33 32 #include "network/Host.h" 34 33 … … 36 35 namespace packet { 37 36 38 #define PACKET_FLAGS_CHAT ENET_PACKET_FLAG_RELIABLE37 #define PACKET_FLAGS_CHAT PacketFlag::Reliable 39 38 #define _PACKETID 0 40 39 const int _PLAYERID = _PACKETID + sizeof(ENUM::Type); … … 42 41 #define _MESSAGE _MESSAGELENGTH + sizeof(uint32_t) 43 42 44 Chat::Chat( std::stringmessage, unsigned int playerID )43 Chat::Chat( const std::string& message, unsigned int playerID ) 45 44 : Packet() 46 45 { -
code/branches/netp5/src/network/packet/Chat.h
r2171 r3209 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch> 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKCHAT_H3 #define NETWORKCHAT_H29 #ifndef _NETWORK_Chat_H__ 30 #define _NETWORK_Chat_H__ 4 31 5 #include "../NetworkPrereqs.h" 6 7 #include <string> 8 #include <cstring> 9 32 #include "network/NetworkPrereqs.h" 10 33 #include "Packet.h" 11 34 … … 18 41 { 19 42 public: 20 Chat( std::stringmessage, unsigned int playerID );43 Chat( const std::string& message, unsigned int playerID ); 21 44 Chat( uint8_t* data, unsigned int clientID ); 22 45 ~Chat(); … … 35 58 } //namespace orxonox 36 59 37 #endif 60 #endif /* _NETWORK_Chat_H__ */ -
code/branches/netp5/src/network/packet/ClassID.cc
r3084 r3209 27 27 */ 28 28 29 #include "ClassID.h" 29 30 30 31 #include "ClassID.h"32 #include <enet/enet.h>33 #include "core/CoreIncludes.h"34 #include "core/Factory.h"35 #include <cstring>36 #include <string>37 31 #include <cassert> 38 32 #include <map> 39 33 #include <queue> 34 #include <string> 35 36 #include "core/CoreIncludes.h" 40 37 41 38 namespace orxonox { … … 43 40 44 41 45 #define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE42 #define PACKET_FLAGS_CLASSID PacketFlag::Reliable 46 43 #define _PACKETID 0 47 44 -
code/branches/netp5/src/network/packet/ClassID.h
r2759 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKCLASSID_H29 #define NETWORKCLASSID_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _NETWORK_ClassID_H__ 30 #define _NETWORK_ClassID_H__ 32 31 33 #include <string> 34 32 #include "network/NetworkPrereqs.h" 35 33 #include "Packet.h" 36 34 … … 58 56 } //namespace orxonox 59 57 60 #endif 58 #endif /* _NETWORK_ClassID_H__ */ -
code/branches/netp5/src/network/packet/DeleteObjects.cc
r3208 r3209 29 29 30 30 #include "DeleteObjects.h" 31 #include <enet/enet.h> 31 32 #include <cassert> 33 #include "util/Debug.h" 32 34 #include "network/synchronisable/Synchronisable.h" 33 #include "core/CoreIncludes.h"34 #include <cassert>35 35 36 36 namespace orxonox { 37 37 namespace packet { 38 38 39 #define PACKET_FLAG_DELETE ENET_PACKET_FLAG_RELIABLE39 #define PACKET_FLAG_DELETE PacketFlag::Reliable 40 40 #define _PACKETID 0 41 41 #define _QUANTITY _PACKETID + sizeof(ENUM::Type) -
code/branches/netp5/src/network/packet/DeleteObjects.h
r2171 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKPACKETDELETEOBJECTS_H29 #define NETWORKPACKETDELETEOBJECTS_H28 #ifndef _DeleteObjects_H__ 29 #define _DeleteObjects_H__ 30 30 31 #include "../NetworkPrereqs.h" 32 31 #include "network/NetworkPrereqs.h" 33 32 #include "Packet.h" 34 35 33 36 34 namespace orxonox { … … 57 55 } //namespace orxonox 58 56 59 #endif 57 #endif /* _DeleteObjects_H__ */ -
code/branches/netp5/src/network/packet/FunctionCalls.cc
r3208 r3209 29 29 #include "FunctionCalls.h" 30 30 31 #include <enet/enet.h>32 31 #include <cassert> 33 #include <cstring> 34 #include "network/Host.h" 32 #include "util/MultiType.h" 35 33 #include "network/NetworkFunction.h" 36 #include "util/MultiType.h"37 34 38 35 namespace orxonox { 39 36 namespace packet { 40 37 41 #define PACKET_FLAGS_FUNCTIONCALLS ENET_PACKET_FLAG_RELIABLE38 #define PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable 42 39 #define _PACKETID 0 43 40 const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000; -
code/branches/netp5/src/network/packet/FunctionCalls.h
r3084 r3209 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Oliver Scheuss <scheusso [at] ee.ethz.ch> 24 * Co-authors: 25 * ... 26 * 27 */ 1 28 2 #ifndef NETWORKFUNCTIONCALLS_H3 #define NETWORKFUNCTIONCALLS_H29 #ifndef _FunctionCalls_H__ 30 #define _FunctionCalls_H__ 4 31 5 #include " ../NetworkPrereqs.h"32 #include "network/NetworkPrereqs.h" 6 33 7 #include <string> 8 #include <cstring> 9 34 #include <cassert> 35 #include "util/UtilPrereqs.h" 10 36 #include "Packet.h" 11 #include <cassert>12 37 13 38 namespace orxonox { 14 15 class MultiType;16 39 17 40 namespace packet { … … 44 67 } //namespace orxonox 45 68 46 #endif 69 #endif /* _FunctionCalls_H__ */ -
code/branches/netp5/src/network/packet/FunctionIDs.cc
r3084 r3209 27 27 */ 28 28 29 #include "FunctionIDs.h" 29 30 30 31 #include "FunctionIDs.h"32 #include "network/NetworkFunction.h"33 #include <enet/enet.h>34 #include "core/CoreIncludes.h"35 #include <string>36 31 #include <cassert> 37 32 #include <queue> 33 #include <string> 34 35 #include "util/Debug.h" 36 #include "core/ObjectList.h" 37 #include "network/NetworkFunction.h" 38 38 39 39 namespace orxonox { … … 41 41 42 42 43 #define PACKET_FLAGS_FUNCTIONIDS ENET_PACKET_FLAG_RELIABLE43 #define PACKET_FLAGS_FUNCTIONIDS PacketFlag::Reliable 44 44 #define _PACKETID 0 45 45 -
code/branches/netp5/src/network/packet/FunctionIDs.h
r3084 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKFUNCTIONIDS_H29 #define NETWORKFUNCTIONIDS_H30 28 31 #include "../NetworkPrereqs.h" 29 #ifndef _FunctionIDs_H__ 30 #define _FunctionIDs_H__ 32 31 33 #include <string> 34 32 #include "network/NetworkPrereqs.h" 35 33 #include "Packet.h" 36 34 … … 58 56 } //namespace orxonox 59 57 60 #endif 58 #endif /* _FunctionIDs_H__ */ -
code/branches/netp5/src/network/packet/Gamestate.cc
r3198 r3209 28 28 29 29 #include "Gamestate.h" 30 #include <enet/enet.h> 30 31 31 #include <zlib.h> 32 #include <cassert> 33 #include "../GamestateHandler.h" 34 #include "../synchronisable/Synchronisable.h" 35 #include "../TrafficControl.h" 32 33 #include "util/Debug.h" 36 34 #include "core/GameMode.h" 37 #include "core/CoreIncludes.h" 38 39 40 35 #include "core/ObjectList.h" 36 #include "network/synchronisable/Synchronisable.h" 37 #include "network/GamestateHandler.h" 41 38 42 39 namespace orxonox { … … 46 43 #define GAMESTATE_START(data) (data + GamestateHeader::getSize()) 47 44 48 #define PACKET_FLAG_GAMESTATE ENET_PACKET_FLAG_RELIABLE45 #define PACKET_FLAG_GAMESTATE PacketFlag::Reliable 49 46 50 47 -
code/branches/netp5/src/network/packet/Gamestate.h
r3198 r3209 28 28 29 29 30 #ifndef NETWORK_PACKETGAMESTATE_H31 #define NETWORK_PACKETGAMESTATE_H30 #ifndef _Gamestate_H__ 31 #define _Gamestate_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <cassert> 36 #include <list> 37 38 #include "util/CRC32.h" 39 #include "network/TrafficControl.h" 35 40 #include "Packet.h" 36 #include "network/TrafficControl.h"37 #include <string.h>38 #include <map>39 #include <vector>40 #include <cassert>41 #ifndef NDEBUG42 #include "util/CRC32.h"43 #endif44 41 45 42 namespace orxonox { … … 138 135 } 139 136 140 #endif 137 #endif /* _Gamestate_H__ */ -
code/branches/netp5/src/network/packet/Packet.cc
r3208 r3209 32 32 #include <cassert> 33 33 #include <enet/enet.h> 34 35 #include "network/ClientInformation.h" 36 34 #include <boost/static_assert.hpp> 35 36 #include "util/Debug.h" 37 37 #include "Acknowledgement.h" 38 #include "DeleteObjects.h"39 38 #include "Chat.h" 40 39 #include "ClassID.h" 40 #include "DeleteObjects.h" 41 41 #include "FunctionCalls.h" 42 42 #include "FunctionIDs.h" … … 44 44 #include "Welcome.h" 45 45 #include "network/Host.h" 46 #include " core/CoreIncludes.h"46 #include "network/ClientInformation.h" 47 47 48 48 namespace orxonox{ … … 50 50 namespace packet{ 51 51 52 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE 52 // Make sure we assume the right values 53 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Reliable) == static_cast<int>(ENET_PACKET_FLAG_RELIABLE)); 54 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Unsequence) == static_cast<int>(ENET_PACKET_FLAG_UNSEQUENCED)); 55 BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::NoAllocate) == static_cast<int>(ENET_PACKET_FLAG_NO_ALLOCATE)); 56 57 #define PACKET_FLAG_DEFAULT PacketFlag::NoAllocate 53 58 #define _PACKETID 0 54 59 … … 103 108 } 104 109 else if (this->data_) { 105 // This destructor was probably called as a consequence toENet executing our callback.110 // This destructor was probably called as a consequence of ENet executing our callback. 106 111 // It simply serves us to be able to deallocate the packet content (data_) ourselves since 107 112 // we have created it in the first place. -
code/branches/netp5/src/network/packet/Packet.h
r3084 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKPACKET_H29 #define NETWORKPACKET_H28 #ifndef _NETWORK_Packet_H__ 29 #define _NETWORK_Packet_H__ 30 30 31 31 #include "network/NetworkPrereqs.h" 32 33 32 #include <map> 34 33 … … 102 101 } //namespace orxonox 103 102 104 #endif 103 #endif /* _NETWORK_Packet_H__ */ -
code/branches/netp5/src/network/packet/Welcome.cc
r2773 r3209 29 29 */ 30 30 31 #include "Welcome.h" 31 32 32 #include "Welcome.h"33 #include <enet/enet.h>34 33 #include <cassert> 34 #include "util/Debug.h" 35 35 #include "network/Host.h" 36 36 #include "network/synchronisable/Synchronisable.h" 37 #include "core/CoreIncludes.h"38 37 39 38 namespace orxonox { 40 39 namespace packet { 41 40 42 #define PACKET_FLAGS_CLASSID ENET_PACKET_FLAG_RELIABLE41 #define PACKET_FLAGS_CLASSID PacketFlag::Reliable 43 42 #define _PACKETID 0 44 43 #define _CLIENTID _PACKETID + sizeof(ENUM::Type) -
code/branches/netp5/src/network/packet/Welcome.h
r2662 r3209 26 26 * 27 27 */ 28 #ifndef NETWORKWELCOME_H29 #define NETWORKWELCOME_H28 #ifndef _NETWORK_Welcome_H__ 29 #define _NETWORK_Welcome_H__ 30 30 31 #include "../NetworkPrereqs.h" 32 31 #include "network/NetworkPrereqs.h" 33 32 #include "Packet.h" 34 33 … … 56 55 } //namespace orxonox 57 56 58 #endif 57 #endif /* _NETWORK_Welcome_H__ */ -
code/branches/netp5/src/network/synchronisable/NetworkCallback.h
r3068 r3209 28 28 29 29 30 #ifndef _N ETWORK_CALLBACK__31 #define _N ETWORK_CALLBACK__30 #ifndef _NetworkCallback_H__ 31 #define _NetworkCallback_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" … … 61 61 62 62 63 #endif 63 #endif /* _NetworkCallback_H__ */ -
code/branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc
r3084 r3209 27 27 */ 28 28 29 30 29 #include "NetworkCallbackManager.h" 31 30 #include "NetworkCallback.h" -
code/branches/netp5/src/network/synchronisable/NetworkCallbackManager.h
r2662 r3209 28 28 29 29 30 #ifndef _N ETWORK_CALLBACKMANAGER__31 #define _N ETWORK_CALLBACKMANAGER__30 #ifndef _NetworkCallbackManager_H__ 31 #define _NetworkCallbackManager_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <set> 35 36 #include <queue> … … 52 53 53 54 54 #endif 55 #endif /* _NetworkCallbackManager_H__ */ -
code/branches/netp5/src/network/synchronisable/Synchronisable.cc
r3198 r3209 31 31 #include "Synchronisable.h" 32 32 33 #include <cstring>34 #include <string>35 #include <iostream>36 #include <cassert>37 38 33 #include "core/CoreIncludes.h" 39 34 #include "core/BaseObject.h" 40 // #include "core/Identifier.h"41 42 35 #include "network/Host.h" 36 43 37 namespace orxonox 44 38 { -
code/branches/netp5/src/network/synchronisable/Synchronisable.h
r3084 r3209 32 32 #include "network/NetworkPrereqs.h" 33 33 34 #include < list>34 #include <cassert> 35 35 #include <vector> 36 36 #include <map> 37 37 #include <queue> 38 #include <cassert> 39 #include <string> 40 #include "util/Math.h" 38 41 39 #include "util/mbool.h" 42 40 #include "core/OrxonoxClass.h" 41 #include "SynchronisableVariable.h" 43 42 #include "NetworkCallback.h" 44 #include "SynchronisableVariable.h"45 43 46 44 /*#define REGISTERDATA(varname, ...) \ -
code/branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc
r3084 r3209 28 28 */ 29 29 30 #include "network/synchronisable/Synchronisable.h"31 30 #include <string> 31 #include "util/Math.h" 32 #include "Synchronisable.h" 33 #include "SynchronisableVariable.h" 32 34 33 35 // ================ template spezialisation -
code/branches/netp5/src/network/synchronisable/SynchronisableVariable.cc
r3084 r3209 29 29 #include "SynchronisableVariable.h" 30 30 31 32 31 namespace orxonox{ 33 32 -
code/branches/netp5/src/network/synchronisable/SynchronisableVariable.h
r3102 r3209 28 28 29 29 30 #ifndef _ NETWORK_SYNCHRONISABLEVARIABLE__31 #define _ NETWORK_SYNCHRONISABLEVARIABLE__30 #ifndef _SynchronisableVariable_H__ 31 #define _SynchronisableVariable_H__ 32 32 33 33 #include "network/NetworkPrereqs.h" 34 34 35 #include <string>36 35 #include <cassert> 37 36 #include "util/Serialise.h" 38 #include "core/Core.h"39 #include "core/CoreIncludes.h"40 37 #include "core/GameMode.h" 41 #include "network/synchronisable/NetworkCallback.h"42 38 #include "network/synchronisable/NetworkCallbackManager.h" 43 39 … … 253 249 254 250 255 #endif 251 #endif /* _SynchronisableVariable_H__ */
Note: See TracChangeset
for help on using the changeset viewer.