| 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/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 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 26 matching lines...) Expand all Loading... |
| 37 static const uint8 kSOCKSStreamRequest = 0x01; | 37 static const uint8 kSOCKSStreamRequest = 0x01; |
| 38 | 38 |
| 39 // A struct holding the essential details of the SOCKS4 Server Request. | 39 // A struct holding the essential details of the SOCKS4 Server Request. |
| 40 // The port in the header is stored in network byte order. | 40 // The port in the header is stored in network byte order. |
| 41 struct SOCKS4ServerRequest { | 41 struct SOCKS4ServerRequest { |
| 42 uint8 version; | 42 uint8 version; |
| 43 uint8 command; | 43 uint8 command; |
| 44 uint16 nw_port; | 44 uint16 nw_port; |
| 45 uint8 ip[4]; | 45 uint8 ip[4]; |
| 46 }; | 46 }; |
| 47 COMPILE_ASSERT(sizeof(SOCKS4ServerRequest) == kWriteHeaderSize, | 47 static_assert(sizeof(SOCKS4ServerRequest) == kWriteHeaderSize, |
| 48 socks4_server_request_struct_wrong_size); | 48 "socks4 server request struct has incorrect size"); |
| 49 | 49 |
| 50 // A struct holding details of the SOCKS4 Server Response. | 50 // A struct holding details of the SOCKS4 Server Response. |
| 51 struct SOCKS4ServerResponse { | 51 struct SOCKS4ServerResponse { |
| 52 uint8 reserved_null; | 52 uint8 reserved_null; |
| 53 uint8 code; | 53 uint8 code; |
| 54 uint16 port; | 54 uint16 port; |
| 55 uint8 ip[4]; | 55 uint8 ip[4]; |
| 56 }; | 56 }; |
| 57 COMPILE_ASSERT(sizeof(SOCKS4ServerResponse) == kReadHeaderSize, | 57 static_assert(sizeof(SOCKS4ServerResponse) == kReadHeaderSize, |
| 58 socks4_server_response_struct_wrong_size); | 58 "socks4 server response struct has incorrect size"); |
| 59 | 59 |
| 60 SOCKSClientSocket::SOCKSClientSocket( | 60 SOCKSClientSocket::SOCKSClientSocket( |
| 61 scoped_ptr<ClientSocketHandle> transport_socket, | 61 scoped_ptr<ClientSocketHandle> transport_socket, |
| 62 const HostResolver::RequestInfo& req_info, | 62 const HostResolver::RequestInfo& req_info, |
| 63 RequestPriority priority, | 63 RequestPriority priority, |
| 64 HostResolver* host_resolver) | 64 HostResolver* host_resolver) |
| 65 : transport_(transport_socket.Pass()), | 65 : transport_(transport_socket.Pass()), |
| 66 next_state_(STATE_NONE), | 66 next_state_(STATE_NONE), |
| 67 completed_handshake_(false), | 67 completed_handshake_(false), |
| 68 bytes_sent_(0), | 68 bytes_sent_(0), |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { | 453 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| 454 return transport_->socket()->GetPeerAddress(address); | 454 return transport_->socket()->GetPeerAddress(address); |
| 455 } | 455 } |
| 456 | 456 |
| 457 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 457 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 458 return transport_->socket()->GetLocalAddress(address); | 458 return transport_->socket()->GetLocalAddress(address); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace net | 461 } // namespace net |
| OLD | NEW |