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

Side by Side Diff: remoting/host/it2me/it2me_host.h

Issue 2901033002: Host port range policy is no longer ignored in it2me host (Closed)
Patch Set: Host port range policy is no longer ignored in it2me host Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 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 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_HOST_IT2ME_IT2ME_HOST_H_ 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_HOST_H_
6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "remoting/host/host_status_observer.h" 16 #include "remoting/host/host_status_observer.h"
16 #include "remoting/host/it2me/it2me_confirmation_dialog.h" 17 #include "remoting/host/it2me/it2me_confirmation_dialog.h"
17 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" 18 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h"
19 #include "remoting/protocol/port_range.h"
18 #include "remoting/protocol/validating_authenticator.h" 20 #include "remoting/protocol/validating_authenticator.h"
19 #include "remoting/signaling/xmpp_signal_strategy.h" 21 #include "remoting/signaling/xmpp_signal_strategy.h"
20 22
21 namespace base { 23 namespace base {
22 class DictionaryValue; 24 class DictionaryValue;
23 } 25 }
24 26
25 namespace remoting { 27 namespace remoting {
26 28
27 class ChromotingHost; 29 class ChromotingHost;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 100
99 protected: 101 protected:
100 friend class base::RefCountedThreadSafe<It2MeHost>; 102 friend class base::RefCountedThreadSafe<It2MeHost>;
101 103
102 ~It2MeHost() override; 104 ~It2MeHost() override;
103 105
104 ChromotingHostContext* host_context() { return host_context_.get(); } 106 ChromotingHostContext* host_context() { return host_context_.get(); }
105 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } 107 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; }
106 108
107 private: 109 private:
110 FRIEND_TEST_ALL_PREFIXES(
111 It2MeHostTest,
112 ConnectionValidation_HostUdpPortRangePolicy_ValidRange);
113 FRIEND_TEST_ALL_PREFIXES(
114 It2MeHostTest,
115 ConnectionValidation_HostUdpPortRangePolicy_InvalidRange);
116 FRIEND_TEST_ALL_PREFIXES(It2MeHostTest,
117 ConnectionValidation_HostUdpPortRangePolicy_NoRange);
118
108 // Updates state of the host. Can be called only on the network thread. 119 // Updates state of the host. Can be called only on the network thread.
109 void SetState(It2MeHostState state, const std::string& error_message); 120 void SetState(It2MeHostState state, const std::string& error_message);
110 121
111 // Returns true if the host is in a post-starting, non-error state. 122 // Returns true if the host is in a post-starting, non-error state.
112 bool IsRunning() const; 123 bool IsRunning() const;
113 124
114 // Processes the result of the confirmation dialog. 125 // Processes the result of the confirmation dialog.
115 void OnConfirmationResult( 126 void OnConfirmationResult(
116 const protocol::ValidatingAuthenticator::ResultCallback& result_callback, 127 const protocol::ValidatingAuthenticator::ResultCallback& result_callback,
117 It2MeConfirmationDialog::Result result); 128 It2MeConfirmationDialog::Result result);
118 129
119 // Called by Connect() to check for policies and start connection process. 130 // Called by Connect() to check for policies and start connection process.
120 void ReadPolicyAndConnect(); 131 void ReadPolicyAndConnect();
121 132
122 // Called by ReadPolicyAndConnect once policies have been read. 133 // Called by ReadPolicyAndConnect once policies have been read.
123 void FinishConnect(); 134 void FinishConnect();
124 135
125 // Called when the support host registration completes. 136 // Called when the support host registration completes.
126 void OnReceivedSupportID(const std::string& support_id, 137 void OnReceivedSupportID(const std::string& support_id,
127 const base::TimeDelta& lifetime, 138 const base::TimeDelta& lifetime,
128 const std::string& error_message); 139 const std::string& error_message);
129 140
130 // Handlers for NAT traversal and domain policies. 141 // Handlers for NAT traversal and domain policies.
131 void UpdateNatPolicy(bool nat_traversal_enabled); 142 void UpdateNatPolicy(bool nat_traversal_enabled);
132 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list); 143 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list);
133 void UpdateClientDomainListPolicy( 144 void UpdateClientDomainListPolicy(
134 std::vector<std::string> client_domain_list); 145 std::vector<std::string> client_domain_list);
146 void UpdateHostUdpPortRangePolicy(std::string port_range_string);
Sergey Ulanov 2017/05/25 19:34:53 use const reference to pass strings (const std::st
Gus Smith 2017/05/25 21:39:09 Done.
135 147
136 void DisconnectOnNetworkThread(); 148 void DisconnectOnNetworkThread();
137 149
138 // Uses details of the connection and current policies to determine if the 150 // Uses details of the connection and current policies to determine if the
139 // connection should be accepted or rejected. 151 // connection should be accepted or rejected.
140 void ValidateConnectionDetails( 152 void ValidateConnectionDetails(
141 const std::string& remote_jid, 153 const std::string& remote_jid,
142 const protocol::ValidatingAuthenticator::ResultCallback& result_callback); 154 const protocol::ValidatingAuthenticator::ResultCallback& result_callback);
143 155
144 // Caller supplied fields. 156 // Caller supplied fields.
(...skipping 17 matching lines...) Expand all
162 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; 174 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_;
163 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; 175 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_;
164 176
165 // Host the current nat traversal policy setting. 177 // Host the current nat traversal policy setting.
166 bool nat_traversal_enabled_ = false; 178 bool nat_traversal_enabled_ = false;
167 179
168 // The client and host domain policy setting. 180 // The client and host domain policy setting.
169 std::vector<std::string> required_client_domain_list_; 181 std::vector<std::string> required_client_domain_list_;
170 std::vector<std::string> required_host_domain_list_; 182 std::vector<std::string> required_host_domain_list_;
171 183
184 // The host port range policy setting.
185 std::string udp_port_range_string_;
Sergey Ulanov 2017/05/25 19:34:53 It's better to store parsed PortRange value.
Gus Smith 2017/05/25 21:39:09 Done.
186
172 // Tracks the JID of the remote user when in a connecting state. 187 // Tracks the JID of the remote user when in a connecting state.
173 std::string connecting_jid_; 188 std::string connecting_jid_;
174 189
175 // Indicates whether or not a policy has ever been read. This is to ensure 190 // Indicates whether or not a policy has ever been read. This is to ensure
176 // that on startup, we do not accidentally start a connection before we have 191 // that on startup, we do not accidentally start a connection before we have
177 // queried our policy restrictions. 192 // queried our policy restrictions.
178 bool policy_received_ = false; 193 bool policy_received_ = false;
179 194
180 // On startup, it is possible to have Connect() called before the policy read 195 // On startup, it is possible to have Connect() called before the policy read
181 // is completed. Rather than just failing, we thunk the connection call so 196 // is completed. Rather than just failing, we thunk the connection call so
(...skipping 18 matching lines...) Expand all
200 const std::string& username, 215 const std::string& username,
201 const std::string& directory_bot_jid); 216 const std::string& directory_bot_jid);
202 217
203 private: 218 private:
204 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); 219 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
205 }; 220 };
206 221
207 } // namespace remoting 222 } // namespace remoting
208 223
209 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 224 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698