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

Side by Side Diff: remoting/protocol/network_settings.h

Issue 966433002: Malformed PortRange or ThirdPartyAuthConfig trigger OnPolicyError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a Windows-specific, pre-processor-related build break. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "remoting/protocol/port_range.h"
12 13
13 namespace remoting { 14 namespace remoting {
14 namespace protocol { 15 namespace protocol {
15 16
16 struct NetworkSettings { 17 struct NetworkSettings {
17 18
18 // When hosts are configured with NAT traversal disabled they will 19 // When hosts are configured with NAT traversal disabled they will
19 // typically also limit their P2P ports to this range, so that 20 // typically also limit their P2P ports to this range, so that
20 // sessions may be blocked or un-blocked via firewall rules. 21 // sessions may be blocked or un-blocked via firewall rules.
21 static const uint16 kDefaultMinPort = 12400; 22 static const uint16 kDefaultMinPort = 12400;
(...skipping 13 matching lines...) Expand all
35 NAT_TRAVERSAL_STUN = 0x2, 36 NAT_TRAVERSAL_STUN = 0x2,
36 37
37 // Allow the use of relay servers when a direct connection is not available. 38 // Allow the use of relay servers when a direct connection is not available.
38 NAT_TRAVERSAL_RELAY = 0x4, 39 NAT_TRAVERSAL_RELAY = 0x4,
39 40
40 // Active NAT traversal using STUN and relay servers. 41 // Active NAT traversal using STUN and relay servers.
41 NAT_TRAVERSAL_FULL = NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY | 42 NAT_TRAVERSAL_FULL = NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY |
42 NAT_TRAVERSAL_OUTGOING 43 NAT_TRAVERSAL_OUTGOING
43 }; 44 };
44 45
45 NetworkSettings() 46 NetworkSettings() : flags(NAT_TRAVERSAL_DISABLED) {
46 : flags(NAT_TRAVERSAL_DISABLED),
47 min_port(0),
48 max_port(0) {
49 DCHECK(!(flags & (NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY)) || 47 DCHECK(!(flags & (NAT_TRAVERSAL_STUN | NAT_TRAVERSAL_RELAY)) ||
50 (flags & NAT_TRAVERSAL_OUTGOING)); 48 (flags & NAT_TRAVERSAL_OUTGOING));
51 } 49 }
52 50
53 explicit NetworkSettings(uint32 flags) 51 explicit NetworkSettings(uint32 flags) : flags(flags) {}
54 : flags(flags),
55 min_port(0),
56 max_port(0) {
57 }
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 52
65 uint32 flags; 53 uint32 flags;
66 54
67 // |min_port| and |max_port| specify range (inclusive) of ports used by 55 // Range of ports used by P2P sessions.
68 // P2P sessions. Any port can be used when both values are set to 0. 56 PortRange port_range;
69 uint16 min_port;
70 uint16 max_port;
71 }; 57 };
72 58
73 } // namespace protocol 59 } // namespace protocol
74 } // namespace remoting 60 } // namespace remoting
75 61
76 #endif // REMOTING_HOST_NETWORK_SETTINGS_H_ 62 #endif // REMOTING_HOST_NETWORK_SETTINGS_H_
OLDNEW
« no previous file with comments | « remoting/protocol/me2me_host_authenticator_factory.cc ('k') | remoting/protocol/network_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698