• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef REMOTING_JINGLE_GLUE_NETWORK_SETTINGS_H_
6 #define REMOTING_JINGLE_GLUE_NETWORK_SETTINGS_H_
7 
8 namespace remoting {
9 
10 struct NetworkSettings {
11 
12   // When hosts are configured with NAT traversal disabled they will
13   // typically also limit their P2P ports to this range, so that
14   // sessions may be blocked or un-blocked via firewall rules.
15   static const int kDefaultMinPort = 12400;
16   static const int kDefaultMaxPort = 12409;
17 
18   enum NatTraversalMode {
19     // Active NAT traversal using STUN and relay servers.
20     NAT_TRAVERSAL_ENABLED,
21 
22     // Don't use STUN or relay servers. Accept incoming P2P connection
23     // attempts, but don't initiate any. This ensures that the peer is
24     // on the same network. Note that connection will always fail if
25     // both ends use this mode.
26     NAT_TRAVERSAL_DISABLED,
27 
28     // Don't use STUN or relay servers but make outgoing connections.
29     NAT_TRAVERSAL_OUTGOING,
30   };
31 
NetworkSettingsNetworkSettings32   NetworkSettings()
33       : nat_traversal_mode(NAT_TRAVERSAL_DISABLED),
34         min_port(0),
35         max_port(0) {
36   }
37 
NetworkSettingsNetworkSettings38   explicit NetworkSettings(NatTraversalMode nat_traversal_mode)
39       : nat_traversal_mode(nat_traversal_mode),
40         min_port(0),
41         max_port(0) {
42   }
43 
44   NatTraversalMode nat_traversal_mode;
45 
46   // |min_port| and |max_port| specify range (inclusive) of ports used by
47   // P2P sessions. Any port can be used when both values are set to 0.
48   int min_port;
49   int max_port;
50 };
51 
52 }  // namespace remoting
53 
54 #endif  // REMOTING_HOST_NETWORK_SETTINGS_H_
55