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

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

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years 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/socket/socket_test_util.cc ('k') | net/socket/socks5_client_socket.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) 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_SOCKS5_CLIENT_SOCKET_H_ 5 #ifndef NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_
6 #define NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_ 6 #define NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Deprecated constructor (http://crbug.com/37810) that takes a StreamSocket. 44 // Deprecated constructor (http://crbug.com/37810) that takes a StreamSocket.
45 SOCKS5ClientSocket(StreamSocket* transport_socket, 45 SOCKS5ClientSocket(StreamSocket* transport_socket,
46 const HostResolver::RequestInfo& req_info); 46 const HostResolver::RequestInfo& req_info);
47 47
48 // On destruction Disconnect() is called. 48 // On destruction Disconnect() is called.
49 virtual ~SOCKS5ClientSocket(); 49 virtual ~SOCKS5ClientSocket();
50 50
51 // StreamSocket implementation. 51 // StreamSocket implementation.
52 52
53 // Does the SOCKS handshake and completes the protocol. 53 // Does the SOCKS handshake and completes the protocol.
54 virtual int Connect(OldCompletionCallback* callback) OVERRIDE;
55 virtual int Connect(const CompletionCallback& callback) OVERRIDE; 54 virtual int Connect(const CompletionCallback& callback) OVERRIDE;
56 virtual void Disconnect() OVERRIDE; 55 virtual void Disconnect() OVERRIDE;
57 virtual bool IsConnected() const OVERRIDE; 56 virtual bool IsConnected() const OVERRIDE;
58 virtual bool IsConnectedAndIdle() const OVERRIDE; 57 virtual bool IsConnectedAndIdle() const OVERRIDE;
59 virtual const BoundNetLog& NetLog() const OVERRIDE; 58 virtual const BoundNetLog& NetLog() const OVERRIDE;
60 virtual void SetSubresourceSpeculation() OVERRIDE; 59 virtual void SetSubresourceSpeculation() OVERRIDE;
61 virtual void SetOmniboxSpeculation() OVERRIDE; 60 virtual void SetOmniboxSpeculation() OVERRIDE;
62 virtual bool WasEverUsed() const OVERRIDE; 61 virtual bool WasEverUsed() const OVERRIDE;
63 virtual bool UsingTCPFastOpen() const OVERRIDE; 62 virtual bool UsingTCPFastOpen() const OVERRIDE;
64 virtual int64 NumBytesRead() const OVERRIDE; 63 virtual int64 NumBytesRead() const OVERRIDE;
65 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 64 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
66 65
67 // Socket implementation. 66 // Socket implementation.
68 virtual int Read(IOBuffer* buf, 67 virtual int Read(IOBuffer* buf,
69 int buf_len, 68 int buf_len,
70 OldCompletionCallback* callback) OVERRIDE;
71 virtual int Read(IOBuffer* buf,
72 int buf_len,
73 const CompletionCallback& callback) OVERRIDE; 69 const CompletionCallback& callback) OVERRIDE;
74 virtual int Write(IOBuffer* buf, 70 virtual int Write(IOBuffer* buf,
75 int buf_len, 71 int buf_len,
76 OldCompletionCallback* callback) OVERRIDE; 72 const CompletionCallback& callback) OVERRIDE;
77 73
78 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 74 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
79 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 75 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
80 76
81 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; 77 virtual int GetPeerAddress(AddressList* address) const OVERRIDE;
82 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; 78 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
83 79
84 private: 80 private:
85 enum State { 81 enum State {
86 STATE_GREET_WRITE, 82 STATE_GREET_WRITE,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 int DoHandshakeWriteComplete(int result); 114 int DoHandshakeWriteComplete(int result);
119 int DoGreetRead(); 115 int DoGreetRead();
120 int DoGreetReadComplete(int result); 116 int DoGreetReadComplete(int result);
121 int DoGreetWrite(); 117 int DoGreetWrite();
122 int DoGreetWriteComplete(int result); 118 int DoGreetWriteComplete(int result);
123 119
124 // Writes the SOCKS handshake buffer into |handshake| 120 // Writes the SOCKS handshake buffer into |handshake|
125 // and return OK on success. 121 // and return OK on success.
126 int BuildHandshakeWriteBuffer(std::string* handshake) const; 122 int BuildHandshakeWriteBuffer(std::string* handshake) const;
127 123
128 OldCompletionCallbackImpl<SOCKS5ClientSocket> io_callback_; 124 CompletionCallback io_callback_;
129 125
130 // Stores the underlying socket. 126 // Stores the underlying socket.
131 scoped_ptr<ClientSocketHandle> transport_; 127 scoped_ptr<ClientSocketHandle> transport_;
132 128
133 State next_state_; 129 State next_state_;
134 130
135 // Stores the callback to the layer above, called on completing Connect(). 131 // Stores the callback to the layer above, called on completing Connect().
136 OldCompletionCallback* old_user_callback_;
137 CompletionCallback user_callback_; 132 CompletionCallback user_callback_;
138 133
139 // This IOBuffer is used by the class to read and write 134 // This IOBuffer is used by the class to read and write
140 // SOCKS handshake data. The length contains the expected size to 135 // SOCKS handshake data. The length contains the expected size to
141 // read or write. 136 // read or write.
142 scoped_refptr<IOBuffer> handshake_buf_; 137 scoped_refptr<IOBuffer> handshake_buf_;
143 138
144 // While writing, this buffer stores the complete write handshake data. 139 // While writing, this buffer stores the complete write handshake data.
145 // While reading, it stores the handshake information received so far. 140 // While reading, it stores the handshake information received so far.
146 std::string buffer_; 141 std::string buffer_;
(...skipping 11 matching lines...) Expand all
158 HostResolver::RequestInfo host_request_info_; 153 HostResolver::RequestInfo host_request_info_;
159 154
160 BoundNetLog net_log_; 155 BoundNetLog net_log_;
161 156
162 DISALLOW_COPY_AND_ASSIGN(SOCKS5ClientSocket); 157 DISALLOW_COPY_AND_ASSIGN(SOCKS5ClientSocket);
163 }; 158 };
164 159
165 } // namespace net 160 } // namespace net
166 161
167 #endif // NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_ 162 #endif // NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/socks5_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698