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

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

Issue 2097653002: Add virtual Initialize methods to PortAllocator and NetworkManager. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing typo in test. Created 4 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/api/peerconnectioninterface_unittest.cc ('k') | webrtc/p2p/base/fakeportallocator.h » ('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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 public: 56 public:
57 virtual ~DefaultLocalAddressProvider() = default; 57 virtual ~DefaultLocalAddressProvider() = default;
58 // The default local address is the local address used in multi-homed endpoint 58 // The default local address is the local address used in multi-homed endpoint
59 // when the any address (0.0.0.0 or ::) is used as the local address. It's 59 // when the any address (0.0.0.0 or ::) is used as the local address. It's
60 // important to check the return value as a IP family may not be enabled. 60 // important to check the return value as a IP family may not be enabled.
61 virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0; 61 virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0;
62 }; 62 };
63 63
64 // Generic network manager interface. It provides list of local 64 // Generic network manager interface. It provides list of local
65 // networks. 65 // networks.
66 //
67 // Every method of NetworkManager (including the destructor) must be called on
68 // the same thread, except for the constructor which may be called on any
69 // thread.
70 //
71 // This allows constructing a NetworkManager subclass on one thread and
72 // passing it into an object that uses it on a different thread.
66 class NetworkManager : public DefaultLocalAddressProvider { 73 class NetworkManager : public DefaultLocalAddressProvider {
67 public: 74 public:
68 typedef std::vector<Network*> NetworkList; 75 typedef std::vector<Network*> NetworkList;
69 76
70 // This enum indicates whether adapter enumeration is allowed. 77 // This enum indicates whether adapter enumeration is allowed.
71 enum EnumerationPermission { 78 enum EnumerationPermission {
72 ENUMERATION_ALLOWED, // Adapter enumeration is allowed. Getting 0 network 79 ENUMERATION_ALLOWED, // Adapter enumeration is allowed. Getting 0 network
73 // from GetNetworks means that there is no network 80 // from GetNetworks means that there is no network
74 // available. 81 // available.
75 ENUMERATION_BLOCKED, // Adapter enumeration is disabled. 82 ENUMERATION_BLOCKED, // Adapter enumeration is disabled.
76 // GetAnyAddressNetworks() should be used instead. 83 // GetAnyAddressNetworks() should be used instead.
77 }; 84 };
78 85
79 NetworkManager(); 86 NetworkManager();
80 ~NetworkManager() override; 87 ~NetworkManager() override;
81 88
82 // Called when network list is updated. 89 // Called when network list is updated.
83 sigslot::signal0<> SignalNetworksChanged; 90 sigslot::signal0<> SignalNetworksChanged;
84 91
85 // Indicates a failure when getting list of network interfaces. 92 // Indicates a failure when getting list of network interfaces.
86 sigslot::signal0<> SignalError; 93 sigslot::signal0<> SignalError;
87 94
95 // This should be called on the NetworkManager's thread before the
96 // NetworkManager is used. Subclasses may override this if necessary.
97 virtual void Initialize() {}
98
88 // Start/Stop monitoring of network interfaces 99 // Start/Stop monitoring of network interfaces
89 // list. SignalNetworksChanged or SignalError is emitted immediately 100 // list. SignalNetworksChanged or SignalError is emitted immediately
90 // after StartUpdating() is called. After that SignalNetworksChanged 101 // after StartUpdating() is called. After that SignalNetworksChanged
91 // is emitted whenever list of networks changes. 102 // is emitted whenever list of networks changes.
92 virtual void StartUpdating() = 0; 103 virtual void StartUpdating() = 0;
93 virtual void StopUpdating() = 0; 104 virtual void StopUpdating() = 0;
94 105
95 // Returns the current list of networks available on this machine. 106 // Returns the current list of networks available on this machine.
96 // StartUpdating() must be called before this method is called. 107 // StartUpdating() must be called before this method is called.
97 // It makes sure that repeated calls return the same object for a 108 // It makes sure that repeated calls return the same object for a
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 int preference_; 424 int preference_;
414 bool active_ = true; 425 bool active_ = true;
415 uint16_t id_ = 0; 426 uint16_t id_ = 0;
416 427
417 friend class NetworkManager; 428 friend class NetworkManager;
418 }; 429 };
419 430
420 } // namespace rtc 431 } // namespace rtc
421 432
422 #endif // WEBRTC_BASE_NETWORK_H_ 433 #endif // WEBRTC_BASE_NETWORK_H_
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectioninterface_unittest.cc ('k') | webrtc/p2p/base/fakeportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698