| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "net/base/cert_verify_result.h" | 15 #include "net/base/cert_verify_result.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/host_port_pair.h" |
| 17 #include "net/base/net_log.h" | 18 #include "net/base/net_log.h" |
| 18 #include "net/base/ssl_config_service.h" | 19 #include "net/base/ssl_config_service.h" |
| 19 #include "net/socket/ssl_client_socket.h" | 20 #include "net/socket/ssl_client_socket.h" |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 | 23 |
| 23 class CertVerifier; | 24 class CertVerifier; |
| 24 class ClientSocketHandle; | 25 class ClientSocketHandle; |
| 25 | 26 |
| 26 // An SSL client socket implemented with Secure Transport. | 27 // An SSL client socket implemented with Secure Transport. |
| 27 class SSLClientSocketMac : public SSLClientSocket { | 28 class SSLClientSocketMac : public SSLClientSocket { |
| 28 public: | 29 public: |
| 29 // Takes ownership of the |transport_socket|, which must already be connected. | 30 // Takes ownership of the |transport_socket|, which must already be connected. |
| 30 // The given hostname will be compared with the name(s) in the server's | 31 // The given hostname will be compared with the name(s) in the server's |
| 31 // certificate during the SSL handshake. ssl_config specifies the SSL | 32 // certificate during the SSL handshake. ssl_config specifies the SSL |
| 32 // settings. | 33 // settings. |
| 33 SSLClientSocketMac(ClientSocketHandle* transport_socket, | 34 SSLClientSocketMac(ClientSocketHandle* transport_socket, |
| 34 const std::string& hostname, | 35 const HostPortPair& host_port_pair, |
| 35 const SSLConfig& ssl_config); | 36 const SSLConfig& ssl_config); |
| 36 ~SSLClientSocketMac(); | 37 ~SSLClientSocketMac(); |
| 37 | 38 |
| 38 // SSLClientSocket methods: | 39 // SSLClientSocket methods: |
| 39 virtual void GetSSLInfo(SSLInfo* ssl_info); | 40 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 40 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 41 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 41 virtual NextProtoStatus GetNextProto(std::string* proto); | 42 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 42 | 43 |
| 43 // ClientSocket methods: | 44 // ClientSocket methods: |
| 44 virtual int Connect(CompletionCallback* callback); | 45 virtual int Connect(CompletionCallback* callback); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 size_t* data_length); | 85 size_t* data_length); |
| 85 static OSStatus SSLWriteCallback(SSLConnectionRef connection, | 86 static OSStatus SSLWriteCallback(SSLConnectionRef connection, |
| 86 const void* data, | 87 const void* data, |
| 87 size_t* data_length); | 88 size_t* data_length); |
| 88 | 89 |
| 89 CompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; | 90 CompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; |
| 90 CompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; | 91 CompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; |
| 91 CompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; | 92 CompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; |
| 92 | 93 |
| 93 scoped_ptr<ClientSocketHandle> transport_; | 94 scoped_ptr<ClientSocketHandle> transport_; |
| 94 std::string hostname_; | 95 HostPortPair host_port_pair_; |
| 95 SSLConfig ssl_config_; | 96 SSLConfig ssl_config_; |
| 96 | 97 |
| 97 CompletionCallback* user_connect_callback_; | 98 CompletionCallback* user_connect_callback_; |
| 98 CompletionCallback* user_read_callback_; | 99 CompletionCallback* user_read_callback_; |
| 99 CompletionCallback* user_write_callback_; | 100 CompletionCallback* user_write_callback_; |
| 100 | 101 |
| 101 // Used by Read function. | 102 // Used by Read function. |
| 102 scoped_refptr<IOBuffer> user_read_buf_; | 103 scoped_refptr<IOBuffer> user_read_buf_; |
| 103 int user_read_buf_len_; | 104 int user_read_buf_len_; |
| 104 | 105 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 133 // These are the IOBuffers used for operations on the underlying transport. | 134 // These are the IOBuffers used for operations on the underlying transport. |
| 134 scoped_refptr<IOBuffer> read_io_buf_; | 135 scoped_refptr<IOBuffer> read_io_buf_; |
| 135 scoped_refptr<IOBuffer> write_io_buf_; | 136 scoped_refptr<IOBuffer> write_io_buf_; |
| 136 | 137 |
| 137 BoundNetLog net_log_; | 138 BoundNetLog net_log_; |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 } // namespace net | 141 } // namespace net |
| 141 | 142 |
| 142 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ | 143 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| OLD | NEW |