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