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...) Expand 10 before | Expand all | Expand 10 after 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 | |
257 private: | 244 private: |
258 std::string ToStringInternal(bool sensitive) const { | 245 std::string ToStringInternal(bool sensitive) const { |
259 std::ostringstream ost; | 246 std::ostringstream ost; |
260 std::string address = sensitive ? address_.ToSensitiveString() : | 247 std::string address = sensitive ? address_.ToSensitiveString() : |
261 address_.ToString(); | 248 address_.ToString(); |
262 ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_ | 249 ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_ |
263 << ":" << protocol_ << ":" << priority_ << ":" << address << ":" | 250 << ":" << protocol_ << ":" << priority_ << ":" << address << ":" |
264 << type_ << ":" << related_address_ << ":" << username_ << ":" | 251 << type_ << ":" << related_address_ << ":" << username_ << ":" |
265 << password_ << ":" << network_id_ << ":" << network_cost_ << ":" | 252 << password_ << ":" << network_id_ << ":" << network_cost_ << ":" |
266 << generation_ << "]"; | 253 << generation_ << "]"; |
(...skipping 28 matching lines...) Expand all Loading... |
295 virtual ~CandidateTranslator() {} | 282 virtual ~CandidateTranslator() {} |
296 virtual bool GetChannelNameFromComponent( | 283 virtual bool GetChannelNameFromComponent( |
297 int component, std::string* channel_name) const = 0; | 284 int component, std::string* channel_name) const = 0; |
298 virtual bool GetComponentFromChannelName( | 285 virtual bool GetComponentFromChannelName( |
299 const std::string& channel_name, int* component) const = 0; | 286 const std::string& channel_name, int* component) const = 0; |
300 }; | 287 }; |
301 | 288 |
302 } // namespace cricket | 289 } // namespace cricket |
303 | 290 |
304 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ | 291 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ |
OLD | NEW |