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

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

Issue 1288843003: Revert "Generate localhost candidate when no STUN/TURN and portallocator has the right flag spefied… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 4 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/base/ipaddress.cc ('k') | webrtc/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // length of that prefix. 49 // length of that prefix.
50 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, 50 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix,
51 int prefix_length); 51 int prefix_length);
52 52
53 // Generic network manager interface. It provides list of local 53 // Generic network manager interface. It provides list of local
54 // networks. 54 // networks.
55 class NetworkManager { 55 class NetworkManager {
56 public: 56 public:
57 typedef std::vector<Network*> NetworkList; 57 typedef std::vector<Network*> NetworkList;
58 58
59 // This enum indicates whether adapter enumeration is allowed.
60 enum EnumerationPermission {
61 kEnumerationAllowed, // Adapter enumeration is allowed. Getting 0
62 // network from GetNetworks means that there is no
63 // network available.
64 kEnumerationDisallowed, // Adapter enumeration is
65 // disabled. GetAnyAddressNetworks() should be used
66 // instead.
67 };
68
69 NetworkManager(); 59 NetworkManager();
70 virtual ~NetworkManager(); 60 virtual ~NetworkManager();
71 61
72 // Called when network list is updated. 62 // Called when network list is updated.
73 sigslot::signal0<> SignalNetworksChanged; 63 sigslot::signal0<> SignalNetworksChanged;
74 64
75 // Indicates a failure when getting list of network interfaces. 65 // Indicates a failure when getting list of network interfaces.
76 sigslot::signal0<> SignalError; 66 sigslot::signal0<> SignalError;
77 67
78 // Start/Stop monitoring of network interfaces 68 // Start/Stop monitoring of network interfaces
79 // list. SignalNetworksChanged or SignalError is emitted immediately 69 // list. SignalNetworksChanged or SignalError is emitted immediately
80 // after StartUpdating() is called. After that SignalNetworksChanged 70 // after StartUpdating() is called. After that SignalNetworksChanged
81 // is emitted whenever list of networks changes. 71 // is emitted whenever list of networks changes.
82 virtual void StartUpdating() = 0; 72 virtual void StartUpdating() = 0;
83 virtual void StopUpdating() = 0; 73 virtual void StopUpdating() = 0;
84 74
85 // Returns the current list of networks available on this machine. 75 // Returns the current list of networks available on this machine.
86 // StartUpdating() must be called before this method is called. 76 // UpdateNetworks() must be called before this method is called.
87 // It makes sure that repeated calls return the same object for a 77 // It makes sure that repeated calls return the same object for a
88 // given network, so that quality is tracked appropriately. Does not 78 // given network, so that quality is tracked appropriately. Does not
89 // include ignored networks. 79 // include ignored networks.
90 virtual void GetNetworks(NetworkList* networks) const = 0; 80 virtual void GetNetworks(NetworkList* networks) const = 0;
91 81
92 // return the current permission state of GetNetworks()
93 virtual EnumerationPermission enumeration_permission() const = 0;
94
95 // "AnyAddressNetwork" is a network which only contains single "any address" 82 // "AnyAddressNetwork" is a network which only contains single "any address"
96 // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is 83 // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is
97 // useful as binding to such interfaces allow default routing behavior like 84 // useful as binding to such interfaces allow default routing behavior like
98 // http traffic. 85 // http traffic.
99 // TODO(guoweis): remove this body when chromium implements this. 86 // TODO(guoweis): remove this body when chromium implements this.
100 virtual void GetAnyAddressNetworks(NetworkList* networks) {} 87 virtual void GetAnyAddressNetworks(NetworkList* networks) {}
101 88
102 // Dumps a list of networks available to LS_INFO. 89 // Dumps a list of networks available to LS_INFO.
103 virtual void DumpNetworks(bool include_ignored) {} 90 virtual void DumpNetworks(bool include_ignored) {}
104 91
(...skipping 14 matching lines...) Expand all
119 ~NetworkManagerBase() override; 106 ~NetworkManagerBase() override;
120 107
121 void GetNetworks(std::vector<Network*>* networks) const override; 108 void GetNetworks(std::vector<Network*>* networks) const override;
122 void GetAnyAddressNetworks(NetworkList* networks) override; 109 void GetAnyAddressNetworks(NetworkList* networks) override;
123 bool ipv6_enabled() const { return ipv6_enabled_; } 110 bool ipv6_enabled() const { return ipv6_enabled_; }
124 void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; } 111 void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; }
125 112
126 void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; } 113 void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; }
127 int max_ipv6_networks() { return max_ipv6_networks_; } 114 int max_ipv6_networks() { return max_ipv6_networks_; }
128 115
129 EnumerationPermission enumeration_permission() const override;
130
131 protected: 116 protected:
132 typedef std::map<std::string, Network*> NetworkMap; 117 typedef std::map<std::string, Network*> NetworkMap;
133 // Updates |networks_| with the networks listed in |list|. If 118 // Updates |networks_| with the networks listed in |list|. If
134 // |network_map_| already has a Network object for a network listed 119 // |network_map_| already has a Network object for a network listed
135 // in the |list| then it is reused. Accept ownership of the Network 120 // in the |list| then it is reused. Accept ownership of the Network
136 // objects in the |list|. |changed| will be set to true if there is 121 // objects in the |list|. |changed| will be set to true if there is
137 // any change in the network list. 122 // any change in the network list.
138 void MergeNetworkList(const NetworkList& list, bool* changed); 123 void MergeNetworkList(const NetworkList& list, bool* changed);
139 124
140 // |stats| will be populated even if |*changed| is false. 125 // |stats| will be populated even if |*changed| is false.
141 void MergeNetworkList(const NetworkList& list, 126 void MergeNetworkList(const NetworkList& list,
142 bool* changed, 127 bool* changed,
143 NetworkManager::Stats* stats); 128 NetworkManager::Stats* stats);
144 129
145 void set_enumeration_permission(EnumerationPermission state) {
146 enumeration_permission_ = state;
147 }
148
149 private: 130 private:
150 friend class NetworkTest; 131 friend class NetworkTest;
151 void DoUpdateNetworks(); 132 void DoUpdateNetworks();
152 133
153 EnumerationPermission enumeration_permission_;
154
155 NetworkList networks_; 134 NetworkList networks_;
156 int max_ipv6_networks_; 135 int max_ipv6_networks_;
157 136
158 NetworkMap networks_map_; 137 NetworkMap networks_map_;
159 bool ipv6_enabled_; 138 bool ipv6_enabled_;
160 139
161 rtc::scoped_ptr<rtc::Network> ipv4_any_address_network_; 140 rtc::scoped_ptr<rtc::Network> ipv4_any_address_network_;
162 rtc::scoped_ptr<rtc::Network> ipv6_any_address_network_; 141 rtc::scoped_ptr<rtc::Network> ipv6_any_address_network_;
163 }; 142 };
164 143
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool ignored_; 301 bool ignored_;
323 AdapterType type_; 302 AdapterType type_;
324 int preference_; 303 int preference_;
325 304
326 friend class NetworkManager; 305 friend class NetworkManager;
327 }; 306 };
328 307
329 } // namespace rtc 308 } // namespace rtc
330 309
331 #endif // WEBRTC_BASE_NETWORK_H_ 310 #endif // WEBRTC_BASE_NETWORK_H_
OLDNEW
« no previous file with comments | « webrtc/base/ipaddress.cc ('k') | webrtc/base/network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698