Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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_HOST_NETWORK_SETTINGS_H_ | |
| 6 #define REMOTING_HOST_NETWORK_SETTINGS_H_ | |
| 7 | |
| 8 namespace remoting { | |
| 9 | |
| 10 struct NetworkSettings { | |
| 11 enum NatTraversalMode { | |
| 12 // Don't use STUN or relay servers. Accept incoming P2P connection | |
| 13 // attempts, but don't initiate any. This ensures that the peer is | |
| 14 // on the same network. Note that connection will always fail if | |
| 15 // both ends use this mode. | |
| 16 NAT_TRAVERSAL_DISABLED, | |
| 17 | |
| 18 // Don't use STUN or relay servers but make outgoing connections. | |
| 19 NAT_TRAVERSAL_OUTGOING, | |
| 20 | |
| 21 // Active NAT traversal using STUN and relay servers. | |
| 22 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.
| |
| 23 }; | |
| 24 | |
| 25 NetworkSettings() | |
| 26 : nat_traversal_mode(NAT_TRAVERSAL_DISABLED), | |
| 27 min_port(0), | |
| 28 max_port(0) { | |
| 29 } | |
| 30 | |
| 31 explicit NetworkSettings(bool allow_nat_traversal) | |
| 32 : nat_traversal_mode(allow_nat_traversal ? | |
| 33 NAT_TRAVERSAL_ENABLED : | |
| 34 NAT_TRAVERSAL_DISABLED), | |
| 35 min_port(0), | |
| 36 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.
| |
| 37 } | |
| 38 | |
| 39 explicit NetworkSettings(NatTraversalMode nat_traversal_mode) | |
| 40 : nat_traversal_mode(nat_traversal_mode), | |
| 41 min_port(0), | |
| 42 max_port(0) { | |
| 43 } | |
| 44 | |
| 45 NatTraversalMode nat_traversal_mode; | |
| 46 | |
| 47 // |min_port| and |max_port| specify range (inclusive) of ports used by | |
| 48 // P2P sessions. Any port can be used when both values are set to 0. | |
| 49 int min_port; | |
| 50 int max_port; | |
| 51 }; | |
| 52 | |
| 53 } // namespace remoting | |
| 54 | |
| 55 #endif // REMOTING_HOST_NETWORK_SETTINGS_H_ | |
| OLD | NEW |