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

Unified Diff: webrtc/base/firewallsocketserver.h

Issue 2936553003: Adding PortAllocator option to support cases where sockets can't be bound. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | webrtc/base/firewallsocketserver.cc » ('j') | webrtc/base/natsocketfactory.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/firewallsocketserver.h
diff --git a/webrtc/base/firewallsocketserver.h b/webrtc/base/firewallsocketserver.h
index 95ff039623a2800a8169cb2991f9c731958def2f..b9664f007ae00659aa45b119134d0a65dc64dfde 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 which can't be bound to using Bind. 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 SetInvalidBindIps(const std::vector<rtc::IPAddress>& invalid_bind_ips);
+ bool CanBindToIp(const rtc::IPAddress& ip);
+
Socket* CreateSocket(int type) override;
Socket* CreateSocket(int family, int type) override;
@@ -83,6 +93,9 @@ class FirewallSocketServer : public SocketServer {
SocketAddress dst;
};
std::vector<Rule> rules_;
+ // IP addresses which can't be successfully bound to, using Bind. If this
+ // list is empty, any address is accepted.
+ std::vector<rtc::IPAddress> invalid_bind_ips_;
bool should_delete_server_;
bool udp_sockets_enabled_;
bool tcp_sockets_enabled_;
« no previous file with comments | « no previous file | webrtc/base/firewallsocketserver.cc » ('j') | webrtc/base/natsocketfactory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698