| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVER_SOCKET_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| 6 #define NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class SSLInfo; | 23 class SSLInfo; |
| 24 | 24 |
| 25 class SSLServerSocketOpenSSL : public SSLServerSocket { | 25 class SSLServerSocketOpenSSL : public SSLServerSocket { |
| 26 public: | 26 public: |
| 27 // See comments on CreateSSLServerSocket for details of how these | 27 // See comments on CreateSSLServerSocket for details of how these |
| 28 // parameters are used. | 28 // parameters are used. |
| 29 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, | 29 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, |
| 30 scoped_refptr<X509Certificate> certificate, | 30 scoped_refptr<X509Certificate> certificate, |
| 31 crypto::RSAPrivateKey* key, | 31 crypto::RSAPrivateKey* key, |
| 32 const SSLConfig& ssl_config); | 32 const SSLConfig& ssl_config); |
| 33 virtual ~SSLServerSocketOpenSSL(); | 33 ~SSLServerSocketOpenSSL() override; |
| 34 | 34 |
| 35 // SSLServerSocket interface. | 35 // SSLServerSocket interface. |
| 36 virtual int Handshake(const CompletionCallback& callback) override; | 36 int Handshake(const CompletionCallback& callback) override; |
| 37 | 37 |
| 38 // SSLSocket interface. | 38 // SSLSocket interface. |
| 39 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 39 int ExportKeyingMaterial(const base::StringPiece& label, |
| 40 bool has_context, | 40 bool has_context, |
| 41 const base::StringPiece& context, | 41 const base::StringPiece& context, |
| 42 unsigned char* out, | 42 unsigned char* out, |
| 43 unsigned int outlen) override; | 43 unsigned int outlen) override; |
| 44 virtual int GetTLSUniqueChannelBinding(std::string* out) override; | 44 int GetTLSUniqueChannelBinding(std::string* out) override; |
| 45 | 45 |
| 46 // Socket interface (via StreamSocket). | 46 // Socket interface (via StreamSocket). |
| 47 virtual int Read(IOBuffer* buf, int buf_len, | 47 int Read(IOBuffer* buf, |
| 48 const CompletionCallback& callback) override; | 48 int buf_len, |
| 49 virtual int Write(IOBuffer* buf, int buf_len, | 49 const CompletionCallback& callback) override; |
| 50 const CompletionCallback& callback) override; | 50 int Write(IOBuffer* buf, |
| 51 virtual int SetReceiveBufferSize(int32 size) override; | 51 int buf_len, |
| 52 virtual int SetSendBufferSize(int32 size) override; | 52 const CompletionCallback& callback) override; |
| 53 int SetReceiveBufferSize(int32 size) override; |
| 54 int SetSendBufferSize(int32 size) override; |
| 53 | 55 |
| 54 // StreamSocket implementation. | 56 // StreamSocket implementation. |
| 55 virtual int Connect(const CompletionCallback& callback) override; | 57 int Connect(const CompletionCallback& callback) override; |
| 56 virtual void Disconnect() override; | 58 void Disconnect() override; |
| 57 virtual bool IsConnected() const override; | 59 bool IsConnected() const override; |
| 58 virtual bool IsConnectedAndIdle() const override; | 60 bool IsConnectedAndIdle() const override; |
| 59 virtual int GetPeerAddress(IPEndPoint* address) const override; | 61 int GetPeerAddress(IPEndPoint* address) const override; |
| 60 virtual int GetLocalAddress(IPEndPoint* address) const override; | 62 int GetLocalAddress(IPEndPoint* address) const override; |
| 61 virtual const BoundNetLog& NetLog() const override; | 63 const BoundNetLog& NetLog() const override; |
| 62 virtual void SetSubresourceSpeculation() override; | 64 void SetSubresourceSpeculation() override; |
| 63 virtual void SetOmniboxSpeculation() override; | 65 void SetOmniboxSpeculation() override; |
| 64 virtual bool WasEverUsed() const override; | 66 bool WasEverUsed() const override; |
| 65 virtual bool UsingTCPFastOpen() const override; | 67 bool UsingTCPFastOpen() const override; |
| 66 virtual bool WasNpnNegotiated() const override; | 68 bool WasNpnNegotiated() const override; |
| 67 virtual NextProto GetNegotiatedProtocol() const override; | 69 NextProto GetNegotiatedProtocol() const override; |
| 68 virtual bool GetSSLInfo(SSLInfo* ssl_info) override; | 70 bool GetSSLInfo(SSLInfo* ssl_info) override; |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 enum State { | 73 enum State { |
| 72 STATE_NONE, | 74 STATE_NONE, |
| 73 STATE_HANDSHAKE, | 75 STATE_HANDSHAKE, |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 void OnSendComplete(int result); | 78 void OnSendComplete(int result); |
| 77 void OnRecvComplete(int result); | 79 void OnRecvComplete(int result); |
| 78 void OnHandshakeIOComplete(int result); | 80 void OnHandshakeIOComplete(int result); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 143 |
| 142 State next_handshake_state_; | 144 State next_handshake_state_; |
| 143 bool completed_handshake_; | 145 bool completed_handshake_; |
| 144 | 146 |
| 145 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); | 147 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 } // namespace net | 150 } // namespace net |
| 149 | 151 |
| 150 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 152 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| OLD | NEW |