Changeset 9454 in orxonox.OLD for branches/proxy/src/lib/network/handshake.h
- Timestamp:
- Jul 25, 2006, 11:27:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/handshake.h
r9406 r9454 49 49 /* functions indicating states of the handshake */ 50 50 /** @returns true if the handshake is completed */ 51 inline bool completed() { return localState.completed != 0 && remoteState.completed != 0; }51 inline bool completed() const { return localState.completed != 0 && remoteState.completed != 0; } 52 52 /** @returns true if no error has occured until now */ 53 inline bool ok() { return localState.error == 0 && remoteState.error == 0; }53 inline bool ok() const { return localState.error == 0 && remoteState.error == 0; } 54 54 /** stops the handshake and reject the other side with @param reason: string describing the reason */ 55 55 inline void doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; } 56 56 /** @returns true if the handshake is finished and the instances can be deleted */ 57 inline bool canDel() { return localState.canDel == 1 && remoteState.canDel == 1; }57 inline bool canDel() const { return localState.canDel == 1 && remoteState.canDel == 1; } 58 58 /** @returns true if the local state can be removed*/ 59 inline bool allowDel() { return localState.canDel == 1; }59 inline bool allowDel() const { return localState.canDel == 1; } 60 60 /** marks the handshake to be deleted */ 61 inline void del() { localState.canDel = 1; }61 inline void del() { localState.canDel = 1; } 62 62 63 63 64 64 /* the actual informations exchanged in the handshake */ 65 65 /** @returns the host id of the remote host */ 66 inline int getHostId() { return remoteState.hostId; }66 inline int getHostId() const { return remoteState.hostId; } 67 67 /** @returns the unique id of the network game manager*/ 68 inline int getNetworkGameManagerId() { return remoteState.networkManagerId; }68 inline int getNetworkGameManagerId() const { return remoteState.networkManagerId; } 69 69 /** @returns the unique id of the message manager */ 70 inline int getMessageManagerId() { return remoteState.messageManagerId; }70 inline int getMessageManagerId() const { return remoteState.messageManagerId; } 71 71 /** @returns the node type of the remote host */ 72 inline int getRemoteNodeType() { return this->remoteState.nodeType; }72 inline int getRemoteNodeType() const { return this->remoteState.nodeType; } 73 73 74 74 /** sets @param nick the prefereded nick name */ 75 75 inline void setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; } 76 76 /** @returns the prefered nick name */ 77 inline std::string getPreferedNickName(){ return remoteState.preferedNickName; }77 inline const std::string& getPreferedNickName() const { return remoteState.preferedNickName; } 78 78 79 79 /** @returns if true the local client should reconnect to a proxy server from the proxy server list */ 80 inline bool redirect() { return this->redirectProxy;}80 inline bool redirect() const { return this->redirectProxy; } 81 81 /** @param flag: indicating if the client should be redirected */ 82 82 inline void setRedirect(bool flag) { if( SharedNetworkData::getInstance()->isClient()) return; this->redirectProxy = (int)flag; } … … 85 85 inline void setProxy1Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy1 = address; } 86 86 /** @returns the address of the proxy server 1 if any */ 87 inline IP getProxy1Address() { return this->proxy1; }87 inline IP getProxy1Address() const { return this->proxy1; } 88 88 /** @param address: the address of the proxy server 2 if any */ 89 89 inline void setProxy2Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy2 = address; } 90 90 /** @returns the address of the proxy server 2 if any */ 91 inline IP getProxy2Address() { return this->proxy2; }91 inline IP getProxy2Address() const { return this->proxy2; } 92 92 93 93
Note: See TracChangeset
for help on using the changeset viewer.