Line | |
---|
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 | |
---|
12 | #define _ORXONOX_ID 0xF91337A0 |
---|
13 | |
---|
14 | #define _ORXONOX_VERSION 1 |
---|
15 | |
---|
16 | struct HandshakeState { |
---|
17 | int orxId; |
---|
18 | int version; |
---|
19 | |
---|
20 | int networkManagerId; |
---|
21 | int messageManagerId; |
---|
22 | int hostId; |
---|
23 | |
---|
24 | int completed; |
---|
25 | |
---|
26 | int error; |
---|
27 | |
---|
28 | std::string errorString; |
---|
29 | }; |
---|
30 | |
---|
31 | class Handshake : public Synchronizeable |
---|
32 | { |
---|
33 | public: |
---|
34 | Handshake( bool server, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 ); |
---|
35 | inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; } |
---|
36 | inline bool ok(){ return localState.error == 0 && remoteState.error == 0; } |
---|
37 | inline int getHostId(){ return remoteState.hostId; } |
---|
38 | inline int getNetworkGameManagerId(){ return remoteState.networkManagerId; } |
---|
39 | inline int getMessageManagerId(){ return remoteState.messageManagerId; } |
---|
40 | inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; } |
---|
41 | |
---|
42 | virtual void varChangeHandler( std::list<int> & id ); |
---|
43 | |
---|
44 | private: |
---|
45 | HandshakeState localState; |
---|
46 | HandshakeState remoteState; |
---|
47 | |
---|
48 | int netManId_handler; |
---|
49 | int msgManId_handler; |
---|
50 | int hostId_handler; |
---|
51 | int completed_handler; |
---|
52 | int error_handler; |
---|
53 | int errorString_handler; |
---|
54 | int orxId_handler; |
---|
55 | int version_handler; |
---|
56 | |
---|
57 | }; |
---|
58 | |
---|
59 | |
---|
60 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.