| 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 hostname specified in |host_and_port| will be compared with the name(s) |
| 31 // certificate during the SSL handshake. ssl_config specifies the SSL | 32 // in the server's certificate during the SSL handshake. If SSL client |
| 32 // settings. | 33 // authentication is requested, the host_and_port field of SSLCertRequestInfo |
| 34 // will be populated with |host_and_port|. |ssl_config| specifies |
| 35 // the SSL settings. |
| 33 SSLClientSocketMac(ClientSocketHandle* transport_socket, | 36 SSLClientSocketMac(ClientSocketHandle* transport_socket, |
| 34 const std::string& hostname, | 37 const HostPortPair& host_and_port, |
| 35 const SSLConfig& ssl_config); | 38 const SSLConfig& ssl_config); |
| 36 ~SSLClientSocketMac(); | 39 ~SSLClientSocketMac(); |
| 37 | 40 |
| 38 // SSLClientSocket methods: | 41 // SSLClientSocket methods: |
| 39 virtual void GetSSLInfo(SSLInfo* ssl_info); | 42 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 40 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 43 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 41 virtual NextProtoStatus GetNextProto(std::string* proto); | 44 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 42 | 45 |
| 43 // ClientSocket methods: | 46 // ClientSocket methods: |
| 44 virtual int Connect(CompletionCallback* callback); | 47 virtual int Connect(CompletionCallback* callback); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 size_t* data_length); | 94 size_t* data_length); |
| 92 static OSStatus SSLWriteCallback(SSLConnectionRef connection, | 95 static OSStatus SSLWriteCallback(SSLConnectionRef connection, |
| 93 const void* data, | 96 const void* data, |
| 94 size_t* data_length); | 97 size_t* data_length); |
| 95 | 98 |
| 96 CompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; | 99 CompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; |
| 97 CompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; | 100 CompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; |
| 98 CompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; | 101 CompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; |
| 99 | 102 |
| 100 scoped_ptr<ClientSocketHandle> transport_; | 103 scoped_ptr<ClientSocketHandle> transport_; |
| 101 std::string hostname_; | 104 HostPortPair host_and_port_; |
| 102 SSLConfig ssl_config_; | 105 SSLConfig ssl_config_; |
| 103 | 106 |
| 104 CompletionCallback* user_connect_callback_; | 107 CompletionCallback* user_connect_callback_; |
| 105 CompletionCallback* user_read_callback_; | 108 CompletionCallback* user_read_callback_; |
| 106 CompletionCallback* user_write_callback_; | 109 CompletionCallback* user_write_callback_; |
| 107 | 110 |
| 108 // Used by Read function. | 111 // Used by Read function. |
| 109 scoped_refptr<IOBuffer> user_read_buf_; | 112 scoped_refptr<IOBuffer> user_read_buf_; |
| 110 int user_read_buf_len_; | 113 int user_read_buf_len_; |
| 111 | 114 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // These are the IOBuffers used for operations on the underlying transport. | 155 // These are the IOBuffers used for operations on the underlying transport. |
| 153 scoped_refptr<IOBuffer> read_io_buf_; | 156 scoped_refptr<IOBuffer> read_io_buf_; |
| 154 scoped_refptr<IOBuffer> write_io_buf_; | 157 scoped_refptr<IOBuffer> write_io_buf_; |
| 155 | 158 |
| 156 BoundNetLog net_log_; | 159 BoundNetLog net_log_; |
| 157 }; | 160 }; |
| 158 | 161 |
| 159 } // namespace net | 162 } // namespace net |
| 160 | 163 |
| 161 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ | 164 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| OLD | NEW |