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

Side by Side Diff: net/base/ssl_client_socket_nss.h

Issue 16207: Make ssl_client_socket_unittest use a local server (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ssl/ssl_uitest.cc ('k') | net/base/ssl_client_socket_nss.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-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_BASE_SSL_CLIENT_SOCKET_NSS_H_ 5 #ifndef NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
6 #define NET_BASE_SSL_CLIENT_SOCKET_NSS_H_ 6 #define NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
7 7
8 #include "build/build_config.h" 8 #include <nspr.h>
9 9 #include <nss.h>
10 #include <prio.h>
11 #include "net/base/nss_memio.h"
12
13 #include <string> 10 #include <string>
14 11
15 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
16 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/base/nss_memio.h"
17 #include "net/base/ssl_client_socket.h" 15 #include "net/base/ssl_client_socket.h"
18 #include "net/base/ssl_config_service.h" 16 #include "net/base/ssl_config_service.h"
19 17
20 namespace net { 18 namespace net {
21 19
22 // An SSL client socket implemented with Mozilla NSS. 20 // An SSL client socket implemented with Mozilla NSS.
23 class SSLClientSocketNSS : public SSLClientSocket { 21 class SSLClientSocketNSS : public SSLClientSocket {
24 public: 22 public:
25 // Takes ownership of the transport_socket, which may already be connected. 23 // Takes ownership of the transport_socket, which may already be connected.
26 // The given hostname will be compared with the name(s) in the server's 24 // The given hostname will be compared with the name(s) in the server's
(...skipping 26 matching lines...) Expand all
53 int DoConnectComplete(int result); 51 int DoConnectComplete(int result);
54 int DoHandshakeRead(); 52 int DoHandshakeRead();
55 int DoPayloadRead(); 53 int DoPayloadRead();
56 int DoPayloadWrite(); 54 int DoPayloadWrite();
57 int Init(); 55 int Init();
58 int BufferSend(void); 56 int BufferSend(void);
59 int BufferRecv(void); 57 int BufferRecv(void);
60 void BufferSendComplete(int result); 58 void BufferSendComplete(int result);
61 void BufferRecvComplete(int result); 59 void BufferRecvComplete(int result);
62 60
61 // nss calls this on error. We pass 'this' as the first argument.
62 static SECStatus OwnBadCertHandler(void* arg, PRFileDesc* socket);
63
63 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; 64 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_;
64 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; 65 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_;
65 bool transport_send_busy_; 66 bool transport_send_busy_;
66 bool transport_recv_busy_; 67 bool transport_recv_busy_;
67 68
68 CompletionCallbackImpl<SSLClientSocketNSS> io_callback_; 69 CompletionCallbackImpl<SSLClientSocketNSS> io_callback_;
69 scoped_ptr<ClientSocket> transport_; 70 scoped_ptr<ClientSocket> transport_;
70 std::string hostname_; 71 std::string hostname_;
71 SSLConfig ssl_config_; 72 SSLConfig ssl_config_;
72 73
73 CompletionCallback* user_callback_; 74 CompletionCallback* user_callback_;
74 75
75 // Used by both Read and Write functions. 76 // Used by both Read and Write functions.
76 char* user_buf_; 77 char* user_buf_;
77 int user_buf_len_; 78 int user_buf_len_;
78 79
79 int server_cert_status_; 80 // Set when handshake finishes. Value is net error code, see net_errors.h
81 int server_cert_error_;
80 82
81 bool completed_handshake_; 83 bool completed_handshake_;
82 84
83 enum State { 85 enum State {
84 STATE_NONE, 86 STATE_NONE,
85 STATE_CONNECT, 87 STATE_CONNECT,
86 STATE_CONNECT_COMPLETE, 88 STATE_CONNECT_COMPLETE,
87 STATE_HANDSHAKE_READ, 89 STATE_HANDSHAKE_READ,
88 // No STATE_HANDSHAKE_READ_COMPLETE needed, go to STATE_NONE instead. 90 // No STATE_HANDSHAKE_READ_COMPLETE needed, go to STATE_NONE instead.
89 STATE_PAYLOAD_WRITE, 91 STATE_PAYLOAD_WRITE,
90 STATE_PAYLOAD_READ, 92 STATE_PAYLOAD_READ,
91 }; 93 };
92 State next_state_; 94 State next_state_;
93 95
94 /* The NSS SSL state machine */ 96 // The NSS SSL state machine
95 PRFileDesc* nss_fd_; 97 PRFileDesc* nss_fd_;
96 98
97 /* Buffers for the network end of the SSL state machine */ 99 // Buffers for the network end of the SSL state machine
98 memio_Private* nss_bufs_; 100 memio_Private* nss_bufs_;
99 101
100 static bool nss_options_initialized_; 102 static bool nss_options_initialized_;
101 }; 103 };
102 104
103 } // namespace net 105 } // namespace net
104 106
105 #endif // NET_BASE_SSL_CLIENT_SOCKET_NSS_H_ 107 #endif // NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
106 108
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_uitest.cc ('k') | net/base/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698