Index: remoting/host/network_settings.h |
diff --git a/remoting/host/network_settings.h b/remoting/host/network_settings.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6bdbd2c0f7bc779fdf34d1770da24368ef201afa |
--- /dev/null |
+++ b/remoting/host/network_settings.h |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_HOST_NETWORK_SETTINGS_H_ |
+#define REMOTING_HOST_NETWORK_SETTINGS_H_ |
+ |
+namespace remoting { |
+ |
+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, |
Wez
2012/04/27 23:23:21
nit: Consider re-ordering these so that ENABLED ap
Sergey Ulanov
2012/04/28 00:05:27
Done.
|
+ }; |
+ |
+ 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) { |
Wez
2012/04/27 23:23:21
Can we do without this ugly ctor, please? :)
Sergey Ulanov
2012/04/28 00:05:27
Done.
|
+ } |
+ |
+ 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; |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_NETWORK_SETTINGS_H_ |