/*! * @file network_stream.h * implementation of a network pipe */ #ifndef _HANDSHAKE #define _HANDSHAKE #include "base_object.h" #include "synchronizeable.h" #define _ORXONOX_ID 0xF91337A0 #define _ORXONOX_VERSION 1 struct HandshakeState { int orxId; int version; int networkManagerId; int hostId; int completed; int error; std::string errorString; }; class Handshake : public Synchronizeable { public: Handshake( bool server, int clientId = 0, int networkGameManagerId = 0 ); inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; } inline bool ok(){ return localState.error == 0 && remoteState.error == 0; } inline int getHostId(){ return localState.hostId; } inline int getNetworkGameManagerId(){ return localState.networkManagerId; } inline void doReject( std::string reason ){ remoteState.error = 1; remoteState.errorString = "the server rejected your connection ["+ reason +"]"; } virtual void varChangeHandler( std::list & id ); private: HandshakeState localState; HandshakeState remoteState; int netManId_handler; int hostId_handler; int completed_handler; int error_handler; int errorString_handler; int orxId_handler; int version_handler; }; #endif