| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_IMPL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_IMPL_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_IMPL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void DumpMemoryStats(SocketMemoryStats* stats) const override; | 120 void DumpMemoryStats(SocketMemoryStats* stats) const override; |
| 121 | 121 |
| 122 // Dumps memory allocation stats. |pmd| is the browser process memory dump. | 122 // Dumps memory allocation stats. |pmd| is the browser process memory dump. |
| 123 static void DumpSSLClientSessionMemoryStats( | 123 static void DumpSSLClientSessionMemoryStats( |
| 124 base::trace_event::ProcessMemoryDump* pmd); | 124 base::trace_event::ProcessMemoryDump* pmd); |
| 125 | 125 |
| 126 // Socket implementation. | 126 // Socket implementation. |
| 127 int Read(IOBuffer* buf, | 127 int Read(IOBuffer* buf, |
| 128 int buf_len, | 128 int buf_len, |
| 129 const CompletionCallback& callback) override; | 129 const CompletionCallback& callback) override; |
| 130 int ReadIfReady(IOBuffer* buf, |
| 131 int buf_len, |
| 132 const CompletionCallback& callback) override; |
| 130 int Write(IOBuffer* buf, | 133 int Write(IOBuffer* buf, |
| 131 int buf_len, | 134 int buf_len, |
| 132 const CompletionCallback& callback) override; | 135 const CompletionCallback& callback) override; |
| 133 int SetReceiveBufferSize(int32_t size) override; | 136 int SetReceiveBufferSize(int32_t size) override; |
| 134 int SetSendBufferSize(int32_t size) override; | 137 int SetSendBufferSize(int32_t size) override; |
| 135 | 138 |
| 136 // SocketBIOAdapter implementation: | 139 // SocketBIOAdapter implementation: |
| 137 void OnReadReady() override; | 140 void OnReadReady(int rv) override; |
| 138 void OnWriteReady() override; | 141 void OnWriteReady(int rv) override; |
| 139 | 142 |
| 140 private: | 143 private: |
| 141 class PeerCertificateChain; | 144 class PeerCertificateChain; |
| 142 class SSLContext; | 145 class SSLContext; |
| 143 friend class SSLClientSocket; | 146 friend class SSLClientSocket; |
| 144 friend class SSLContext; | 147 friend class SSLContext; |
| 145 | 148 |
| 146 int Init(); | 149 int Init(); |
| 147 void DoReadCallback(int result); | 150 void DoReadCallback(int result); |
| 148 void DoWriteCallback(int result); | 151 void DoWriteCallback(int result); |
| 149 | 152 |
| 150 int DoHandshake(); | 153 int DoHandshake(); |
| 151 int DoHandshakeComplete(int result); | 154 int DoHandshakeComplete(int result); |
| 152 int DoChannelIDLookup(); | 155 int DoChannelIDLookup(); |
| 153 int DoChannelIDLookupComplete(int result); | 156 int DoChannelIDLookupComplete(int result); |
| 154 int DoVerifyCert(int result); | 157 int DoVerifyCert(int result); |
| 155 int DoVerifyCertComplete(int result); | 158 int DoVerifyCertComplete(int result); |
| 156 void DoConnectCallback(int result); | 159 void DoConnectCallback(int result); |
| 157 void UpdateServerCert(); | 160 void UpdateServerCert(); |
| 158 | 161 |
| 159 void OnHandshakeIOComplete(int result); | 162 void OnHandshakeIOComplete(int result); |
| 160 | 163 |
| 161 int DoHandshakeLoop(int last_io_result); | 164 int DoHandshakeLoop(int last_io_result); |
| 162 int DoPayloadRead(); | 165 int DoPayloadRead(IOBuffer* buf, int buf_len); |
| 163 int DoPayloadWrite(); | 166 int DoPayloadWrite(); |
| 164 | 167 |
| 165 // Called when an asynchronous event completes which may have blocked the | 168 // Called when an asynchronous event completes which may have blocked the |
| 166 // pending Connect, Read or Write calls, if any. Retries all state machines | 169 // pending Connect, Read or Write calls, if any. Retries all state machines |
| 167 // and, if complete, runs the respective callbacks. | 170 // and, if complete, runs the respective callbacks. |rv| is the net error |
| 168 void RetryAllOperations(); | 171 // of the last asynchronous event. |
| 172 void RetryAllOperations(int rv); |
| 169 | 173 |
| 170 int VerifyCT(); | 174 int VerifyCT(); |
| 171 | 175 |
| 172 // Callback from the SSL layer that indicates the remote server is requesting | 176 // Callback from the SSL layer that indicates the remote server is requesting |
| 173 // a certificate for this client. | 177 // a certificate for this client. |
| 174 int ClientCertRequestCallback(SSL* ssl); | 178 int ClientCertRequestCallback(SSL* ssl); |
| 175 | 179 |
| 176 // CertVerifyCallback is called to verify the server's certificates. We do | 180 // CertVerifyCallback is called to verify the server's certificates. We do |
| 177 // verification after the handshake so this function only enforces that the | 181 // verification after the handshake so this function only enforces that the |
| 178 // certificates don't change during renegotiation. | 182 // certificates don't change during renegotiation. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // True if PKP is bypassed due to a local trust anchor. | 356 // True if PKP is bypassed due to a local trust anchor. |
| 353 bool pkp_bypassed_; | 357 bool pkp_bypassed_; |
| 354 | 358 |
| 355 NetLogWithSource net_log_; | 359 NetLogWithSource net_log_; |
| 356 base::WeakPtrFactory<SSLClientSocketImpl> weak_factory_; | 360 base::WeakPtrFactory<SSLClientSocketImpl> weak_factory_; |
| 357 }; | 361 }; |
| 358 | 362 |
| 359 } // namespace net | 363 } // namespace net |
| 360 | 364 |
| 361 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_IMPL_H_ | 365 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_IMPL_H_ |
| OLD | NEW |