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

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

Issue 2912143002: Host port range policy is no longer ignored in it2me host. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/it2me/it2me_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(It2MeHostTest, HostUdpPortRangePolicy_ValidRange);
111 FRIEND_TEST_ALL_PREFIXES(It2MeHostTest, HostUdpPortRangePolicy_NoRange);
112
108 // Updates state of the host. Can be called only on the network thread. 113 // Updates state of the host. Can be called only on the network thread.
109 void SetState(It2MeHostState state, const std::string& error_message); 114 void SetState(It2MeHostState state, const std::string& error_message);
110 115
111 // Returns true if the host is in a post-starting, non-error state. 116 // Returns true if the host is in a post-starting, non-error state.
112 bool IsRunning() const; 117 bool IsRunning() const;
113 118
114 // Processes the result of the confirmation dialog. 119 // Processes the result of the confirmation dialog.
115 void OnConfirmationResult( 120 void OnConfirmationResult(
116 const protocol::ValidatingAuthenticator::ResultCallback& result_callback, 121 const protocol::ValidatingAuthenticator::ResultCallback& result_callback,
117 It2MeConfirmationDialog::Result result); 122 It2MeConfirmationDialog::Result result);
118 123
119 // Called by Connect() to check for policies and start connection process. 124 // Called by Connect() to check for policies and start connection process.
120 void ReadPolicyAndConnect(); 125 void ReadPolicyAndConnect();
121 126
122 // Called by ReadPolicyAndConnect once policies have been read. 127 // Called by ReadPolicyAndConnect once policies have been read.
123 void FinishConnect(); 128 void FinishConnect();
124 129
125 // Called when the support host registration completes. 130 // Called when the support host registration completes.
126 void OnReceivedSupportID(const std::string& support_id, 131 void OnReceivedSupportID(const std::string& support_id,
127 const base::TimeDelta& lifetime, 132 const base::TimeDelta& lifetime,
128 const std::string& error_message); 133 const std::string& error_message);
129 134
130 // Handlers for NAT traversal and domain policies. 135 // Handlers for NAT traversal and domain policies.
131 void UpdateNatPolicy(bool nat_traversal_enabled); 136 void UpdateNatPolicy(bool nat_traversal_enabled);
132 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list); 137 void UpdateHostDomainListPolicy(std::vector<std::string> host_domain_list);
133 void UpdateClientDomainListPolicy( 138 void UpdateClientDomainListPolicy(
134 std::vector<std::string> client_domain_list); 139 std::vector<std::string> client_domain_list);
140 void UpdateHostUdpPortRangePolicy(const std::string& port_range_string);
135 141
136 void DisconnectOnNetworkThread(); 142 void DisconnectOnNetworkThread();
137 143
138 // Uses details of the connection and current policies to determine if the 144 // Uses details of the connection and current policies to determine if the
139 // connection should be accepted or rejected. 145 // connection should be accepted or rejected.
140 void ValidateConnectionDetails( 146 void ValidateConnectionDetails(
141 const std::string& remote_jid, 147 const std::string& remote_jid,
142 const protocol::ValidatingAuthenticator::ResultCallback& result_callback); 148 const protocol::ValidatingAuthenticator::ResultCallback& result_callback);
143 149
144 // Caller supplied fields. 150 // Caller supplied fields.
(...skipping 17 matching lines...) Expand all
162 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; 168 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_;
163 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; 169 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_;
164 170
165 // Host the current nat traversal policy setting. 171 // Host the current nat traversal policy setting.
166 bool nat_traversal_enabled_ = false; 172 bool nat_traversal_enabled_ = false;
167 173
168 // The client and host domain policy setting. 174 // The client and host domain policy setting.
169 std::vector<std::string> required_client_domain_list_; 175 std::vector<std::string> required_client_domain_list_;
170 std::vector<std::string> required_host_domain_list_; 176 std::vector<std::string> required_host_domain_list_;
171 177
178 // The host port range policy setting.
179 PortRange udp_port_range_;
180
172 // Tracks the JID of the remote user when in a connecting state. 181 // Tracks the JID of the remote user when in a connecting state.
173 std::string connecting_jid_; 182 std::string connecting_jid_;
174 183
175 // Indicates whether or not a policy has ever been read. This is to ensure 184 // 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 185 // that on startup, we do not accidentally start a connection before we have
177 // queried our policy restrictions. 186 // queried our policy restrictions.
178 bool policy_received_ = false; 187 bool policy_received_ = false;
179 188
180 // On startup, it is possible to have Connect() called before the policy read 189 // 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 190 // is completed. Rather than just failing, we thunk the connection call so
(...skipping 18 matching lines...) Expand all
200 const std::string& username, 209 const std::string& username,
201 const std::string& directory_bot_jid); 210 const std::string& directory_bot_jid);
202 211
203 private: 212 private:
204 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); 213 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
205 }; 214 };
206 215
207 } // namespace remoting 216 } // namespace remoting
208 217
209 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 218 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/it2me/it2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698