| 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 #include "net/socket/ssl_server_socket_impl.h" | 5 #include "net/socket/ssl_server_socket_impl.h" |
| 6 | 6 |
| 7 #include <openssl/err.h> | 7 #include <openssl/err.h> |
| 8 #include <openssl/ssl.h> | 8 #include <openssl/ssl.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int SetReceiveBufferSize(int32_t size) override; | 79 int SetReceiveBufferSize(int32_t size) override; |
| 80 int SetSendBufferSize(int32_t size) override; | 80 int SetSendBufferSize(int32_t size) override; |
| 81 | 81 |
| 82 // StreamSocket implementation. | 82 // StreamSocket implementation. |
| 83 int Connect(const CompletionCallback& callback) override; | 83 int Connect(const CompletionCallback& callback) override; |
| 84 void Disconnect() override; | 84 void Disconnect() override; |
| 85 bool IsConnected() const override; | 85 bool IsConnected() const override; |
| 86 bool IsConnectedAndIdle() const override; | 86 bool IsConnectedAndIdle() const override; |
| 87 int GetPeerAddress(IPEndPoint* address) const override; | 87 int GetPeerAddress(IPEndPoint* address) const override; |
| 88 int GetLocalAddress(IPEndPoint* address) const override; | 88 int GetLocalAddress(IPEndPoint* address) const override; |
| 89 const BoundNetLog& NetLog() const override; | 89 const NetLogWithSource& NetLog() const override; |
| 90 void SetSubresourceSpeculation() override; | 90 void SetSubresourceSpeculation() override; |
| 91 void SetOmniboxSpeculation() override; | 91 void SetOmniboxSpeculation() override; |
| 92 bool WasEverUsed() const override; | 92 bool WasEverUsed() const override; |
| 93 bool WasNpnNegotiated() const override; | 93 bool WasNpnNegotiated() const override; |
| 94 NextProto GetNegotiatedProtocol() const override; | 94 NextProto GetNegotiatedProtocol() const override; |
| 95 bool GetSSLInfo(SSLInfo* ssl_info) override; | 95 bool GetSSLInfo(SSLInfo* ssl_info) override; |
| 96 void GetConnectionAttempts(ConnectionAttempts* out) const override; | 96 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
| 97 void ClearConnectionAttempts() override {} | 97 void ClearConnectionAttempts() override {} |
| 98 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} | 98 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} |
| 99 int64_t GetTotalReceivedBytes() const override; | 99 int64_t GetTotalReceivedBytes() const override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 void ExtractClientCert(); | 131 void ExtractClientCert(); |
| 132 | 132 |
| 133 // Members used to send and receive buffer. | 133 // Members used to send and receive buffer. |
| 134 bool transport_send_busy_; | 134 bool transport_send_busy_; |
| 135 bool transport_recv_busy_; | 135 bool transport_recv_busy_; |
| 136 bool transport_recv_eof_; | 136 bool transport_recv_eof_; |
| 137 | 137 |
| 138 scoped_refptr<DrainableIOBuffer> send_buffer_; | 138 scoped_refptr<DrainableIOBuffer> send_buffer_; |
| 139 scoped_refptr<IOBuffer> recv_buffer_; | 139 scoped_refptr<IOBuffer> recv_buffer_; |
| 140 | 140 |
| 141 BoundNetLog net_log_; | 141 NetLogWithSource net_log_; |
| 142 | 142 |
| 143 CompletionCallback user_handshake_callback_; | 143 CompletionCallback user_handshake_callback_; |
| 144 CompletionCallback user_read_callback_; | 144 CompletionCallback user_read_callback_; |
| 145 CompletionCallback user_write_callback_; | 145 CompletionCallback user_write_callback_; |
| 146 | 146 |
| 147 // Used by Read function. | 147 // Used by Read function. |
| 148 scoped_refptr<IOBuffer> user_read_buf_; | 148 scoped_refptr<IOBuffer> user_read_buf_; |
| 149 int user_read_buf_len_; | 149 int user_read_buf_len_; |
| 150 | 150 |
| 151 // Used by Write function. | 151 // Used by Write function. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 return ERR_SOCKET_NOT_CONNECTED; | 330 return ERR_SOCKET_NOT_CONNECTED; |
| 331 return transport_socket_->GetPeerAddress(address); | 331 return transport_socket_->GetPeerAddress(address); |
| 332 } | 332 } |
| 333 | 333 |
| 334 int SSLServerSocketImpl::GetLocalAddress(IPEndPoint* address) const { | 334 int SSLServerSocketImpl::GetLocalAddress(IPEndPoint* address) const { |
| 335 if (!IsConnected()) | 335 if (!IsConnected()) |
| 336 return ERR_SOCKET_NOT_CONNECTED; | 336 return ERR_SOCKET_NOT_CONNECTED; |
| 337 return transport_socket_->GetLocalAddress(address); | 337 return transport_socket_->GetLocalAddress(address); |
| 338 } | 338 } |
| 339 | 339 |
| 340 const BoundNetLog& SSLServerSocketImpl::NetLog() const { | 340 const NetLogWithSource& SSLServerSocketImpl::NetLog() const { |
| 341 return net_log_; | 341 return net_log_; |
| 342 } | 342 } |
| 343 | 343 |
| 344 void SSLServerSocketImpl::SetSubresourceSpeculation() { | 344 void SSLServerSocketImpl::SetSubresourceSpeculation() { |
| 345 transport_socket_->SetSubresourceSpeculation(); | 345 transport_socket_->SetSubresourceSpeculation(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void SSLServerSocketImpl::SetOmniboxSpeculation() { | 348 void SSLServerSocketImpl::SetOmniboxSpeculation() { |
| 349 transport_socket_->SetOmniboxSpeculation(); | 349 transport_socket_->SetOmniboxSpeculation(); |
| 350 } | 350 } |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 SSL* ssl = SSL_new(ssl_ctx_.get()); | 947 SSL* ssl = SSL_new(ssl_ctx_.get()); |
| 948 return std::unique_ptr<SSLServerSocket>( | 948 return std::unique_ptr<SSLServerSocket>( |
| 949 new SSLServerSocketImpl(std::move(socket), ssl)); | 949 new SSLServerSocketImpl(std::move(socket), ssl)); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void EnableSSLServerSockets() { | 952 void EnableSSLServerSockets() { |
| 953 // No-op because CreateSSLServerSocket() calls crypto::EnsureOpenSSLInit(). | 953 // No-op because CreateSSLServerSocket() calls crypto::EnsureOpenSSLInit(). |
| 954 } | 954 } |
| 955 | 955 |
| 956 } // namespace net | 956 } // namespace net |
| OLD | NEW |