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_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> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // Socket methods: | 80 // Socket methods: |
81 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 81 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
82 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 82 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
83 virtual bool SetReceiveBufferSize(int32 size); | 83 virtual bool SetReceiveBufferSize(int32 size); |
84 virtual bool SetSendBufferSize(int32 size); | 84 virtual bool SetSendBufferSize(int32 size); |
85 | 85 |
86 private: | 86 private: |
87 enum State { | 87 enum State { |
88 STATE_NONE, | 88 STATE_NONE, |
| 89 STATE_LOAD_SSL_HOST_INFO, |
89 STATE_HANDSHAKE, | 90 STATE_HANDSHAKE, |
90 STATE_VERIFY_DNSSEC, | 91 STATE_VERIFY_DNSSEC, |
91 STATE_VERIFY_DNSSEC_COMPLETE, | 92 STATE_VERIFY_DNSSEC_COMPLETE, |
92 STATE_VERIFY_CERT, | 93 STATE_VERIFY_CERT, |
93 STATE_VERIFY_CERT_COMPLETE, | 94 STATE_VERIFY_CERT_COMPLETE, |
94 }; | 95 }; |
95 | 96 |
96 int Init(); | 97 int Init(); |
97 | 98 |
98 // Initializes NSS SSL options. Returns a net error code. | 99 // Initializes NSS SSL options. Returns a net error code. |
99 int InitializeSSLOptions(); | 100 int InitializeSSLOptions(); |
100 | 101 |
101 // Initializes the socket peer name in SSL. Returns a net error code. | 102 // Initializes the socket peer name in SSL. Returns a net error code. |
102 int InitializeSSLPeerName(); | 103 int InitializeSSLPeerName(); |
103 | 104 |
104 X509Certificate* UpdateServerCert(); | 105 X509Certificate* UpdateServerCert(); |
105 void UpdateConnectionStatus(); | 106 void UpdateConnectionStatus(); |
106 void DoReadCallback(int result); | 107 void DoReadCallback(int result); |
107 void DoWriteCallback(int result); | 108 void DoWriteCallback(int result); |
108 void DoConnectCallback(int result); | 109 void DoConnectCallback(int result); |
109 void OnHandshakeIOComplete(int result); | 110 void OnHandshakeIOComplete(int result); |
110 void OnSendComplete(int result); | 111 void OnSendComplete(int result); |
111 void OnRecvComplete(int result); | 112 void OnRecvComplete(int result); |
112 | 113 |
113 int DoHandshakeLoop(int last_io_result); | 114 int DoHandshakeLoop(int last_io_result); |
114 int DoReadLoop(int result); | 115 int DoReadLoop(int result); |
115 int DoWriteLoop(int result); | 116 int DoWriteLoop(int result); |
116 | 117 |
| 118 bool LoadSSLHostInfo(); |
| 119 int DoLoadSSLHostInfo(); |
117 int DoHandshake(); | 120 int DoHandshake(); |
118 | 121 |
119 int DoVerifyDNSSEC(int result); | 122 int DoVerifyDNSSEC(int result); |
120 int DoVerifyDNSSECComplete(int result); | 123 int DoVerifyDNSSECComplete(int result); |
121 int DoVerifyCert(int result); | 124 int DoVerifyCert(int result); |
122 int DoVerifyCertComplete(int result); | 125 int DoVerifyCertComplete(int result); |
123 int DoPayloadRead(); | 126 int DoPayloadRead(); |
124 int DoPayloadWrite(); | 127 int DoPayloadWrite(); |
125 void LogConnectionTypeMetrics() const; | 128 void LogConnectionTypeMetrics() const; |
126 void SaveSSLHostInfo(); | 129 void SaveSSLHostInfo(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Added the following code Debugging in release mode. | 257 // Added the following code Debugging in release mode. |
255 mutable base::Lock lock_; | 258 mutable base::Lock lock_; |
256 // This is mutable so that CalledOnValidThread can set it. | 259 // This is mutable so that CalledOnValidThread can set it. |
257 // It's guarded by |lock_|. | 260 // It's guarded by |lock_|. |
258 mutable base::PlatformThreadId valid_thread_id_; | 261 mutable base::PlatformThreadId valid_thread_id_; |
259 }; | 262 }; |
260 | 263 |
261 } // namespace net | 264 } // namespace net |
262 | 265 |
263 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 266 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
OLD | NEW |