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_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "net/base/net_errors.h" | |
12 | 11 |
13 namespace net { | 12 namespace net { |
14 class StreamSocket; | 13 class StreamSocket; |
15 } // namespace net | 14 } // namespace net |
16 | 15 |
17 namespace remoting { | 16 namespace remoting { |
18 namespace protocol { | 17 namespace protocol { |
19 | 18 |
20 // Interface for channel authentications that perform channel-level | 19 // Interface for channel authentications that perform channel-level |
21 // authentication. Depending on implementation channel authenticators | 20 // authentication. Depending on implementation channel authenticators |
22 // may also establish SSL connection. Each instance of this interface | 21 // may also establish SSL connection. Each instance of this interface |
23 // should be used only once for one channel. | 22 // should be used only once for one channel. |
24 class ChannelAuthenticator { | 23 class ChannelAuthenticator { |
25 public: | 24 public: |
26 typedef base::Callback<void(net::Error error, scoped_ptr<net::StreamSocket>)> | 25 typedef base::Callback<void(int error, scoped_ptr<net::StreamSocket>)> |
27 DoneCallback; | 26 DoneCallback; |
28 | 27 |
29 virtual ~ChannelAuthenticator() {} | 28 virtual ~ChannelAuthenticator() {} |
30 | 29 |
31 // Start authentication of the given |socket|. |done_callback| is | 30 // Start authentication of the given |socket|. |done_callback| is called when |
32 // called when authentication is finished. Callback may be invoked | 31 // authentication is finished. Callback may be invoked before this method |
33 // before this method returns. | 32 // returns, and may delete the calling authenticator. |
34 virtual void SecureAndAuthenticate( | 33 virtual void SecureAndAuthenticate( |
35 scoped_ptr<net::StreamSocket> socket, | 34 scoped_ptr<net::StreamSocket> socket, |
36 const DoneCallback& done_callback) = 0; | 35 const DoneCallback& done_callback) = 0; |
37 }; | 36 }; |
38 | 37 |
39 } // namespace protocol | 38 } // namespace protocol |
40 } // namespace remoting | 39 } // namespace remoting |
41 | 40 |
42 #endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ | 41 #endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_ |
OLD | NEW |