OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 223 matching lines...) Loading... |
234 | 234 |
235 int addr_pref = IPAddressPrecedence(address_.ipaddr()); | 235 int addr_pref = IPAddressPrecedence(address_.ipaddr()); |
236 int local_preference = ((network_adapter_preference << 8) | addr_pref) + | 236 int local_preference = ((network_adapter_preference << 8) | addr_pref) + |
237 relay_preference; | 237 relay_preference; |
238 | 238 |
239 return (type_preference << 24) | | 239 return (type_preference << 24) | |
240 (local_preference << 8) | | 240 (local_preference << 8) | |
241 (256 - component_); | 241 (256 - component_); |
242 } | 242 } |
243 | 243 |
| 244 bool operator==(const Candidate& o) const { |
| 245 return id_ == o.id_ && component_ == o.component_ && |
| 246 protocol_ == o.protocol_ && relay_protocol_ == o.relay_protocol_ && |
| 247 address_ == o.address_ && priority_ == o.priority_ && |
| 248 username_ == o.username_ && password_ == o.password_ && |
| 249 type_ == o.type_ && network_name_ == o.network_name_ && |
| 250 network_type_ == o.network_type_ && generation_ == o.generation_ && |
| 251 foundation_ == o.foundation_ && |
| 252 related_address_ == o.related_address_ && tcptype_ == o.tcptype_ && |
| 253 transport_name_ == o.transport_name_ && network_id_ == o.network_id_; |
| 254 } |
| 255 bool operator!=(const Candidate& o) const { return !(*this == o); } |
| 256 |
244 private: | 257 private: |
245 std::string ToStringInternal(bool sensitive) const { | 258 std::string ToStringInternal(bool sensitive) const { |
246 std::ostringstream ost; | 259 std::ostringstream ost; |
247 std::string address = sensitive ? address_.ToSensitiveString() : | 260 std::string address = sensitive ? address_.ToSensitiveString() : |
248 address_.ToString(); | 261 address_.ToString(); |
249 ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_ | 262 ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_ |
250 << ":" << protocol_ << ":" << priority_ << ":" << address << ":" | 263 << ":" << protocol_ << ":" << priority_ << ":" << address << ":" |
251 << type_ << ":" << related_address_ << ":" << username_ << ":" | 264 << type_ << ":" << related_address_ << ":" << username_ << ":" |
252 << password_ << ":" << network_id_ << ":" << network_cost_ << ":" | 265 << password_ << ":" << network_id_ << ":" << network_cost_ << ":" |
253 << generation_ << "]"; | 266 << generation_ << "]"; |
(...skipping 28 matching lines...) Loading... |
282 virtual ~CandidateTranslator() {} | 295 virtual ~CandidateTranslator() {} |
283 virtual bool GetChannelNameFromComponent( | 296 virtual bool GetChannelNameFromComponent( |
284 int component, std::string* channel_name) const = 0; | 297 int component, std::string* channel_name) const = 0; |
285 virtual bool GetComponentFromChannelName( | 298 virtual bool GetComponentFromChannelName( |
286 const std::string& channel_name, int* component) const = 0; | 299 const std::string& channel_name, int* component) const = 0; |
287 }; | 300 }; |
288 | 301 |
289 } // namespace cricket | 302 } // namespace cricket |
290 | 303 |
291 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ | 304 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ |
OLD | NEW |