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_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class SSLClientSocketOpenSSL : public SSLClientSocket { | 44 class SSLClientSocketOpenSSL : public SSLClientSocket { |
45 public: | 45 public: |
46 // Takes ownership of the transport_socket, which may already be connected. | 46 // Takes ownership of the transport_socket, which may already be connected. |
47 // The given hostname will be compared with the name(s) in the server's | 47 // The given hostname will be compared with the name(s) in the server's |
48 // certificate during the SSL handshake. ssl_config specifies the SSL | 48 // certificate during the SSL handshake. ssl_config specifies the SSL |
49 // settings. | 49 // settings. |
50 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, | 50 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, |
51 const HostPortPair& host_and_port, | 51 const HostPortPair& host_and_port, |
52 const SSLConfig& ssl_config, | 52 const SSLConfig& ssl_config, |
53 const SSLClientSocketContext& context); | 53 const SSLClientSocketContext& context); |
54 virtual ~SSLClientSocketOpenSSL(); | 54 ~SSLClientSocketOpenSSL() override; |
55 | 55 |
56 const HostPortPair& host_and_port() const { return host_and_port_; } | 56 const HostPortPair& host_and_port() const { return host_and_port_; } |
57 const std::string& ssl_session_cache_shard() const { | 57 const std::string& ssl_session_cache_shard() const { |
58 return ssl_session_cache_shard_; | 58 return ssl_session_cache_shard_; |
59 } | 59 } |
60 | 60 |
61 // SSLClientSocket implementation. | 61 // SSLClientSocket implementation. |
62 virtual std::string GetSessionCacheKey() const override; | 62 std::string GetSessionCacheKey() const override; |
63 virtual bool InSessionCache() const override; | 63 bool InSessionCache() const override; |
64 virtual void SetHandshakeCompletionCallback( | 64 void SetHandshakeCompletionCallback(const base::Closure& callback) override; |
65 const base::Closure& callback) override; | 65 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
66 virtual void GetSSLCertRequestInfo( | 66 NextProtoStatus GetNextProto(std::string* proto) override; |
67 SSLCertRequestInfo* cert_request_info) override; | 67 ChannelIDService* GetChannelIDService() const override; |
68 virtual NextProtoStatus GetNextProto(std::string* proto) override; | |
69 virtual ChannelIDService* GetChannelIDService() const override; | |
70 | 68 |
71 // SSLSocket implementation. | 69 // SSLSocket implementation. |
72 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 70 int ExportKeyingMaterial(const base::StringPiece& label, |
73 bool has_context, | 71 bool has_context, |
74 const base::StringPiece& context, | 72 const base::StringPiece& context, |
75 unsigned char* out, | 73 unsigned char* out, |
76 unsigned int outlen) override; | 74 unsigned int outlen) override; |
77 virtual int GetTLSUniqueChannelBinding(std::string* out) override; | 75 int GetTLSUniqueChannelBinding(std::string* out) override; |
78 | 76 |
79 // StreamSocket implementation. | 77 // StreamSocket implementation. |
80 virtual int Connect(const CompletionCallback& callback) override; | 78 int Connect(const CompletionCallback& callback) override; |
81 virtual void Disconnect() override; | 79 void Disconnect() override; |
82 virtual bool IsConnected() const override; | 80 bool IsConnected() const override; |
83 virtual bool IsConnectedAndIdle() const override; | 81 bool IsConnectedAndIdle() const override; |
84 virtual int GetPeerAddress(IPEndPoint* address) const override; | 82 int GetPeerAddress(IPEndPoint* address) const override; |
85 virtual int GetLocalAddress(IPEndPoint* address) const override; | 83 int GetLocalAddress(IPEndPoint* address) const override; |
86 virtual const BoundNetLog& NetLog() const override; | 84 const BoundNetLog& NetLog() const override; |
87 virtual void SetSubresourceSpeculation() override; | 85 void SetSubresourceSpeculation() override; |
88 virtual void SetOmniboxSpeculation() override; | 86 void SetOmniboxSpeculation() override; |
89 virtual bool WasEverUsed() const override; | 87 bool WasEverUsed() const override; |
90 virtual bool UsingTCPFastOpen() const override; | 88 bool UsingTCPFastOpen() const override; |
91 virtual bool GetSSLInfo(SSLInfo* ssl_info) override; | 89 bool GetSSLInfo(SSLInfo* ssl_info) override; |
92 | 90 |
93 // Socket implementation. | 91 // Socket implementation. |
94 virtual int Read(IOBuffer* buf, int buf_len, | 92 int Read(IOBuffer* buf, |
95 const CompletionCallback& callback) override; | 93 int buf_len, |
96 virtual int Write(IOBuffer* buf, int buf_len, | 94 const CompletionCallback& callback) override; |
97 const CompletionCallback& callback) override; | 95 int Write(IOBuffer* buf, |
98 virtual int SetReceiveBufferSize(int32 size) override; | 96 int buf_len, |
99 virtual int SetSendBufferSize(int32 size) override; | 97 const CompletionCallback& callback) override; |
| 98 int SetReceiveBufferSize(int32 size) override; |
| 99 int SetSendBufferSize(int32 size) override; |
100 | 100 |
101 protected: | 101 protected: |
102 // SSLClientSocket implementation. | 102 // SSLClientSocket implementation. |
103 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() | 103 scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
104 const override; | 104 const override; |
105 | 105 |
106 private: | 106 private: |
107 class PeerCertificateChain; | 107 class PeerCertificateChain; |
108 class SSLContext; | 108 class SSLContext; |
109 friend class SSLClientSocket; | 109 friend class SSLClientSocket; |
110 friend class SSLContext; | 110 friend class SSLContext; |
111 | 111 |
112 int Init(); | 112 int Init(); |
113 void DoReadCallback(int result); | 113 void DoReadCallback(int result); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // pinning failure. It is a (somewhat) human-readable string. | 301 // pinning failure. It is a (somewhat) human-readable string. |
302 std::string pinning_failure_log_; | 302 std::string pinning_failure_log_; |
303 | 303 |
304 BoundNetLog net_log_; | 304 BoundNetLog net_log_; |
305 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; | 305 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; |
306 }; | 306 }; |
307 | 307 |
308 } // namespace net | 308 } // namespace net |
309 | 309 |
310 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 310 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |