| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_MAC_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| 7 | 7 |
| 8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "net/base/cert_verify_result.h" | 14 #include "net/base/cert_verify_result.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/ssl_config_service.h" | 16 #include "net/base/ssl_config_service.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 17 #include "net/socket/ssl_client_socket.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 class CertVerifier; | 21 class CertVerifier; |
| 22 class LoadLog; |
| 22 | 23 |
| 23 // An SSL client socket implemented with Secure Transport. | 24 // An SSL client socket implemented with Secure Transport. |
| 24 class SSLClientSocketMac : public SSLClientSocket { | 25 class SSLClientSocketMac : public SSLClientSocket { |
| 25 public: | 26 public: |
| 26 // Takes ownership of the transport_socket, which may already be connected. | 27 // Takes ownership of the transport_socket, which may already be connected. |
| 27 // The given hostname will be compared with the name(s) in the server's | 28 // The given hostname will be compared with the name(s) in the server's |
| 28 // certificate during the SSL handshake. ssl_config specifies the SSL | 29 // certificate during the SSL handshake. ssl_config specifies the SSL |
| 29 // settings. | 30 // settings. |
| 30 SSLClientSocketMac(ClientSocket* transport_socket, | 31 SSLClientSocketMac(ClientSocket* transport_socket, |
| 31 const std::string& hostname, | 32 const std::string& hostname, |
| 32 const SSLConfig& ssl_config); | 33 const SSLConfig& ssl_config); |
| 33 ~SSLClientSocketMac(); | 34 ~SSLClientSocketMac(); |
| 34 | 35 |
| 35 // SSLClientSocket methods: | 36 // SSLClientSocket methods: |
| 36 virtual void GetSSLInfo(SSLInfo* ssl_info); | 37 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 37 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 38 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 38 | 39 |
| 39 // ClientSocket methods: | 40 // ClientSocket methods: |
| 40 virtual int Connect(CompletionCallback* callback); | 41 virtual int Connect(CompletionCallback* callback, LoadLog* load_log); |
| 41 virtual void Disconnect(); | 42 virtual void Disconnect(); |
| 42 virtual bool IsConnected() const; | 43 virtual bool IsConnected() const; |
| 43 virtual bool IsConnectedAndIdle() const; | 44 virtual bool IsConnectedAndIdle() const; |
| 44 | 45 |
| 45 // Socket methods: | 46 // Socket methods: |
| 46 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 47 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 47 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 48 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 48 virtual bool SetReceiveBufferSize(int32 size); | 49 virtual bool SetReceiveBufferSize(int32 size); |
| 49 virtual bool SetSendBufferSize(int32 size); | 50 virtual bool SetSendBufferSize(int32 size); |
| 50 | 51 |
| 51 private: | 52 private: |
| 53 // Initializes the SSLContext. Returns a net error code. |
| 54 int InitializeSSLContext(); |
| 55 |
| 52 void DoConnectCallback(int result); | 56 void DoConnectCallback(int result); |
| 53 void DoReadCallback(int result); | 57 void DoReadCallback(int result); |
| 54 void DoWriteCallback(int result); | 58 void DoWriteCallback(int result); |
| 55 void OnHandshakeIOComplete(int result); | 59 void OnHandshakeIOComplete(int result); |
| 56 void OnTransportReadComplete(int result); | 60 void OnTransportReadComplete(int result); |
| 57 void OnTransportWriteComplete(int result); | 61 void OnTransportWriteComplete(int result); |
| 58 | 62 |
| 59 int DoHandshakeLoop(int last_io_result); | 63 int DoHandshakeLoop(int last_io_result); |
| 60 | 64 |
| 61 int DoPayloadRead(); | 65 int DoPayloadRead(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // but don't (yet). | 119 // but don't (yet). |
| 116 std::vector<char> send_buffer_; | 120 std::vector<char> send_buffer_; |
| 117 int pending_send_error_; | 121 int pending_send_error_; |
| 118 std::vector<char> recv_buffer_; | 122 std::vector<char> recv_buffer_; |
| 119 int recv_buffer_head_slop_; | 123 int recv_buffer_head_slop_; |
| 120 int recv_buffer_tail_slop_; | 124 int recv_buffer_tail_slop_; |
| 121 | 125 |
| 122 // This buffer holds data for Read() operations on the underlying transport | 126 // This buffer holds data for Read() operations on the underlying transport |
| 123 // (ClientSocket::Read()). | 127 // (ClientSocket::Read()). |
| 124 scoped_refptr<IOBuffer> read_io_buf_; | 128 scoped_refptr<IOBuffer> read_io_buf_; |
| 129 |
| 130 scoped_refptr<LoadLog> load_log_; |
| 125 }; | 131 }; |
| 126 | 132 |
| 127 } // namespace net | 133 } // namespace net |
| 128 | 134 |
| 129 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ | 135 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| OLD | NEW |