OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // scheme = "turn" / "turns" | 224 // scheme = "turn" / "turns" |
225 // transport = "udp" / "tcp" / transport-ext | 225 // transport = "udp" / "tcp" / transport-ext |
226 // transport-ext = 1*unreserved | 226 // transport-ext = 1*unreserved |
227 // turn-host = IP-literal / IPv4address / reg-name | 227 // turn-host = IP-literal / IPv4address / reg-name |
228 // turn-port = *DIGIT | 228 // turn-port = *DIGIT |
229 RTC_DCHECK(stun_servers != nullptr); | 229 RTC_DCHECK(stun_servers != nullptr); |
230 RTC_DCHECK(turn_servers != nullptr); | 230 RTC_DCHECK(turn_servers != nullptr); |
231 std::vector<std::string> tokens; | 231 std::vector<std::string> tokens; |
232 cricket::ProtocolType turn_transport_type = cricket::PROTO_UDP; | 232 cricket::ProtocolType turn_transport_type = cricket::PROTO_UDP; |
233 RTC_DCHECK(!url.empty()); | 233 RTC_DCHECK(!url.empty()); |
234 rtc::tokenize(url, '?', &tokens); | 234 rtc::tokenize_with_empty_tokens(url, '?', &tokens); |
235 std::string uri_without_transport = tokens[0]; | 235 std::string uri_without_transport = tokens[0]; |
236 // Let's look into transport= param, if it exists. | 236 // Let's look into transport= param, if it exists. |
237 if (tokens.size() == kTurnTransportTokensNum) { // ?transport= is present. | 237 if (tokens.size() == kTurnTransportTokensNum) { // ?transport= is present. |
238 std::string uri_transport_param = tokens[1]; | 238 std::string uri_transport_param = tokens[1]; |
239 rtc::tokenize(uri_transport_param, '=', &tokens); | 239 rtc::tokenize_with_empty_tokens(uri_transport_param, '=', &tokens); |
240 if (tokens[0] == kTransport) { | 240 if (tokens[0] != kTransport) { |
241 // As per above grammar transport param will be consist of lower case | 241 LOG(LS_WARNING) << "Invalid transport parameter key."; |
242 // letters. | 242 return false; |
243 if (!cricket::StringToProto(tokens[1].c_str(), &turn_transport_type) || | 243 } |
244 (turn_transport_type != cricket::PROTO_UDP && | 244 if (tokens.size() < 2 || |
245 turn_transport_type != cricket::PROTO_TCP)) { | 245 !cricket::StringToProto(tokens[1].c_str(), &turn_transport_type) || |
246 LOG(LS_WARNING) << "Transport param should always be udp or tcp."; | 246 (turn_transport_type != cricket::PROTO_UDP && |
247 return false; | 247 turn_transport_type != cricket::PROTO_TCP)) { |
248 } | 248 LOG(LS_WARNING) << "Transport param should always be udp or tcp."; |
| 249 return false; |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 std::string hoststring; | 253 std::string hoststring; |
253 ServiceType service_type; | 254 ServiceType service_type; |
254 if (!GetServiceTypeAndHostnameFromUri(uri_without_transport, | 255 if (!GetServiceTypeAndHostnameFromUri(uri_without_transport, |
255 &service_type, | 256 &service_type, |
256 &hoststring)) { | 257 &hoststring)) { |
257 LOG(LS_WARNING) << "Invalid transport parameter in ICE URI: " << url; | 258 LOG(LS_WARNING) << "Invalid transport parameter in ICE URI: " << url; |
258 return false; | 259 return false; |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 | 2368 |
2368 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, | 2369 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, |
2369 int64_t max_size_bytes) { | 2370 int64_t max_size_bytes) { |
2370 return event_log_->StartLogging(file, max_size_bytes); | 2371 return event_log_->StartLogging(file, max_size_bytes); |
2371 } | 2372 } |
2372 | 2373 |
2373 void PeerConnection::StopRtcEventLog_w() { | 2374 void PeerConnection::StopRtcEventLog_w() { |
2374 event_log_->StopLogging(); | 2375 event_log_->StopLogging(); |
2375 } | 2376 } |
2376 } // namespace webrtc | 2377 } // namespace webrtc |
OLD | NEW |