Index: webrtc/base/firewallsocketserver.h |
diff --git a/webrtc/base/firewallsocketserver.h b/webrtc/base/firewallsocketserver.h |
index 95ff039623a2800a8169cb2991f9c731958def2f..21a476b10b438205145819ce35f2884256b37f0f 100644 |
--- a/webrtc/base/firewallsocketserver.h |
+++ b/webrtc/base/firewallsocketserver.h |
@@ -58,6 +58,16 @@ class FirewallSocketServer : public SocketServer { |
bool Check(FirewallProtocol p, |
const SocketAddress& src, const SocketAddress& dst); |
+ // Set the IP addresses for which Bind will fail. By default this list is |
+ // empty. This can be used to simulate a real OS that refuses to bind to |
+ // addresses under various circumstances. |
+ // |
+ // No matter how many addresses are added (including INADDR_ANY), the server |
+ // will still allow creating outgoing TCP connections, since they don't |
+ // require explicitly binding a socket. |
+ void SetUnbindableIps(const std::vector<rtc::IPAddress>& unbindable_ips); |
+ bool IsBindableIp(const rtc::IPAddress& ip); |
+ |
Socket* CreateSocket(int type) override; |
Socket* CreateSocket(int family, int type) override; |
@@ -83,6 +93,7 @@ class FirewallSocketServer : public SocketServer { |
SocketAddress dst; |
}; |
std::vector<Rule> rules_; |
+ std::vector<rtc::IPAddress> unbindable_ips_; |
bool should_delete_server_; |
bool udp_sockets_enabled_; |
bool tcp_sockets_enabled_; |