OLD | NEW |
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 #include "net/socket/socks5_client_socket.h" | 5 #include "net/socket/socks5_client_socket.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 const unsigned int SOCKS5ClientSocket::kWriteHeaderSize = 10; | 22 const unsigned int SOCKS5ClientSocket::kWriteHeaderSize = 10; |
23 const unsigned int SOCKS5ClientSocket::kReadHeaderSize = 5; | 23 const unsigned int SOCKS5ClientSocket::kReadHeaderSize = 5; |
24 const uint8_t SOCKS5ClientSocket::kSOCKS5Version = 0x05; | 24 const uint8_t SOCKS5ClientSocket::kSOCKS5Version = 0x05; |
25 const uint8_t SOCKS5ClientSocket::kTunnelCommand = 0x01; | 25 const uint8_t SOCKS5ClientSocket::kTunnelCommand = 0x01; |
26 const uint8_t SOCKS5ClientSocket::kNullByte = 0x00; | 26 const uint8_t SOCKS5ClientSocket::kNullByte = 0x00; |
27 | 27 |
28 static_assert(sizeof(struct in_addr) == 4, "incorrect system size of IPv4"); | 28 static_assert(sizeof(struct in_addr) == 4, "incorrect system size of IPv4"); |
29 static_assert(sizeof(struct in6_addr) == 16, "incorrect system size of IPv6"); | 29 static_assert(sizeof(struct in6_addr) == 16, "incorrect system size of IPv6"); |
30 | 30 |
31 SOCKS5ClientSocket::SOCKS5ClientSocket( | 31 SOCKS5ClientSocket::SOCKS5ClientSocket( |
32 scoped_ptr<ClientSocketHandle> transport_socket, | 32 std::unique_ptr<ClientSocketHandle> transport_socket, |
33 const HostResolver::RequestInfo& req_info) | 33 const HostResolver::RequestInfo& req_info) |
34 : io_callback_(base::Bind(&SOCKS5ClientSocket::OnIOComplete, | 34 : io_callback_(base::Bind(&SOCKS5ClientSocket::OnIOComplete, |
35 base::Unretained(this))), | 35 base::Unretained(this))), |
36 transport_(std::move(transport_socket)), | 36 transport_(std::move(transport_socket)), |
37 next_state_(STATE_NONE), | 37 next_state_(STATE_NONE), |
38 completed_handshake_(false), | 38 completed_handshake_(false), |
39 bytes_sent_(0), | 39 bytes_sent_(0), |
40 bytes_received_(0), | 40 bytes_received_(0), |
41 read_header_size(kReadHeaderSize), | 41 read_header_size(kReadHeaderSize), |
42 was_ever_used_(false), | 42 was_ever_used_(false), |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { | 496 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { |
497 return transport_->socket()->GetPeerAddress(address); | 497 return transport_->socket()->GetPeerAddress(address); |
498 } | 498 } |
499 | 499 |
500 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 500 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
501 return transport_->socket()->GetLocalAddress(address); | 501 return transport_->socket()->GetLocalAddress(address); |
502 } | 502 } |
503 | 503 |
504 } // namespace net | 504 } // namespace net |
OLD | NEW |