Changeset 9385 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 21, 2006, 1:09:19 PM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/ip.cc
r9383 r9385 32 32 IP::IP() 33 33 { 34 this->_ ip= 0;34 this->_host = 0; 35 35 this->_port = IP::_defaultPort; 36 36 } … … 45 45 IP::IP(int ip, int port) 46 46 { 47 this->_ ip= ip;47 this->_host = ip; 48 48 if (port != -1) 49 49 this->_port = port; … … 84 84 IP::IP(const IPaddress& ip) 85 85 { 86 this->_ ip= ip.host;86 this->_host = ip.host; 87 87 this->_port = ip.port; 88 88 } … … 98 98 *this = ip; 99 99 } 100 101 102 /** 103 * @brief constructs an IP out of the four pairs and a Port. 104 * @param first The first octal. 105 * @param second The second octal. 106 * @param third The third octal. 107 * @param fourth The fourth octal. 108 * @param port The Port. 109 * @return self. 110 */ 111 IP::IP(unsigned int first, unsigned int second, unsigned int third, unsigned int fourth, int port) 112 { 113 this->_host = (first << 24) + 114 (second << 16) + 115 (third << 8) + 116 fourth; 117 this->_port = port; 118 } 119 100 120 101 121 /** … … 106 126 const IP& IP::operator=(const IP& ip) 107 127 { 108 this->_ ip= ip.host();128 this->_host = ip.host(); 109 129 this->_port = ip.port(); 110 130 return *this; … … 119 139 const IP& IP::operator=(const IPaddress& ip) 120 140 { 121 this->_ ip= ip.host;141 this->_host = ip.host; 122 142 this->_port = ip.port; 123 143 return *this; … … 132 152 bool IP::operator==(const IP& ip) const 133 153 { 134 return (this->_ ip== ip.host() &&154 return (this->_host == ip.host() && 135 155 this->_port == ip.port()); 136 156 } … … 144 164 bool IP::operator!=(const IP& ip) const 145 165 { 146 return (this->_ ip!= ip.host() ||147 this->_port != ip.port());166 return (this->_host != ip.host() || 167 this->_port != ip.port()); 148 168 } 149 169 … … 199 219 { 200 220 case 0: 201 return (_ ip& 0xFF000000) >> 24;221 return (_host & 0xFF000000) >> 24; 202 222 case 1: 203 return (_ ip& 0x00FF0000) >> 16;223 return (_host & 0x00FF0000) >> 16; 204 224 case 2: 205 return (_ ip& 0x0000FF00) >> 8;225 return (_host & 0x0000FF00) >> 8; 206 226 case 3: 207 return (_ ip& 0x000000FF);227 return (_host & 0x000000FF); 208 228 default: 209 229 return -1; … … 217 237 std::string IP::ipString() const 218 238 { 219 return IP::ipToString(this->_ ip, this->_port);239 return IP::ipToString(this->_host, this->_port); 220 240 } 221 241 -
branches/proxy/src/lib/network/ip.h
r9383 r9385 26 26 IP(const IPaddress& ip); 27 27 IP(const IP& ip); 28 IP(unsigned int first, unsigned int second, unsigned int third, unsigned int fourth, int port = IP::_defaultPort); 28 29 29 30 /// OPERATORS … … 35 36 /// RETRIVEAL 36 37 /** @returns the IP */ 37 int host() const { return this->_ ip; };38 int* hostRef() { return &this->_ ip; }38 int host() const { return this->_host; }; 39 int* hostRef() { return &this->_host; } 39 40 /** @returns the Port */ 40 41 int port() const { return this->_port; }; 41 42 int* portRef() { return &this->_port; }; 42 43 43 inline IPaddress getSDLNotation() { IPaddress sdlIP; sdlIP.host = this->_ ip; sdlIP.port = this->_port; return sdlIP; }44 inline IPaddress getSDLNotation() { IPaddress sdlIP; sdlIP.host = this->_host; sdlIP.port = this->_port; return sdlIP; } 44 45 45 46 int ipPart(unsigned int part) const; … … 59 60 60 61 private: 61 int _ ip; //!< The IP in int form.62 int _port; //!< The Port number of the IP62 int _host; //!< The IP in int form. 63 int _port; //!< The Port number of the IP 63 64 64 static int _defaultPort; //!< Default Port65 static int _defaultPort; //!< Default Port 65 66 }; 66 67 -
branches/proxy/src/util/network_stats_widget.cc
r9383 r9385 52 52 : _proxyWidget(proxyName, ip) 53 53 { 54 this->_clientNameWidth = 100.0f; 54 55 this->pack(&_proxyWidget); 55 56 } … … 58 59 { 59 60 HostWidget* newClient = new HostWidget(name, ip); 61 newClient->setNameWidth(this->_clientNameWidth); 60 62 61 63 this->pack(newClient); … … 112 114 113 115 116 void ProxyWidget::setClientNameWidths(float width) 117 { 118 this->_clientNameWidth = width; 119 for (unsigned int i = 0; i < this->_clients.size(); ++i) 120 this->_clients[i]->setNameWidth(width); 121 } 122 114 123 void ProxyWidget::hiding() 115 124 { … … 135 144 */ 136 145 NetworkStatsWidget::NetworkStatsWidget () 137 : GLGuiBox(Vertical)146 : GLGuiBox(Vertical), _thisHost("myName", IP(127, 0, 0 , 0)) 138 147 { 139 148 // this->setClassID(CL_PROTO_ID, "NetworkStatsWidget"); -
branches/proxy/src/util/network_stats_widget.h
r9383 r9385 53 53 bool removeClient(const std::string& name, const IP& ip); 54 54 55 void setClientNameWidths(float width); 56 55 57 56 58 protected: … … 63 65 64 66 std::vector<HostWidget*> _clients; 67 float _clientNameWidth; 65 68 }; 66 69 … … 92 95 93 96 private: 94 IP _ip; 95 GLGuiText _ipText; 97 HostWidget _thisHost; 96 98 97 99 GLGuiText _upstreamText; 98 100 GLGuiText _downstreamText; 99 101 100 std::vector< GLGuiText> _connectedHosts;102 std::vector<HostWidget*>_connectedProxies; 101 103 102 104 GLGuiText _serverIP;
Note: See TracChangeset
for help on using the changeset viewer.