Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_PROTOCOL_NETWORK_SETTINGS_H_ | 5 #ifndef REMOTING_PROTOCOL_NETWORK_SETTINGS_H_ |
| 6 #define REMOTING_PROTOCOL_NETWORK_SETTINGS_H_ | 6 #define REMOTING_PROTOCOL_NETWORK_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 DCHECK(!(flags & (NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY)) || | 49 DCHECK(!(flags & (NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY)) || |
| 50 (flags & NAT_TRAVERSAL_OUTGOING)); | 50 (flags & NAT_TRAVERSAL_OUTGOING)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 explicit NetworkSettings(uint32 flags) | 53 explicit NetworkSettings(uint32 flags) |
| 54 : flags(flags), | 54 : flags(flags), |
| 55 min_port(0), | 55 min_port(0), |
| 56 max_port(0) { | 56 max_port(0) { |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Parse string in the form "<min_port>-<max_port>". E.g. "12400-12409". | |
| 60 // Returns true if string was parsed successfuly. | |
| 61 static bool ParsePortRange(const std::string& port_range, | |
| 62 uint16* out_min_port, | |
| 63 uint16* out_max_port); | |
| 64 | |
| 65 uint32 flags; | 59 uint32 flags; |
| 66 | 60 |
| 67 // |min_port| and |max_port| specify range (inclusive) of ports used by | 61 // |min_port| and |max_port| specify range (inclusive) of ports used by |
| 68 // P2P sessions. Any port can be used when both values are set to 0. | 62 // P2P sessions. Any port can be used when both values are set to 0. |
| 69 uint16 min_port; | 63 uint16 min_port; |
|
Sergey Ulanov
2015/02/27 03:05:20
replace these with a PortRange?
Łukasz Anforowicz
2015/02/27 18:36:12
Done.
| |
| 70 uint16 max_port; | 64 uint16 max_port; |
| 71 }; | 65 }; |
| 72 | 66 |
| 73 } // namespace protocol | 67 } // namespace protocol |
| 74 } // namespace remoting | 68 } // namespace remoting |
| 75 | 69 |
| 76 #endif // REMOTING_HOST_NETWORK_SETTINGS_H_ | 70 #endif // REMOTING_HOST_NETWORK_SETTINGS_H_ |
| OLD | NEW |