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

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

Issue 4313001: Rename classes for Chromoting: (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Resolve merge conflicts Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/client_connection_unittest.cc ('k') | remoting/protocol/fake_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // The purprose of ChromotocolServer is to facilitate creation of chromotocol
6 // connections. Both host and client use it to establish chromotocol
7 // connections. JingleChromotocolServer implements this inteface using
8 // libjingle.
9 //
10 // OUTGOING CONNECTIONS
11 // Connect() must be used to create new connection to a remote host. The
12 // returned connection is initially in INITIALIZING state. Later state is
13 // changed to CONNECTED if the connection is accepted by the host or CLOSED
14 // if the connection is rejected.
15 //
16 // INCOMING CONNECTIONS
17 // The IncomingConnectionCallback is called when a client attempts to connect.
18 // The callback function decides whether the connection should be accepted or
19 // rejected.
20 //
21 // CONNECTION OWNERSHIP AND SHUTDOWN
22 // ChromotocolServer owns all ChromotocolConnections it creates. The server
23 // must not be closed while connections created by the server are still in use.
24 // When shutting down the Close() method for the connection and the server
25 // objects must be called in the following order: ChromotocolConnection,
26 // ChromotocolServer, JingleClient. The same order must be followed in the case
27 // of rejected and failed connections.
28 //
29 // PROTOCOL VERSION NEGOTIATION
30 // When client connects to a host it sends a session-initiate stanza with list
31 // of supported configurations for each channel. If the host decides to accept
32 // connection, then it selects configuration that is supported by both sides
33 // and then replies with the session-accept stanza that contans selected
34 // configuration. The configuration specified in the session-accept is used
35 // for the session.
36 //
37 // The CandidateChromotocolConfig class represents list of configurations
38 // supported by an endpoint. The |chromotocol_config| argument in the Connect()
39 // specifies configuration supported on the client side. When the host receives
40 // session-initiate stanza, the IncomingConnectionCallback is called. The
41 // configuration sent in the session-intiate staza is available via
42 // ChromotocolConnnection::candidate_config(). If an incoming connection is
43 // being accepted then the IncomingConnectionCallback callback function must
44 // select session configuration and then set it with
45 // ChromotocolConnection::set_config().
46
47 #ifndef REMOTING_PROTOCOL_CHROMOTOCOL_SERVER_H_
48 #define REMOTING_PROTOCOL_CHROMOTOCOL_SERVER_H_
49
50 #include <string>
51
52 #include "base/callback.h"
53 #include "base/ref_counted.h"
54 #include "remoting/protocol/chromotocol_connection.h"
55
56 class Task;
57
58 namespace remoting {
59
60 // Generic interface for Chromotocol server.
61 class ChromotocolServer : public base::RefCountedThreadSafe<ChromotocolServer> {
62 public:
63 enum IncomingConnectionResponse {
64 ACCEPT,
65 INCOMPATIBLE,
66 DECLINE,
67 };
68
69 // IncomingConnectionCallback is called when a new connection is received. If
70 // the callback decides to accept the connection it should set the second
71 // argument to ACCEPT. Otherwise it should set it to DECLINE, or
72 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has incompartible
73 // configuration, and cannot be accepted.
74 // If the callback accepts connection then it must also set configuration
75 // for the new connection using ChromotocolConnection::set_config().
76 typedef Callback2<ChromotocolConnection*, IncomingConnectionResponse*>::Type
77 IncomingConnectionCallback;
78
79 // Initializes connection to the host |jid|. Ownership of the
80 // |chromotocol_config| is passed to the new connection.
81 virtual scoped_refptr<ChromotocolConnection> Connect(
82 const std::string& jid,
83 CandidateChromotocolConfig* chromotocol_config,
84 ChromotocolConnection::StateChangeCallback* state_change_callback) = 0;
85
86 // Close server and all current connections. |close_task| is executed after
87 // the session client/ is actually closed. No callbacks are called after
88 // |closed_task| is executed.
89 virtual void Close(Task* closed_task) = 0;
90
91 protected:
92 friend class base::RefCountedThreadSafe<ChromotocolServer>;
93
94 ChromotocolServer() { }
95 virtual ~ChromotocolServer() { }
96
97 private:
98 DISALLOW_COPY_AND_ASSIGN(ChromotocolServer);
99 };
100
101 } // namespace remoting
102
103 #endif // REMOTING_PROTOCOL_CHROMOTOCOL_SERVER_H_
OLDNEW
« no previous file with comments | « remoting/host/client_connection_unittest.cc ('k') | remoting/protocol/fake_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698