| 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_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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual void GetSSLCertRequestInfo( | 45 virtual void GetSSLCertRequestInfo( |
| 46 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 46 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 47 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 47 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
| 48 const base::StringPiece& context, | 48 const base::StringPiece& context, |
| 49 unsigned char *out, | 49 unsigned char *out, |
| 50 unsigned int outlen) OVERRIDE; | 50 unsigned int outlen) OVERRIDE; |
| 51 virtual NextProtoStatus GetNextProto(std::string* proto, | 51 virtual NextProtoStatus GetNextProto(std::string* proto, |
| 52 std::string* server_protos) OVERRIDE; | 52 std::string* server_protos) OVERRIDE; |
| 53 | 53 |
| 54 // StreamSocket implementation. | 54 // StreamSocket implementation. |
| 55 virtual int Connect(OldCompletionCallback* callback) OVERRIDE; | |
| 56 virtual int Connect(const CompletionCallback& callback) OVERRIDE; | 55 virtual int Connect(const CompletionCallback& callback) OVERRIDE; |
| 57 virtual void Disconnect() OVERRIDE; | 56 virtual void Disconnect() OVERRIDE; |
| 58 virtual bool IsConnected() const OVERRIDE; | 57 virtual bool IsConnected() const OVERRIDE; |
| 59 virtual bool IsConnectedAndIdle() const OVERRIDE; | 58 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 60 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; | 59 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; |
| 61 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 60 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
| 62 virtual const BoundNetLog& NetLog() const OVERRIDE; | 61 virtual const BoundNetLog& NetLog() const OVERRIDE; |
| 63 virtual void SetSubresourceSpeculation() OVERRIDE; | 62 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 64 virtual void SetOmniboxSpeculation() OVERRIDE; | 63 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 65 virtual bool WasEverUsed() const OVERRIDE; | 64 virtual bool WasEverUsed() const OVERRIDE; |
| 66 virtual bool UsingTCPFastOpen() const OVERRIDE; | 65 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 67 virtual int64 NumBytesRead() const OVERRIDE; | 66 virtual int64 NumBytesRead() const OVERRIDE; |
| 68 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 67 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 69 | 68 |
| 70 // Socket implementation. | 69 // Socket implementation. |
| 71 virtual int Read(IOBuffer* buf, | 70 virtual int Read(IOBuffer* buf, |
| 72 int buf_len, | 71 int buf_len, |
| 73 OldCompletionCallback* callback) OVERRIDE; | |
| 74 virtual int Read(IOBuffer* buf, | |
| 75 int buf_len, | |
| 76 const CompletionCallback& callback) OVERRIDE; | 72 const CompletionCallback& callback) OVERRIDE; |
| 77 virtual int Write(IOBuffer* buf, | 73 virtual int Write(IOBuffer* buf, |
| 78 int buf_len, | 74 int buf_len, |
| 79 OldCompletionCallback* callback) OVERRIDE; | 75 const CompletionCallback& callback) OVERRIDE; |
| 80 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 76 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 81 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 77 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 82 | 78 |
| 83 private: | 79 private: |
| 84 bool completed_handshake() const { | 80 bool completed_handshake() const { |
| 85 return next_handshake_state_ == STATE_COMPLETED_HANDSHAKE; | 81 return next_handshake_state_ == STATE_COMPLETED_HANDSHAKE; |
| 86 } | 82 } |
| 87 // Initializes the SSLContext. Returns a net error code. | 83 // Initializes the SSLContext. Returns a net error code. |
| 88 int InitializeSSLContext(); | 84 int InitializeSSLContext(); |
| 89 | 85 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 108 | 104 |
| 109 int SetClientCert(); | 105 int SetClientCert(); |
| 110 | 106 |
| 111 static OSStatus SSLReadCallback(SSLConnectionRef connection, | 107 static OSStatus SSLReadCallback(SSLConnectionRef connection, |
| 112 void* data, | 108 void* data, |
| 113 size_t* data_length); | 109 size_t* data_length); |
| 114 static OSStatus SSLWriteCallback(SSLConnectionRef connection, | 110 static OSStatus SSLWriteCallback(SSLConnectionRef connection, |
| 115 const void* data, | 111 const void* data, |
| 116 size_t* data_length); | 112 size_t* data_length); |
| 117 | 113 |
| 118 OldCompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; | |
| 119 OldCompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; | |
| 120 | |
| 121 scoped_ptr<ClientSocketHandle> transport_; | 114 scoped_ptr<ClientSocketHandle> transport_; |
| 122 HostPortPair host_and_port_; | 115 HostPortPair host_and_port_; |
| 123 SSLConfig ssl_config_; | 116 SSLConfig ssl_config_; |
| 124 | 117 |
| 125 OldCompletionCallback* old_user_connect_callback_; | |
| 126 CompletionCallback user_connect_callback_; | 118 CompletionCallback user_connect_callback_; |
| 127 OldCompletionCallback* old_user_read_callback_; | |
| 128 CompletionCallback user_read_callback_; | 119 CompletionCallback user_read_callback_; |
| 129 OldCompletionCallback* user_write_callback_; | 120 CompletionCallback user_write_callback_; |
| 130 | 121 |
| 131 // Used by Read function. | 122 // Used by Read function. |
| 132 scoped_refptr<IOBuffer> user_read_buf_; | 123 scoped_refptr<IOBuffer> user_read_buf_; |
| 133 int user_read_buf_len_; | 124 int user_read_buf_len_; |
| 134 | 125 |
| 135 // Used by Write function. | 126 // Used by Write function. |
| 136 scoped_refptr<IOBuffer> user_write_buf_; | 127 scoped_refptr<IOBuffer> user_write_buf_; |
| 137 int user_write_buf_len_; | 128 int user_write_buf_len_; |
| 138 | 129 |
| 139 enum State { | 130 enum State { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // These are the IOBuffers used for operations on the underlying transport. | 171 // These are the IOBuffers used for operations on the underlying transport. |
| 181 scoped_refptr<IOBuffer> read_io_buf_; | 172 scoped_refptr<IOBuffer> read_io_buf_; |
| 182 scoped_refptr<IOBuffer> write_io_buf_; | 173 scoped_refptr<IOBuffer> write_io_buf_; |
| 183 | 174 |
| 184 BoundNetLog net_log_; | 175 BoundNetLog net_log_; |
| 185 }; | 176 }; |
| 186 | 177 |
| 187 } // namespace net | 178 } // namespace net |
| 188 | 179 |
| 189 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ | 180 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_MAC_H_ |
| OLD | NEW |