Chromium Code Reviews| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 } | 162 } |
| 163 void set_related_address( | 163 void set_related_address( |
| 164 const rtc::SocketAddress & related_address) { | 164 const rtc::SocketAddress & related_address) { |
| 165 related_address_ = related_address; | 165 related_address_ = related_address; |
| 166 } | 166 } |
| 167 const std::string& tcptype() const { return tcptype_; } | 167 const std::string& tcptype() const { return tcptype_; } |
| 168 void set_tcptype(const std::string& tcptype){ | 168 void set_tcptype(const std::string& tcptype){ |
| 169 tcptype_ = tcptype; | 169 tcptype_ = tcptype; |
| 170 } | 170 } |
| 171 | 171 |
| 172 const std::string& transport_name() const { return transport_name_; } | |
| 173 void set_transport_name(const std::string& transport_name) { | |
| 174 transport_name_ = transport_name; | |
| 175 } | |
|
pthatcher1
2016/03/05 02:14:32
We should probably put a comment explaining what t
honghaiz3
2016/03/09 17:40:06
Done.
| |
| 176 | |
| 172 // Determines whether this candidate is equivalent to the given one. | 177 // Determines whether this candidate is equivalent to the given one. |
| 173 bool IsEquivalent(const Candidate& c) const { | 178 bool IsEquivalent(const Candidate& c) const { |
| 174 // We ignore the network name, since that is just debug information, and | 179 // We ignore the network name, since that is just debug information, and |
| 175 // the priority, since that should be the same if the rest is (and it's | 180 // the priority, since that should be the same if the rest is (and it's |
| 176 // a float so equality checking is always worrisome). | 181 // a float so equality checking is always worrisome). |
| 177 return (component_ == c.component_) && (protocol_ == c.protocol_) && | 182 return (component_ == c.component_) && (protocol_ == c.protocol_) && |
| 178 (address_ == c.address_) && (username_ == c.username_) && | 183 (address_ == c.address_) && (username_ == c.username_) && |
| 179 (password_ == c.password_) && (type_ == c.type_) && | 184 (password_ == c.password_) && (type_ == c.type_) && |
| 180 (generation_ == c.generation_) && (foundation_ == c.foundation_) && | 185 (generation_ == c.generation_) && (foundation_ == c.foundation_) && |
| 181 (related_address_ == c.related_address_); | 186 (related_address_ == c.related_address_); |
| 182 } | 187 } |
| 183 | 188 |
| 189 // Determines whether this candidate can be considered equivalent to the | |
| 190 // given one when looking for a matching candidate to remove. | |
| 191 bool MatchesForRemoval(const Candidate& c) const { | |
| 192 return component_ == c.component_ && protocol_ == c.protocol_ && | |
| 193 address_ == c.address_; | |
| 194 } | |
| 195 | |
| 184 std::string ToString() const { | 196 std::string ToString() const { |
| 185 return ToStringInternal(false); | 197 return ToStringInternal(false); |
| 186 } | 198 } |
| 187 | 199 |
| 188 std::string ToSensitiveString() const { | 200 std::string ToSensitiveString() const { |
| 189 return ToStringInternal(true); | 201 return ToStringInternal(true); |
| 190 } | 202 } |
| 191 | 203 |
| 192 uint32_t GetPriority(uint32_t type_preference, | 204 uint32_t GetPriority(uint32_t type_preference, |
| 193 int network_adapter_preference, | 205 int network_adapter_preference, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 std::string username_; | 250 std::string username_; |
| 239 std::string password_; | 251 std::string password_; |
| 240 std::string type_; | 252 std::string type_; |
| 241 std::string network_name_; | 253 std::string network_name_; |
| 242 rtc::AdapterType network_type_; | 254 rtc::AdapterType network_type_; |
| 243 uint32_t generation_; | 255 uint32_t generation_; |
| 244 std::string foundation_; | 256 std::string foundation_; |
| 245 rtc::SocketAddress related_address_; | 257 rtc::SocketAddress related_address_; |
| 246 std::string tcptype_; | 258 std::string tcptype_; |
| 247 uint32_t network_cost_ = 0; | 259 uint32_t network_cost_ = 0; |
| 260 std::string transport_name_; | |
|
pthatcher1
2016/03/05 02:14:32
Can you make this the first thing (before id_) and
honghaiz3
2016/03/09 17:40:06
Done. The first thing was foundation.
| |
| 248 }; | 261 }; |
| 249 | 262 |
| 263 typedef std::vector<Candidate> Candidates; | |
|
pthatcher1
2016/03/05 02:14:32
Same here as before.
honghaiz3
2016/03/09 17:40:06
Done.
| |
| 264 | |
| 250 // Used during parsing and writing to map component to channel name | 265 // Used during parsing and writing to map component to channel name |
| 251 // and back. This is primarily for converting old G-ICE candidate | 266 // and back. This is primarily for converting old G-ICE candidate |
| 252 // signalling to new ICE candidate classes. | 267 // signalling to new ICE candidate classes. |
| 253 class CandidateTranslator { | 268 class CandidateTranslator { |
| 254 public: | 269 public: |
| 255 virtual ~CandidateTranslator() {} | 270 virtual ~CandidateTranslator() {} |
| 256 virtual bool GetChannelNameFromComponent( | 271 virtual bool GetChannelNameFromComponent( |
| 257 int component, std::string* channel_name) const = 0; | 272 int component, std::string* channel_name) const = 0; |
| 258 virtual bool GetComponentFromChannelName( | 273 virtual bool GetComponentFromChannelName( |
| 259 const std::string& channel_name, int* component) const = 0; | 274 const std::string& channel_name, int* component) const = 0; |
| 260 }; | 275 }; |
| 261 | 276 |
| 262 } // namespace cricket | 277 } // namespace cricket |
| 263 | 278 |
| 264 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ | 279 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ |
| OLD | NEW |