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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 const HostPortPair& host_and_port() const { return host_and_port_; } | 45 const HostPortPair& host_and_port() const { return host_and_port_; } |
46 | 46 |
47 // Callback from the SSL layer that indicates the remote server is requesting | 47 // Callback from the SSL layer that indicates the remote server is requesting |
48 // a certificate for this client. | 48 // a certificate for this client. |
49 int ClientCertRequestCallback(SSL* ssl, X509** x509, EVP_PKEY** pkey); | 49 int ClientCertRequestCallback(SSL* ssl, X509** x509, EVP_PKEY** pkey); |
50 | 50 |
51 // Callback from the SSL layer to check which NPN protocol we are supporting | 51 // Callback from the SSL layer to check which NPN protocol we are supporting |
52 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, | 52 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, |
53 const unsigned char* in, unsigned int inlen); | 53 const unsigned char* in, unsigned int inlen); |
54 | 54 |
55 // SSLClientSocket methods: | 55 // SSLClientSocket implementation. |
56 virtual void GetSSLInfo(SSLInfo* ssl_info); | 56 virtual void GetSSLInfo(SSLInfo* ssl_info); |
57 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 57 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
58 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 58 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
59 const base::StringPiece& context, | 59 const base::StringPiece& context, |
60 unsigned char *out, | 60 unsigned char *out, |
61 unsigned int outlen); | 61 unsigned int outlen); |
62 virtual NextProtoStatus GetNextProto(std::string* proto); | 62 virtual NextProtoStatus GetNextProto(std::string* proto); |
63 | 63 |
64 // StreamSocket methods: | 64 // StreamSocket implementation. |
65 virtual int Connect(OldCompletionCallback* callback); | 65 virtual int Connect(OldCompletionCallback* callback); |
| 66 virtual int Connect(const CompletionCallback& callback); |
66 virtual void Disconnect(); | 67 virtual void Disconnect(); |
67 virtual bool IsConnected() const; | 68 virtual bool IsConnected() const; |
68 virtual bool IsConnectedAndIdle() const; | 69 virtual bool IsConnectedAndIdle() const; |
69 virtual int GetPeerAddress(AddressList* address) const; | 70 virtual int GetPeerAddress(AddressList* address) const; |
70 virtual int GetLocalAddress(IPEndPoint* address) const; | 71 virtual int GetLocalAddress(IPEndPoint* address) const; |
71 virtual const BoundNetLog& NetLog() const; | 72 virtual const BoundNetLog& NetLog() const; |
72 virtual void SetSubresourceSpeculation(); | 73 virtual void SetSubresourceSpeculation(); |
73 virtual void SetOmniboxSpeculation(); | 74 virtual void SetOmniboxSpeculation(); |
74 virtual bool WasEverUsed() const; | 75 virtual bool WasEverUsed() const; |
75 virtual bool UsingTCPFastOpen() const; | 76 virtual bool UsingTCPFastOpen() const; |
76 virtual int64 NumBytesRead() const; | 77 virtual int64 NumBytesRead() const; |
77 virtual base::TimeDelta GetConnectTimeMicros() const; | 78 virtual base::TimeDelta GetConnectTimeMicros() const; |
78 | 79 |
79 // Socket methods: | 80 // Socket implementation. |
80 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); | 81 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); |
81 virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback)
; | 82 virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback)
; |
82 virtual bool SetReceiveBufferSize(int32 size); | 83 virtual bool SetReceiveBufferSize(int32 size); |
83 virtual bool SetSendBufferSize(int32 size); | 84 virtual bool SetSendBufferSize(int32 size); |
84 | 85 |
85 private: | 86 private: |
86 bool Init(); | 87 bool Init(); |
87 void DoReadCallback(int result); | 88 void DoReadCallback(int result); |
88 void DoWriteCallback(int result); | 89 void DoWriteCallback(int result); |
89 | 90 |
(...skipping 21 matching lines...) Expand all Loading... |
111 void TransportWriteComplete(int result); | 112 void TransportWriteComplete(int result); |
112 void TransportReadComplete(int result); | 113 void TransportReadComplete(int result); |
113 | 114 |
114 OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_send_callback_; | 115 OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_send_callback_; |
115 OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_recv_callback_; | 116 OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_recv_callback_; |
116 bool transport_send_busy_; | 117 bool transport_send_busy_; |
117 scoped_refptr<DrainableIOBuffer> send_buffer_; | 118 scoped_refptr<DrainableIOBuffer> send_buffer_; |
118 bool transport_recv_busy_; | 119 bool transport_recv_busy_; |
119 scoped_refptr<IOBuffer> recv_buffer_; | 120 scoped_refptr<IOBuffer> recv_buffer_; |
120 | 121 |
121 OldCompletionCallback* user_connect_callback_; | 122 OldCompletionCallback* old_user_connect_callback_; |
| 123 CompletionCallback user_connect_callback_; |
122 OldCompletionCallback* user_read_callback_; | 124 OldCompletionCallback* user_read_callback_; |
123 OldCompletionCallback* user_write_callback_; | 125 OldCompletionCallback* user_write_callback_; |
124 | 126 |
125 // Used by Read function. | 127 // Used by Read function. |
126 scoped_refptr<IOBuffer> user_read_buf_; | 128 scoped_refptr<IOBuffer> user_read_buf_; |
127 int user_read_buf_len_; | 129 int user_read_buf_len_; |
128 | 130 |
129 // Used by Write function. | 131 // Used by Write function. |
130 scoped_refptr<IOBuffer> user_write_buf_; | 132 scoped_refptr<IOBuffer> user_write_buf_; |
131 int user_write_buf_len_; | 133 int user_write_buf_len_; |
(...skipping 30 matching lines...) Expand all Loading... |
162 }; | 164 }; |
163 State next_handshake_state_; | 165 State next_handshake_state_; |
164 NextProtoStatus npn_status_; | 166 NextProtoStatus npn_status_; |
165 std::string npn_proto_; | 167 std::string npn_proto_; |
166 BoundNetLog net_log_; | 168 BoundNetLog net_log_; |
167 }; | 169 }; |
168 | 170 |
169 } // namespace net | 171 } // namespace net |
170 | 172 |
171 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 173 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |