OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_ |
6 #define REMOTING_HOST_CHROMOTING_HOST_H_ | 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "net/base/backoff_entry.h" | 14 #include "net/base/backoff_entry.h" |
15 #include "remoting/base/encoder.h" | 15 #include "remoting/base/encoder.h" |
16 #include "remoting/host/capturer.h" | 16 #include "remoting/host/capturer.h" |
17 #include "remoting/host/client_session.h" | 17 #include "remoting/host/client_session.h" |
18 #include "remoting/host/desktop_environment.h" | 18 #include "remoting/host/desktop_environment.h" |
19 #include "remoting/host/host_key_pair.h" | 19 #include "remoting/host/host_key_pair.h" |
20 #include "remoting/host/host_status_observer.h" | 20 #include "remoting/host/host_status_observer.h" |
| 21 #include "remoting/host/network_settings.h" |
21 #include "remoting/host/ui_strings.h" | 22 #include "remoting/host/ui_strings.h" |
22 #include "remoting/jingle_glue/jingle_thread.h" | 23 #include "remoting/jingle_glue/jingle_thread.h" |
23 #include "remoting/jingle_glue/signal_strategy.h" | 24 #include "remoting/jingle_glue/signal_strategy.h" |
24 #include "remoting/protocol/authenticator.h" | 25 #include "remoting/protocol/authenticator.h" |
25 #include "remoting/protocol/session_manager.h" | 26 #include "remoting/protocol/session_manager.h" |
26 #include "remoting/protocol/connection_to_client.h" | 27 #include "remoting/protocol/connection_to_client.h" |
27 | 28 |
28 namespace remoting { | 29 namespace remoting { |
29 | 30 |
30 namespace protocol { | 31 namespace protocol { |
31 class InputStub; | 32 class InputStub; |
32 class SessionConfig; | 33 class SessionConfig; |
33 class CandidateSessionConfig; | 34 class CandidateSessionConfig; |
34 } // namespace protocol | 35 } // namespace protocol |
35 | 36 |
36 class Capturer; | 37 class Capturer; |
37 class ChromotingHostContext; | 38 class ChromotingHostContext; |
38 class DesktopEnvironment; | 39 class DesktopEnvironment; |
39 class Encoder; | 40 class Encoder; |
40 class ScreenRecorder; | 41 class ScreenRecorder; |
41 | 42 |
42 struct NetworkSettings { | |
43 enum NatTraversalMode { | |
44 // Don't use STUN or relay servers. Accept incoming P2P connection | |
45 // attempts, but don't initiate any. This ensures that the peer is | |
46 // on the same network. Note that connection will always fail if | |
47 // both ends use this mode. | |
48 NAT_TRAVERSAL_DISABLED, | |
49 | |
50 // Don't use STUN or relay servers but make outgoing connections. | |
51 NAT_TRAVERSAL_OUTGOING, | |
52 | |
53 // Active NAT traversal using STUN and relay servers. | |
54 NAT_TRAVERSAL_ENABLED, | |
55 }; | |
56 | |
57 NetworkSettings() | |
58 : nat_traversal_mode(NAT_TRAVERSAL_DISABLED), | |
59 min_port(0), | |
60 max_port(0) { | |
61 } | |
62 | |
63 explicit NetworkSettings(bool allow_nat_traversal) | |
64 : nat_traversal_mode(allow_nat_traversal ? | |
65 NAT_TRAVERSAL_ENABLED : | |
66 NAT_TRAVERSAL_DISABLED), | |
67 min_port(0), | |
68 max_port(0) { | |
69 } | |
70 | |
71 explicit NetworkSettings(NatTraversalMode nat_traversal_mode) | |
72 : nat_traversal_mode(nat_traversal_mode), | |
73 min_port(0), | |
74 max_port(0) { | |
75 } | |
76 | |
77 NatTraversalMode nat_traversal_mode; | |
78 | |
79 // |min_port| and |max_port| specify range (inclusive) of ports used by | |
80 // P2P sessions. Any port can be used when both values are set to 0. | |
81 int min_port; | |
82 int max_port; | |
83 }; | |
84 | |
85 // A class to implement the functionality of a host process. | 43 // A class to implement the functionality of a host process. |
86 // | 44 // |
87 // Here's the work flow of this class: | 45 // Here's the work flow of this class: |
88 // 1. We should load the saved GAIA ID token or if this is the first | 46 // 1. We should load the saved GAIA ID token or if this is the first |
89 // time the host process runs we should prompt user for the | 47 // time the host process runs we should prompt user for the |
90 // credential. We will use this token or credentials to authenicate | 48 // credential. We will use this token or credentials to authenicate |
91 // and register the host. | 49 // and register the host. |
92 // | 50 // |
93 // 2. We listen for incoming connection using libjingle. We will create | 51 // 2. We listen for incoming connection using libjingle. We will create |
94 // a ConnectionToClient object that wraps around linjingle for transport. | 52 // a ConnectionToClient object that wraps around linjingle for transport. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // TODO(sergeyu): The following members do not belong to | 219 // TODO(sergeyu): The following members do not belong to |
262 // ChromotingHost and should be moved elsewhere. | 220 // ChromotingHost and should be moved elsewhere. |
263 UiStrings ui_strings_; | 221 UiStrings ui_strings_; |
264 | 222 |
265 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 223 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
266 }; | 224 }; |
267 | 225 |
268 } // namespace remoting | 226 } // namespace remoting |
269 | 227 |
270 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 228 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |