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

Unified Diff: webrtc/base/networkmonitor.h

Issue 1556743002: Bind a socket to a network if the network handle is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/network_unittest.cc ('k') | webrtc/base/networkmonitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/networkmonitor.h
diff --git a/webrtc/base/networkmonitor.h b/webrtc/base/networkmonitor.h
index c45c81704072774497facdbf7821121dbd5a76d9..dd15f6e8f7244226d40084a0742d0316be63f470 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 {
+ NETWORK_BIND_SUCCESS = 0, // No error
+ NETWORK_BIND_FAILURE = -1, // Generic error
+ NETWORK_BIND_NOT_IMPLEMENTED = -2,
+ NETWORK_BIND_ADDRESS_NOT_FOUND = -3,
+ NETWORK_BIND_NETWORK_CHANGED = -4
+};
+
+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.
@@ -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_;
};
/*
« no previous file with comments | « webrtc/base/network_unittest.cc ('k') | webrtc/base/networkmonitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698