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 |
11 #ifndef WEBRTC_P2P_BASE_CANDIDATE_H_ | 11 #ifndef WEBRTC_P2P_BASE_CANDIDATE_H_ |
12 #define WEBRTC_P2P_BASE_CANDIDATE_H_ | 12 #define WEBRTC_P2P_BASE_CANDIDATE_H_ |
13 | 13 |
14 #include <limits.h> | 14 #include <limits.h> |
15 #include <math.h> | 15 #include <math.h> |
16 #include <stdint.h> | 16 #include <stdint.h> |
17 | 17 |
18 #include <algorithm> | 18 #include <algorithm> |
19 #include <iomanip> | 19 #include <iomanip> |
20 #include <sstream> | 20 #include <sstream> |
21 #include <string> | 21 #include <string> |
22 | 22 |
23 #include "webrtc/p2p/base/p2pconstants.h" | 23 #include "webrtc/p2p/base/p2pconstants.h" |
| 24 #include "webrtc/base/checks.h" |
24 #include "webrtc/base/helpers.h" | 25 #include "webrtc/base/helpers.h" |
25 #include "webrtc/base/network.h" | 26 #include "webrtc/base/network.h" |
26 #include "webrtc/base/socketaddress.h" | 27 #include "webrtc/base/socketaddress.h" |
27 | 28 |
28 namespace cricket { | 29 namespace cricket { |
29 | 30 |
30 // Candidate for ICE based connection discovery. | 31 // Candidate for ICE based connection discovery. |
31 | 32 |
32 class Candidate { | 33 class Candidate { |
33 public: | 34 public: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 142 } |
142 void set_generation_str(const std::string& str) { | 143 void set_generation_str(const std::string& str) { |
143 std::istringstream ist(str); | 144 std::istringstream ist(str); |
144 ist >> generation_; | 145 ist >> generation_; |
145 } | 146 } |
146 | 147 |
147 // |network_cost| measures the cost/penalty of using this candidate. A network | 148 // |network_cost| measures the cost/penalty of using this candidate. A network |
148 // cost of 0 indicates this candidate can be used freely. A value of | 149 // cost of 0 indicates this candidate can be used freely. A value of |
149 // rtc::kNetworkCostMax indicates it should be used only as the last resort. | 150 // rtc::kNetworkCostMax indicates it should be used only as the last resort. |
150 void set_network_cost(uint16_t network_cost) { | 151 void set_network_cost(uint16_t network_cost) { |
151 ASSERT(network_cost <= rtc::kNetworkCostMax); | 152 RTC_DCHECK(network_cost <= rtc::kNetworkCostMax); |
152 network_cost_ = network_cost; | 153 network_cost_ = network_cost; |
153 } | 154 } |
154 uint16_t network_cost() const { return network_cost_; } | 155 uint16_t network_cost() const { return network_cost_; } |
155 | 156 |
156 // An ID assigned to the network hosting the candidate. | 157 // An ID assigned to the network hosting the candidate. |
157 uint16_t network_id() const { return network_id_; } | 158 uint16_t network_id() const { return network_id_; } |
158 void set_network_id(uint16_t network_id) { network_id_ = network_id; } | 159 void set_network_id(uint16_t network_id) { network_id_ = network_id; } |
159 | 160 |
160 const std::string& foundation() const { | 161 const std::string& foundation() const { |
161 return foundation_; | 162 return foundation_; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 virtual ~CandidateTranslator() {} | 294 virtual ~CandidateTranslator() {} |
294 virtual bool GetChannelNameFromComponent( | 295 virtual bool GetChannelNameFromComponent( |
295 int component, std::string* channel_name) const = 0; | 296 int component, std::string* channel_name) const = 0; |
296 virtual bool GetComponentFromChannelName( | 297 virtual bool GetComponentFromChannelName( |
297 const std::string& channel_name, int* component) const = 0; | 298 const std::string& channel_name, int* component) const = 0; |
298 }; | 299 }; |
299 | 300 |
300 } // namespace cricket | 301 } // namespace cricket |
301 | 302 |
302 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ | 303 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ |
OLD | NEW |