OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #ifndef REMOTING_PROTOCOL_V1_CLIENT_CHANNEL_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_V1_CLIENT_CHANNEL_AUTHENTICATOR_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/threading/non_thread_safe.h" |
| 14 #include "net/base/completion_callback.h" |
| 15 #include "remoting/protocol/channel_authenticator.h" |
| 16 |
| 17 namespace net { |
| 18 class CertVerifier; |
| 19 class DrainableIOBuffer; |
| 20 class GrowableIOBuffer; |
| 21 class SSLClientSocket; |
| 22 } // namespace net |
| 23 |
| 24 namespace remoting { |
| 25 namespace protocol { |
| 26 |
| 27 class V1ClientChannelAuthenticator : public ChannelAuthenticator, |
| 28 public base::NonThreadSafe { |
| 29 public: |
| 30 V1ClientChannelAuthenticator(const std::string& host_cert, |
| 31 const std::string& shared_secret); |
| 32 virtual ~V1ClientChannelAuthenticator(); |
| 33 |
| 34 // ChannelAuthenticator implementation. |
| 35 virtual void SecureAndAuthenticate( |
| 36 net::StreamSocket* socket, const DoneCallback& done_callback) OVERRIDE; |
| 37 |
| 38 private: |
| 39 void OnConnected(int result); |
| 40 void WriteAuthenticationBytes(); |
| 41 void OnAuthBytesWritten(int result); |
| 42 bool HandleAuthBytesWritten(int result); |
| 43 |
| 44 std::string host_cert_; |
| 45 std::string shared_secret_; |
| 46 scoped_ptr<net::SSLClientSocket> socket_; |
| 47 DoneCallback done_callback_; |
| 48 |
| 49 scoped_ptr<net::CertVerifier> cert_verifier_; |
| 50 scoped_refptr<net::DrainableIOBuffer> auth_write_buf_; |
| 51 |
| 52 net::OldCompletionCallbackImpl<V1ClientChannelAuthenticator> |
| 53 connect_callback_; |
| 54 net::OldCompletionCallbackImpl<V1ClientChannelAuthenticator> |
| 55 auth_write_callback_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(V1ClientChannelAuthenticator); |
| 58 }; |
| 59 |
| 60 } // namespace protocol |
| 61 } // namespace remoting |
| 62 |
| 63 #endif // REMOTING_PROTOCOL_V1_CLIENT_CHANNEL_AUTHENTICATOR_H_ |
OLD | NEW |