- Timestamp:
- Jul 13, 2006, 10:50:10 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network/monitor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9276 r9277 46 46 47 47 /** 48 * adds a client 48 * add the network node 49 * @param node to add 49 50 */ 50 void NetworkMonitor::add Client(PeerInfo* node)51 void NetworkMonitor::addNetworkNode(NetworkNode* node) 51 52 { 52 this->clientList.push_back(node); 53 this->playerNumber++; 53 this->nodeList.push_back(node); 54 54 } 55 55 56 /**57 * adds a proxy server58 */59 void NetworkMonitor::addProxyServer(PeerInfo* node)60 {61 this->proxyServerList.push_back(node);62 this->playerNumber++;63 }64 56 65 57 /** 66 * adds a master server 58 * add the network node 59 * @param node to add 67 60 */ 68 void NetworkMonitor:: addMasterServer(PeerInfo* node)61 void NetworkMonitor::removeNetworkNode(NetworkNode* node) 69 62 { 70 this->masterServerList.push_back(node); 71 this->playerNumber++; 72 } 73 74 /** 75 * removes a client 76 */ 77 void NetworkMonitor::removeClient(PeerInfo* node) 78 { 79 std::list<PeerInfo*>::iterator it = this->clientList.begin(); 80 for(; it != this->clientList.end(); it++) 63 std::list<NetworkNode*>::iterator it = this->nodeList.begin(); 64 for(; it != this->nodeList.end(); it++) 81 65 { 82 66 if( *it == node) 83 67 { 84 this-> clientList.erase(it);68 this->nodeList.erase(it); 85 69 this->playerNumber--; 86 70 return; 87 71 } 88 72 } 89 90 PRINTF(2)("Could not remove client from the list, very strange...");91 73 } 92 93 /**94 * removes a proxy server95 */96 void NetworkMonitor::removeProxyServer(PeerInfo* node)97 {98 std::list<PeerInfo*>::iterator it = this->proxyServerList.begin();99 for(; it != this->proxyServerList.end(); it++)100 {101 if( *it == node)102 {103 this->proxyServerList.erase(it);104 this->playerNumber--;105 return;106 }107 }108 109 PRINTF(2)("Could not remove proxy server from the list, very strange...");110 }111 112 /**113 * removes a master server114 */115 void NetworkMonitor::removeMasterServer(PeerInfo* node)116 {117 std::list<PeerInfo*>::iterator it = this->masterServerList.begin();118 for(; it != this->masterServerList.end(); it++)119 {120 if( *it == node)121 {122 this->masterServerList.erase(it);123 this->playerNumber--;124 return;125 }126 }127 128 PRINTF(2)("Could not remove client from the list, very strange...");129 }130 131 74 132 75 -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9276 r9277 28 28 virtual ~NetworkMonitor(); 29 29 30 /* client/masterserver/proxyserver addition/removal interface */ 31 void addNetworkNode(NetworkNode* node); 32 void removeNetworkNode(NetworkNode* node); 30 33 31 34 void addClient(PeerInfo* node); … … 37 40 void removeMasterServer(PeerInfo* node); 38 41 42 39 43 void showGUI(); 40 44 void hideGUI(); … … 44 48 45 49 private: 46 std::list<PeerInfo*> clientList; //!< list of all clients in the network 47 std::list<PeerInfo*> proxyServerList; //!< list of all proxy servers in the network 48 std::list<PeerInfo*> masterServerList; //!< list of all master servers in the network (should be 1!! :D) 49 50 std::list<NetworkNode*> nodeList; //!< list of all network nodes 50 51 51 52 OrxGui::GLGuiBox* box; -
branches/proxy/src/lib/network/monitor/network_node.cc
r9276 r9277 17 17 18 18 19 #include "debug.h" 19 20 21 22 /** 23 * constructor 24 */ 20 25 NetworkNode::NetworkNode() 26 { 27 this->playerNumber = 0; 28 this->nodeType = NET_CLIENT; 29 } 30 31 32 /** 33 * deconstructor 34 */ 35 NetworkNode::~NetworkNode() 21 36 {} 22 37 23 38 24 NetworkNode::~NetworkNode() 25 {} 39 /** 40 * adds a client 41 */ 42 void NetworkNode::addClient(PeerInfo* node) 43 { 44 this->clientList.push_back(node); 45 this->playerNumber++; 46 } 26 47 48 /** 49 * adds a proxy server 50 */ 51 void NetworkNode::addProxyServer(PeerInfo* node) 52 { 53 this->proxyServerList.push_back(node); 54 this->playerNumber++; 55 } 56 57 /** 58 * adds a master server 59 */ 60 void NetworkNode::addMasterServer(PeerInfo* node) 61 { 62 this->masterServerList.push_back(node); 63 this->playerNumber++; 64 } 65 66 /** 67 * removes a client 68 */ 69 void NetworkNode::removeClient(PeerInfo* node) 70 { 71 std::list<PeerInfo*>::iterator it = this->clientList.begin(); 72 for(; it != this->clientList.end(); it++) 73 { 74 if( *it == node) 75 { 76 this->clientList.erase(it); 77 this->playerNumber--; 78 return; 79 } 80 } 81 82 PRINTF(2)("Could not remove client from the list, very strange..."); 83 } 84 85 /** 86 * removes a proxy server 87 */ 88 void NetworkNode::removeProxyServer(PeerInfo* node) 89 { 90 std::list<PeerInfo*>::iterator it = this->proxyServerList.begin(); 91 for(; it != this->proxyServerList.end(); it++) 92 { 93 if( *it == node) 94 { 95 this->proxyServerList.erase(it); 96 this->playerNumber--; 97 return; 98 } 99 } 100 101 PRINTF(2)("Could not remove proxy server from the list, very strange..."); 102 } 103 104 /** 105 * removes a master server 106 */ 107 void NetworkNode::removeMasterServer(PeerInfo* node) 108 { 109 std::list<PeerInfo*>::iterator it = this->masterServerList.begin(); 110 for(; it != this->masterServerList.end(); it++) 111 { 112 if( *it == node) 113 { 114 this->masterServerList.erase(it); 115 this->playerNumber--; 116 return; 117 } 118 } 119 120 PRINTF(2)("Could not remove client from the list, very strange..."); 121 } -
branches/proxy/src/lib/network/monitor/network_node.h
r9276 r9277 22 22 23 23 24 void addClient(PeerInfo* node); 25 void addProxyServer(PeerInfo* node); 26 void addMasterServer(PeerInfo* node); 27 28 void removeClient(PeerInfo* node); 29 void removeProxyServer(PeerInfo* node); 30 void removeMasterServer(PeerInfo* node); 31 32 33 24 34 private: 25 35 int nodeType; //!< the type of the node 36 int playerNumber; //!< localy direct connected player number 26 37 38 /* network nodes directly connected to this node */ 27 39 std::list<PeerInfo*> clientList; //!< list of all clients in the network 28 40 std::list<PeerInfo*> proxyServerList; //!< list of all proxy servers in the network
Note: See TracChangeset
for help on using the changeset viewer.