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

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

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "net/base/address_list.h" 16 #include "net/base/address_list.h"
17 #include "net/base/completion_callback.h" 17 #include "net/base/completion_callback.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/dns/host_resolver.h" 19 #include "net/dns/host_resolver.h"
20 #include "net/log/net_log.h" 20 #include "net/log/net_log.h"
21 #include "net/socket/stream_socket.h" 21 #include "net/socket/stream_socket.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 namespace net { 24 namespace net {
25 25
26 class ClientSocketHandle; 26 class ClientSocketHandle;
27 class BoundNetLog; 27 class BoundNetLog;
28 28
29 // This StreamSocket is used to setup a SOCKSv5 handshake with a socks proxy. 29 // This StreamSocket is used to setup a SOCKSv5 handshake with a socks proxy.
30 // Currently no SOCKSv5 authentication is supported. 30 // Currently no SOCKSv5 authentication is supported.
31 class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket { 31 class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket {
32 public: 32 public:
33 // |req_info| contains the hostname and port to which the socket above will 33 // |req_info| contains the hostname and port to which the socket above will
34 // communicate to via the SOCKS layer. 34 // communicate to via the SOCKS layer.
35 // 35 //
36 // Although SOCKS 5 supports 3 different modes of addressing, we will 36 // Although SOCKS 5 supports 3 different modes of addressing, we will
37 // always pass it a hostname. This means the DNS resolving is done 37 // always pass it a hostname. This means the DNS resolving is done
38 // proxy side. 38 // proxy side.
39 SOCKS5ClientSocket(scoped_ptr<ClientSocketHandle> transport_socket, 39 SOCKS5ClientSocket(std::unique_ptr<ClientSocketHandle> transport_socket,
40 const HostResolver::RequestInfo& req_info); 40 const HostResolver::RequestInfo& req_info);
41 41
42 // On destruction Disconnect() is called. 42 // On destruction Disconnect() is called.
43 ~SOCKS5ClientSocket() override; 43 ~SOCKS5ClientSocket() override;
44 44
45 // StreamSocket implementation. 45 // StreamSocket implementation.
46 46
47 // Does the SOCKS handshake and completes the protocol. 47 // Does the SOCKS handshake and completes the protocol.
48 int Connect(const CompletionCallback& callback) override; 48 int Connect(const CompletionCallback& callback) override;
49 void Disconnect() override; 49 void Disconnect() override;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int DoGreetWrite(); 116 int DoGreetWrite();
117 int DoGreetWriteComplete(int result); 117 int DoGreetWriteComplete(int result);
118 118
119 // Writes the SOCKS handshake buffer into |handshake| 119 // Writes the SOCKS handshake buffer into |handshake|
120 // and return OK on success. 120 // and return OK on success.
121 int BuildHandshakeWriteBuffer(std::string* handshake) const; 121 int BuildHandshakeWriteBuffer(std::string* handshake) const;
122 122
123 CompletionCallback io_callback_; 123 CompletionCallback io_callback_;
124 124
125 // Stores the underlying socket. 125 // Stores the underlying socket.
126 scoped_ptr<ClientSocketHandle> transport_; 126 std::unique_ptr<ClientSocketHandle> transport_;
127 127
128 State next_state_; 128 State next_state_;
129 129
130 // Stores the callback to the layer above, called on completing Connect(). 130 // Stores the callback to the layer above, called on completing Connect().
131 CompletionCallback user_callback_; 131 CompletionCallback user_callback_;
132 132
133 // This IOBuffer is used by the class to read and write 133 // This IOBuffer is used by the class to read and write
134 // SOCKS handshake data. The length contains the expected size to 134 // SOCKS handshake data. The length contains the expected size to
135 // read or write. 135 // read or write.
136 scoped_refptr<IOBuffer> handshake_buf_; 136 scoped_refptr<IOBuffer> handshake_buf_;
(...skipping 17 matching lines...) Expand all
154 HostResolver::RequestInfo host_request_info_; 154 HostResolver::RequestInfo host_request_info_;
155 155
156 BoundNetLog net_log_; 156 BoundNetLog net_log_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(SOCKS5ClientSocket); 158 DISALLOW_COPY_AND_ASSIGN(SOCKS5ClientSocket);
159 }; 159 };
160 160
161 } // namespace net 161 } // namespace net
162 162
163 #endif // NET_SOCKET_SOCKS5_CLIENT_SOCKET_H_ 163 #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