| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TCP_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <winsock2.h> | 9 #include <winsock2.h> |
| 10 | 10 |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "net/base/address_list.h" | 12 #include "net/base/address_list.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
| 15 #include "net/socket/client_socket.h" | 15 #include "net/socket/stream_socket.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class BoundNetLog; | 19 class BoundNetLog; |
| 20 | 20 |
| 21 class TCPClientSocketWin : public ClientSocket, base::NonThreadSafe { | 21 class TCPClientSocketWin : public StreamSocket, base::NonThreadSafe { |
| 22 public: | 22 public: |
| 23 // The IP address(es) and port number to connect to. The TCP socket will try | 23 // The IP address(es) and port number to connect to. The TCP socket will try |
| 24 // each IP address in the list until it succeeds in establishing a | 24 // each IP address in the list until it succeeds in establishing a |
| 25 // connection. | 25 // connection. |
| 26 TCPClientSocketWin(const AddressList& addresses, | 26 TCPClientSocketWin(const AddressList& addresses, |
| 27 net::NetLog* net_log, | 27 net::NetLog* net_log, |
| 28 const net::NetLog::Source& source); | 28 const net::NetLog::Source& source); |
| 29 | 29 |
| 30 virtual ~TCPClientSocketWin(); | 30 virtual ~TCPClientSocketWin(); |
| 31 | 31 |
| 32 // AdoptSocket causes the given, connected socket to be adopted as a TCP | 32 // AdoptSocket causes the given, connected socket to be adopted as a TCP |
| 33 // socket. This object must not be connected. This object takes ownership of | 33 // socket. This object must not be connected. This object takes ownership of |
| 34 // the given socket and then acts as if Connect() had been called. This | 34 // the given socket and then acts as if Connect() had been called. This |
| 35 // function is used by TCPServerSocket() to adopt accepted connections | 35 // function is used by TCPServerSocket() to adopt accepted connections |
| 36 // and for testing. | 36 // and for testing. |
| 37 void AdoptSocket(SOCKET socket); | 37 void AdoptSocket(SOCKET socket); |
| 38 | 38 |
| 39 // ClientSocket methods: | 39 // StreamSocket methods: |
| 40 virtual int Connect(CompletionCallback* callback); | 40 virtual int Connect(CompletionCallback* callback); |
| 41 virtual void Disconnect(); | 41 virtual void Disconnect(); |
| 42 virtual bool IsConnected() const; | 42 virtual bool IsConnected() const; |
| 43 virtual bool IsConnectedAndIdle() const; | 43 virtual bool IsConnectedAndIdle() const; |
| 44 virtual int GetPeerAddress(AddressList* address) const; | 44 virtual int GetPeerAddress(AddressList* address) const; |
| 45 virtual int GetLocalAddress(IPEndPoint* address) const; | 45 virtual int GetLocalAddress(IPEndPoint* address) const; |
| 46 virtual const BoundNetLog& NetLog() const { return net_log_; } | 46 virtual const BoundNetLog& NetLog() const { return net_log_; } |
| 47 virtual void SetSubresourceSpeculation(); | 47 virtual void SetSubresourceSpeculation(); |
| 48 virtual void SetOmniboxSpeculation(); | 48 virtual void SetOmniboxSpeculation(); |
| 49 virtual bool WasEverUsed() const; | 49 virtual bool WasEverUsed() const; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Record of connectivity and transmissions, for use in speculative connection | 134 // Record of connectivity and transmissions, for use in speculative connection |
| 135 // histograms. | 135 // histograms. |
| 136 UseHistory use_history_; | 136 UseHistory use_history_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 138 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace net | 141 } // namespace net |
| 142 | 142 |
| 143 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 143 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| OLD | NEW |