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