| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <certt.h> | 9 #include <certt.h> |
| 10 #include <keyt.h> | 10 #include <keyt.h> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 virtual void GetSSLCertRequestInfo( | 64 virtual void GetSSLCertRequestInfo( |
| 65 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 65 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 66 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 66 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
| 67 const base::StringPiece& context, | 67 const base::StringPiece& context, |
| 68 unsigned char *out, | 68 unsigned char *out, |
| 69 unsigned int outlen) OVERRIDE; | 69 unsigned int outlen) OVERRIDE; |
| 70 virtual NextProtoStatus GetNextProto(std::string* proto, | 70 virtual NextProtoStatus GetNextProto(std::string* proto, |
| 71 std::string* server_protos) OVERRIDE; | 71 std::string* server_protos) OVERRIDE; |
| 72 | 72 |
| 73 // StreamSocket implementation. | 73 // StreamSocket implementation. |
| 74 virtual int Connect(OldCompletionCallback* callback) OVERRIDE; | |
| 75 virtual int Connect(const CompletionCallback& callback) OVERRIDE; | 74 virtual int Connect(const CompletionCallback& callback) OVERRIDE; |
| 76 virtual void Disconnect() OVERRIDE; | 75 virtual void Disconnect() OVERRIDE; |
| 77 virtual bool IsConnected() const OVERRIDE; | 76 virtual bool IsConnected() const OVERRIDE; |
| 78 virtual bool IsConnectedAndIdle() const OVERRIDE; | 77 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 79 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; | 78 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; |
| 80 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 79 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
| 81 virtual const BoundNetLog& NetLog() const OVERRIDE; | 80 virtual const BoundNetLog& NetLog() const OVERRIDE; |
| 82 virtual void SetSubresourceSpeculation() OVERRIDE; | 81 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 83 virtual void SetOmniboxSpeculation() OVERRIDE; | 82 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 84 virtual bool WasEverUsed() const OVERRIDE; | 83 virtual bool WasEverUsed() const OVERRIDE; |
| 85 virtual bool UsingTCPFastOpen() const OVERRIDE; | 84 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 86 virtual int64 NumBytesRead() const OVERRIDE; | 85 virtual int64 NumBytesRead() const OVERRIDE; |
| 87 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 86 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 88 | 87 |
| 89 // Socket implementation. | 88 // Socket implementation. |
| 90 virtual int Read(IOBuffer* buf, | 89 virtual int Read(IOBuffer* buf, |
| 91 int buf_len, | 90 int buf_len, |
| 92 OldCompletionCallback* callback) OVERRIDE; | |
| 93 virtual int Read(IOBuffer* buf, | |
| 94 int buf_len, | |
| 95 const CompletionCallback& callback) OVERRIDE; | 91 const CompletionCallback& callback) OVERRIDE; |
| 96 virtual int Write(IOBuffer* buf, | 92 virtual int Write(IOBuffer* buf, |
| 97 int buf_len, | 93 int buf_len, |
| 98 OldCompletionCallback* callback) OVERRIDE; | 94 const CompletionCallback& callback) OVERRIDE; |
| 99 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 95 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 100 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 96 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 101 | 97 |
| 102 private: | 98 private: |
| 103 enum State { | 99 enum State { |
| 104 STATE_NONE, | 100 STATE_NONE, |
| 105 STATE_LOAD_SSL_HOST_INFO, | 101 STATE_LOAD_SSL_HOST_INFO, |
| 106 STATE_HANDSHAKE, | 102 STATE_HANDSHAKE, |
| 107 STATE_GET_OB_CERT_COMPLETE, | 103 STATE_GET_OB_CERT_COMPLETE, |
| 108 STATE_VERIFY_DNSSEC, | 104 STATE_VERIFY_DNSSEC, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 const unsigned char* protos, | 201 const unsigned char* protos, |
| 206 unsigned int protos_len, | 202 unsigned int protos_len, |
| 207 unsigned char* proto_out, | 203 unsigned char* proto_out, |
| 208 unsigned int* proto_out_len); | 204 unsigned int* proto_out_len); |
| 209 | 205 |
| 210 // The following methods are for debugging bug 65948. Will remove this code | 206 // The following methods are for debugging bug 65948. Will remove this code |
| 211 // after fixing bug 65948. | 207 // after fixing bug 65948. |
| 212 void EnsureThreadIdAssigned() const; | 208 void EnsureThreadIdAssigned() const; |
| 213 bool CalledOnValidThread() const; | 209 bool CalledOnValidThread() const; |
| 214 | 210 |
| 215 OldCompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; | |
| 216 OldCompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; | |
| 217 bool transport_send_busy_; | 211 bool transport_send_busy_; |
| 218 bool transport_recv_busy_; | 212 bool transport_recv_busy_; |
| 219 // corked_ is true if we are currently suspending writes to the network. This | 213 // corked_ is true if we are currently suspending writes to the network. This |
| 220 // is named after the similar kernel flag, TCP_CORK. | 214 // is named after the similar kernel flag, TCP_CORK. |
| 221 bool corked_; | 215 bool corked_; |
| 222 // uncork_timer_ is used to limit the amount of time that we'll delay the | 216 // uncork_timer_ is used to limit the amount of time that we'll delay the |
| 223 // Finished message while waiting for a Write. | 217 // Finished message while waiting for a Write. |
| 224 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; | 218 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; |
| 225 scoped_refptr<IOBuffer> recv_buffer_; | 219 scoped_refptr<IOBuffer> recv_buffer_; |
| 226 | 220 |
| 227 CompletionCallback handshake_io_callback_; | |
| 228 scoped_ptr<ClientSocketHandle> transport_; | 221 scoped_ptr<ClientSocketHandle> transport_; |
| 229 HostPortPair host_and_port_; | 222 HostPortPair host_and_port_; |
| 230 SSLConfig ssl_config_; | 223 SSLConfig ssl_config_; |
| 231 | 224 |
| 232 OldCompletionCallback* old_user_connect_callback_; | |
| 233 CompletionCallback user_connect_callback_; | 225 CompletionCallback user_connect_callback_; |
| 234 OldCompletionCallback* old_user_read_callback_; | |
| 235 CompletionCallback user_read_callback_; | 226 CompletionCallback user_read_callback_; |
| 236 OldCompletionCallback* user_write_callback_; | 227 CompletionCallback user_write_callback_; |
| 237 | 228 |
| 238 // Used by Read function. | 229 // Used by Read function. |
| 239 scoped_refptr<IOBuffer> user_read_buf_; | 230 scoped_refptr<IOBuffer> user_read_buf_; |
| 240 int user_read_buf_len_; | 231 int user_read_buf_len_; |
| 241 | 232 |
| 242 // Used by Write function. | 233 // Used by Write function. |
| 243 scoped_refptr<IOBuffer> user_write_buf_; | 234 scoped_refptr<IOBuffer> user_write_buf_; |
| 244 int user_write_buf_len_; | 235 int user_write_buf_len_; |
| 245 | 236 |
| 246 // Set when handshake finishes. The server certificate is first received | 237 // Set when handshake finishes. The server certificate is first received |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Added the following code Debugging in release mode. | 310 // Added the following code Debugging in release mode. |
| 320 mutable base::Lock lock_; | 311 mutable base::Lock lock_; |
| 321 // This is mutable so that CalledOnValidThread can set it. | 312 // This is mutable so that CalledOnValidThread can set it. |
| 322 // It's guarded by |lock_|. | 313 // It's guarded by |lock_|. |
| 323 mutable base::PlatformThreadId valid_thread_id_; | 314 mutable base::PlatformThreadId valid_thread_id_; |
| 324 }; | 315 }; |
| 325 | 316 |
| 326 } // namespace net | 317 } // namespace net |
| 327 | 318 |
| 328 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 319 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| OLD | NEW |