Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: net/socket/ssl_client_socket_win.h

Issue 344026: Add LoadLog to ClientSocket::Connect(). (Closed)
Patch Set: Minor build fixups and fixed mac bug. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_WIN_H_ 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
7 7
8 #define SECURITY_WIN32 // Needs to be defined before including security.h 8 #define SECURITY_WIN32 // Needs to be defined before including security.h
9 9
10 #include <windows.h> 10 #include <windows.h>
11 #include <wincrypt.h> 11 #include <wincrypt.h>
12 #include <security.h> 12 #include <security.h>
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
17 #include "net/base/cert_verify_result.h" 17 #include "net/base/cert_verify_result.h"
18 #include "net/base/completion_callback.h" 18 #include "net/base/completion_callback.h"
19 #include "net/base/ssl_config_service.h" 19 #include "net/base/ssl_config_service.h"
20 #include "net/socket/ssl_client_socket.h" 20 #include "net/socket/ssl_client_socket.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 class CertVerifier; 24 class CertVerifier;
25 class LoadLog;
25 26
26 // An SSL client socket implemented with the Windows Schannel. 27 // An SSL client socket implemented with the Windows Schannel.
27 class SSLClientSocketWin : public SSLClientSocket { 28 class SSLClientSocketWin : public SSLClientSocket {
28 public: 29 public:
29 // Takes ownership of the transport_socket, which may already be connected. 30 // Takes ownership of the transport_socket, which may already be connected.
30 // The given hostname will be compared with the name(s) in the server's 31 // The given hostname will be compared with the name(s) in the server's
31 // certificate during the SSL handshake. ssl_config specifies the SSL 32 // certificate during the SSL handshake. ssl_config specifies the SSL
32 // settings. 33 // settings.
33 SSLClientSocketWin(ClientSocket* transport_socket, 34 SSLClientSocketWin(ClientSocket* transport_socket,
34 const std::string& hostname, 35 const std::string& hostname,
35 const SSLConfig& ssl_config); 36 const SSLConfig& ssl_config);
36 ~SSLClientSocketWin(); 37 ~SSLClientSocketWin();
37 38
38 // SSLClientSocket methods: 39 // SSLClientSocket methods:
39 virtual void GetSSLInfo(SSLInfo* ssl_info); 40 virtual void GetSSLInfo(SSLInfo* ssl_info);
40 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 41 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
41 42
42 // ClientSocket methods: 43 // ClientSocket methods:
43 virtual int Connect(CompletionCallback* callback); 44 virtual int Connect(CompletionCallback* callback, LoadLog* load_log);
44 virtual void Disconnect(); 45 virtual void Disconnect();
45 virtual bool IsConnected() const; 46 virtual bool IsConnected() const;
46 virtual bool IsConnectedAndIdle() const; 47 virtual bool IsConnectedAndIdle() const;
47 48
48 // Socket methods: 49 // Socket methods:
49 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 50 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
50 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); 51 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
51 52
52 virtual bool SetReceiveBufferSize(int32 size); 53 virtual bool SetReceiveBufferSize(int32 size);
53 virtual bool SetSendBufferSize(int32 size); 54 virtual bool SetSendBufferSize(int32 size);
54 55
55 private: 56 private:
56 bool completed_handshake() const { 57 bool completed_handshake() const {
57 return next_state_ == STATE_COMPLETED_HANDSHAKE; 58 return next_state_ == STATE_COMPLETED_HANDSHAKE;
58 } 59 }
59 60
61 // Initializes the SSL options and security context. Returns a net error code.
62 int InitializeSSLContext();
63
60 void OnHandshakeIOComplete(int result); 64 void OnHandshakeIOComplete(int result);
61 void OnReadComplete(int result); 65 void OnReadComplete(int result);
62 void OnWriteComplete(int result); 66 void OnWriteComplete(int result);
63 67
64 int DoLoop(int last_io_result); 68 int DoLoop(int last_io_result);
65 int DoHandshakeRead(); 69 int DoHandshakeRead();
66 int DoHandshakeReadComplete(int result); 70 int DoHandshakeReadComplete(int result);
67 int DoHandshakeWrite(); 71 int DoHandshakeWrite();
68 int DoHandshakeWriteComplete(int result); 72 int DoHandshakeWriteComplete(int result);
69 int DoVerifyCert(); 73 int DoVerifyCert();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // to continue processing previously read data without reading more data. 173 // to continue processing previously read data without reading more data.
170 // We have to pass a 'result' of OK to the DoLoop method, and don't want it 174 // We have to pass a 'result' of OK to the DoLoop method, and don't want it
171 // to be interpreted as EOF. 175 // to be interpreted as EOF.
172 bool ignore_ok_result_; 176 bool ignore_ok_result_;
173 177
174 // Renegotiation is in progress. 178 // Renegotiation is in progress.
175 bool renegotiating_; 179 bool renegotiating_;
176 180
177 // True when the decrypter needs more data in order to decrypt. 181 // True when the decrypter needs more data in order to decrypt.
178 bool need_more_data_; 182 bool need_more_data_;
183
184 scoped_refptr<LoadLog> load_log_;
179 }; 185 };
180 186
181 } // namespace net 187 } // namespace net
182 188
183 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ 189 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698