Changeset 9426 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 24, 2006, 2:49:33 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/ip.cc
r9406 r9426 185 185 IPaddress ipaddr; 186 186 187 SDLNet_ResolveHost(&ipaddr, NULL, 2000);188 189 return IP(ipaddr .host, port);187 SDLNet_ResolveHost(&ipaddr, ip.c_str(), port); 188 189 return IP(ipaddr); 190 190 } 191 191 else … … 255 255 /** 256 256 * @brief converts a IP into a String (without port). 257 * @param ipthe IP to put into the string.257 * @param host the IP to put into the string. 258 258 * @param port -1 if not wanted 259 259 * @return the string of the ip. 260 260 */ 261 std::string IP::ipToString(int ip, int port)262 { 263 MultiType part0((int) ( ip & 0xFF000000) >> 24);264 MultiType part1((int) ( ip & 0x00FF0000) >> 16);265 MultiType part2((int) ( ip & 0x0000FF00) >> 8);266 MultiType part3((int) ( ip & 0x000000FF));261 std::string IP::ipToString(int host, int port) 262 { 263 MultiType part0((int) ((host & 0xFF000000) >> 24)); 264 MultiType part1((int) ((host & 0x00FF0000) >> 16)); 265 MultiType part2((int) ((host & 0x0000FF00) >> 8)); 266 MultiType part3((int) ((host & 0x000000FF) )); 267 267 268 268 std::string addr = part3.getString() + "." + part2.getString() + "." + -
branches/proxy/src/lib/network/ip.h
r9406 r9426 54 54 55 55 static std::string ipToString(const IPaddress& ipaddr); 56 static std::string ipToString(int ip, int port = -1);56 static std::string ipToString(int host, int port = -1); 57 57 58 58 static void setDefaultPort(int defaultPort); -
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9410 r9426 57 57 { 58 58 // assuming that the config files are already read we get the proxy servers 59 std::vector<IP address*>* proxyList = NetworkSettings::getInstance()->getProxyList();60 std::vector<IP address*>::iterator it = proxyList->begin();59 std::vector<IP>* proxyList = NetworkSettings::getInstance()->getProxyList(); 60 std::vector<IP>::iterator it = proxyList->begin(); 61 61 // create a peer info class and a network node class for each new proxy and add them to the passive list 62 62 for(; it < proxyList->end(); it++) 63 63 { 64 64 PeerInfo* peer = new PeerInfo(); 65 peer->ip = *(*it);65 peer->ip = (*it); 66 66 peer->nodeType = NET_PROXY_SERVER_ACTIVE; 67 67 peer->userId = -1; -
branches/proxy/src/lib/network/proxy/network_settings.cc
r9416 r9426 51 51 52 52 // remove all unused proxy data again 53 for( int i = 0; i < this->proxies.size(); i++)53 for(unsigned int i = 0; i < this->proxies.size(); i++) 54 54 { 55 IP address*ip = this->proxies.back();55 IP ip = this->proxies.back(); 56 56 this->proxies.pop_back(); 57 delete ip;58 57 } 59 58 } … … 139 138 return; 140 139 141 IPaddress *ip = new IPaddress; 140 IP ip(proxyAddr, 9999); 141 printf("========== "); 142 ip.debug(); 142 143 143 SDLNet_ResolveHost( ip, proxyAddr.c_str(), 9999 ); 144 145 this->proxies.push_back(ip); 144 this->proxies.push_back(ip);//IP(proxyAddr, 9999)); 146 145 } 147 146 -
branches/proxy/src/lib/network/proxy/network_settings.h
r9410 r9426 48 48 void setProxyAddr(const std::string& proxyAddr); 49 49 /** @returns the list of proxy servers from the init file */ 50 inline std::vector<IP address*>* getProxyList() { return &this->proxies; }50 inline std::vector<IP>* getProxyList() { return &this->proxies; } 51 51 52 52 … … 61 61 float maxPlayerSaturation; //!< the saturation level from where on the proxy server should be activated 62 62 63 std::vector<IP address*>proxies; //!< all registered proxies63 std::vector<IP> proxies; //!< all registered proxies 64 64 IP masterServer; //!< master server ip address 65 65
Note: See TracChangeset
for help on using the changeset viewer.