Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: webrtc/rtc_base/network.h

Issue 2983213002: Relanding: Move "max IPv6 networks" logic to BasicPortAllocator, and fix sorting. (Closed)
Patch Set: Fixing P2PTransportChannelMultihomedTest (was relying on ordering assumptions it shouldn't have beeā€¦ Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/client/basicportallocator_unittest.cc ('k') | webrtc/rtc_base/network.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 }; 140 };
141 141
142 // Base class for NetworkManager implementations. 142 // Base class for NetworkManager implementations.
143 class NetworkManagerBase : public NetworkManager { 143 class NetworkManagerBase : public NetworkManager {
144 public: 144 public:
145 NetworkManagerBase(); 145 NetworkManagerBase();
146 ~NetworkManagerBase() override; 146 ~NetworkManagerBase() override;
147 147
148 void GetNetworks(NetworkList* networks) const override; 148 void GetNetworks(NetworkList* networks) const override;
149 void GetAnyAddressNetworks(NetworkList* networks) override; 149 void GetAnyAddressNetworks(NetworkList* networks) override;
150
150 // Defaults to true. 151 // Defaults to true.
152 // TODO(deadbeef): Remove this. Nothing but tests use this; IPv6 is enabled
153 // by default everywhere else.
151 bool ipv6_enabled() const { return ipv6_enabled_; } 154 bool ipv6_enabled() const { return ipv6_enabled_; }
152 void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; } 155 void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; }
153 156
154 void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; }
155 int max_ipv6_networks() { return max_ipv6_networks_; }
156
157 EnumerationPermission enumeration_permission() const override; 157 EnumerationPermission enumeration_permission() const override;
158 158
159 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; 159 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override;
160 160
161 protected: 161 protected:
162 typedef std::map<std::string, Network*> NetworkMap; 162 typedef std::map<std::string, Network*> NetworkMap;
163 // Updates |networks_| with the networks listed in |list|. If 163 // Updates |networks_| with the networks listed in |list|. If
164 // |network_map_| already has a Network object for a network listed 164 // |network_map_| already has a Network object for a network listed
165 // in the |list| then it is reused. Accept ownership of the Network 165 // in the |list| then it is reused. Accept ownership of the Network
166 // objects in the |list|. |changed| will be set to true if there is 166 // objects in the |list|. |changed| will be set to true if there is
(...skipping 13 matching lines...) Expand all
180 const IPAddress& ipv6); 180 const IPAddress& ipv6);
181 181
182 private: 182 private:
183 friend class NetworkTest; 183 friend class NetworkTest;
184 184
185 Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const; 185 Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const;
186 186
187 EnumerationPermission enumeration_permission_; 187 EnumerationPermission enumeration_permission_;
188 188
189 NetworkList networks_; 189 NetworkList networks_;
190 int max_ipv6_networks_;
191 190
192 NetworkMap networks_map_; 191 NetworkMap networks_map_;
193 bool ipv6_enabled_; 192 bool ipv6_enabled_;
194 193
195 std::unique_ptr<rtc::Network> ipv4_any_address_network_; 194 std::unique_ptr<rtc::Network> ipv4_any_address_network_;
196 std::unique_ptr<rtc::Network> ipv6_any_address_network_; 195 std::unique_ptr<rtc::Network> ipv6_any_address_network_;
197 196
198 IPAddress default_local_ipv4_address_; 197 IPAddress default_local_ipv4_address_;
199 IPAddress default_local_ipv6_address_; 198 IPAddress default_local_ipv6_address_;
200 // We use 16 bits to save the bandwidth consumption when sending the network 199 // We use 16 bits to save the bandwidth consumption when sending the network
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 int preference_; 425 int preference_;
427 bool active_ = true; 426 bool active_ = true;
428 uint16_t id_ = 0; 427 uint16_t id_ = 0;
429 428
430 friend class NetworkManager; 429 friend class NetworkManager;
431 }; 430 };
432 431
433 } // namespace rtc 432 } // namespace rtc
434 433
435 #endif // WEBRTC_RTC_BASE_NETWORK_H_ 434 #endif // WEBRTC_RTC_BASE_NETWORK_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/client/basicportallocator_unittest.cc ('k') | webrtc/rtc_base/network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698