Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3209 for code/branches


Ignore:
Timestamp:
Jun 23, 2009, 2:12:44 AM (15 years ago)
Author:
rgrieder
Message:

Cleanup in network plus a few dependency reductions (no enet-function inlines, using enum PacketFlag instead of the enet version)

Location:
code/branches/netp5/src/network
Files:
56 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp5/src/network/ChatListener.cc

    r2896 r3209  
    2828
    2929#include "ChatListener.h"
    30 
    3130#include "core/CoreIncludes.h"
    3231
  • code/branches/netp5/src/network/ChatListener.h

    r2171 r3209  
    3131
    3232#include "NetworkPrereqs.h"
    33 
    34 #include "ClientInformation.h"
    3533#include "core/OrxonoxClass.h"
    3634
  • code/branches/netp5/src/network/Client.cc

    r3206 r3209  
    3939//
    4040
     41#include "Client.h"
     42
    4143#include <cassert>
    42 #include <enet/enet.h>
    4344
    44 #include "Client.h"
    45 #include "Host.h"
     45#include "util/Debug.h"
     46#include "core/Clock.h"
    4647#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"
    5050#include "FunctionCallManager.h"
    5151
  • code/branches/netp5/src/network/Client.h

    r3202 r3209  
    4545
    4646#include <string>
    47 
    48 #include "Host.h"
    49 #include "packet/Chat.h"
    5047#include "ClientConnection.h"
    5148#include "GamestateClient.h"
    52 
     49#include "Host.h"
    5350
    5451namespace orxonox
  • code/branches/netp5/src/network/ClientConnection.cc

    r3203 r3209  
    2929#include "ClientConnection.h"
    3030
    31 #include <iostream>
    3231#include <cassert>
    33 
     32#include <enet/enet.h>
    3433#include "util/Debug.h"
    3534
     
    4342
    4443  ClientConnection::ClientConnection():
    45     server_(NULL),
    46     established_(false)
     44    established_(false),
     45    server_(NULL)
    4746  {
    4847    this->serverAddress_ = new ENetAddress();
     
    5655      closeConnection();
    5756    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;
    5865  }
    5966
  • code/branches/netp5/src/network/ClientConnection.h

    r3202 r3209  
    3030#define _ClientConnection_H__
    3131
    32 #include <string>
    33 
    3432#include "NetworkPrereqs.h"
    3533#include "Connection.h"
     
    4139  public:
    4240    ClientConnection();
    43     ~ClientConnection();
     41    virtual ~ClientConnection();
    4442   
    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 );
    4745   
    4846    ENetEvent *getEvent();
     
    6866
    6967
    70 
    71 
    72 
    73 
    74 
    75 
    7668}
    7769
  • code/branches/netp5/src/network/ClientConnectionListener.cc

    r2896 r3209  
    2828
    2929#include "ClientConnectionListener.h"
     30
    3031#include "core/CoreIncludes.h"
    3132#include "core/GameMode.h"
     33#include "ClientInformation.h"
    3234
    3335namespace 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__
    331
    432#include "NetworkPrereqs.h"
    5 #include "ClientInformation.h"
    633#include "core/OrxonoxClass.h"
    734
     
    2653
    2754
    28 #endif
     55#endif /* _ClientConnectionListener_H__ */
  • code/branches/netp5/src/network/ClientInformation.cc

    r2773 r3209  
    4040
    4141#include "ClientInformation.h"
    42 
    4342#include <enet/enet.h>
    44 #include <iostream> //debug
    4543
    4644namespace orxonox
  • code/branches/netp5/src/network/Connection.cc

    r3202 r3209  
    2929#include "Connection.h"
    3030
    31 #include <iostream>
    3231#include <cassert>
     32#include <enet/enet.h>
    3333#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"
    4135
    4236namespace orxonox
     
    5549  Connection::~Connection(){
    5650    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);
    5759  }
    5860
     
    9698  }
    9799
     100  bool Connection::processPacket(ENetEvent* event) {
     101    packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer);
     102    return p->process();
     103  }
     104
    98105}
  • code/branches/netp5/src/network/Connection.h

    r3203 r3209  
    4343#include "NetworkPrereqs.h"
    4444
    45 #include <string>
    46 #include <map>
    47 #include <enet/enet.h>
    48 
    49 #include "packet/Packet.h"
    50 
    5145namespace orxonox
    5246{
     
    5953  class _NetworkExport Connection{
    6054  public:
    61     ~Connection();
     55    virtual ~Connection();
    6256   
    6357    static bool addPacket(ENetPacket *packet, ENetPeer *peer);
     
    6963    static Connection* getInstance(){ return Connection::instance_; }
    7064   
    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);
    7367   
    7468    void processQueue();
    7569    virtual void addClient(ENetEvent* event)=0;
    7670    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);
    7872   
    7973    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 */
    128
    2 #ifndef NETWORKFUNCTIONCALLMANAGER_H
    3 #define NETWORKFUNCTIONCALLMANAGER_H
     29#ifndef _FunctionCallManager_H__
     30#define _FunctionCallManager_H__
    431
    532#include "NetworkPrereqs.h"
    6 #include "packet/FunctionCalls.h"
     33
    734#include <map>
    8 
     35#include "util/UtilPrereqs.h"
    936
    1037namespace orxonox {
     
    1239        @author
    1340*/
    14 
    15 class MultiType;
    1641
    1742class _NetworkExport FunctionCallManager
     
    4267} //namespace orxonox
    4368
    44 #endif
     69#endif /* _FunctionCallManager_H__ */
  • code/branches/netp5/src/network/GamestateClient.cc

    r3196 r3209  
    2929#include "GamestateClient.h"
    3030
    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"
    3633#include "synchronisable/Synchronisable.h"
    3734#include "synchronisable/NetworkCallbackManager.h"
    3835#include "packet/Acknowledgement.h"
     36#include "packet/Gamestate.h"
    3937
    4038
  • code/branches/netp5/src/network/GamestateClient.h

    r2171 r3209  
    4141#define _GamestateClient_H__
    4242
     43#include "NetworkPrereqs.h"
     44
    4345#include <map>
    44 //
    45 #include "NetworkPrereqs.h"
    4646#include "core/CorePrereqs.h"
    47 #include "packet/Gamestate.h"
    4847#include "GamestateHandler.h"
    4948
  • 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 */
    228
    329#include "GamestateHandler.h"
    4 #include "packet/Packet.h"
     30#include <cassert>
    531
    632namespace orxonox {
  • code/branches/netp5/src/network/GamestateHandler.h

    r2171 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKGAMESTATEHANDLER_H
    29 #define NETWORKGAMESTATEHANDLER_H
    3028
    31 #include <string>
     29#ifndef _GamestateHandler_H__
     30#define _GamestateHandler_H__
    3231
    3332#include "NetworkPrereqs.h"
    34 #include "packet/Chat.h"
    3533
    3634namespace orxonox {
     
    5856}
    5957
    60 #endif
     58#endif /* _GamestateHandler_H__ */
  • code/branches/netp5/src/network/GamestateManager.cc

    r3198 r3209  
    4141#include "GamestateManager.h"
    4242
    43 #include <utility>
    44 #include <iostream>
    45 #include <zlib.h>
    4643#include <cassert>
    4744
    48 #include "core/CoreIncludes.h"
    49 #include "core/BaseObject.h"
     45#include "util/Debug.h"
    5046#include "ClientInformation.h"
    51 #include "synchronisable/Synchronisable.h"
     47#include "packet/Acknowledgement.h"
     48#include "packet/Gamestate.h"
    5249#include "synchronisable/NetworkCallbackManager.h"
    53 #include "packet/Acknowledgement.h"
     50#include "TrafficControl.h"
    5451
    5552namespace orxonox
  • code/branches/netp5/src/network/GamestateManager.h

    r3084 r3209  
    4242
    4343#include "NetworkPrereqs.h"
     44
     45#include <map>
    4446#include "GamestateHandler.h"
    45 #include "TrafficControl.h"
    46 #include <map>
    47 
    48 #include "packet/Gamestate.h"
    4947
    5048namespace orxonox
    5149{
    5250
    53     const int KEEP_GAMESTATES = 10;
     51  const int KEEP_GAMESTATES = 10;
    5452
    5553  /**
  • code/branches/netp5/src/network/Host.cc

    r3095 r3209  
    2727 */
    2828
     29#include "Host.h"
     30
    2931#include <cassert>
     32#include <string>
    3033
    31 #include "Host.h"
    3234#include "core/ConsoleCommand.h"
    33 #include "packet/Packet.h"
     35#include "core/ObjectList.h"
    3436#include "ChatListener.h"
    3537
  • code/branches/netp5/src/network/Host.h

    r3196 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKHOST_H
    29 #define NETWORKHOST_H
    3028
    31 #include <string>
     29#ifndef _NETWORK_Host_H__
     30#define _NETWORK_Host_H__
    3231
    3332#include "NetworkPrereqs.h"
    34 #include "packet/Chat.h"
    3533
    3634namespace orxonox {
     
    8684}
    8785
    88 #endif
     86#endif /* _NETWORK_Host_H__ */
  • code/branches/netp5/src/network/NetworkFunction.cc

    r3084 r3209  
    2828
    2929#include "NetworkFunction.h"
    30 #include <string>
    31 #include "synchronisable/Synchronisable.h"
     30#include "core/CoreIncludes.h"
    3231
    3332namespace orxonox
     
    4241  std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
    4342
    44   NetworkFunctionBase::NetworkFunctionBase(std::string name)
     43  NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
    4544  {
    4645    RegisterRootObject(NetworkFunctionBase);
     
    5857 
    5958 
    60   NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p):
     59  NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p):
    6160    NetworkFunctionBase(name)
    6261  {
     
    7574 
    7675 
    77   NetworkMemberFunctionBase::NetworkMemberFunctionBase(std::string name, const NetworkFunctionPointer& p):
     76  NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p):
    7877    NetworkFunctionBase(name)
    7978  {
  • code/branches/netp5/src/network/NetworkFunction.h

    r3208 r3209  
    2727 */
    2828
    29 #ifndef NETWORKFUNCTION_H
    30 #define NETWORKFUNCTION_H
     29#ifndef _NetworkFunction_H__
     30#define _NetworkFunction_H__
    3131
    3232#include "NetworkPrereqs.h"
     33
     34#include <cassert>
     35#include <map>
     36#include <string>
     37#include <boost/preprocessor/cat.hpp>
     38
    3339#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"
    4040#include "core/Functor.h"
     41#include "FunctionCallManager.h"
    4142#include "synchronisable/Synchronisable.h"
    42 #include "OrxonoxConfig.h"
    43 #include "FunctionCallManager.h"
    44 
    4543
    4644namespace orxonox
     
    7270class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass {
    7371  public:
    74     NetworkFunctionBase(std::string name);
     72    NetworkFunctionBase(const std::string& name);
    7573    ~NetworkFunctionBase();
    7674   
    7775    virtual void        setNetworkID(uint32_t id)       { this->networkID_ = id; }
    7876    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_; }
    8078    static inline bool  isStatic( uint32_t networkID )  { return isStaticMap_[networkID]; }
    8179   
    82     static inline void setNetworkID(std::string name, 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); }
    8381   
    8482  protected:
     
    9593class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase {
    9694  public:
    97     NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p);
     95    NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p);
    9896    ~NetworkFunctionStatic();
    9997   
     
    121119class _NetworkExport NetworkMemberFunctionBase: public NetworkFunctionBase {
    122120  public:
    123     NetworkMemberFunctionBase(std::string name, const NetworkFunctionPointer& p);
     121    NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p);
    124122    ~NetworkMemberFunctionBase();
    125123   
     
    145143template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase {
    146144  public:
    147     NetworkMemberFunction(FunctorMember<T>* functor, std::string name, const NetworkFunctionPointer& p);
     145    NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p);
    148146    ~NetworkMemberFunction();
    149147   
     
    183181};
    184182
    185 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, std::string name, const NetworkFunctionPointer& p):
     183template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p):
    186184    NetworkMemberFunctionBase(name, p), functor_(functor)
    187185{
     
    201199}
    202200
    203 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, std::string name )
     201template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name )
    204202{
    205203  NetworkFunctionPointer destptr;
     
    209207}
    210208
    211 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, std::string name )
     209template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name )
    212210{
    213211  NetworkFunctionPointer destptr;
     
    239237}
    240238
    241 #endif
     239#endif /* _NetworkFunction_H__ */
  • code/branches/netp5/src/network/NetworkPrereqs.h

    r3201 r3209  
    114114  struct QueueItem;
    115115  struct syncData;
     116  class TrafficControl;
    116117  class obj;
    117118  class objInfo;
     
    129130    class Welcome;
    130131  }
     132
     133  namespace PacketFlag
     134  {
     135    enum Enum
     136    {
     137      Reliable   = 1,
     138      Unsequence = 2,
     139      NoAllocate = 4
     140    };
     141  }
    131142}
    132143
  • code/branches/netp5/src/network/PacketBuffer.cc

    r2773 r3209  
    3333#include "PacketBuffer.h"
    3434
    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>
    4136#include <boost/thread/recursive_mutex.hpp>
    4237
  • code/branches/netp5/src/network/Server.cc

    r3202 r3209  
    4242
    4343#include <enet/enet.h>
    44 #include <iostream>
    4544#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"
    5059#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 
    6660
    6761namespace orxonox
  • code/branches/netp5/src/network/Server.h

    r3201 r3209  
    3232#include "NetworkPrereqs.h"
    3333
    34 #include <string>
    35 
     34#include "core/CorePrereqs.h"
    3635#include "Host.h"
    3736#include "ServerConnection.h"
    38 #include "GamestateManager.h"
    3937
    4038namespace orxonox
  • code/branches/netp5/src/network/ServerConnection.cc

    r3203 r3209  
    3030
    3131#include <cassert>
     32#include <string>
     33#include <enet/enet.h>
    3234
     35#include "util/Debug.h"
    3336#include "ClientInformation.h"
    34 
    35 #include "core/CoreIncludes.h"
    3637
    3738namespace orxonox
     
    5051      closeListener();
    5152    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;
    5261  }
    5362
  • code/branches/netp5/src/network/ServerConnection.h

    r3202 r3209  
    4242
    4343#include "NetworkPrereqs.h"
    44 
    4544#include "Connection.h"
    4645
     
    5251    ~ServerConnection();
    5352   
    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 );
    5655   
    5756    bool openListener();
  • code/branches/netp5/src/network/TrafficControl.cc

    r3198 r3209  
    2929#include "TrafficControl.h"
    3030
    31 #include "synchronisable/Synchronisable.h"
     31#include <cassert>
     32#include <boost/bind.hpp>
     33
    3234#include "core/CoreIncludes.h"
    3335#include "core/ConfigValueIncludes.h"
    34 
    35 #include <cassert>
    36 #include <boost/bind.hpp>
     36#include "synchronisable/Synchronisable.h"
    3737
    3838namespace orxonox {
  • code/branches/netp5/src/network/TrafficControl.h

    r3084 r3209  
    2525 *      ...
    2626 *
     27
    2728 */
    28 #ifndef NETWORK_TRAFFICCONTROL_H
    29 #define NETWORK_TRAFFICCONTROL_H
     29#ifndef _TrafficControl_H__
     30#define _TrafficControl_H__
    3031
    3132#include "NetworkPrereqs.h"
    3233
    33 #include <string>
    3434#include <list>
    3535#include <map>
    36 #include <utility>
    37 #include <algorithm>
    38 #include "core/OrxonoxClass.h"
    3936#include "network/ClientConnectionListener.h"
    4037
     
    143140}
    144141
    145 #endif
    146 
     142#endif /* _TrafficControl_H__ */
  • code/branches/netp5/src/network/packet/Acknowledgement.cc

    r3198 r3209  
    2727 */
    2828
     29#include "Acknowledgement.h"
    2930
    30 #include "Acknowledgement.h"
    31 #include "network/Host.h"
     31#include "util/Debug.h"
    3232#include "network/GamestateHandler.h"
    33 #include "core/CoreIncludes.h"
    3433
    3534namespace orxonox {
  • code/branches/netp5/src/network/packet/Acknowledgement.h

    r2662 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKACKNOLEDGEMENT_H
    29 #define NETWORKACKNOLEDGEMENT_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _Acknowledgement_H__
     30#define _Acknowledgement_H__
     31
     32#include "network/NetworkPrereqs.h"
    3233#include "Packet.h"
    3334
     35namespace orxonox {
    3436const unsigned int ACKID_NACK = 0;
    35 
    36 namespace orxonox {
    3737namespace packet {
    3838/**
     
    5656} //namespace orxonox
    5757
    58 #endif
     58#endif /* _Acknowledgement_H__ */
  • code/branches/netp5/src/network/packet/Chat.cc

    r2773 r3209  
    2929#include "Chat.h"
    3030
    31 #include <enet/enet.h>
    32 #include <cassert>
     31#include <string>
    3332#include "network/Host.h"
    3433
     
    3635namespace packet {
    3736 
    38 #define   PACKET_FLAGS_CHAT ENET_PACKET_FLAG_RELIABLE
     37#define   PACKET_FLAGS_CHAT PacketFlag::Reliable
    3938#define   _PACKETID         0
    4039const int _PLAYERID     =   _PACKETID + sizeof(ENUM::Type);
     
    4241#define   _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
    4342
    44 Chat::Chat( std::string message, unsigned int playerID )
     43Chat::Chat( const std::string& message, unsigned int playerID )
    4544 : Packet()
    4645{
  • 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 */
    128
    2 #ifndef NETWORKCHAT_H
    3 #define NETWORKCHAT_H
     29#ifndef _NETWORK_Chat_H__
     30#define _NETWORK_Chat_H__
    431
    5 #include "../NetworkPrereqs.h"
    6 
    7 #include <string>
    8 #include <cstring>
    9 
     32#include "network/NetworkPrereqs.h"
    1033#include "Packet.h"
    1134
     
    1841{
    1942public:
    20   Chat( std::string message, unsigned int playerID );
     43  Chat( const std::string& message, unsigned int playerID );
    2144  Chat( uint8_t* data, unsigned int clientID );
    2245  ~Chat();
     
    3558} //namespace orxonox
    3659
    37 #endif
     60#endif /* _NETWORK_Chat_H__ */
  • code/branches/netp5/src/network/packet/ClassID.cc

    r3084 r3209  
    2727 */
    2828
     29#include "ClassID.h"
    2930
    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>
    3731#include <cassert>
    3832#include <map>
    3933#include <queue>
     34#include <string>
     35
     36#include "core/CoreIncludes.h"
    4037
    4138namespace orxonox {
     
    4340
    4441
    45 #define PACKET_FLAGS_CLASSID  ENET_PACKET_FLAG_RELIABLE
     42#define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
    4643#define _PACKETID             0
    4744
  • code/branches/netp5/src/network/packet/ClassID.h

    r2759 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKCLASSID_H
    29 #define NETWORKCLASSID_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _NETWORK_ClassID_H__
     30#define _NETWORK_ClassID_H__
    3231
    33 #include <string>
    34 
     32#include "network/NetworkPrereqs.h"
    3533#include "Packet.h"
    3634
     
    5856} //namespace orxonox
    5957
    60 #endif
     58#endif /* _NETWORK_ClassID_H__ */
  • code/branches/netp5/src/network/packet/DeleteObjects.cc

    r3208 r3209  
    2929
    3030#include "DeleteObjects.h"
    31 #include <enet/enet.h>
     31
     32#include <cassert>
     33#include "util/Debug.h"
    3234#include "network/synchronisable/Synchronisable.h"
    33 #include "core/CoreIncludes.h"
    34 #include <cassert>
    3535
    3636namespace orxonox {
    3737namespace packet {
    3838
    39 #define PACKET_FLAG_DELETE  ENET_PACKET_FLAG_RELIABLE
     39#define PACKET_FLAG_DELETE  PacketFlag::Reliable
    4040#define _PACKETID           0
    4141#define _QUANTITY           _PACKETID + sizeof(ENUM::Type)
  • code/branches/netp5/src/network/packet/DeleteObjects.h

    r2171 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKPACKETDELETEOBJECTS_H
    29 #define NETWORKPACKETDELETEOBJECTS_H
     28#ifndef _DeleteObjects_H__
     29#define _DeleteObjects_H__
    3030
    31 #include "../NetworkPrereqs.h"
    32 
     31#include "network/NetworkPrereqs.h"
    3332#include "Packet.h"
    34 
    3533
    3634namespace orxonox {
     
    5755} //namespace orxonox
    5856
    59 #endif
     57#endif /* _DeleteObjects_H__ */
  • code/branches/netp5/src/network/packet/FunctionCalls.cc

    r3208 r3209  
    2929#include "FunctionCalls.h"
    3030
    31 #include <enet/enet.h>
    3231#include <cassert>
    33 #include <cstring>
    34 #include "network/Host.h"
     32#include "util/MultiType.h"
    3533#include "network/NetworkFunction.h"
    36 #include "util/MultiType.h"
    3734
    3835namespace orxonox {
    3936namespace packet {
    4037 
    41 #define   PACKET_FLAGS_FUNCTIONCALLS ENET_PACKET_FLAG_RELIABLE
     38#define   PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable
    4239#define   _PACKETID         0
    4340const 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 */
    128
    2 #ifndef NETWORKFUNCTIONCALLS_H
    3 #define NETWORKFUNCTIONCALLS_H
     29#ifndef _FunctionCalls_H__
     30#define _FunctionCalls_H__
    431
    5 #include "../NetworkPrereqs.h"
     32#include "network/NetworkPrereqs.h"
    633
    7 #include <string>
    8 #include <cstring>
    9 
     34#include <cassert>
     35#include "util/UtilPrereqs.h"
    1036#include "Packet.h"
    11 #include <cassert>
    1237
    1338namespace orxonox {
    14 
    15 class MultiType;
    1639
    1740namespace packet {
     
    4467} //namespace orxonox
    4568
    46 #endif
     69#endif /* _FunctionCalls_H__ */
  • code/branches/netp5/src/network/packet/FunctionIDs.cc

    r3084 r3209  
    2727 */
    2828
     29#include "FunctionIDs.h"
    2930
    30 
    31 #include "FunctionIDs.h"
    32 #include "network/NetworkFunction.h"
    33 #include <enet/enet.h>
    34 #include "core/CoreIncludes.h"
    35 #include <string>
    3631#include <cassert>
    3732#include <queue>
     33#include <string>
     34
     35#include "util/Debug.h"
     36#include "core/ObjectList.h"
     37#include "network/NetworkFunction.h"
    3838
    3939namespace orxonox {
     
    4141
    4242
    43 #define PACKET_FLAGS_FUNCTIONIDS  ENET_PACKET_FLAG_RELIABLE
     43#define PACKET_FLAGS_FUNCTIONIDS  PacketFlag::Reliable
    4444#define _PACKETID                 0
    4545
  • code/branches/netp5/src/network/packet/FunctionIDs.h

    r3084 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKFUNCTIONIDS_H
    29 #define NETWORKFUNCTIONIDS_H
    3028
    31 #include "../NetworkPrereqs.h"
     29#ifndef _FunctionIDs_H__
     30#define _FunctionIDs_H__
    3231
    33 #include <string>
    34 
     32#include "network/NetworkPrereqs.h"
    3533#include "Packet.h"
    3634
     
    5856} //namespace orxonox
    5957
    60 #endif
     58#endif /* _FunctionIDs_H__ */
  • code/branches/netp5/src/network/packet/Gamestate.cc

    r3198 r3209  
    2828
    2929#include "Gamestate.h"
    30 #include <enet/enet.h>
     30
    3131#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"
    3634#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"
    4138
    4239namespace orxonox {
     
    4643#define GAMESTATE_START(data) (data + GamestateHeader::getSize())
    4744
    48 #define PACKET_FLAG_GAMESTATE  ENET_PACKET_FLAG_RELIABLE
     45#define PACKET_FLAG_GAMESTATE  PacketFlag::Reliable
    4946
    5047
  • code/branches/netp5/src/network/packet/Gamestate.h

    r3198 r3209  
    2828
    2929
    30 #ifndef NETWORK_PACKETGAMESTATE_H
    31 #define NETWORK_PACKETGAMESTATE_H
     30#ifndef _Gamestate_H__
     31#define _Gamestate_H__
    3232
    3333#include "network/NetworkPrereqs.h"
    3434
     35#include <cassert>
     36#include <list>
     37
     38#include "util/CRC32.h"
     39#include "network/TrafficControl.h"
    3540#include "Packet.h"
    36 #include "network/TrafficControl.h"
    37 #include <string.h>
    38 #include <map>
    39 #include <vector>
    40 #include <cassert>
    41 #ifndef NDEBUG
    42 #include "util/CRC32.h"
    43 #endif
    4441
    4542namespace orxonox {
     
    138135}
    139136
    140 #endif
     137#endif /* _Gamestate_H__ */
  • code/branches/netp5/src/network/packet/Packet.cc

    r3208 r3209  
    3232#include <cassert>
    3333#include <enet/enet.h>
    34 
    35 #include "network/ClientInformation.h"
    36 
     34#include <boost/static_assert.hpp>
     35
     36#include "util/Debug.h"
    3737#include "Acknowledgement.h"
    38 #include "DeleteObjects.h"
    3938#include "Chat.h"
    4039#include "ClassID.h"
     40#include "DeleteObjects.h"
    4141#include "FunctionCalls.h"
    4242#include "FunctionIDs.h"
     
    4444#include "Welcome.h"
    4545#include "network/Host.h"
    46 #include "core/CoreIncludes.h"
     46#include "network/ClientInformation.h"
    4747
    4848namespace orxonox{
     
    5050namespace packet{
    5151
    52 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE
     52// Make sure we assume the right values
     53BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Reliable)   == static_cast<int>(ENET_PACKET_FLAG_RELIABLE));
     54BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::Unsequence) == static_cast<int>(ENET_PACKET_FLAG_UNSEQUENCED));
     55BOOST_STATIC_ASSERT(static_cast<int>(PacketFlag::NoAllocate) == static_cast<int>(ENET_PACKET_FLAG_NO_ALLOCATE));
     56
     57#define PACKET_FLAG_DEFAULT PacketFlag::NoAllocate
    5358#define _PACKETID           0
    5459
     
    103108  }
    104109  else if (this->data_) {
    105     // This destructor was probably called as a consequence to ENet executing our callback.
     110    // This destructor was probably called as a consequence of ENet executing our callback.
    106111    // It simply serves us to be able to deallocate the packet content (data_) ourselves since
    107112    // we have created it in the first place.
  • code/branches/netp5/src/network/packet/Packet.h

    r3084 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKPACKET_H
    29 #define NETWORKPACKET_H
     28#ifndef _NETWORK_Packet_H__
     29#define _NETWORK_Packet_H__
    3030
    3131#include "network/NetworkPrereqs.h"
    32 
    3332#include <map>
    3433
     
    102101} //namespace orxonox
    103102
    104 #endif
     103#endif /* _NETWORK_Packet_H__ */
  • code/branches/netp5/src/network/packet/Welcome.cc

    r2773 r3209  
    2929 */
    3030
     31#include "Welcome.h"
    3132
    32 #include "Welcome.h"
    33 #include <enet/enet.h>
    3433#include <cassert>
     34#include "util/Debug.h"
    3535#include "network/Host.h"
    3636#include "network/synchronisable/Synchronisable.h"
    37 #include "core/CoreIncludes.h"
    3837
    3938namespace orxonox {
    4039namespace packet {
    4140
    42 #define PACKET_FLAGS_CLASSID  ENET_PACKET_FLAG_RELIABLE
     41#define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
    4342#define _PACKETID             0
    4443#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
  • code/branches/netp5/src/network/packet/Welcome.h

    r2662 r3209  
    2626 *
    2727 */
    28 #ifndef NETWORKWELCOME_H
    29 #define NETWORKWELCOME_H
     28#ifndef _NETWORK_Welcome_H__
     29#define _NETWORK_Welcome_H__
    3030
    31 #include "../NetworkPrereqs.h"
    32 
     31#include "network/NetworkPrereqs.h"
    3332#include "Packet.h"
    3433
     
    5655} //namespace orxonox
    5756
    58 #endif
     57#endif /* _NETWORK_Welcome_H__ */
  • code/branches/netp5/src/network/synchronisable/NetworkCallback.h

    r3068 r3209  
    2828
    2929
    30 #ifndef _NETWORK_CALLBACK__
    31 #define _NETWORK_CALLBACK__
     30#ifndef _NetworkCallback_H__
     31#define _NetworkCallback_H__
    3232
    3333#include "network/NetworkPrereqs.h"
     
    6161
    6262
    63 #endif
     63#endif /* _NetworkCallback_H__ */
  • code/branches/netp5/src/network/synchronisable/NetworkCallbackManager.cc

    r3084 r3209  
    2727 */
    2828 
    29 
    3029#include "NetworkCallbackManager.h"
    3130#include "NetworkCallback.h"
  • code/branches/netp5/src/network/synchronisable/NetworkCallbackManager.h

    r2662 r3209  
    2828
    2929
    30 #ifndef _NETWORK_CALLBACKMANAGER__
    31 #define _NETWORK_CALLBACKMANAGER__
     30#ifndef _NetworkCallbackManager_H__
     31#define _NetworkCallbackManager_H__
    3232
    3333#include "network/NetworkPrereqs.h"
     34
    3435#include <set>
    3536#include <queue>
     
    5253
    5354
    54 #endif
     55#endif /* _NetworkCallbackManager_H__ */
  • code/branches/netp5/src/network/synchronisable/Synchronisable.cc

    r3198 r3209  
    3131#include "Synchronisable.h"
    3232
    33 #include <cstring>
    34 #include <string>
    35 #include <iostream>
    36 #include <cassert>
    37 
    3833#include "core/CoreIncludes.h"
    3934#include "core/BaseObject.h"
    40 // #include "core/Identifier.h"
    41 
    4235#include "network/Host.h"
     36
    4337namespace orxonox
    4438{
  • code/branches/netp5/src/network/synchronisable/Synchronisable.h

    r3084 r3209  
    3232#include "network/NetworkPrereqs.h"
    3333
    34 #include <list>
     34#include <cassert>
    3535#include <vector>
    3636#include <map>
    3737#include <queue>
    38 #include <cassert>
    39 #include <string>
    40 #include "util/Math.h"
     38
    4139#include "util/mbool.h"
    4240#include "core/OrxonoxClass.h"
     41#include "SynchronisableVariable.h"
    4342#include "NetworkCallback.h"
    44 #include "SynchronisableVariable.h"
    4543
    4644/*#define REGISTERDATA(varname, ...) \
  • code/branches/netp5/src/network/synchronisable/SynchronisableSpecialisations.cc

    r3084 r3209  
    2828 */
    2929
    30 #include "network/synchronisable/Synchronisable.h"
    3130#include <string>
     31#include "util/Math.h"
     32#include "Synchronisable.h"
     33#include "SynchronisableVariable.h"
    3234
    3335// ================ template spezialisation
  • code/branches/netp5/src/network/synchronisable/SynchronisableVariable.cc

    r3084 r3209  
    2929#include "SynchronisableVariable.h"
    3030
    31 
    3231namespace orxonox{
    3332
  • code/branches/netp5/src/network/synchronisable/SynchronisableVariable.h

    r3102 r3209  
    2828
    2929
    30 #ifndef _NETWORK_SYNCHRONISABLEVARIABLE__
    31 #define _NETWORK_SYNCHRONISABLEVARIABLE__
     30#ifndef _SynchronisableVariable_H__
     31#define _SynchronisableVariable_H__
    3232
    3333#include "network/NetworkPrereqs.h"
    3434
    35 #include <string>
    3635#include <cassert>
    3736#include "util/Serialise.h"
    38 #include "core/Core.h"
    39 #include "core/CoreIncludes.h"
    4037#include "core/GameMode.h"
    41 #include "network/synchronisable/NetworkCallback.h"
    4238#include "network/synchronisable/NetworkCallbackManager.h"
    4339
     
    253249
    254250
    255 #endif
     251#endif /* _SynchronisableVariable_H__ */
Note: See TracChangeset for help on using the changeset viewer.