Rev | Line | |
---|
[6043] | 1 | /*! |
---|
| 2 | * @file network_stream.h |
---|
| 3 | * implementation of a network pipe |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _HANDSHAKE |
---|
| 7 | #define _HANDSHAKE |
---|
| 8 | |
---|
| 9 | #include "base_object.h" |
---|
| 10 | #include "synchronizeable.h" |
---|
| 11 | |
---|
[7565] | 12 | #define _ORXONOX_ID 0xF91337A0 |
---|
[6043] | 13 | |
---|
[7444] | 14 | #define _ORXONOX_VERSION 1 |
---|
[6043] | 15 | |
---|
[7444] | 16 | struct HandshakeState { |
---|
| 17 | int orxId; |
---|
| 18 | int version; |
---|
| 19 | |
---|
| 20 | int networkManagerId; |
---|
[7681] | 21 | int messageManagerId; |
---|
[7444] | 22 | int hostId; |
---|
| 23 | |
---|
| 24 | int completed; |
---|
| 25 | |
---|
| 26 | int error; |
---|
| 27 | |
---|
| 28 | std::string errorString; |
---|
[6043] | 29 | }; |
---|
| 30 | |
---|
| 31 | class Handshake : public Synchronizeable |
---|
| 32 | { |
---|
| 33 | public: |
---|
[7681] | 34 | Handshake( bool server, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 ); |
---|
[7444] | 35 | inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; } |
---|
| 36 | inline bool ok(){ return localState.error == 0 && remoteState.error == 0; } |
---|
[7591] | 37 | inline int getHostId(){ return remoteState.hostId; } |
---|
| 38 | inline int getNetworkGameManagerId(){ return remoteState.networkManagerId; } |
---|
[7681] | 39 | inline int getMessageManagerId(){ return remoteState.messageManagerId; } |
---|
[7591] | 40 | inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; } |
---|
[7444] | 41 | |
---|
| 42 | virtual void varChangeHandler( std::list<int> & id ); |
---|
[6043] | 43 | |
---|
| 44 | private: |
---|
[7444] | 45 | HandshakeState localState; |
---|
| 46 | HandshakeState remoteState; |
---|
| 47 | |
---|
| 48 | int netManId_handler; |
---|
[7731] | 49 | int msgManId_handler; |
---|
[7444] | 50 | int hostId_handler; |
---|
| 51 | int completed_handler; |
---|
| 52 | int error_handler; |
---|
| 53 | int errorString_handler; |
---|
| 54 | int orxId_handler; |
---|
| 55 | int version_handler; |
---|
[6043] | 56 | |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.