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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 return ost.str(); | 157 return ost.str(); |
158 } | 158 } |
159 | 159 |
160 NetworkManager::NetworkManager() { | 160 NetworkManager::NetworkManager() { |
161 } | 161 } |
162 | 162 |
163 NetworkManager::~NetworkManager() { | 163 NetworkManager::~NetworkManager() { |
164 } | 164 } |
165 | 165 |
166 NetworkManagerBase::NetworkManagerBase() | 166 NetworkManagerBase::NetworkManagerBase() |
167 : max_ipv6_networks_(kMaxIPv6Networks), ipv6_enabled_(true) { | 167 : max_ipv6_networks_(kMaxIPv6Networks), |
168 ipv6_enabled_(true), | |
169 network_permission_state_(NetworkManager::STATE_UNKNOWN) { | |
168 } | 170 } |
169 | 171 |
170 NetworkManagerBase::~NetworkManagerBase() { | 172 NetworkManagerBase::~NetworkManagerBase() { |
171 for (const auto& kv : networks_map_) { | 173 for (const auto& kv : networks_map_) { |
172 delete kv.second; | 174 delete kv.second; |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 void NetworkManagerBase::GetAnyAddressNetworks(NetworkList* networks) { | 178 void NetworkManagerBase::GetAnyAddressNetworks(NetworkList* networks) { |
177 if (!ipv4_any_address_network_) { | 179 if (!ipv4_any_address_network_) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 for (Network* network : networks_) { | 301 for (Network* network : networks_) { |
300 network->set_preference(pref); | 302 network->set_preference(pref); |
301 if (pref > 0) { | 303 if (pref > 0) { |
302 --pref; | 304 --pref; |
303 } else { | 305 } else { |
304 LOG(LS_ERROR) << "Too many network interfaces to handle!"; | 306 LOG(LS_ERROR) << "Too many network interfaces to handle!"; |
305 break; | 307 break; |
306 } | 308 } |
307 } | 309 } |
308 } | 310 } |
311 | |
312 network_permission_state_ = STATE_ALLOWED; | |
309 } | 313 } |
310 | 314 |
311 BasicNetworkManager::BasicNetworkManager() | 315 BasicNetworkManager::BasicNetworkManager() |
312 : thread_(NULL), sent_first_update_(false), start_count_(0), | 316 : thread_(NULL), sent_first_update_(false), start_count_(0), |
313 network_ignore_mask_(kDefaultNetworkIgnoreMask), | 317 network_ignore_mask_(kDefaultNetworkIgnoreMask), |
314 ignore_non_default_routes_(false) { | 318 ignore_non_default_routes_(false) { |
315 } | 319 } |
316 | 320 |
317 BasicNetworkManager::~BasicNetworkManager() { | 321 BasicNetworkManager::~BasicNetworkManager() { |
318 } | 322 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 // we should trigger network signal immediately for the new clients | 652 // we should trigger network signal immediately for the new clients |
649 // to start allocating ports. | 653 // to start allocating ports. |
650 if (sent_first_update_) | 654 if (sent_first_update_) |
651 thread_->Post(this, kSignalNetworksMessage); | 655 thread_->Post(this, kSignalNetworksMessage); |
652 } else { | 656 } else { |
653 thread_->Post(this, kUpdateNetworksMessage); | 657 thread_->Post(this, kUpdateNetworksMessage); |
654 } | 658 } |
655 ++start_count_; | 659 ++start_count_; |
656 } | 660 } |
657 | 661 |
658 void BasicNetworkManager::StopUpdating() { | 662 void BasicNetworkManager::StopUpdating() { |
juberti1
2015/08/14 23:25:55
Should this reset the permission state?
| |
659 ASSERT(Thread::Current() == thread_); | 663 ASSERT(Thread::Current() == thread_); |
660 if (!start_count_) | 664 if (!start_count_) |
661 return; | 665 return; |
662 | 666 |
663 --start_count_; | 667 --start_count_; |
664 if (!start_count_) { | 668 if (!start_count_) { |
665 thread_->Clear(this); | 669 thread_->Clear(this); |
666 sent_first_update_ = false; | 670 sent_first_update_ = false; |
667 } | 671 } |
668 } | 672 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
800 std::stringstream ss; | 804 std::stringstream ss; |
801 // Print out the first space-terminated token of the network desc, plus | 805 // Print out the first space-terminated token of the network desc, plus |
802 // the IP address. | 806 // the IP address. |
803 ss << "Net[" << description_.substr(0, description_.find(' ')) | 807 ss << "Net[" << description_.substr(0, description_.find(' ')) |
804 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 808 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
805 << ":" << AdapterTypeToString(type_) << "]"; | 809 << ":" << AdapterTypeToString(type_) << "]"; |
806 return ss.str(); | 810 return ss.str(); |
807 } | 811 } |
808 | 812 |
809 } // namespace rtc | 813 } // namespace rtc |
OLD | NEW |