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

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

Issue 3174004: Pass both hostname and port into SSLClientSocket (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « net/socket/ssl_client_socket_mac_factory.cc ('k') | net/socket/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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_NSS_H_ 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <certt.h> 9 #include <certt.h>
10 #include <keyt.h> 10 #include <keyt.h>
11 #include <nspr.h> 11 #include <nspr.h>
12 #include <nss.h> 12 #include <nss.h>
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/scoped_ptr.h" 17 #include "base/scoped_ptr.h"
18 #include "net/base/cert_verify_result.h" 18 #include "net/base/cert_verify_result.h"
19 #include "net/base/completion_callback.h" 19 #include "net/base/completion_callback.h"
20 #include "net/base/host_port_pair.h"
20 #include "net/base/net_log.h" 21 #include "net/base/net_log.h"
21 #include "net/base/nss_memio.h" 22 #include "net/base/nss_memio.h"
22 #include "net/base/ssl_config_service.h" 23 #include "net/base/ssl_config_service.h"
23 #include "net/base/x509_certificate.h" 24 #include "net/base/x509_certificate.h"
24 #include "net/socket/ssl_client_socket.h" 25 #include "net/socket/ssl_client_socket.h"
25 26
26 namespace net { 27 namespace net {
27 28
28 class BoundNetLog; 29 class BoundNetLog;
29 class CertVerifier; 30 class CertVerifier;
30 class ClientSocketHandle; 31 class ClientSocketHandle;
31 class X509Certificate; 32 class X509Certificate;
32 33
33 // An SSL client socket implemented with Mozilla NSS. 34 // An SSL client socket implemented with Mozilla NSS.
34 class SSLClientSocketNSS : public SSLClientSocket { 35 class SSLClientSocketNSS : public SSLClientSocket {
35 public: 36 public:
36 // Takes ownership of the |transport_socket|, which must already be connected. 37 // Takes ownership of the |transport_socket|, which must already be connected.
37 // The given hostname will be compared with the name(s) in the server's 38 // The given hostname will be compared with the name(s) in the server's
38 // certificate during the SSL handshake. ssl_config specifies the SSL 39 // certificate during the SSL handshake. ssl_config specifies the SSL
39 // settings. 40 // settings.
40 SSLClientSocketNSS(ClientSocketHandle* transport_socket, 41 SSLClientSocketNSS(ClientSocketHandle* transport_socket,
41 const std::string& hostname, 42 const HostPortPair& host_port_pair,
42 const SSLConfig& ssl_config); 43 const SSLConfig& ssl_config);
43 ~SSLClientSocketNSS(); 44 ~SSLClientSocketNSS();
44 45
45 // SSLClientSocket methods: 46 // SSLClientSocket methods:
46 virtual void GetSSLInfo(SSLInfo* ssl_info); 47 virtual void GetSSLInfo(SSLInfo* ssl_info);
47 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 48 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
48 virtual NextProtoStatus GetNextProto(std::string* proto); 49 virtual NextProtoStatus GetNextProto(std::string* proto);
49 50
50 // ClientSocket methods: 51 // ClientSocket methods:
51 virtual int Connect(CompletionCallback* callback); 52 virtual int Connect(CompletionCallback* callback);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static void HandshakeCallback(PRFileDesc* socket, void* arg); 114 static void HandshakeCallback(PRFileDesc* socket, void* arg);
114 115
115 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; 116 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_;
116 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; 117 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_;
117 bool transport_send_busy_; 118 bool transport_send_busy_;
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 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; 122 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_;
122 scoped_ptr<ClientSocketHandle> transport_; 123 scoped_ptr<ClientSocketHandle> transport_;
123 std::string hostname_; 124 HostPortPair host_port_pair_;
124 SSLConfig ssl_config_; 125 SSLConfig ssl_config_;
125 126
126 CompletionCallback* user_connect_callback_; 127 CompletionCallback* user_connect_callback_;
127 CompletionCallback* user_read_callback_; 128 CompletionCallback* user_read_callback_;
128 CompletionCallback* user_write_callback_; 129 CompletionCallback* user_write_callback_;
129 130
130 // Used by Read function. 131 // Used by Read function.
131 scoped_refptr<IOBuffer> user_read_buf_; 132 scoped_refptr<IOBuffer> user_read_buf_;
132 int user_read_buf_len_; 133 int user_read_buf_len_;
133 134
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // 2. Copy client certificates from the "MY" system certificate store into 179 // 2. Copy client certificates from the "MY" system certificate store into
179 // this store so that we can close the system store when we finish 180 // this store so that we can close the system store when we finish
180 // searching for client certificates. 181 // searching for client certificates.
181 static HCERTSTORE cert_store_; 182 static HCERTSTORE cert_store_;
182 #endif 183 #endif
183 }; 184 };
184 185
185 } // namespace net 186 } // namespace net
186 187
187 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ 188 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_mac_factory.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698