OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <ws2tcpip.h> | 10 #include <ws2tcpip.h> |
11 #elif defined(OS_POSIX) | 11 #elif defined(OS_POSIX) |
12 #include <netdb.h> | 12 #include <netdb.h> |
13 #endif | 13 #endif |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/trace_event.h" | 15 #include "base/trace_event.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
18 | 18 |
| 19 #if defined(OS_FREEBSD) |
| 20 #include <netinet/in.h> |
| 21 #include <sys/socket.h> |
| 22 #endif |
| 23 |
19 namespace net { | 24 namespace net { |
20 | 25 |
21 const unsigned int SOCKS5ClientSocket::kGreetReadHeaderSize = 2; | 26 const unsigned int SOCKS5ClientSocket::kGreetReadHeaderSize = 2; |
22 const unsigned int SOCKS5ClientSocket::kWriteHeaderSize = 10; | 27 const unsigned int SOCKS5ClientSocket::kWriteHeaderSize = 10; |
23 const unsigned int SOCKS5ClientSocket::kReadHeaderSize = 5; | 28 const unsigned int SOCKS5ClientSocket::kReadHeaderSize = 5; |
24 const uint8 SOCKS5ClientSocket::kSOCKS5Version = 0x05; | 29 const uint8 SOCKS5ClientSocket::kSOCKS5Version = 0x05; |
25 const uint8 SOCKS5ClientSocket::kTunnelCommand = 0x01; | 30 const uint8 SOCKS5ClientSocket::kTunnelCommand = 0x01; |
26 const uint8 SOCKS5ClientSocket::kNullByte = 0x00; | 31 const uint8 SOCKS5ClientSocket::kNullByte = 0x00; |
27 | 32 |
28 COMPILE_ASSERT(sizeof(struct in_addr) == 4, incorrect_system_size_of_IPv4); | 33 COMPILE_ASSERT(sizeof(struct in_addr) == 4, incorrect_system_size_of_IPv4); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 } | 434 } |
430 | 435 |
431 #if defined(OS_LINUX) | 436 #if defined(OS_LINUX) |
432 int SOCKS5ClientSocket::GetPeerName(struct sockaddr* name, | 437 int SOCKS5ClientSocket::GetPeerName(struct sockaddr* name, |
433 socklen_t* namelen) { | 438 socklen_t* namelen) { |
434 return transport_->GetPeerName(name, namelen); | 439 return transport_->GetPeerName(name, namelen); |
435 } | 440 } |
436 #endif | 441 #endif |
437 | 442 |
438 } // namespace net | 443 } // namespace net |
OLD | NEW |