Index: webrtc/base/networkmonitor.h |
diff --git a/webrtc/base/networkmonitor.h b/webrtc/base/networkmonitor.h |
index c45c81704072774497facdbf7821121dbd5a76d9..15a75b15f2bc6356cc24e6dc641f50adcb295cd9 100644 |
--- a/webrtc/base/networkmonitor.h |
+++ b/webrtc/base/networkmonitor.h |
@@ -17,6 +17,27 @@ |
#include "webrtc/base/thread.h" |
namespace rtc { |
+ |
+class IPAddress; |
+ |
+// Error values are negative. |
+enum NetworkBindingResults { |
+ OK = 0, // No error |
+ ERR_FAILED = -1, // Generic error |
+ ERR_NOT_IMPLEMENTED = -2, |
+ ERR_ADDRESS_NOT_FOUND = -3, |
+ ERR_NETWORK_CHANGED = -4 |
+}; |
pthatcher1
2016/01/15 19:56:11
This should have more specific names, like:
NETWO
honghaiz3
2016/01/15 21:37:36
Done.
|
+ |
+class NetworkBinderInterface { |
+ public: |
+ // Binds a socket to the network that is attached to |address| so that all |
+ // packets on the socket |socket_fd| will be sent via that network. |
+ // This is needed because some operating systems (like Android) require a |
+ // special bind call to put packets on a non-default network interface. |
+ virtual int BindSocketToNetwork(int socket_fd, const IPAddress& address) = 0; |
+}; |
+ |
/* |
* Receives network-change events via |OnNetworksChanged| and signals the |
* networks changed event. |
@@ -36,7 +57,7 @@ namespace rtc { |
*/ |
// Generic network monitor interface. It starts and stops monitoring network |
// changes, and fires the SignalNetworksChanged event when networks change. |
-class NetworkMonitorInterface { |
+class NetworkMonitorInterface : public NetworkBinderInterface { |
pthatcher1
2016/01/15 19:56:11
Is it necessary to mandate that *every* NetworkMon
honghaiz3
2016/01/15 21:37:36
Good point. Thanks!
|
public: |
NetworkMonitorInterface(); |
virtual ~NetworkMonitorInterface(); |
@@ -62,8 +83,11 @@ class NetworkMonitorBase : public NetworkMonitorInterface, |
void OnMessage(Message* msg) override; |
+ protected: |
+ Thread* worker_thread() { return worker_thread_; } |
+ |
private: |
- Thread* thread_; |
+ Thread* worker_thread_; |
}; |
/* |