- Timestamp:
- Jul 12, 2006, 5:37:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/handshake.h
r9235 r9258 17 17 int orxId; 18 18 int version; 19 19 20 20 int networkManagerId; 21 21 int messageManagerId; 22 22 int hostId; 23 23 24 24 int completed; 25 25 int canDel; 26 26 27 27 int error; 28 28 29 29 std::string errorString; 30 30 31 31 //additional data 32 32 std::string preferedNickName; … … 35 35 class Handshake : public Synchronizeable 36 36 { 37 37 38 public: 38 39 Handshake( bool server, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 ); 39 inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; } 40 inline bool ok(){ return localState.error == 0 && remoteState.error == 0; } 41 inline int getHostId(){ return remoteState.hostId; } 42 inline int getNetworkGameManagerId(){ return remoteState.networkManagerId; } 43 inline int getMessageManagerId(){ return remoteState.messageManagerId; } 44 inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; } 45 inline bool canDel(){ return localState.canDel == 1 && remoteState.canDel == 1; } 46 inline bool allowDel(){ return localState.canDel == 1; } 47 inline void del(){ localState.canDel = 1; } 48 49 inline void setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; } 40 41 42 /** @returns true if the handshake is completed */ 43 inline bool completed(){ return localState.completed != 0 && remoteState.completed != 0; } 44 /** @returns true if no error has occured until now */ 45 inline bool ok(){ return localState.error == 0 && remoteState.error == 0; } 46 /** @returns the host id of the remote host */ 47 inline int getHostId(){ return remoteState.hostId; } 48 /** @returns the unique id of the network game manager*/ 49 inline int getNetworkGameManagerId(){ return remoteState.networkManagerId; } 50 /** @returns the unique id of the message manager */ 51 inline int getMessageManagerId(){ return remoteState.messageManagerId; } 52 /** stops the handshake and reject the other side with @param reason: string describing the reason */ 53 inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; } 54 /** @returns true if the handshake is finished and the instances can be deleted */ 55 inline bool canDel(){ return localState.canDel == 1 && remoteState.canDel == 1; } 56 /** @returns true if the local state can be removed*/ 57 inline bool allowDel(){ return localState.canDel == 1; } 58 /** marks the handshake to be deleted */ 59 inline void del(){ localState.canDel = 1; } 60 61 /** sets @param nick the prefereded nick name */ 62 inline void setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; } 63 /** @returns the prefered nick name */ 50 64 inline std::string getPreferedNickName(){ return remoteState.preferedNickName; } 51 65 52 66 virtual void varChangeHandler( std::list<int> & id ); 53 67 … … 55 69 HandshakeState localState; 56 70 HandshakeState remoteState; 57 71 58 72 int netManId_handler; 59 73 int msgManId_handler;
Note: See TracChangeset
for help on using the changeset viewer.