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

Unified Diff: remoting/host/chromoting_host.h

Issue 10233021: Move PortAllocator creation out of LibjingleTransportFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | remoting/host/chromoting_host.cc » ('j') | remoting/host/chromoting_host.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.h
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 28a613d850226323d4e500ebd0b2ebd4943cc46e..a9749aca990ad439e81a088b5b7f51143a2c48a3 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -39,6 +39,49 @@ class DesktopEnvironment;
class Encoder;
class ScreenRecorder;
+struct NetworkSettings {
+ enum NatTraversalMode {
+ // Don't use STUN or relay servers. Accept incoming P2P connection
+ // attempts, but don't initiate any. This ensures that the peer is
+ // on the same network. Note that connection will always fail if
+ // both ends use this mode.
+ NAT_TRAVERSAL_DISABLED,
+
+ // Don't use STUN or relay servers but make outgoing connections.
+ NAT_TRAVERSAL_OUTGOING,
+
+ // Active NAT traversal using STUN and relay servers.
+ NAT_TRAVERSAL_ENABLED,
+ };
+
+ NetworkSettings()
+ : nat_traversal_mode(NAT_TRAVERSAL_DISABLED),
+ min_port(0),
+ max_port(0) {
+ }
+
+ explicit NetworkSettings(bool allow_nat_traversal)
+ : nat_traversal_mode(allow_nat_traversal ?
+ NAT_TRAVERSAL_ENABLED :
+ NAT_TRAVERSAL_DISABLED),
+ min_port(0),
+ max_port(0) {
+ }
+
+ explicit NetworkSettings(NatTraversalMode nat_traversal_mode)
+ : nat_traversal_mode(nat_traversal_mode),
+ min_port(0),
+ max_port(0) {
+ }
+
+ NatTraversalMode nat_traversal_mode;
+
+ // |min_port| and |max_port| specify range (inclusive) of ports used by
+ // P2P sessions. Any port can be used when both values are set to 0.
+ int min_port;
+ int max_port;
+};
+
// A class to implement the functionality of a host process.
//
// Here's the work flow of this class:
@@ -71,7 +114,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
ChromotingHost(ChromotingHostContext* context,
SignalStrategy* signal_strategy,
DesktopEnvironment* environment,
- const protocol::NetworkSettings& network_settings);
+ const NetworkSettings& network_settings);
// Asynchronously start the host process.
//
@@ -176,7 +219,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
// Parameters specified when the host was created.
ChromotingHostContext* context_;
DesktopEnvironment* desktop_environment_;
- protocol::NetworkSettings network_settings_;
+ NetworkSettings network_settings_;
// Connection objects.
SignalStrategy* signal_strategy_;
« no previous file with comments | « no previous file | remoting/host/chromoting_host.cc » ('j') | remoting/host/chromoting_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698