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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 | 63 |
64 const std::string & id() const { return id_; } | 64 const std::string & id() const { return id_; } |
65 void set_id(const std::string & id) { id_ = id; } | 65 void set_id(const std::string & id) { id_ = id; } |
66 | 66 |
67 int component() const { return component_; } | 67 int component() const { return component_; } |
68 void set_component(int component) { component_ = component; } | 68 void set_component(int component) { component_ = component; } |
69 | 69 |
70 const std::string & protocol() const { return protocol_; } | 70 const std::string & protocol() const { return protocol_; } |
71 void set_protocol(const std::string & protocol) { protocol_ = protocol; } | 71 void set_protocol(const std::string & protocol) { protocol_ = protocol; } |
72 | 72 |
73 // The protocol used by the first hop. Mainly interesting for TURN/TCP | |
74 // candidate as it's actually TCP although the candidate is udp itself. | |
75 const std::string& first_hop_protocol() const { | |
juberti1
2015/08/14 21:04:59
Rather than duplicating the protocol value in case
| |
76 if (first_hop_protocol_.empty()) { | |
77 return protocol_; | |
78 } | |
79 return first_hop_protocol_; | |
80 } | |
81 void set_first_hop_protocol(const std::string& protocol) { | |
82 first_hop_protocol_ = protocol; | |
83 } | |
84 | |
73 const rtc::SocketAddress & address() const { return address_; } | 85 const rtc::SocketAddress & address() const { return address_; } |
74 void set_address(const rtc::SocketAddress & address) { | 86 void set_address(const rtc::SocketAddress & address) { |
75 address_ = address; | 87 address_ = address; |
76 } | 88 } |
77 | 89 |
78 uint32 priority() const { return priority_; } | 90 uint32 priority() const { return priority_; } |
79 void set_priority(const uint32 priority) { priority_ = priority; } | 91 void set_priority(const uint32 priority) { priority_ = priority; } |
80 | 92 |
81 // void set_type_preference(uint32 type_preference) { | 93 // void set_type_preference(uint32 type_preference) { |
82 // priority_ = GetPriority(type_preference); | 94 // priority_ = GetPriority(type_preference); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 ost << "Cand[" << foundation_ << ":" << component_ << ":" | 219 ost << "Cand[" << foundation_ << ":" << component_ << ":" |
208 << protocol_ << ":" << priority_ << ":" | 220 << protocol_ << ":" << priority_ << ":" |
209 << address << ":" << type_ << ":" << related_address_ << ":" | 221 << address << ":" << type_ << ":" << related_address_ << ":" |
210 << username_ << ":" << password_ << "]"; | 222 << username_ << ":" << password_ << "]"; |
211 return ost.str(); | 223 return ost.str(); |
212 } | 224 } |
213 | 225 |
214 std::string id_; | 226 std::string id_; |
215 int component_; | 227 int component_; |
216 std::string protocol_; | 228 std::string protocol_; |
229 std::string first_hop_protocol_; | |
217 rtc::SocketAddress address_; | 230 rtc::SocketAddress address_; |
218 uint32 priority_; | 231 uint32 priority_; |
219 std::string username_; | 232 std::string username_; |
220 std::string password_; | 233 std::string password_; |
221 std::string type_; | 234 std::string type_; |
222 std::string network_name_; | 235 std::string network_name_; |
223 rtc::AdapterType network_type_; | 236 rtc::AdapterType network_type_; |
224 uint32 generation_; | 237 uint32 generation_; |
225 std::string foundation_; | 238 std::string foundation_; |
226 rtc::SocketAddress related_address_; | 239 rtc::SocketAddress related_address_; |
227 std::string tcptype_; | 240 std::string tcptype_; |
228 }; | 241 }; |
229 | 242 |
230 // Used during parsing and writing to map component to channel name | 243 // Used during parsing and writing to map component to channel name |
231 // and back. This is primarily for converting old G-ICE candidate | 244 // and back. This is primarily for converting old G-ICE candidate |
232 // signalling to new ICE candidate classes. | 245 // signalling to new ICE candidate classes. |
233 class CandidateTranslator { | 246 class CandidateTranslator { |
234 public: | 247 public: |
235 virtual ~CandidateTranslator() {} | 248 virtual ~CandidateTranslator() {} |
236 virtual bool GetChannelNameFromComponent( | 249 virtual bool GetChannelNameFromComponent( |
237 int component, std::string* channel_name) const = 0; | 250 int component, std::string* channel_name) const = 0; |
238 virtual bool GetComponentFromChannelName( | 251 virtual bool GetComponentFromChannelName( |
239 const std::string& channel_name, int* component) const = 0; | 252 const std::string& channel_name, int* component) const = 0; |
240 }; | 253 }; |
241 | 254 |
242 } // namespace cricket | 255 } // namespace cricket |
243 | 256 |
244 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ | 257 #endif // WEBRTC_P2P_BASE_CANDIDATE_H_ |
OLD | NEW |