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