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

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

Issue 4049: Port SSLClientSocket to Linux (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 | « net/base/nss_memio.c ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
6 #define NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
7
8 #include "build/build_config.h"
9
10 #include <prio.h>
11 #include "net/base/nss_memio.h"
12
13 #include <string>
14
15 #include "base/scoped_ptr.h"
16 #include "net/base/completion_callback.h"
17 #include "net/base/ssl_client_socket.h"
18 #include "net/base/ssl_config_service.h"
19
20 namespace net {
21
22 // An SSL client socket implemented with Mozilla NSS.
23 class SSLClientSocketNSS : public SSLClientSocket {
24 public:
25 // 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
27 // certificate during the SSL handshake. ssl_config specifies the SSL
28 // settings.
29 SSLClientSocketNSS(ClientSocket* transport_socket,
30 const std::string& hostname,
31 const SSLConfig& ssl_config);
32 ~SSLClientSocketNSS();
33
34 // SSLClientSocket methods:
35 virtual void GetSSLInfo(SSLInfo* ssl_info);
36
37 // ClientSocket methods:
38 virtual int Connect(CompletionCallback* callback);
39 virtual int ReconnectIgnoringLastError(CompletionCallback* callback);
40 virtual void Disconnect();
41 virtual bool IsConnected() const;
42
43 // Socket methods:
44 virtual int Read(char* buf, int buf_len, CompletionCallback* callback);
45 virtual int Write(const char* buf, int buf_len, CompletionCallback* callback);
46
47 private:
48 void DoCallback(int result);
49 void OnIOComplete(int result);
50
51 int DoLoop(int last_io_result);
52 int DoConnect();
53 int DoConnectComplete(int result);
54 int DoHandshakeRead();
55 int DoPayloadRead();
56 int DoPayloadWrite();
57 int Init();
58 int BufferSend(void);
59 int BufferRecv(void);
60 void BufferSendComplete(int result);
61 void BufferRecvComplete(int result);
62
63 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_;
64 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_;
65 bool transport_send_busy_;
66 bool transport_recv_busy_;
67
68 CompletionCallbackImpl<SSLClientSocketNSS> io_callback_;
69 scoped_ptr<ClientSocket> transport_;
70 std::string hostname_;
71 SSLConfig ssl_config_;
72
73 CompletionCallback* user_callback_;
74
75 // Used by both Read and Write functions.
76 char* user_buf_;
77 int user_buf_len_;
78
79 bool completed_handshake_;
80
81 enum State {
82 STATE_NONE,
83 STATE_CONNECT,
84 STATE_CONNECT_COMPLETE,
85 STATE_HANDSHAKE_READ,
86 // No STATE_HANDSHAKE_READ_COMPLETE needed, go to STATE_NONE instead.
87 STATE_PAYLOAD_WRITE,
88 STATE_PAYLOAD_READ,
89 };
90 State next_state_;
91
92 /* The NSS SSL state machine */
93 PRFileDesc* nss_fd_;
94
95 /* Buffers for the network end of the SSL state machine */
96 memio_Private* nss_bufs_;
97
98 static bool nss_options_initialized_;
99 };
100
101 } // namespace net
102
103 #endif // NET_BASE_SSL_CLIENT_SOCKET_NSS_H_
104
OLDNEW
« no previous file with comments | « net/base/nss_memio.c ('k') | net/base/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698