[email protected] | d7c6cc2 | 2012-02-05 05:19:27 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ | ||||
6 | #define REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | |||||
[email protected] | 34deb10 | 2011-12-22 13:06:04 | [diff] [blame] | 10 | #include "base/callback_forward.h" |
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 11 | |
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 12 | namespace remoting { |
13 | namespace protocol { | ||||
14 | |||||
sergeyu | aa22c08 | 2015-07-20 19:41:13 | [diff] [blame] | 15 | class P2PStreamSocket; |
16 | |||||
[email protected] | 8d1f875 | 2011-11-23 03:58:43 | [diff] [blame] | 17 | // Interface for channel authentications that perform channel-level |
18 | // authentication. Depending on implementation channel authenticators | ||||
19 | // may also establish SSL connection. Each instance of this interface | ||||
20 | // should be used only once for one channel. | ||||
21 | class ChannelAuthenticator { | ||||
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 22 | public: |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 23 | typedef base::Callback<void(int error, std::unique_ptr<P2PStreamSocket>)> |
[email protected] | 8d1f875 | 2011-11-23 03:58:43 | [diff] [blame] | 24 | DoneCallback; |
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 25 | |
[email protected] | 8d1f875 | 2011-11-23 03:58:43 | [diff] [blame] | 26 | virtual ~ChannelAuthenticator() {} |
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 27 | |
sergeyu | 9cb142f | 2014-09-12 20:43:01 | [diff] [blame] | 28 | // Start authentication of the given |socket|. |done_callback| is called when |
29 | // authentication is finished. Callback may be invoked before this method | ||||
30 | // returns, and may delete the calling authenticator. | ||||
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 31 | virtual void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket, |
32 | const DoneCallback& done_callback) = 0; | ||||
[email protected] | dd9ce7c7f | 2011-08-02 01:54:08 | [diff] [blame] | 33 | }; |
34 | |||||
35 | } // namespace protocol | ||||
36 | } // namespace remoting | ||||
37 | |||||
38 | #endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ |